From 44827a8fc10c14f4b789e22613c264092c206351 Mon Sep 17 00:00:00 2001 From: Boris Date: Thu, 18 Jul 2024 11:12:43 +0200 Subject: [PATCH 01/32] Fix: Change message when 7 user in pm --- .../more_direct_channels/list/list.tsx | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index c04182cbb8..c44446e758 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -120,13 +120,20 @@ const List = React.forwardRef((props: Props, ref?: React.Ref + props.values.length === MAX_SELECTABLE_VALUES ? ( + + ) : ( + + ) } buttonSubmitText={ Date: Fri, 19 Jul 2024 11:24:39 +0200 Subject: [PATCH 02/32] Feat: modal for max user in pm --- .../more_direct_channels/list/list.tsx | 14 +-- .../more_direct_channels.tsx | 1 + .../src/components/multiselect/index.ts | 21 +++++ .../components/multiselect/multiselect.tsx | 93 +++++++++++++++---- webapp/channels/src/i18n/de.json | 7 +- webapp/channels/src/i18n/en.json | 7 +- webapp/channels/src/i18n/es.json | 7 +- webapp/channels/src/i18n/fr.json | 7 +- webapp/channels/src/i18n/it.json | 7 +- webapp/channels/src/images/icons/lamp.svg | 15 +++ .../channels/src/sass/components/_modal.scss | 14 +++ .../src/sass/components/_react-select.scss | 3 + webapp/channels/src/utils/constants.tsx | 2 + 13 files changed, 163 insertions(+), 35 deletions(-) create mode 100644 webapp/channels/src/components/multiselect/index.ts create mode 100644 webapp/channels/src/images/icons/lamp.svg diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index c44446e758..8a8f68634f 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -7,7 +7,7 @@ import {FormattedMessage, useIntl} from 'react-intl'; import type {UserProfile} from '@mattermost/types/users'; -import MultiSelect from 'components/multiselect/multiselect'; +import MultiSelect from 'components/multiselect/index'; import Constants from 'utils/constants'; @@ -35,6 +35,7 @@ export type Props = { totalCount: number; users: UserProfile[]; emptyGroupChannelsIds: string[]; + exitParentModal: () => void; /** * An array of values that have been selected by the user in the multiselect. @@ -118,20 +119,21 @@ const List = React.forwardRef((props: Props, ref?: React.Ref ) : ( ) } diff --git a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx index ceee0a6f4a..a93f3d8f70 100644 --- a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx +++ b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx @@ -267,6 +267,7 @@ export default class MoreDirectChannels extends React.PureComponent(modalData: ModalData

) => void; + closeModal: (modalId: string) => void; +} + export type Props = { + actions: Actions; ariaLabelRenderer: getOptionValue; backButtonClick?: () => void; backButtonClass?: string; @@ -59,16 +68,20 @@ export type Props = { perPage: number; placeholderText?: string; saving?: boolean; + showError?: boolean; + changeMessageColor: string; submitImmediatelyOn?: (value: T) => boolean; totalCount?: number; users?: unknown[]; valueWithImage: boolean; + disableMultiSelectList?: boolean; valueRenderer?: (props: {data: T}) => any; values: T[]; focusOnLoad?: boolean; savingEnabled?: boolean; handleCancel?: () => void; customNoOptionsMessage?: React.ReactNode; + exitParentModal: () => void; } export type State = { @@ -91,6 +104,8 @@ export class MultiSelect extends React.PureComponent, focusOnLoad: true, savingEnabled: true, showInputByDefault: false, + changeMessageColor: false, + disableMultiSelectList: false, }; public constructor(props: Props) { @@ -103,6 +118,15 @@ export class MultiSelect extends React.PureComponent, }; } + public openModal = (): void => { + this.props.exitParentModal(); + const newModal = { + modalId: ModalIdentifiers.NEW_CHANNEL_MODAL, + dialogType: NewChannelModal, + }; + this.props.actions.openModal(newModal); + }; + public componentDidMount() { const inputRef: unknown = this.reactSelectRef.current && this.reactSelectRef.current.select.inputRef; @@ -447,18 +471,18 @@ export class MultiSelect extends React.PureComponent, memberCount = ( ); } + const lampIcon = () => Constants.LAMP_ICON; return ( <> -

+
extends React.PureComponent, ref={this.reactSelectRef as React.RefObject} // type of ref on @types/react-select is outdated isMulti={true} options={this.props.options} - styles={styles} + styles={styles(this.props.showError)} components={{ Menu: nullComponent, IndicatorsContainer: nullComponent, @@ -487,7 +511,7 @@ export class MultiSelect extends React.PureComponent, getOptionLabel={this.props.ariaLabelRenderer} aria-label={this.props.placeholderText} className={this.state.a11yActive ? 'multi-select__focused' : ''} - classNamePrefix='react-select-auto react-select' + classNamePrefix={this.props.showError ? 'react-select-auto react-select error' : 'react-select-auto react-select'} /> {this.props.saveButtonPosition === 'top' && extends React.PureComponent, id='multiSelectHelpMemberInfo' className='multi-select__help' > - {numRemainingText} +
+ {numRemainingText} +
+ {memberCount}
- {multiSelectList} + {this.props.disableMultiSelectList && this.props.values.length === 7 ? ( + + ) : (multiSelectList) + }
{noteTextContainer}
- {this.props.saveButtonPosition === 'top' && + {this.props.saveButtonPosition === 'top' && !this.props.disableMultiSelectList &&
{previousButton} {nextButton} @@ -572,14 +620,21 @@ const paddedComponent = (WrappedComponent: any) => { }; }; -const styles = { - container: () => { - return { - display: 'flex', - overflow: 'hidden', - flex: 'auto', - }; - }, -}; +const styles = (showError: boolean | undefined) => ({ + container: (base: React.CSSProperties) => ({ + ...base, + display: 'flex', + overflow: 'hidden', + flex: 'auto', + }), + control: (base: React.CSSProperties) => ({ + ...base, + borderColor: 'red', + boxShadow: showError ? '0 0 0 1px red' : 'none', + '&:hover': { + borderColor: 'red', + }, + }), +}); export default MultiSelect; diff --git a/webapp/channels/src/i18n/de.json b/webapp/channels/src/i18n/de.json index 5129539688..a092907c61 100644 --- a/webapp/channels/src/i18n/de.json +++ b/webapp/channels/src/i18n/de.json @@ -4437,10 +4437,13 @@ "multiselect.go": "Los", "multiselect.list.notFound": "Für die Suchanfrage {searchQuery} wurden keine Ergebnisse gefunden", "multiselect.loading": "Lade...", + "multiselect.noMorePeople": "Eine persönliche Nachricht ist auf 7 Personen begrenzt.", + "multiselect.numMembers": "{options}/7 Benutzer", + "multiselect.numPeopleRemaining": "Verwenden Sie die ↑↓ Pfeiltasten auf der Tastatur, ENTER zum Auswählen.", + "multiselect.new_channel": "Erstellen Sie einen Kanal, um mit mehr Personen zu kommunizieren", + "multiselect.new_channel_create": "Einen Kanal erstellen", "multiselect.maxGroupMembers": "Es können nicht mehr als 256 Mitglieder auf einmal zu einer Gruppe hinzugefügt werden.", "multiselect.numGroupsRemaining": "Verwende ↑↓ zum Navigieren, ↵ zur Auswahl. Du kannst {num, number} weitere {num, plural, one {Gruppe} other {Gruppen}} hinzufügen. ", - "multiselect.numMembers": "{memberOptions, number} von {totalCount, number} Benutzern", - "multiselect.numPeopleRemaining": "Verwende ↑↓ zum Navigieren, ↵ zur Auswahl. Du kannst {num, number} weitere {num, plural, one {Person} other {Personen}} hinzufügen. ", "multiselect.numRemaining": "Es können maximal {max, number} gleichzeitig hinzugefügt werden. Es können {num, number} weitere hinzugefügt werden.", "multiselect.placeholder": "Mitglieder suchen", "multiselect.placeholder.peopleOrGroups": "Suche nach Personen oder Gruppen", diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index 6a687dab2b..e810e39173 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -4411,10 +4411,13 @@ "multiselect.go": "Go", "multiselect.list.notFound": "No results found matching {searchQuery}", "multiselect.loading": "Loading...", + "multiselect.noMorePeople": "A personal message is limited to 7 people.", + "multiselect.numMembers": "{options}/7 users", + "multiselect.numPeopleRemaining": "Use the ↑↓ arrows on the keyboard, ENTER to select.", + "multiselect.new_channel": "Create a channel to communicate with more people", + "multiselect.new_channel_create": "Create a channel", "multiselect.maxGroupMembers": "No more than 256 members can be added to a group at once.", "multiselect.numGroupsRemaining": "Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {group} other {groups}}. ", - "multiselect.numMembers": "{memberOptions, number} of {totalCount, number} members", - "multiselect.numPeopleRemaining": "Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {person} other {people}}. ", "multiselect.numRemaining": "Up to {max, number} can be added at a time. You have {num, number} remaining.", "multiselect.placeholder": "Search for people", "multiselect.placeholder.peopleOrGroups": "Search for people or groups", diff --git a/webapp/channels/src/i18n/es.json b/webapp/channels/src/i18n/es.json index e97fe9ecce..d7899fe0cd 100644 --- a/webapp/channels/src/i18n/es.json +++ b/webapp/channels/src/i18n/es.json @@ -3810,9 +3810,12 @@ "multiselect.go": "Ir", "multiselect.list.notFound": "No se encontraron resultados que encajen con **{searchQuery}**", "multiselect.loading": "Cargando...", + "multiselect.noMorePeople": "Un mensaje personal está limitado a 7 personas.", + "multiselect.numMembers": "{options}/7 usuarios", + "multiselect.numPeopleRemaining": "Usa las flechas ↑↓ del teclado, ENTER para seleccionar.", + "multiselect.new_channel": "Crear un canal para comunicarse con más personas", + "multiselect.new_channel_create": "Crear un canal", "multiselect.numGroupsRemaining": "Utiliza ↑↓ para navegar, ↵ para seleccionar. Puedes agregar {num, number} {num, plural, one {grupo} other {grupos}} más. ", - "multiselect.numMembers": "{memberOptions, number} de {totalCount, number} miembros", - "multiselect.numPeopleRemaining": "Utiliza ↑↓ para navegar, ↵ para seleccionar. Puedes agregar {num, number} {num, plural, one {persona} other {personas}} más. ", "multiselect.numRemaining": "Se puede añadir hasta {max, number} a la vez. Te quedan {num, number}.", "multiselect.placeholder": "Buscar personas", "multiselect.saveDetailsButton": "Guardar Detalles", diff --git a/webapp/channels/src/i18n/fr.json b/webapp/channels/src/i18n/fr.json index 60eafb4f6b..f9914b383d 100644 --- a/webapp/channels/src/i18n/fr.json +++ b/webapp/channels/src/i18n/fr.json @@ -3750,12 +3750,15 @@ "multiselect.go": "Aller à", "multiselect.list.notFound": "Aucun résultat trouvé pour {searchQuery}", "multiselect.loading": "Chargement…", + "multiselect.noMorePeople": "Un message personnel est limité à 7 personnes.", "multiselect.numGroupsRemaining": "Utilisez les flèches ↑↓ pour parcourir, ↵ pour sélectionner. Vous pouvez encore ajouter {num, number} {num, plural, one {groupe} other {groupes}}. ", - "multiselect.numMembers": "{memberOptions, number} de {totalCount, number} membres", - "multiselect.numPeopleRemaining": "Utilisez les flèches ↑↓ pour parcourir, ↵ pour sélectionner. Vous pouvez encore ajouter {num, number} {num, plural, one {personne} other {personnes}}. ", + "multiselect.numMembers": "{options}/7 utilisateurs", + "multiselect.numPeopleRemaining": "Utilisez les flèches ↑↓ du clavier, ENTER pour sélectionner.", "multiselect.numRemaining": "Vous pouvez ajouter jusqu'à {max, number} à la fois. Il vous reste {num, number}.", "multiselect.placeholder": "Rechercher des membres", "multiselect.placeholder.peopleOrGroups": "Rechercher des personnes ou des groupes", + "multiselect.new_channel": "Créer un canal pour échanger avec plus de personnes", + "multiselect.new_channel_create": "Créer un canal", "multiselect.saveDetailsButton": "Enregistrer les détails", "multiselect.savingDetailsButton": "Enregistrement...", "multiselect.selectChannels": "Utilisez ↑↓ pour parcourir, ↵ pour sélectionner.", diff --git a/webapp/channels/src/i18n/it.json b/webapp/channels/src/i18n/it.json index 935a6142d2..55ed577acc 100644 --- a/webapp/channels/src/i18n/it.json +++ b/webapp/channels/src/i18n/it.json @@ -2907,9 +2907,12 @@ "multiselect.go": "Vai", "multiselect.list.notFound": "Nessun elemento trovato corrispondenti a {searchQuery}", "multiselect.loading": "Caricamento...", + "multiselect.noMorePeople": "Un messaggio personale è limitato a 7 persone.", + "multiselect.numMembers": "{options}/7 utenti", + "multiselect.numPeopleRemaining": "Usa le frecce ↑↓ della tastiera, ENTER per selezionare.", + "multiselect.new_channel": "Crea un canale per comunicare con più persone", + "multiselect.new_channel_create": "Crea un canale", "multiselect.numGroupsRemaining": "Usa ↑↓ per navigare, ↵ per scegliere. Puoi aggiungere {num, number} {num, plural, one {group} other {groups}}. ", - "multiselect.numMembers": "{memberOptions, number} di {totalCount, number} membri", - "multiselect.numPeopleRemaining": "Usa ↑↓ per navigare, ↵ per scegliere. Puoi aggiungere {num, number} più {num, plural, one {person} altre {people}}. ", "multiselect.numRemaining": "Si possono ancora aggiungere {num, number}", "multiselect.placeholder": "Cercare ed aggiungere membri", "multiselect.selectChannels": "Usa ↑↓ per navigare, ↵ per selezionare.", diff --git a/webapp/channels/src/images/icons/lamp.svg b/webapp/channels/src/images/icons/lamp.svg new file mode 100644 index 0000000000..8d7686b196 --- /dev/null +++ b/webapp/channels/src/images/icons/lamp.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/webapp/channels/src/sass/components/_modal.scss b/webapp/channels/src/sass/components/_modal.scss index 75632bc509..5ea6c96c7a 100644 --- a/webapp/channels/src/sass/components/_modal.scss +++ b/webapp/channels/src/sass/components/_modal.scss @@ -980,6 +980,10 @@ flex: 1 1 auto; } + &.disable-list { + height: unset; + } + .multi-select__wrapper { display: flex; height: 1px; @@ -1040,6 +1044,16 @@ } } +.create-new-channel { + height: 60px; + margin: 20px; + display: flex; + border-radius: 4px; + align-items: center; + justify-content: space-around; + background-color: #f2f2f2; +} + .team-selector-modal, .channel-selector-modal { .more-modal__row { diff --git a/webapp/channels/src/sass/components/_react-select.scss b/webapp/channels/src/sass/components/_react-select.scss index 6a9b1561c4..f53034659e 100644 --- a/webapp/channels/src/sass/components/_react-select.scss +++ b/webapp/channels/src/sass/components/_react-select.scss @@ -1,4 +1,7 @@ .react-select { + &.error { + border-color: var(--danger-color) !important; + } .a11y--focused { box-shadow: none; } diff --git a/webapp/channels/src/utils/constants.tsx b/webapp/channels/src/utils/constants.tsx index 4ef81d30a6..5e1576928e 100644 --- a/webapp/channels/src/utils/constants.tsx +++ b/webapp/channels/src/utils/constants.tsx @@ -21,6 +21,7 @@ import audioIcon from 'images/icons/audio.svg'; import codeIcon from 'images/icons/code.svg'; import excelIcon from 'images/icons/excel.svg'; import genericIcon from 'images/icons/generic.svg'; +import lampIcon from 'images/icons/lamp.svg'; import patchIcon from 'images/icons/patch.svg'; import pdfIcon from 'images/icons/pdf.svg'; import pptIcon from 'images/icons/ppt.svg'; @@ -2119,6 +2120,7 @@ export const Constants = { RECENT_EMOJI_KEY: 'recentEmojis', DEFAULT_WEBHOOK_LOGO: logoWebhook, TRANSCRIPT_ICON: transcriptIcon, + LAMP_ICON: lampIcon, MHPNS_US: 'https://push.mattermost.com', MHPNS_DE: 'https://hpns-de.mattermost.com', MTPNS: 'https://push-test.mattermost.com', From 76ef4a38e8ceaf660428135148a86095dcc6a415 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 19 Jul 2024 12:03:21 +0200 Subject: [PATCH 03/32] Fix: test --- .../src/components/multiselect/multiselect.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index 343ffc7014..fd5d8008f9 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -38,7 +38,7 @@ type Actions = { } export type Props = { - actions: Actions; + actions?: Actions; ariaLabelRenderer: getOptionValue; backButtonClick?: () => void; backButtonClass?: string; @@ -69,7 +69,7 @@ export type Props = { placeholderText?: string; saving?: boolean; showError?: boolean; - changeMessageColor: string; + changeMessageColor?: string; submitImmediatelyOn?: (value: T) => boolean; totalCount?: number; users?: unknown[]; @@ -81,7 +81,7 @@ export type Props = { savingEnabled?: boolean; handleCancel?: () => void; customNoOptionsMessage?: React.ReactNode; - exitParentModal: () => void; + exitParentModal?: () => void; } export type State = { @@ -119,12 +119,14 @@ export class MultiSelect extends React.PureComponent, } public openModal = (): void => { - this.props.exitParentModal(); + if (this.props.exitParentModal) { + this.props.exitParentModal(); + } const newModal = { modalId: ModalIdentifiers.NEW_CHANNEL_MODAL, dialogType: NewChannelModal, }; - this.props.actions.openModal(newModal); + this.props.actions?.openModal(newModal); }; public componentDidMount() { From a59837db9c8a854a03cb5fa5934c17cc67b07731 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 19 Jul 2024 12:52:04 +0200 Subject: [PATCH 04/32] Fix: Modal css, tests, snap --- .../__snapshots__/channel_invite_modal.test.tsx.snap | 6 ++++++ .../__snapshots__/more_direct_channels.test.tsx.snap | 2 ++ webapp/channels/src/components/multiselect/multiselect.tsx | 7 ++++--- webapp/channels/src/sass/components/_modal.scss | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/webapp/channels/src/components/channel_invite_modal/__snapshots__/channel_invite_modal.test.tsx.snap b/webapp/channels/src/components/channel_invite_modal/__snapshots__/channel_invite_modal.test.tsx.snap index 7111e7e536..985d0a6381 100644 --- a/webapp/channels/src/components/channel_invite_modal/__snapshots__/channel_invite_modal.test.tsx.snap +++ b/webapp/channels/src/components/channel_invite_modal/__snapshots__/channel_invite_modal.test.tsx.snap @@ -66,7 +66,9 @@ exports[`components/channel_invite_modal should match snapshot for channel_invit ariaLabelRenderer={[Function]} backButtonClass="btn-tertiary tertiary-button" backButtonClick={[Function]} + changeMessageColor="" customNoOptionsMessage={null} + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleCancel={[Function]} @@ -205,7 +207,9 @@ exports[`components/channel_invite_modal should match snapshot for channel_invit ariaLabelRenderer={[Function]} backButtonClass="btn-tertiary tertiary-button" backButtonClick={[Function]} + changeMessageColor="" customNoOptionsMessage={null} + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleCancel={[Function]} @@ -366,7 +370,9 @@ exports[`components/channel_invite_modal should match snapshot with exclude and ariaLabelRenderer={[Function]} backButtonClass="btn-tertiary tertiary-button" backButtonClick={[Function]} + changeMessageColor="" customNoOptionsMessage={null} + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleCancel={[Function]} diff --git a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap index 6073e4686f..535cbcaf3c 100644 --- a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap +++ b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap @@ -56,6 +56,7 @@ exports[`components/MoreDirectChannels should exclude deleted users if there is extends React.PureComponent, focusOnLoad: true, savingEnabled: true, showInputByDefault: false, - changeMessageColor: false, + changeMessageColor: '', disableMultiSelectList: false, }; @@ -533,8 +533,9 @@ export class MultiSelect extends React.PureComponent,
{numRemainingText}
- - {memberCount} +
+ {memberCount} +
{this.props.disableMultiSelectList && this.props.values.length === 7 ? ( diff --git a/webapp/channels/src/sass/components/_modal.scss b/webapp/channels/src/sass/components/_modal.scss index 5ea6c96c7a..1e6548a0ba 100644 --- a/webapp/channels/src/sass/components/_modal.scss +++ b/webapp/channels/src/sass/components/_modal.scss @@ -1046,9 +1046,9 @@ .create-new-channel { height: 60px; - margin: 20px; + margin: 27px; display: flex; - border-radius: 4px; + border-radius: 8px; align-items: center; justify-content: space-around; background-color: #f2f2f2; From 71c5e7af9f3b71a67ac97f24cf6d9f2e5b3a53c5 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 19 Jul 2024 13:13:06 +0200 Subject: [PATCH 05/32] Fix: snap --- .../add_groups_to_channel_modal.test.tsx.snap | 2 + .../add_groups_to_channel_modal.tsx | 3 +- ...dd_user_to_group_multiselect.test.tsx.snap | 6 ++ .../add_users_to_team_modal.test.tsx.snap | 4 + .../add_users_to_role_modal.test.tsx.snap | 12 +++ .../channel_selector_modal.test.tsx.snap | 4 + .../__snapshots__/multiselect.test.tsx.snap | 75 ++++++++++++------- 7 files changed, 78 insertions(+), 28 deletions(-) diff --git a/webapp/channels/src/components/add_groups_to_channel_modal/__snapshots__/add_groups_to_channel_modal.test.tsx.snap b/webapp/channels/src/components/add_groups_to_channel_modal/__snapshots__/add_groups_to_channel_modal.test.tsx.snap index a95bd53ae8..996646bfa4 100644 --- a/webapp/channels/src/components/add_groups_to_channel_modal/__snapshots__/add_groups_to_channel_modal.test.tsx.snap +++ b/webapp/channels/src/components/add_groups_to_channel_modal/__snapshots__/add_groups_to_channel_modal.test.tsx.snap @@ -59,6 +59,8 @@ exports[`components/AddGroupsToChannelModal should match snapshot 1`] = ` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} diff --git a/webapp/channels/src/components/add_groups_to_channel_modal/add_groups_to_channel_modal.tsx b/webapp/channels/src/components/add_groups_to_channel_modal/add_groups_to_channel_modal.tsx index a6bfce7679..41751bce23 100644 --- a/webapp/channels/src/components/add_groups_to_channel_modal/add_groups_to_channel_modal.tsx +++ b/webapp/channels/src/components/add_groups_to_channel_modal/add_groups_to_channel_modal.tsx @@ -15,10 +15,11 @@ import type {ActionResult} from 'mattermost-redux/types/actions'; import MultiSelect from 'components/multiselect/multiselect'; import type {Value} from 'components/multiselect/multiselect'; -import groupsAvatar from 'images/groups-avatar.png'; import Constants from 'utils/constants'; import {localizeMessage} from 'utils/utils'; +import groupsAvatar from 'images/groups-avatar.png'; + const GROUPS_PER_PAGE = 50; const MAX_SELECTABLE_VALUES = 10; diff --git a/webapp/channels/src/components/add_user_to_group_multiselect/__snapshots__/add_user_to_group_multiselect.test.tsx.snap b/webapp/channels/src/components/add_user_to_group_multiselect/__snapshots__/add_user_to_group_multiselect.test.tsx.snap index 679a617e2b..321d635248 100644 --- a/webapp/channels/src/components/add_user_to_group_multiselect/__snapshots__/add_user_to_group_multiselect.test.tsx.snap +++ b/webapp/channels/src/components/add_user_to_group_multiselect/__snapshots__/add_user_to_group_multiselect.test.tsx.snap @@ -5,6 +5,8 @@ exports[`component/add_user_to_group_multiselect should match snapshot with diff ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Updating..." buttonSubmitText="Update Group" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={false} handleAdd={[Function]} handleDelete={[Function]} @@ -90,6 +92,8 @@ exports[`component/add_user_to_group_multiselect should match snapshot with prof ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Creating..." buttonSubmitText="Create Group" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={false} handleAdd={[Function]} handleDelete={[Function]} @@ -175,6 +179,8 @@ exports[`component/add_user_to_group_multiselect should match snapshot without a ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Creating..." buttonSubmitText="Create Group" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={false} handleAdd={[Function]} handleDelete={[Function]} diff --git a/webapp/channels/src/components/add_users_to_team_modal/__snapshots__/add_users_to_team_modal.test.tsx.snap b/webapp/channels/src/components/add_users_to_team_modal/__snapshots__/add_users_to_team_modal.test.tsx.snap index 24f15d8c80..4ee84c49c5 100644 --- a/webapp/channels/src/components/add_users_to_team_modal/__snapshots__/add_users_to_team_modal.test.tsx.snap +++ b/webapp/channels/src/components/add_users_to_team_modal/__snapshots__/add_users_to_team_modal.test.tsx.snap @@ -59,6 +59,8 @@ exports[`components/admin_console/add_users_to_team_modal/AddUsersToTeamModal sh ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -286,6 +288,8 @@ exports[`components/admin_console/add_users_to_team_modal/AddUsersToTeamModal sh ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} diff --git a/webapp/channels/src/components/admin_console/system_roles/system_role/add_users_to_role_modal/__snapshots__/add_users_to_role_modal.test.tsx.snap b/webapp/channels/src/components/admin_console/system_roles/system_role/add_users_to_role_modal/__snapshots__/add_users_to_role_modal.test.tsx.snap index ce6dd9e4ea..7378fab39d 100644 --- a/webapp/channels/src/components/admin_console/system_roles/system_role/add_users_to_role_modal/__snapshots__/add_users_to_role_modal.test.tsx.snap +++ b/webapp/channels/src/components/admin_console/system_roles/system_role/add_users_to_role_modal/__snapshots__/add_users_to_role_modal.test.tsx.snap @@ -59,6 +59,8 @@ exports[`admin_console/add_users_to_role_modal search should not include bot use ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -240,6 +242,8 @@ exports[`admin_console/add_users_to_role_modal should exclude user 1`] = ` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -377,6 +381,8 @@ exports[`admin_console/add_users_to_role_modal should have single passed value 1 ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -558,6 +564,8 @@ exports[`admin_console/add_users_to_role_modal should include additional user 1` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -780,6 +788,8 @@ exports[`admin_console/add_users_to_role_modal should include additional user 2` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -1002,6 +1012,8 @@ exports[`admin_console/add_users_to_role_modal should not include bot user 1`] = ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} diff --git a/webapp/channels/src/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.tsx.snap b/webapp/channels/src/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.tsx.snap index 00d6a640a3..02b2d485e9 100644 --- a/webapp/channels/src/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.tsx.snap +++ b/webapp/channels/src/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.tsx.snap @@ -53,6 +53,8 @@ exports[`components/ChannelSelectorModal exclude already selected 1`] = ` - +
+ +
- +
+ +
- +
+ +
Date: Fri, 19 Jul 2024 13:27:41 +0200 Subject: [PATCH 06/32] Fix: snap --- .../__snapshots__/add_groups_to_team_modal.test.tsx.snap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp/channels/src/components/add_groups_to_team_modal/__snapshots__/add_groups_to_team_modal.test.tsx.snap b/webapp/channels/src/components/add_groups_to_team_modal/__snapshots__/add_groups_to_team_modal.test.tsx.snap index 81eefd6f49..f2ab772eea 100644 --- a/webapp/channels/src/components/add_groups_to_team_modal/__snapshots__/add_groups_to_team_modal.test.tsx.snap +++ b/webapp/channels/src/components/add_groups_to_team_modal/__snapshots__/add_groups_to_team_modal.test.tsx.snap @@ -59,6 +59,8 @@ exports[`components/AddGroupsToTeamModal should match snapshot 1`] = ` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} From 882050971f77e05c52d4cab57a55807fedfa6b53 Mon Sep 17 00:00:00 2001 From: Boris Date: Tue, 23 Jul 2024 09:33:22 +0200 Subject: [PATCH 07/32] Fix: show modal when 7 user in pm Changelog: fixed --- .../more_direct_channels/list/list.tsx | 2 +- .../components/multiselect/multiselect.tsx | 48 ++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index 8a8f68634f..f0ec2dd211 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -17,7 +17,7 @@ import ListItem from '../list_item'; import type {Option, OptionValue} from '../types'; import {optionValue} from '../types'; -const MAX_SELECTABLE_VALUES = Constants.MAX_USERS_IN_GM - 1; +const MAX_SELECTABLE_VALUES = Constants.MAX_USERS_IN_GM; export const USERS_PER_PAGE = 50; export type Props = { diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index 0cc9b1fc42..8c99caf3ed 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -484,7 +484,7 @@ export class MultiSelect extends React.PureComponent, return ( <> -
+
extends React.PureComponent,
- {this.props.disableMultiSelectList && this.props.values.length === 7 ? ( - - ) : (multiSelectList) + { + this.props.disableMultiSelectList && this.props.values.length >= 7 ? ( + <> + {this.props.values.length === 7 && multiSelectList} + + + ) : (multiSelectList) }
Date: Tue, 23 Jul 2024 09:57:31 +0200 Subject: [PATCH 08/32] Fix: Change trad and text position in modal Changelog: fixed --- webapp/channels/src/i18n/de.json | 2 +- webapp/channels/src/i18n/en.json | 2 +- webapp/channels/src/i18n/es.json | 2 +- webapp/channels/src/i18n/fr.json | 2 +- webapp/channels/src/i18n/it.json | 2 +- webapp/channels/src/sass/components/_modal.scss | 8 +++++++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/webapp/channels/src/i18n/de.json b/webapp/channels/src/i18n/de.json index a092907c61..081cb15c33 100644 --- a/webapp/channels/src/i18n/de.json +++ b/webapp/channels/src/i18n/de.json @@ -4440,7 +4440,7 @@ "multiselect.noMorePeople": "Eine persönliche Nachricht ist auf 7 Personen begrenzt.", "multiselect.numMembers": "{options}/7 Benutzer", "multiselect.numPeopleRemaining": "Verwenden Sie die ↑↓ Pfeiltasten auf der Tastatur, ENTER zum Auswählen.", - "multiselect.new_channel": "Erstellen Sie einen Kanal, um mit mehr Personen zu kommunizieren", + "multiselect.new_channel": "Mehr als sieben Personen? Erstellen Sie stattdessen einen Kanal", "multiselect.new_channel_create": "Einen Kanal erstellen", "multiselect.maxGroupMembers": "Es können nicht mehr als 256 Mitglieder auf einmal zu einer Gruppe hinzugefügt werden.", "multiselect.numGroupsRemaining": "Verwende ↑↓ zum Navigieren, ↵ zur Auswahl. Du kannst {num, number} weitere {num, plural, one {Gruppe} other {Gruppen}} hinzufügen. ", diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index e810e39173..f6d9348f1b 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -4414,7 +4414,7 @@ "multiselect.noMorePeople": "A personal message is limited to 7 people.", "multiselect.numMembers": "{options}/7 users", "multiselect.numPeopleRemaining": "Use the ↑↓ arrows on the keyboard, ENTER to select.", - "multiselect.new_channel": "Create a channel to communicate with more people", + "multiselect.new_channel": "More than 7 people? Create a channel instead", "multiselect.new_channel_create": "Create a channel", "multiselect.maxGroupMembers": "No more than 256 members can be added to a group at once.", "multiselect.numGroupsRemaining": "Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {group} other {groups}}. ", diff --git a/webapp/channels/src/i18n/es.json b/webapp/channels/src/i18n/es.json index d7899fe0cd..734c789c97 100644 --- a/webapp/channels/src/i18n/es.json +++ b/webapp/channels/src/i18n/es.json @@ -3813,7 +3813,7 @@ "multiselect.noMorePeople": "Un mensaje personal está limitado a 7 personas.", "multiselect.numMembers": "{options}/7 usuarios", "multiselect.numPeopleRemaining": "Usa las flechas ↑↓ del teclado, ENTER para seleccionar.", - "multiselect.new_channel": "Crear un canal para comunicarse con más personas", + "multiselect.new_channel": "¿Más de 7 personas? Crea un canal", "multiselect.new_channel_create": "Crear un canal", "multiselect.numGroupsRemaining": "Utiliza ↑↓ para navegar, ↵ para seleccionar. Puedes agregar {num, number} {num, plural, one {grupo} other {grupos}} más. ", "multiselect.numRemaining": "Se puede añadir hasta {max, number} a la vez. Te quedan {num, number}.", diff --git a/webapp/channels/src/i18n/fr.json b/webapp/channels/src/i18n/fr.json index f9914b383d..2b99300304 100644 --- a/webapp/channels/src/i18n/fr.json +++ b/webapp/channels/src/i18n/fr.json @@ -3757,7 +3757,7 @@ "multiselect.numRemaining": "Vous pouvez ajouter jusqu'à {max, number} à la fois. Il vous reste {num, number}.", "multiselect.placeholder": "Rechercher des membres", "multiselect.placeholder.peopleOrGroups": "Rechercher des personnes ou des groupes", - "multiselect.new_channel": "Créer un canal pour échanger avec plus de personnes", + "multiselect.new_channel": "Plus de 7 personnes ? Créez plutôt un canal", "multiselect.new_channel_create": "Créer un canal", "multiselect.saveDetailsButton": "Enregistrer les détails", "multiselect.savingDetailsButton": "Enregistrement...", diff --git a/webapp/channels/src/i18n/it.json b/webapp/channels/src/i18n/it.json index 55ed577acc..a3b959c6f0 100644 --- a/webapp/channels/src/i18n/it.json +++ b/webapp/channels/src/i18n/it.json @@ -2910,7 +2910,7 @@ "multiselect.noMorePeople": "Un messaggio personale è limitato a 7 persone.", "multiselect.numMembers": "{options}/7 utenti", "multiselect.numPeopleRemaining": "Usa le frecce ↑↓ della tastiera, ENTER per selezionare.", - "multiselect.new_channel": "Crea un canale per comunicare con più persone", + "multiselect.new_channel": "Più di 7 persone? Create invece un canale", "multiselect.new_channel_create": "Crea un canale", "multiselect.numGroupsRemaining": "Usa ↑↓ per navigare, ↵ per scegliere. Puoi aggiungere {num, number} {num, plural, one {group} other {groups}}. ", "multiselect.numRemaining": "Si possono ancora aggiungere {num, number}", diff --git a/webapp/channels/src/sass/components/_modal.scss b/webapp/channels/src/sass/components/_modal.scss index 1e6548a0ba..66795fea79 100644 --- a/webapp/channels/src/sass/components/_modal.scss +++ b/webapp/channels/src/sass/components/_modal.scss @@ -1050,8 +1050,14 @@ display: flex; border-radius: 8px; align-items: center; - justify-content: space-around; + justify-content: flex-start; background-color: #f2f2f2; + padding-left: 20px; + gap: 10px; +} + +.create-new-channel > :last-child { + margin-left: 100px; } .team-selector-modal, From ed1a0ea0cc89de700c9a5ad879ebbd39a7723266 Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 24 Jul 2024 08:59:53 +0200 Subject: [PATCH 09/32] Fix: Change create channel modal position Changelog: fixed --- .../components/multiselect/multiselect.tsx | 53 ++++++++++--------- .../channels/src/sass/components/_modal.scss | 2 +- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index 8c99caf3ed..4682764534 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -536,33 +536,38 @@ export class MultiSelect extends React.PureComponent,
{memberCount}
+
-
- { - this.props.disableMultiSelectList && this.props.values.length >= 7 ? ( - <> - {this.props.values.length === 7 && multiSelectList} - + + ) : null + } + + { + (!this.props.disableMultiSelectList || this.props.values.length <= 7) ? ( + multiSelectList + ) : null }
Date: Thu, 25 Jul 2024 16:31:42 +0200 Subject: [PATCH 10/32] Fix: use constants for max users --- .../src/components/more_direct_channels/list/list.tsx | 5 ++++- .../channels/src/components/multiselect/multiselect.tsx | 9 +++++---- webapp/channels/src/i18n/de.json | 2 +- webapp/channels/src/i18n/en.json | 2 +- webapp/channels/src/i18n/es.json | 2 +- webapp/channels/src/i18n/fr.json | 2 +- webapp/channels/src/i18n/it.json | 2 +- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index f0ec2dd211..36aef73e84 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -128,7 +128,10 @@ const List = React.forwardRef((props: Props, ref?: React.Ref ) : ( extends React.PureComponent, memberCount = ( @@ -484,7 +485,7 @@ export class MultiSelect extends React.PureComponent, return ( <> -
+
extends React.PureComponent,
{ - (this.props.disableMultiSelectList && this.props.values.length >= 7) ? ( + (this.props.disableMultiSelectList && this.props.values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( <>
@@ -565,7 +566,7 @@ export class MultiSelect extends React.PureComponent, }
{ - (!this.props.disableMultiSelectList || this.props.values.length <= 7) ? ( + (!this.props.disableMultiSelectList || this.props.values.length <= (Constants.MAX_USERS_IN_GM - 1)) ? ( multiSelectList ) : null } diff --git a/webapp/channels/src/i18n/de.json b/webapp/channels/src/i18n/de.json index 081cb15c33..699310f1dc 100644 --- a/webapp/channels/src/i18n/de.json +++ b/webapp/channels/src/i18n/de.json @@ -4438,7 +4438,7 @@ "multiselect.list.notFound": "Für die Suchanfrage {searchQuery} wurden keine Ergebnisse gefunden", "multiselect.loading": "Lade...", "multiselect.noMorePeople": "Eine persönliche Nachricht ist auf 7 Personen begrenzt.", - "multiselect.numMembers": "{options}/7 Benutzer", + "multiselect.numMembers": "{options}/{maxUsers} Benutzer", "multiselect.numPeopleRemaining": "Verwenden Sie die ↑↓ Pfeiltasten auf der Tastatur, ENTER zum Auswählen.", "multiselect.new_channel": "Mehr als sieben Personen? Erstellen Sie stattdessen einen Kanal", "multiselect.new_channel_create": "Einen Kanal erstellen", diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index f6d9348f1b..c3af3329da 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -4412,7 +4412,7 @@ "multiselect.list.notFound": "No results found matching {searchQuery}", "multiselect.loading": "Loading...", "multiselect.noMorePeople": "A personal message is limited to 7 people.", - "multiselect.numMembers": "{options}/7 users", + "multiselect.numMembers": "{options}/{maxUsers} users", "multiselect.numPeopleRemaining": "Use the ↑↓ arrows on the keyboard, ENTER to select.", "multiselect.new_channel": "More than 7 people? Create a channel instead", "multiselect.new_channel_create": "Create a channel", diff --git a/webapp/channels/src/i18n/es.json b/webapp/channels/src/i18n/es.json index 734c789c97..60c11beb45 100644 --- a/webapp/channels/src/i18n/es.json +++ b/webapp/channels/src/i18n/es.json @@ -3811,7 +3811,7 @@ "multiselect.list.notFound": "No se encontraron resultados que encajen con **{searchQuery}**", "multiselect.loading": "Cargando...", "multiselect.noMorePeople": "Un mensaje personal está limitado a 7 personas.", - "multiselect.numMembers": "{options}/7 usuarios", + "multiselect.numMembers": "{options}/{maxUsers} usuarios", "multiselect.numPeopleRemaining": "Usa las flechas ↑↓ del teclado, ENTER para seleccionar.", "multiselect.new_channel": "¿Más de 7 personas? Crea un canal", "multiselect.new_channel_create": "Crear un canal", diff --git a/webapp/channels/src/i18n/fr.json b/webapp/channels/src/i18n/fr.json index 2b99300304..a9bfb116fc 100644 --- a/webapp/channels/src/i18n/fr.json +++ b/webapp/channels/src/i18n/fr.json @@ -3752,7 +3752,7 @@ "multiselect.loading": "Chargement…", "multiselect.noMorePeople": "Un message personnel est limité à 7 personnes.", "multiselect.numGroupsRemaining": "Utilisez les flèches ↑↓ pour parcourir, ↵ pour sélectionner. Vous pouvez encore ajouter {num, number} {num, plural, one {groupe} other {groupes}}. ", - "multiselect.numMembers": "{options}/7 utilisateurs", + "multiselect.numMembers": "{options}/{maxUsers} utilisateurs", "multiselect.numPeopleRemaining": "Utilisez les flèches ↑↓ du clavier, ENTER pour sélectionner.", "multiselect.numRemaining": "Vous pouvez ajouter jusqu'à {max, number} à la fois. Il vous reste {num, number}.", "multiselect.placeholder": "Rechercher des membres", diff --git a/webapp/channels/src/i18n/it.json b/webapp/channels/src/i18n/it.json index a3b959c6f0..5c1773fca9 100644 --- a/webapp/channels/src/i18n/it.json +++ b/webapp/channels/src/i18n/it.json @@ -2908,7 +2908,7 @@ "multiselect.list.notFound": "Nessun elemento trovato corrispondenti a {searchQuery}", "multiselect.loading": "Caricamento...", "multiselect.noMorePeople": "Un messaggio personale è limitato a 7 persone.", - "multiselect.numMembers": "{options}/7 utenti", + "multiselect.numMembers": "{options}/{maxUsers} utenti", "multiselect.numPeopleRemaining": "Usa le frecce ↑↓ della tastiera, ENTER per selezionare.", "multiselect.new_channel": "Più di 7 persone? Create invece un canale", "multiselect.new_channel_create": "Crea un canale", From e93b55ae433818a60a3d1ce286a25861dc6c3992 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 26 Jul 2024 09:51:38 +0200 Subject: [PATCH 11/32] Fix: move modal in more direct channels and pass it in children Changelog:fixed --- .../components/more_direct_channels/index.ts | 2 + .../more_direct_channels/list/list.tsx | 113 +++++++++--------- .../more_direct_channels.tsx | 46 ++++++- .../components/multiselect/multiselect.tsx | 43 +------ 4 files changed, 107 insertions(+), 97 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/index.ts b/webapp/channels/src/components/more_direct_channels/index.ts index f5b6d62f6e..498f988a98 100644 --- a/webapp/channels/src/components/more_direct_channels/index.ts +++ b/webapp/channels/src/components/more_direct_channels/index.ts @@ -29,6 +29,7 @@ import { import {openDirectChannelToUserId, openGroupChannelToUserIds} from 'actions/channel_actions'; import {loadStatusesForProfilesList, loadProfilesMissingStatus} from 'actions/status_actions'; import {loadProfilesForGroupChannels} from 'actions/user_actions'; +import {openModal} from 'actions/views/modals'; import {setModalSearchTerm} from 'actions/views/search'; import type {GlobalState} from 'types/store'; @@ -86,6 +87,7 @@ const makeMapStateToProps = () => { function mapDispatchToProps(dispatch: Dispatch) { return { actions: bindActionCreators({ + openModal, getProfiles, getProfilesInTeam, loadProfilesMissingStatus, diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index 36aef73e84..a7eccf8488 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -2,12 +2,13 @@ // See LICENSE.txt for license information. import _ from 'lodash'; +import type {ReactNode} from 'react'; import React, {useCallback, useEffect, useMemo} from 'react'; import {FormattedMessage, useIntl} from 'react-intl'; import type {UserProfile} from '@mattermost/types/users'; -import MultiSelect from 'components/multiselect/index'; +import MultiSelect from 'components/multiselect'; import Constants from 'utils/constants'; @@ -22,6 +23,7 @@ export const USERS_PER_PAGE = 50; export type Props = { addValue: (value: OptionValue) => void; + children: ReactNode; currentUserId: string; handleDelete: (values: OptionValue[]) => void; handlePageChange: (page: number, prevPage: number) => void; @@ -35,7 +37,6 @@ export type Props = { totalCount: number; users: UserProfile[]; emptyGroupChannelsIds: string[]; - exitParentModal: () => void; /** * An array of values that have been selected by the user in the multiselect. @@ -103,62 +104,66 @@ const List = React.forwardRef((props: Props, ref?: React.Ref - ref={ref} - options={options} - optionRenderer={renderOptionValue} - intl={intl} - selectedItemRef={props.selectedItemRef} - values={props.values} - valueRenderer={renderValue} - ariaLabelRenderer={renderAriaLabel} - perPage={USERS_PER_PAGE} - handlePageChange={props.handlePageChange} - handleInput={props.search} - handleDelete={props.handleDelete} - handleAdd={props.addValue} - handleSubmit={props.handleSubmit} - noteText={note} - exitParentModal={props.exitParentModal} - disableMultiSelectList={true} - maxValues={MAX_SELECTABLE_VALUES} - changeMessageColor='red' - showError={props.values.length === MAX_SELECTABLE_VALUES} - numRemainingText={ - props.values.length === MAX_SELECTABLE_VALUES ? ( + <> + + ref={ref} + options={options} + optionRenderer={renderOptionValue} + intl={intl} + selectedItemRef={props.selectedItemRef} + values={props.values} + valueRenderer={renderValue} + ariaLabelRenderer={renderAriaLabel} + perPage={USERS_PER_PAGE} + handlePageChange={props.handlePageChange} + handleInput={props.search} + handleDelete={props.handleDelete} + handleAdd={props.addValue} + handleSubmit={props.handleSubmit} + noteText={note} + disableMultiSelectList={true} + maxValues={MAX_SELECTABLE_VALUES} + changeMessageColor='red' + showError={props.values.length === MAX_SELECTABLE_VALUES} + numRemainingText={ + props.values.length === MAX_SELECTABLE_VALUES ? ( + + ) : ( + + ) + } + buttonSubmitText={ - ) : ( + } + buttonSubmitLoadingText={ - ) - } - buttonSubmitText={ - - } - buttonSubmitLoadingText={ - - } - submitImmediatelyOn={handleSubmitImmediatelyOn} - saving={props.saving} - loading={props.loading} - users={props.users} - totalCount={props.totalCount} - placeholderText={intl.formatMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})} - /> + } + submitImmediatelyOn={handleSubmitImmediatelyOn} + saving={props.saving} + loading={props.loading} + users={props.users} + totalCount={props.totalCount} + placeholderText={intl.formatMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})} + + > + {props.children} + + ); }); diff --git a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx index a93f3d8f70..3f5644a2cb 100644 --- a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx +++ b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx @@ -12,9 +12,12 @@ import type {UserProfile} from '@mattermost/types/users'; import type {ActionResult} from 'mattermost-redux/types/actions'; import type MultiSelect from 'components/multiselect/multiselect'; +import NewChannelModal from 'components/new_channel_modal/new_channel_modal'; import {getHistory} from 'utils/browser_history'; -import Constants from 'utils/constants'; +import Constants, {ModalIdentifiers} from 'utils/constants'; + +import type {ModalData} from 'types/actions'; import List from './list'; import {USERS_PER_PAGE} from './list/list'; @@ -61,6 +64,7 @@ export type Props = { searchProfiles: (term: string, options: any) => Promise>; searchGroupChannels: (term: string) => Promise>; setModalSearchTerm: (term: string) => void; + openModal:

(modalData: ModalData

) => void; }; } @@ -264,10 +268,20 @@ export default class MoreDirectChannels extends React.PureComponent Constants.LAMP_ICON; + + openModal = (): void => { + this.handleExit(); + const newModal = { + modalId: ModalIdentifiers.NEW_CHANNEL_MODAL, + dialogType: NewChannelModal, + }; + this.props.actions?.openModal(newModal); + }; + render() { const body = ( + > + { + (this.state.values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( + <> +

+ + ) : null + } + ); return ( diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index 18025c00f6..b114e8da09 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -10,12 +10,11 @@ import ReactSelect, {components} from 'react-select'; import type {getOptionValue} from 'react-select/src/builtins'; import type {InputActionMeta} from 'react-select/src/types'; -import NewChannelModal from 'components/new_channel_modal/new_channel_modal'; import SaveButton from 'components/save_button'; import CloseCircleSolidIcon from 'components/widgets/icons/close_circle_solid_icon'; import Avatar from 'components/widgets/users/avatar'; -import {Constants, A11yCustomEventTypes, ModalIdentifiers} from 'utils/constants'; +import {Constants, A11yCustomEventTypes} from 'utils/constants'; import {imageURLForUser, getDisplayName, localizeMessage} from 'utils/utils'; import type {ModalData} from 'types/actions'; @@ -81,7 +80,7 @@ export type Props = { savingEnabled?: boolean; handleCancel?: () => void; customNoOptionsMessage?: React.ReactNode; - exitParentModal?: () => void; + children?: ReactNode; } export type State = { @@ -118,17 +117,6 @@ export class MultiSelect extends React.PureComponent, }; } - public openModal = (): void => { - if (this.props.exitParentModal) { - this.props.exitParentModal(); - } - const newModal = { - modalId: ModalIdentifiers.NEW_CHANNEL_MODAL, - dialogType: NewChannelModal, - }; - this.props.actions?.openModal(newModal); - }; - public componentDidMount() { const inputRef: unknown = this.reactSelectRef.current && this.reactSelectRef.current.select.inputRef; @@ -481,7 +469,6 @@ export class MultiSelect extends React.PureComponent, /> ); } - const lampIcon = () => Constants.LAMP_ICON; return ( <> @@ -539,31 +526,7 @@ export class MultiSelect extends React.PureComponent,
- { - (this.props.disableMultiSelectList && this.props.values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( - <> - - - ) : null - } + {this.props.children}
{ (!this.props.disableMultiSelectList || this.props.values.length <= (Constants.MAX_USERS_IN_GM - 1)) ? ( From 6d25be79d9a6edfda0356182d5d6b6b4366adad2 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 26 Jul 2024 09:55:18 +0200 Subject: [PATCH 12/32] Fix: optional children --- .../channels/src/components/more_direct_channels/list/list.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index a7eccf8488..4243ff60d7 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -23,7 +23,7 @@ export const USERS_PER_PAGE = 50; export type Props = { addValue: (value: OptionValue) => void; - children: ReactNode; + children?: ReactNode; currentUserId: string; handleDelete: (values: OptionValue[]) => void; handlePageChange: (page: number, prevPage: number) => void; From 410dfb292078fb28f2eacde7c46f7645dde9b90c Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 26 Jul 2024 10:20:59 +0200 Subject: [PATCH 13/32] Fix: snap --- .../__snapshots__/more_direct_channels.test.tsx.snap | 2 -- .../more_direct_channels/more_direct_channels.test.tsx | 1 + .../multiselect/__snapshots__/multiselect.test.tsx.snap | 9 ++++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap index 535cbcaf3c..6073e4686f 100644 --- a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap +++ b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap @@ -56,7 +56,6 @@ exports[`components/MoreDirectChannels should exclude deleted users if there is { process.nextTick(() => resolve({data: true})); }); }), + openModal: jest.fn().mockResolvedValue({data: true}), getProfilesInTeam: jest.fn().mockResolvedValue({data: true}), loadProfilesMissingStatus: jest.fn().mockResolvedValue({data: true}), searchProfiles: jest.fn().mockResolvedValue({data: true}), diff --git a/webapp/channels/src/components/multiselect/__snapshots__/multiselect.test.tsx.snap b/webapp/channels/src/components/multiselect/__snapshots__/multiselect.test.tsx.snap index 61c34af9a7..86d895b765 100644 --- a/webapp/channels/src/components/multiselect/__snapshots__/multiselect.test.tsx.snap +++ b/webapp/channels/src/components/multiselect/__snapshots__/multiselect.test.tsx.snap @@ -128,10 +128,11 @@ exports[`components/multiselect/multiselect MultiSelectList should match snapsho style={Object {}} > Date: Fri, 26 Jul 2024 13:51:51 +0200 Subject: [PATCH 14/32] Fix: errors + max user in gm in parent compo --- .../more_direct_channels/list/list.tsx | 110 +++++++++--------- .../more_direct_channels.tsx | 37 +++--- .../components/multiselect/multiselect.tsx | 14 +-- 3 files changed, 74 insertions(+), 87 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index 4243ff60d7..5c4c6accc2 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -104,66 +104,64 @@ const List = React.forwardRef((props: Props, ref?: React.Ref - - ref={ref} - options={options} - optionRenderer={renderOptionValue} - intl={intl} - selectedItemRef={props.selectedItemRef} - values={props.values} - valueRenderer={renderValue} - ariaLabelRenderer={renderAriaLabel} - perPage={USERS_PER_PAGE} - handlePageChange={props.handlePageChange} - handleInput={props.search} - handleDelete={props.handleDelete} - handleAdd={props.addValue} - handleSubmit={props.handleSubmit} - noteText={note} - disableMultiSelectList={true} - maxValues={MAX_SELECTABLE_VALUES} - changeMessageColor='red' - showError={props.values.length === MAX_SELECTABLE_VALUES} - numRemainingText={ - props.values.length === MAX_SELECTABLE_VALUES ? ( - - ) : ( - - ) - } - buttonSubmitText={ + + ref={ref} + options={options} + optionRenderer={renderOptionValue} + intl={intl} + selectedItemRef={props.selectedItemRef} + values={props.values} + valueRenderer={renderValue} + ariaLabelRenderer={renderAriaLabel} + perPage={USERS_PER_PAGE} + handlePageChange={props.handlePageChange} + handleInput={props.search} + handleDelete={props.handleDelete} + handleAdd={props.addValue} + handleSubmit={props.handleSubmit} + noteText={note} + disableMultiSelectList={props.values.length > (Constants.MAX_USERS_IN_GM - 1)} + maxValues={MAX_SELECTABLE_VALUES} + changeMessageColor='red' + showError={props.values.length === MAX_SELECTABLE_VALUES} + numRemainingText={ + props.values.length === MAX_SELECTABLE_VALUES ? ( - } - buttonSubmitLoadingText={ + ) : ( - } - submitImmediatelyOn={handleSubmitImmediatelyOn} - saving={props.saving} - loading={props.loading} - users={props.users} - totalCount={props.totalCount} - placeholderText={intl.formatMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})} - - > - {props.children} - - + ) + } + buttonSubmitText={ + + } + buttonSubmitLoadingText={ + + } + submitImmediatelyOn={handleSubmitImmediatelyOn} + saving={props.saving} + loading={props.loading} + users={props.users} + totalCount={props.totalCount} + placeholderText={intl.formatMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})} + + > + {props.children} + ); }); diff --git a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx index 3f5644a2cb..8f69fa5968 100644 --- a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx +++ b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx @@ -298,27 +298,26 @@ export default class MoreDirectChannels extends React.PureComponent { (this.state.values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( - <> - + ) : null } diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index b114e8da09..befca9cff5 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -17,8 +17,6 @@ import Avatar from 'components/widgets/users/avatar'; import {Constants, A11yCustomEventTypes} from 'utils/constants'; import {imageURLForUser, getDisplayName, localizeMessage} from 'utils/utils'; -import type {ModalData} from 'types/actions'; - import MultiSelectList from './multiselect_list'; export type Value = { @@ -31,13 +29,7 @@ export type Value = { disabled?: boolean; }; -type Actions = { - openModal:

(modalData: ModalData

) => void; - closeModal: (modalId: string) => void; -} - export type Props = { - actions?: Actions; ariaLabelRenderer: getOptionValue; backButtonClick?: () => void; backButtonClass?: string; @@ -472,7 +464,7 @@ export class MultiSelect extends React.PureComponent, return ( <> -

+
extends React.PureComponent, {this.props.children}
{ - (!this.props.disableMultiSelectList || this.props.values.length <= (Constants.MAX_USERS_IN_GM - 1)) ? ( - multiSelectList - ) : null + this.props.disableMultiSelectList ? null : multiSelectList }
Date: Thu, 18 Jul 2024 11:12:43 +0200 Subject: [PATCH 15/32] Fix: Change message when 7 user in pm --- .../more_direct_channels/list/list.tsx | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index c04182cbb8..c44446e758 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -120,13 +120,20 @@ const List = React.forwardRef((props: Props, ref?: React.Ref + props.values.length === MAX_SELECTABLE_VALUES ? ( + + ) : ( + + ) } buttonSubmitText={ Date: Fri, 19 Jul 2024 11:24:39 +0200 Subject: [PATCH 16/32] Feat: modal for max user in pm --- .../more_direct_channels/list/list.tsx | 14 +-- .../more_direct_channels.tsx | 1 + .../src/components/multiselect/index.ts | 21 +++++ .../components/multiselect/multiselect.tsx | 93 +++++++++++++++---- webapp/channels/src/i18n/de.json | 7 +- webapp/channels/src/i18n/en.json | 7 +- webapp/channels/src/i18n/es.json | 7 +- webapp/channels/src/i18n/fr.json | 7 +- webapp/channels/src/i18n/it.json | 7 +- webapp/channels/src/images/icons/lamp.svg | 15 +++ .../channels/src/sass/components/_modal.scss | 14 +++ .../src/sass/components/_react-select.scss | 3 + webapp/channels/src/utils/constants.tsx | 2 + 13 files changed, 163 insertions(+), 35 deletions(-) create mode 100644 webapp/channels/src/components/multiselect/index.ts create mode 100644 webapp/channels/src/images/icons/lamp.svg diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index c44446e758..8a8f68634f 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -7,7 +7,7 @@ import {FormattedMessage, useIntl} from 'react-intl'; import type {UserProfile} from '@mattermost/types/users'; -import MultiSelect from 'components/multiselect/multiselect'; +import MultiSelect from 'components/multiselect/index'; import Constants from 'utils/constants'; @@ -35,6 +35,7 @@ export type Props = { totalCount: number; users: UserProfile[]; emptyGroupChannelsIds: string[]; + exitParentModal: () => void; /** * An array of values that have been selected by the user in the multiselect. @@ -118,20 +119,21 @@ const List = React.forwardRef((props: Props, ref?: React.Ref ) : ( ) } diff --git a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx index ceee0a6f4a..a93f3d8f70 100644 --- a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx +++ b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx @@ -267,6 +267,7 @@ export default class MoreDirectChannels extends React.PureComponent(modalData: ModalData

) => void; + closeModal: (modalId: string) => void; +} + export type Props = { + actions: Actions; ariaLabelRenderer: getOptionValue; backButtonClick?: () => void; backButtonClass?: string; @@ -59,16 +68,20 @@ export type Props = { perPage: number; placeholderText?: string; saving?: boolean; + showError?: boolean; + changeMessageColor: string; submitImmediatelyOn?: (value: T) => boolean; totalCount?: number; users?: unknown[]; valueWithImage: boolean; + disableMultiSelectList?: boolean; valueRenderer?: (props: {data: T}) => any; values: T[]; focusOnLoad?: boolean; savingEnabled?: boolean; handleCancel?: () => void; customNoOptionsMessage?: React.ReactNode; + exitParentModal: () => void; } export type State = { @@ -91,6 +104,8 @@ export class MultiSelect extends React.PureComponent, focusOnLoad: true, savingEnabled: true, showInputByDefault: false, + changeMessageColor: false, + disableMultiSelectList: false, }; public constructor(props: Props) { @@ -103,6 +118,15 @@ export class MultiSelect extends React.PureComponent, }; } + public openModal = (): void => { + this.props.exitParentModal(); + const newModal = { + modalId: ModalIdentifiers.NEW_CHANNEL_MODAL, + dialogType: NewChannelModal, + }; + this.props.actions.openModal(newModal); + }; + public componentDidMount() { const inputRef: unknown = this.reactSelectRef.current && this.reactSelectRef.current.select.inputRef; @@ -447,18 +471,18 @@ export class MultiSelect extends React.PureComponent, memberCount = ( ); } + const lampIcon = () => Constants.LAMP_ICON; return ( <> -

+
extends React.PureComponent, ref={this.reactSelectRef as React.RefObject} // type of ref on @types/react-select is outdated isMulti={true} options={this.props.options} - styles={styles} + styles={styles(this.props.showError)} components={{ Menu: nullComponent, IndicatorsContainer: nullComponent, @@ -487,7 +511,7 @@ export class MultiSelect extends React.PureComponent, getOptionLabel={this.props.ariaLabelRenderer} aria-label={this.props.placeholderText} className={this.state.a11yActive ? 'multi-select__focused' : ''} - classNamePrefix='react-select-auto react-select' + classNamePrefix={this.props.showError ? 'react-select-auto react-select error' : 'react-select-auto react-select'} /> {this.props.saveButtonPosition === 'top' && extends React.PureComponent, id='multiSelectHelpMemberInfo' className='multi-select__help' > - {numRemainingText} +
+ {numRemainingText} +
+ {memberCount}
- {multiSelectList} + {this.props.disableMultiSelectList && this.props.values.length === 7 ? ( + + ) : (multiSelectList) + }
{noteTextContainer}
- {this.props.saveButtonPosition === 'top' && + {this.props.saveButtonPosition === 'top' && !this.props.disableMultiSelectList &&
{previousButton} {nextButton} @@ -572,14 +620,21 @@ const paddedComponent = (WrappedComponent: any) => { }; }; -const styles = { - container: () => { - return { - display: 'flex', - overflow: 'hidden', - flex: 'auto', - }; - }, -}; +const styles = (showError: boolean | undefined) => ({ + container: (base: React.CSSProperties) => ({ + ...base, + display: 'flex', + overflow: 'hidden', + flex: 'auto', + }), + control: (base: React.CSSProperties) => ({ + ...base, + borderColor: 'red', + boxShadow: showError ? '0 0 0 1px red' : 'none', + '&:hover': { + borderColor: 'red', + }, + }), +}); export default MultiSelect; diff --git a/webapp/channels/src/i18n/de.json b/webapp/channels/src/i18n/de.json index 3249ea3def..b2bf130215 100644 --- a/webapp/channels/src/i18n/de.json +++ b/webapp/channels/src/i18n/de.json @@ -4437,10 +4437,13 @@ "multiselect.go": "Los", "multiselect.list.notFound": "Für die Suchanfrage {searchQuery} wurden keine Ergebnisse gefunden", "multiselect.loading": "Lade...", + "multiselect.noMorePeople": "Eine persönliche Nachricht ist auf 7 Personen begrenzt.", + "multiselect.numMembers": "{options}/7 Benutzer", + "multiselect.numPeopleRemaining": "Verwenden Sie die ↑↓ Pfeiltasten auf der Tastatur, ENTER zum Auswählen.", + "multiselect.new_channel": "Erstellen Sie einen Kanal, um mit mehr Personen zu kommunizieren", + "multiselect.new_channel_create": "Einen Kanal erstellen", "multiselect.maxGroupMembers": "Es können nicht mehr als 256 Mitglieder auf einmal zu einer Gruppe hinzugefügt werden.", "multiselect.numGroupsRemaining": "Verwende ↑↓ zum Navigieren, ↵ zur Auswahl. Du kannst {num, number} weitere {num, plural, one {Gruppe} other {Gruppen}} hinzufügen. ", - "multiselect.numMembers": "{memberOptions, number} von {totalCount, number} Benutzern", - "multiselect.numPeopleRemaining": "Verwende ↑↓ zum Navigieren, ↵ zur Auswahl. Du kannst {num, number} weitere {num, plural, one {Person} other {Personen}} hinzufügen. ", "multiselect.numRemaining": "Es können maximal {max, number} gleichzeitig hinzugefügt werden. Es können {num, number} weitere hinzugefügt werden.", "multiselect.placeholder": "Mitglieder suchen", "multiselect.placeholder.peopleOrGroups": "Suche nach Personen oder Gruppen", diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index f93c5ed47f..f6d1f60bdd 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -4411,10 +4411,13 @@ "multiselect.go": "Go", "multiselect.list.notFound": "No results found matching {searchQuery}", "multiselect.loading": "Loading...", + "multiselect.noMorePeople": "A personal message is limited to 7 people.", + "multiselect.numMembers": "{options}/7 users", + "multiselect.numPeopleRemaining": "Use the ↑↓ arrows on the keyboard, ENTER to select.", + "multiselect.new_channel": "Create a channel to communicate with more people", + "multiselect.new_channel_create": "Create a channel", "multiselect.maxGroupMembers": "No more than 256 members can be added to a group at once.", "multiselect.numGroupsRemaining": "Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {group} other {groups}}. ", - "multiselect.numMembers": "{memberOptions, number} of {totalCount, number} members", - "multiselect.numPeopleRemaining": "Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {person} other {people}}. ", "multiselect.numRemaining": "Up to {max, number} can be added at a time. You have {num, number} remaining.", "multiselect.placeholder": "Search for people", "multiselect.placeholder.peopleOrGroups": "Search for people or groups", diff --git a/webapp/channels/src/i18n/es.json b/webapp/channels/src/i18n/es.json index c7c062b383..f149d2a394 100644 --- a/webapp/channels/src/i18n/es.json +++ b/webapp/channels/src/i18n/es.json @@ -3810,9 +3810,12 @@ "multiselect.go": "Ir", "multiselect.list.notFound": "No se encontraron resultados que encajen con **{searchQuery}**", "multiselect.loading": "Cargando...", + "multiselect.noMorePeople": "Un mensaje personal está limitado a 7 personas.", + "multiselect.numMembers": "{options}/7 usuarios", + "multiselect.numPeopleRemaining": "Usa las flechas ↑↓ del teclado, ENTER para seleccionar.", + "multiselect.new_channel": "Crear un canal para comunicarse con más personas", + "multiselect.new_channel_create": "Crear un canal", "multiselect.numGroupsRemaining": "Utiliza ↑↓ para navegar, ↵ para seleccionar. Puedes agregar {num, number} {num, plural, one {grupo} other {grupos}} más. ", - "multiselect.numMembers": "{memberOptions, number} de {totalCount, number} miembros", - "multiselect.numPeopleRemaining": "Utiliza ↑↓ para navegar, ↵ para seleccionar. Puedes agregar {num, number} {num, plural, one {persona} other {personas}} más. ", "multiselect.numRemaining": "Se puede añadir hasta {max, number} a la vez. Te quedan {num, number}.", "multiselect.placeholder": "Buscar personas", "multiselect.saveDetailsButton": "Guardar Detalles", diff --git a/webapp/channels/src/i18n/fr.json b/webapp/channels/src/i18n/fr.json index 0f737d5d5f..1db529ec9d 100644 --- a/webapp/channels/src/i18n/fr.json +++ b/webapp/channels/src/i18n/fr.json @@ -3750,12 +3750,15 @@ "multiselect.go": "Aller à", "multiselect.list.notFound": "Aucun résultat trouvé pour {searchQuery}", "multiselect.loading": "Chargement…", + "multiselect.noMorePeople": "Un message personnel est limité à 7 personnes.", "multiselect.numGroupsRemaining": "Utilisez les flèches ↑↓ pour parcourir, ↵ pour sélectionner. Vous pouvez encore ajouter {num, number} {num, plural, one {groupe} other {groupes}}. ", - "multiselect.numMembers": "{memberOptions, number} de {totalCount, number} membres", - "multiselect.numPeopleRemaining": "Utilisez les flèches ↑↓ pour parcourir, ↵ pour sélectionner. Vous pouvez encore ajouter {num, number} {num, plural, one {personne} other {personnes}}. ", + "multiselect.numMembers": "{options}/7 utilisateurs", + "multiselect.numPeopleRemaining": "Utilisez les flèches ↑↓ du clavier, ENTER pour sélectionner.", "multiselect.numRemaining": "Vous pouvez ajouter jusqu'à {max, number} à la fois. Il vous reste {num, number}.", "multiselect.placeholder": "Rechercher des membres", "multiselect.placeholder.peopleOrGroups": "Rechercher des personnes ou des groupes", + "multiselect.new_channel": "Créer un canal pour échanger avec plus de personnes", + "multiselect.new_channel_create": "Créer un canal", "multiselect.saveDetailsButton": "Enregistrer les détails", "multiselect.savingDetailsButton": "Enregistrement...", "multiselect.selectChannels": "Utilisez ↑↓ pour parcourir, ↵ pour sélectionner.", diff --git a/webapp/channels/src/i18n/it.json b/webapp/channels/src/i18n/it.json index 113cd4ebe9..73d58642ab 100644 --- a/webapp/channels/src/i18n/it.json +++ b/webapp/channels/src/i18n/it.json @@ -2908,9 +2908,12 @@ "multiselect.go": "Vai", "multiselect.list.notFound": "Nessun elemento trovato corrispondenti a {searchQuery}", "multiselect.loading": "Caricamento...", + "multiselect.noMorePeople": "Un messaggio personale è limitato a 7 persone.", + "multiselect.numMembers": "{options}/7 utenti", + "multiselect.numPeopleRemaining": "Usa le frecce ↑↓ della tastiera, ENTER per selezionare.", + "multiselect.new_channel": "Crea un canale per comunicare con più persone", + "multiselect.new_channel_create": "Crea un canale", "multiselect.numGroupsRemaining": "Usa ↑↓ per navigare, ↵ per scegliere. Puoi aggiungere {num, number} {num, plural, one {group} other {groups}}. ", - "multiselect.numMembers": "{memberOptions, number} di {totalCount, number} membri", - "multiselect.numPeopleRemaining": "Usa ↑↓ per navigare, ↵ per scegliere. Puoi aggiungere {num, number} più {num, plural, one {person} altre {people}}. ", "multiselect.numRemaining": "Si possono ancora aggiungere {num, number}", "multiselect.placeholder": "Cercare ed aggiungere membri", "multiselect.selectChannels": "Usa ↑↓ per navigare, ↵ per selezionare.", diff --git a/webapp/channels/src/images/icons/lamp.svg b/webapp/channels/src/images/icons/lamp.svg new file mode 100644 index 0000000000..8d7686b196 --- /dev/null +++ b/webapp/channels/src/images/icons/lamp.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/webapp/channels/src/sass/components/_modal.scss b/webapp/channels/src/sass/components/_modal.scss index 75632bc509..5ea6c96c7a 100644 --- a/webapp/channels/src/sass/components/_modal.scss +++ b/webapp/channels/src/sass/components/_modal.scss @@ -980,6 +980,10 @@ flex: 1 1 auto; } + &.disable-list { + height: unset; + } + .multi-select__wrapper { display: flex; height: 1px; @@ -1040,6 +1044,16 @@ } } +.create-new-channel { + height: 60px; + margin: 20px; + display: flex; + border-radius: 4px; + align-items: center; + justify-content: space-around; + background-color: #f2f2f2; +} + .team-selector-modal, .channel-selector-modal { .more-modal__row { diff --git a/webapp/channels/src/sass/components/_react-select.scss b/webapp/channels/src/sass/components/_react-select.scss index 6a9b1561c4..f53034659e 100644 --- a/webapp/channels/src/sass/components/_react-select.scss +++ b/webapp/channels/src/sass/components/_react-select.scss @@ -1,4 +1,7 @@ .react-select { + &.error { + border-color: var(--danger-color) !important; + } .a11y--focused { box-shadow: none; } diff --git a/webapp/channels/src/utils/constants.tsx b/webapp/channels/src/utils/constants.tsx index 3cbaa36f84..bde98db565 100644 --- a/webapp/channels/src/utils/constants.tsx +++ b/webapp/channels/src/utils/constants.tsx @@ -21,6 +21,7 @@ import audioIcon from 'images/icons/audio.svg'; import codeIcon from 'images/icons/code.svg'; import excelIcon from 'images/icons/excel.svg'; import genericIcon from 'images/icons/generic.svg'; +import lampIcon from 'images/icons/lamp.svg'; import patchIcon from 'images/icons/patch.svg'; import pdfIcon from 'images/icons/pdf.svg'; import pptIcon from 'images/icons/ppt.svg'; @@ -2122,6 +2123,7 @@ export const Constants = { RECENT_EMOJI_KEY: 'recentEmojis', DEFAULT_WEBHOOK_LOGO: logoWebhook, TRANSCRIPT_ICON: transcriptIcon, + LAMP_ICON: lampIcon, MHPNS_US: 'https://push.mattermost.com', MHPNS_DE: 'https://hpns-de.mattermost.com', MTPNS: 'https://push-test.mattermost.com', From a13805012459fff984a32ed9aa93853d88705765 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 19 Jul 2024 12:03:21 +0200 Subject: [PATCH 17/32] Fix: test --- .../src/components/multiselect/multiselect.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index 343ffc7014..fd5d8008f9 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -38,7 +38,7 @@ type Actions = { } export type Props = { - actions: Actions; + actions?: Actions; ariaLabelRenderer: getOptionValue; backButtonClick?: () => void; backButtonClass?: string; @@ -69,7 +69,7 @@ export type Props = { placeholderText?: string; saving?: boolean; showError?: boolean; - changeMessageColor: string; + changeMessageColor?: string; submitImmediatelyOn?: (value: T) => boolean; totalCount?: number; users?: unknown[]; @@ -81,7 +81,7 @@ export type Props = { savingEnabled?: boolean; handleCancel?: () => void; customNoOptionsMessage?: React.ReactNode; - exitParentModal: () => void; + exitParentModal?: () => void; } export type State = { @@ -119,12 +119,14 @@ export class MultiSelect extends React.PureComponent, } public openModal = (): void => { - this.props.exitParentModal(); + if (this.props.exitParentModal) { + this.props.exitParentModal(); + } const newModal = { modalId: ModalIdentifiers.NEW_CHANNEL_MODAL, dialogType: NewChannelModal, }; - this.props.actions.openModal(newModal); + this.props.actions?.openModal(newModal); }; public componentDidMount() { From 490b1c37db5e1987cfa5f1bc115123de6b0704f1 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 19 Jul 2024 12:52:04 +0200 Subject: [PATCH 18/32] Fix: Modal css, tests, snap --- .../__snapshots__/channel_invite_modal.test.tsx.snap | 6 ++++++ .../__snapshots__/more_direct_channels.test.tsx.snap | 2 ++ webapp/channels/src/components/multiselect/multiselect.tsx | 7 ++++--- webapp/channels/src/sass/components/_modal.scss | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/webapp/channels/src/components/channel_invite_modal/__snapshots__/channel_invite_modal.test.tsx.snap b/webapp/channels/src/components/channel_invite_modal/__snapshots__/channel_invite_modal.test.tsx.snap index 7111e7e536..985d0a6381 100644 --- a/webapp/channels/src/components/channel_invite_modal/__snapshots__/channel_invite_modal.test.tsx.snap +++ b/webapp/channels/src/components/channel_invite_modal/__snapshots__/channel_invite_modal.test.tsx.snap @@ -66,7 +66,9 @@ exports[`components/channel_invite_modal should match snapshot for channel_invit ariaLabelRenderer={[Function]} backButtonClass="btn-tertiary tertiary-button" backButtonClick={[Function]} + changeMessageColor="" customNoOptionsMessage={null} + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleCancel={[Function]} @@ -205,7 +207,9 @@ exports[`components/channel_invite_modal should match snapshot for channel_invit ariaLabelRenderer={[Function]} backButtonClass="btn-tertiary tertiary-button" backButtonClick={[Function]} + changeMessageColor="" customNoOptionsMessage={null} + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleCancel={[Function]} @@ -366,7 +370,9 @@ exports[`components/channel_invite_modal should match snapshot with exclude and ariaLabelRenderer={[Function]} backButtonClass="btn-tertiary tertiary-button" backButtonClick={[Function]} + changeMessageColor="" customNoOptionsMessage={null} + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleCancel={[Function]} diff --git a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap index 6073e4686f..535cbcaf3c 100644 --- a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap +++ b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap @@ -56,6 +56,7 @@ exports[`components/MoreDirectChannels should exclude deleted users if there is extends React.PureComponent, focusOnLoad: true, savingEnabled: true, showInputByDefault: false, - changeMessageColor: false, + changeMessageColor: '', disableMultiSelectList: false, }; @@ -533,8 +533,9 @@ export class MultiSelect extends React.PureComponent,
{numRemainingText}
- - {memberCount} +
+ {memberCount} +
{this.props.disableMultiSelectList && this.props.values.length === 7 ? ( diff --git a/webapp/channels/src/sass/components/_modal.scss b/webapp/channels/src/sass/components/_modal.scss index 5ea6c96c7a..1e6548a0ba 100644 --- a/webapp/channels/src/sass/components/_modal.scss +++ b/webapp/channels/src/sass/components/_modal.scss @@ -1046,9 +1046,9 @@ .create-new-channel { height: 60px; - margin: 20px; + margin: 27px; display: flex; - border-radius: 4px; + border-radius: 8px; align-items: center; justify-content: space-around; background-color: #f2f2f2; From a8b8e0a4b824515d2d4c313efd58b508d84e5598 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 19 Jul 2024 13:13:06 +0200 Subject: [PATCH 19/32] Fix: snap --- .../add_groups_to_channel_modal.test.tsx.snap | 2 + .../add_groups_to_channel_modal.tsx | 3 +- ...dd_user_to_group_multiselect.test.tsx.snap | 6 ++ .../add_users_to_team_modal.test.tsx.snap | 4 + .../add_users_to_role_modal.test.tsx.snap | 12 +++ .../channel_selector_modal.test.tsx.snap | 4 + .../__snapshots__/multiselect.test.tsx.snap | 75 ++++++++++++------- 7 files changed, 78 insertions(+), 28 deletions(-) diff --git a/webapp/channels/src/components/add_groups_to_channel_modal/__snapshots__/add_groups_to_channel_modal.test.tsx.snap b/webapp/channels/src/components/add_groups_to_channel_modal/__snapshots__/add_groups_to_channel_modal.test.tsx.snap index a95bd53ae8..996646bfa4 100644 --- a/webapp/channels/src/components/add_groups_to_channel_modal/__snapshots__/add_groups_to_channel_modal.test.tsx.snap +++ b/webapp/channels/src/components/add_groups_to_channel_modal/__snapshots__/add_groups_to_channel_modal.test.tsx.snap @@ -59,6 +59,8 @@ exports[`components/AddGroupsToChannelModal should match snapshot 1`] = ` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} diff --git a/webapp/channels/src/components/add_groups_to_channel_modal/add_groups_to_channel_modal.tsx b/webapp/channels/src/components/add_groups_to_channel_modal/add_groups_to_channel_modal.tsx index a6bfce7679..41751bce23 100644 --- a/webapp/channels/src/components/add_groups_to_channel_modal/add_groups_to_channel_modal.tsx +++ b/webapp/channels/src/components/add_groups_to_channel_modal/add_groups_to_channel_modal.tsx @@ -15,10 +15,11 @@ import type {ActionResult} from 'mattermost-redux/types/actions'; import MultiSelect from 'components/multiselect/multiselect'; import type {Value} from 'components/multiselect/multiselect'; -import groupsAvatar from 'images/groups-avatar.png'; import Constants from 'utils/constants'; import {localizeMessage} from 'utils/utils'; +import groupsAvatar from 'images/groups-avatar.png'; + const GROUPS_PER_PAGE = 50; const MAX_SELECTABLE_VALUES = 10; diff --git a/webapp/channels/src/components/add_user_to_group_multiselect/__snapshots__/add_user_to_group_multiselect.test.tsx.snap b/webapp/channels/src/components/add_user_to_group_multiselect/__snapshots__/add_user_to_group_multiselect.test.tsx.snap index 679a617e2b..321d635248 100644 --- a/webapp/channels/src/components/add_user_to_group_multiselect/__snapshots__/add_user_to_group_multiselect.test.tsx.snap +++ b/webapp/channels/src/components/add_user_to_group_multiselect/__snapshots__/add_user_to_group_multiselect.test.tsx.snap @@ -5,6 +5,8 @@ exports[`component/add_user_to_group_multiselect should match snapshot with diff ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Updating..." buttonSubmitText="Update Group" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={false} handleAdd={[Function]} handleDelete={[Function]} @@ -90,6 +92,8 @@ exports[`component/add_user_to_group_multiselect should match snapshot with prof ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Creating..." buttonSubmitText="Create Group" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={false} handleAdd={[Function]} handleDelete={[Function]} @@ -175,6 +179,8 @@ exports[`component/add_user_to_group_multiselect should match snapshot without a ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Creating..." buttonSubmitText="Create Group" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={false} handleAdd={[Function]} handleDelete={[Function]} diff --git a/webapp/channels/src/components/add_users_to_team_modal/__snapshots__/add_users_to_team_modal.test.tsx.snap b/webapp/channels/src/components/add_users_to_team_modal/__snapshots__/add_users_to_team_modal.test.tsx.snap index 24f15d8c80..4ee84c49c5 100644 --- a/webapp/channels/src/components/add_users_to_team_modal/__snapshots__/add_users_to_team_modal.test.tsx.snap +++ b/webapp/channels/src/components/add_users_to_team_modal/__snapshots__/add_users_to_team_modal.test.tsx.snap @@ -59,6 +59,8 @@ exports[`components/admin_console/add_users_to_team_modal/AddUsersToTeamModal sh ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -286,6 +288,8 @@ exports[`components/admin_console/add_users_to_team_modal/AddUsersToTeamModal sh ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} diff --git a/webapp/channels/src/components/admin_console/system_roles/system_role/add_users_to_role_modal/__snapshots__/add_users_to_role_modal.test.tsx.snap b/webapp/channels/src/components/admin_console/system_roles/system_role/add_users_to_role_modal/__snapshots__/add_users_to_role_modal.test.tsx.snap index ce6dd9e4ea..7378fab39d 100644 --- a/webapp/channels/src/components/admin_console/system_roles/system_role/add_users_to_role_modal/__snapshots__/add_users_to_role_modal.test.tsx.snap +++ b/webapp/channels/src/components/admin_console/system_roles/system_role/add_users_to_role_modal/__snapshots__/add_users_to_role_modal.test.tsx.snap @@ -59,6 +59,8 @@ exports[`admin_console/add_users_to_role_modal search should not include bot use ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -240,6 +242,8 @@ exports[`admin_console/add_users_to_role_modal should exclude user 1`] = ` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -377,6 +381,8 @@ exports[`admin_console/add_users_to_role_modal should have single passed value 1 ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -558,6 +564,8 @@ exports[`admin_console/add_users_to_role_modal should include additional user 1` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -780,6 +788,8 @@ exports[`admin_console/add_users_to_role_modal should include additional user 2` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} @@ -1002,6 +1012,8 @@ exports[`admin_console/add_users_to_role_modal should not include bot user 1`] = ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} diff --git a/webapp/channels/src/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.tsx.snap b/webapp/channels/src/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.tsx.snap index 00d6a640a3..02b2d485e9 100644 --- a/webapp/channels/src/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.tsx.snap +++ b/webapp/channels/src/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.tsx.snap @@ -53,6 +53,8 @@ exports[`components/ChannelSelectorModal exclude already selected 1`] = ` - +
+ +
- +
+ +
- +
+ +
Date: Fri, 19 Jul 2024 13:27:41 +0200 Subject: [PATCH 20/32] Fix: snap --- .../__snapshots__/add_groups_to_team_modal.test.tsx.snap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp/channels/src/components/add_groups_to_team_modal/__snapshots__/add_groups_to_team_modal.test.tsx.snap b/webapp/channels/src/components/add_groups_to_team_modal/__snapshots__/add_groups_to_team_modal.test.tsx.snap index 81eefd6f49..f2ab772eea 100644 --- a/webapp/channels/src/components/add_groups_to_team_modal/__snapshots__/add_groups_to_team_modal.test.tsx.snap +++ b/webapp/channels/src/components/add_groups_to_team_modal/__snapshots__/add_groups_to_team_modal.test.tsx.snap @@ -59,6 +59,8 @@ exports[`components/AddGroupsToTeamModal should match snapshot 1`] = ` ariaLabelRenderer={[Function]} buttonSubmitLoadingText="Adding..." buttonSubmitText="Add" + changeMessageColor="" + disableMultiSelectList={false} focusOnLoad={true} handleAdd={[Function]} handleDelete={[Function]} From 7bb296b6e1efa99f6a7fe0355cc65019978cab02 Mon Sep 17 00:00:00 2001 From: Boris Date: Tue, 23 Jul 2024 09:33:22 +0200 Subject: [PATCH 21/32] Fix: show modal when 7 user in pm Changelog: fixed --- .../more_direct_channels/list/list.tsx | 2 +- .../components/multiselect/multiselect.tsx | 48 ++++++++++--------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index 8a8f68634f..f0ec2dd211 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -17,7 +17,7 @@ import ListItem from '../list_item'; import type {Option, OptionValue} from '../types'; import {optionValue} from '../types'; -const MAX_SELECTABLE_VALUES = Constants.MAX_USERS_IN_GM - 1; +const MAX_SELECTABLE_VALUES = Constants.MAX_USERS_IN_GM; export const USERS_PER_PAGE = 50; export type Props = { diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index 0cc9b1fc42..8c99caf3ed 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -484,7 +484,7 @@ export class MultiSelect extends React.PureComponent, return ( <> -
+
extends React.PureComponent,
- {this.props.disableMultiSelectList && this.props.values.length === 7 ? ( - - ) : (multiSelectList) + { + this.props.disableMultiSelectList && this.props.values.length >= 7 ? ( + <> + {this.props.values.length === 7 && multiSelectList} + + + ) : (multiSelectList) }
Date: Tue, 23 Jul 2024 09:57:31 +0200 Subject: [PATCH 22/32] Fix: Change trad and text position in modal Changelog: fixed --- webapp/channels/src/i18n/de.json | 2 +- webapp/channels/src/i18n/en.json | 2 +- webapp/channels/src/i18n/es.json | 2 +- webapp/channels/src/i18n/fr.json | 2 +- webapp/channels/src/i18n/it.json | 2 +- webapp/channels/src/sass/components/_modal.scss | 8 +++++++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/webapp/channels/src/i18n/de.json b/webapp/channels/src/i18n/de.json index b2bf130215..93fbcb361c 100644 --- a/webapp/channels/src/i18n/de.json +++ b/webapp/channels/src/i18n/de.json @@ -4440,7 +4440,7 @@ "multiselect.noMorePeople": "Eine persönliche Nachricht ist auf 7 Personen begrenzt.", "multiselect.numMembers": "{options}/7 Benutzer", "multiselect.numPeopleRemaining": "Verwenden Sie die ↑↓ Pfeiltasten auf der Tastatur, ENTER zum Auswählen.", - "multiselect.new_channel": "Erstellen Sie einen Kanal, um mit mehr Personen zu kommunizieren", + "multiselect.new_channel": "Mehr als sieben Personen? Erstellen Sie stattdessen einen Kanal", "multiselect.new_channel_create": "Einen Kanal erstellen", "multiselect.maxGroupMembers": "Es können nicht mehr als 256 Mitglieder auf einmal zu einer Gruppe hinzugefügt werden.", "multiselect.numGroupsRemaining": "Verwende ↑↓ zum Navigieren, ↵ zur Auswahl. Du kannst {num, number} weitere {num, plural, one {Gruppe} other {Gruppen}} hinzufügen. ", diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index f6d1f60bdd..f9f3b1a863 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -4414,7 +4414,7 @@ "multiselect.noMorePeople": "A personal message is limited to 7 people.", "multiselect.numMembers": "{options}/7 users", "multiselect.numPeopleRemaining": "Use the ↑↓ arrows on the keyboard, ENTER to select.", - "multiselect.new_channel": "Create a channel to communicate with more people", + "multiselect.new_channel": "More than 7 people? Create a channel instead", "multiselect.new_channel_create": "Create a channel", "multiselect.maxGroupMembers": "No more than 256 members can be added to a group at once.", "multiselect.numGroupsRemaining": "Use ↑↓ to browse, ↵ to select. You can add {num, number} more {num, plural, one {group} other {groups}}. ", diff --git a/webapp/channels/src/i18n/es.json b/webapp/channels/src/i18n/es.json index f149d2a394..a9097a970c 100644 --- a/webapp/channels/src/i18n/es.json +++ b/webapp/channels/src/i18n/es.json @@ -3813,7 +3813,7 @@ "multiselect.noMorePeople": "Un mensaje personal está limitado a 7 personas.", "multiselect.numMembers": "{options}/7 usuarios", "multiselect.numPeopleRemaining": "Usa las flechas ↑↓ del teclado, ENTER para seleccionar.", - "multiselect.new_channel": "Crear un canal para comunicarse con más personas", + "multiselect.new_channel": "¿Más de 7 personas? Crea un canal", "multiselect.new_channel_create": "Crear un canal", "multiselect.numGroupsRemaining": "Utiliza ↑↓ para navegar, ↵ para seleccionar. Puedes agregar {num, number} {num, plural, one {grupo} other {grupos}} más. ", "multiselect.numRemaining": "Se puede añadir hasta {max, number} a la vez. Te quedan {num, number}.", diff --git a/webapp/channels/src/i18n/fr.json b/webapp/channels/src/i18n/fr.json index 1db529ec9d..20d66f8cdd 100644 --- a/webapp/channels/src/i18n/fr.json +++ b/webapp/channels/src/i18n/fr.json @@ -3757,7 +3757,7 @@ "multiselect.numRemaining": "Vous pouvez ajouter jusqu'à {max, number} à la fois. Il vous reste {num, number}.", "multiselect.placeholder": "Rechercher des membres", "multiselect.placeholder.peopleOrGroups": "Rechercher des personnes ou des groupes", - "multiselect.new_channel": "Créer un canal pour échanger avec plus de personnes", + "multiselect.new_channel": "Plus de 7 personnes ? Créez plutôt un canal", "multiselect.new_channel_create": "Créer un canal", "multiselect.saveDetailsButton": "Enregistrer les détails", "multiselect.savingDetailsButton": "Enregistrement...", diff --git a/webapp/channels/src/i18n/it.json b/webapp/channels/src/i18n/it.json index 73d58642ab..c0b25de713 100644 --- a/webapp/channels/src/i18n/it.json +++ b/webapp/channels/src/i18n/it.json @@ -2911,7 +2911,7 @@ "multiselect.noMorePeople": "Un messaggio personale è limitato a 7 persone.", "multiselect.numMembers": "{options}/7 utenti", "multiselect.numPeopleRemaining": "Usa le frecce ↑↓ della tastiera, ENTER per selezionare.", - "multiselect.new_channel": "Crea un canale per comunicare con più persone", + "multiselect.new_channel": "Più di 7 persone? Create invece un canale", "multiselect.new_channel_create": "Crea un canale", "multiselect.numGroupsRemaining": "Usa ↑↓ per navigare, ↵ per scegliere. Puoi aggiungere {num, number} {num, plural, one {group} other {groups}}. ", "multiselect.numRemaining": "Si possono ancora aggiungere {num, number}", diff --git a/webapp/channels/src/sass/components/_modal.scss b/webapp/channels/src/sass/components/_modal.scss index 1e6548a0ba..66795fea79 100644 --- a/webapp/channels/src/sass/components/_modal.scss +++ b/webapp/channels/src/sass/components/_modal.scss @@ -1050,8 +1050,14 @@ display: flex; border-radius: 8px; align-items: center; - justify-content: space-around; + justify-content: flex-start; background-color: #f2f2f2; + padding-left: 20px; + gap: 10px; +} + +.create-new-channel > :last-child { + margin-left: 100px; } .team-selector-modal, From 2b4fecb6908e78eb51cbd2fe870310a77ec223c4 Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 24 Jul 2024 08:59:53 +0200 Subject: [PATCH 23/32] Fix: Change create channel modal position Changelog: fixed --- .../components/multiselect/multiselect.tsx | 53 ++++++++++--------- .../channels/src/sass/components/_modal.scss | 2 +- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index 8c99caf3ed..4682764534 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -536,33 +536,38 @@ export class MultiSelect extends React.PureComponent,
{memberCount}
+
-
- { - this.props.disableMultiSelectList && this.props.values.length >= 7 ? ( - <> - {this.props.values.length === 7 && multiSelectList} - + + ) : null + } + + { + (!this.props.disableMultiSelectList || this.props.values.length <= 7) ? ( + multiSelectList + ) : null }
Date: Thu, 25 Jul 2024 16:31:42 +0200 Subject: [PATCH 24/32] Fix: use constants for max users --- .../src/components/more_direct_channels/list/list.tsx | 5 ++++- .../channels/src/components/multiselect/multiselect.tsx | 9 +++++---- webapp/channels/src/i18n/de.json | 2 +- webapp/channels/src/i18n/en.json | 2 +- webapp/channels/src/i18n/es.json | 2 +- webapp/channels/src/i18n/fr.json | 2 +- webapp/channels/src/i18n/it.json | 2 +- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index f0ec2dd211..36aef73e84 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -128,7 +128,10 @@ const List = React.forwardRef((props: Props, ref?: React.Ref ) : ( extends React.PureComponent, memberCount = ( @@ -484,7 +485,7 @@ export class MultiSelect extends React.PureComponent, return ( <> -
+
extends React.PureComponent,
{ - (this.props.disableMultiSelectList && this.props.values.length >= 7) ? ( + (this.props.disableMultiSelectList && this.props.values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( <>
@@ -565,7 +566,7 @@ export class MultiSelect extends React.PureComponent, }
{ - (!this.props.disableMultiSelectList || this.props.values.length <= 7) ? ( + (!this.props.disableMultiSelectList || this.props.values.length <= (Constants.MAX_USERS_IN_GM - 1)) ? ( multiSelectList ) : null } diff --git a/webapp/channels/src/i18n/de.json b/webapp/channels/src/i18n/de.json index 93fbcb361c..5f330c4cc1 100644 --- a/webapp/channels/src/i18n/de.json +++ b/webapp/channels/src/i18n/de.json @@ -4438,7 +4438,7 @@ "multiselect.list.notFound": "Für die Suchanfrage {searchQuery} wurden keine Ergebnisse gefunden", "multiselect.loading": "Lade...", "multiselect.noMorePeople": "Eine persönliche Nachricht ist auf 7 Personen begrenzt.", - "multiselect.numMembers": "{options}/7 Benutzer", + "multiselect.numMembers": "{options}/{maxUsers} Benutzer", "multiselect.numPeopleRemaining": "Verwenden Sie die ↑↓ Pfeiltasten auf der Tastatur, ENTER zum Auswählen.", "multiselect.new_channel": "Mehr als sieben Personen? Erstellen Sie stattdessen einen Kanal", "multiselect.new_channel_create": "Einen Kanal erstellen", diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index f9f3b1a863..dcd3144fa1 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -4412,7 +4412,7 @@ "multiselect.list.notFound": "No results found matching {searchQuery}", "multiselect.loading": "Loading...", "multiselect.noMorePeople": "A personal message is limited to 7 people.", - "multiselect.numMembers": "{options}/7 users", + "multiselect.numMembers": "{options}/{maxUsers} users", "multiselect.numPeopleRemaining": "Use the ↑↓ arrows on the keyboard, ENTER to select.", "multiselect.new_channel": "More than 7 people? Create a channel instead", "multiselect.new_channel_create": "Create a channel", diff --git a/webapp/channels/src/i18n/es.json b/webapp/channels/src/i18n/es.json index a9097a970c..15a4c839e6 100644 --- a/webapp/channels/src/i18n/es.json +++ b/webapp/channels/src/i18n/es.json @@ -3811,7 +3811,7 @@ "multiselect.list.notFound": "No se encontraron resultados que encajen con **{searchQuery}**", "multiselect.loading": "Cargando...", "multiselect.noMorePeople": "Un mensaje personal está limitado a 7 personas.", - "multiselect.numMembers": "{options}/7 usuarios", + "multiselect.numMembers": "{options}/{maxUsers} usuarios", "multiselect.numPeopleRemaining": "Usa las flechas ↑↓ del teclado, ENTER para seleccionar.", "multiselect.new_channel": "¿Más de 7 personas? Crea un canal", "multiselect.new_channel_create": "Crear un canal", diff --git a/webapp/channels/src/i18n/fr.json b/webapp/channels/src/i18n/fr.json index 20d66f8cdd..ed1b0fb167 100644 --- a/webapp/channels/src/i18n/fr.json +++ b/webapp/channels/src/i18n/fr.json @@ -3752,7 +3752,7 @@ "multiselect.loading": "Chargement…", "multiselect.noMorePeople": "Un message personnel est limité à 7 personnes.", "multiselect.numGroupsRemaining": "Utilisez les flèches ↑↓ pour parcourir, ↵ pour sélectionner. Vous pouvez encore ajouter {num, number} {num, plural, one {groupe} other {groupes}}. ", - "multiselect.numMembers": "{options}/7 utilisateurs", + "multiselect.numMembers": "{options}/{maxUsers} utilisateurs", "multiselect.numPeopleRemaining": "Utilisez les flèches ↑↓ du clavier, ENTER pour sélectionner.", "multiselect.numRemaining": "Vous pouvez ajouter jusqu'à {max, number} à la fois. Il vous reste {num, number}.", "multiselect.placeholder": "Rechercher des membres", diff --git a/webapp/channels/src/i18n/it.json b/webapp/channels/src/i18n/it.json index c0b25de713..5611007862 100644 --- a/webapp/channels/src/i18n/it.json +++ b/webapp/channels/src/i18n/it.json @@ -2909,7 +2909,7 @@ "multiselect.list.notFound": "Nessun elemento trovato corrispondenti a {searchQuery}", "multiselect.loading": "Caricamento...", "multiselect.noMorePeople": "Un messaggio personale è limitato a 7 persone.", - "multiselect.numMembers": "{options}/7 utenti", + "multiselect.numMembers": "{options}/{maxUsers} utenti", "multiselect.numPeopleRemaining": "Usa le frecce ↑↓ della tastiera, ENTER per selezionare.", "multiselect.new_channel": "Più di 7 persone? Create invece un canale", "multiselect.new_channel_create": "Crea un canale", From cde8bec863bd2944aa139033cf51fbb6fd0180f4 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 26 Jul 2024 09:51:38 +0200 Subject: [PATCH 25/32] Fix: move modal in more direct channels and pass it in children Changelog:fixed --- .../components/more_direct_channels/index.ts | 2 + .../more_direct_channels/list/list.tsx | 113 +++++++++--------- .../more_direct_channels.tsx | 46 ++++++- .../components/multiselect/multiselect.tsx | 43 +------ 4 files changed, 107 insertions(+), 97 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/index.ts b/webapp/channels/src/components/more_direct_channels/index.ts index f5b6d62f6e..498f988a98 100644 --- a/webapp/channels/src/components/more_direct_channels/index.ts +++ b/webapp/channels/src/components/more_direct_channels/index.ts @@ -29,6 +29,7 @@ import { import {openDirectChannelToUserId, openGroupChannelToUserIds} from 'actions/channel_actions'; import {loadStatusesForProfilesList, loadProfilesMissingStatus} from 'actions/status_actions'; import {loadProfilesForGroupChannels} from 'actions/user_actions'; +import {openModal} from 'actions/views/modals'; import {setModalSearchTerm} from 'actions/views/search'; import type {GlobalState} from 'types/store'; @@ -86,6 +87,7 @@ const makeMapStateToProps = () => { function mapDispatchToProps(dispatch: Dispatch) { return { actions: bindActionCreators({ + openModal, getProfiles, getProfilesInTeam, loadProfilesMissingStatus, diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index 36aef73e84..a7eccf8488 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -2,12 +2,13 @@ // See LICENSE.txt for license information. import _ from 'lodash'; +import type {ReactNode} from 'react'; import React, {useCallback, useEffect, useMemo} from 'react'; import {FormattedMessage, useIntl} from 'react-intl'; import type {UserProfile} from '@mattermost/types/users'; -import MultiSelect from 'components/multiselect/index'; +import MultiSelect from 'components/multiselect'; import Constants from 'utils/constants'; @@ -22,6 +23,7 @@ export const USERS_PER_PAGE = 50; export type Props = { addValue: (value: OptionValue) => void; + children: ReactNode; currentUserId: string; handleDelete: (values: OptionValue[]) => void; handlePageChange: (page: number, prevPage: number) => void; @@ -35,7 +37,6 @@ export type Props = { totalCount: number; users: UserProfile[]; emptyGroupChannelsIds: string[]; - exitParentModal: () => void; /** * An array of values that have been selected by the user in the multiselect. @@ -103,62 +104,66 @@ const List = React.forwardRef((props: Props, ref?: React.Ref - ref={ref} - options={options} - optionRenderer={renderOptionValue} - intl={intl} - selectedItemRef={props.selectedItemRef} - values={props.values} - valueRenderer={renderValue} - ariaLabelRenderer={renderAriaLabel} - perPage={USERS_PER_PAGE} - handlePageChange={props.handlePageChange} - handleInput={props.search} - handleDelete={props.handleDelete} - handleAdd={props.addValue} - handleSubmit={props.handleSubmit} - noteText={note} - exitParentModal={props.exitParentModal} - disableMultiSelectList={true} - maxValues={MAX_SELECTABLE_VALUES} - changeMessageColor='red' - showError={props.values.length === MAX_SELECTABLE_VALUES} - numRemainingText={ - props.values.length === MAX_SELECTABLE_VALUES ? ( + <> + + ref={ref} + options={options} + optionRenderer={renderOptionValue} + intl={intl} + selectedItemRef={props.selectedItemRef} + values={props.values} + valueRenderer={renderValue} + ariaLabelRenderer={renderAriaLabel} + perPage={USERS_PER_PAGE} + handlePageChange={props.handlePageChange} + handleInput={props.search} + handleDelete={props.handleDelete} + handleAdd={props.addValue} + handleSubmit={props.handleSubmit} + noteText={note} + disableMultiSelectList={true} + maxValues={MAX_SELECTABLE_VALUES} + changeMessageColor='red' + showError={props.values.length === MAX_SELECTABLE_VALUES} + numRemainingText={ + props.values.length === MAX_SELECTABLE_VALUES ? ( + + ) : ( + + ) + } + buttonSubmitText={ - ) : ( + } + buttonSubmitLoadingText={ - ) - } - buttonSubmitText={ - - } - buttonSubmitLoadingText={ - - } - submitImmediatelyOn={handleSubmitImmediatelyOn} - saving={props.saving} - loading={props.loading} - users={props.users} - totalCount={props.totalCount} - placeholderText={intl.formatMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})} - /> + } + submitImmediatelyOn={handleSubmitImmediatelyOn} + saving={props.saving} + loading={props.loading} + users={props.users} + totalCount={props.totalCount} + placeholderText={intl.formatMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})} + + > + {props.children} + + ); }); diff --git a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx index a93f3d8f70..3f5644a2cb 100644 --- a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx +++ b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx @@ -12,9 +12,12 @@ import type {UserProfile} from '@mattermost/types/users'; import type {ActionResult} from 'mattermost-redux/types/actions'; import type MultiSelect from 'components/multiselect/multiselect'; +import NewChannelModal from 'components/new_channel_modal/new_channel_modal'; import {getHistory} from 'utils/browser_history'; -import Constants from 'utils/constants'; +import Constants, {ModalIdentifiers} from 'utils/constants'; + +import type {ModalData} from 'types/actions'; import List from './list'; import {USERS_PER_PAGE} from './list/list'; @@ -61,6 +64,7 @@ export type Props = { searchProfiles: (term: string, options: any) => Promise>; searchGroupChannels: (term: string) => Promise>; setModalSearchTerm: (term: string) => void; + openModal:

(modalData: ModalData

) => void; }; } @@ -264,10 +268,20 @@ export default class MoreDirectChannels extends React.PureComponent Constants.LAMP_ICON; + + openModal = (): void => { + this.handleExit(); + const newModal = { + modalId: ModalIdentifiers.NEW_CHANNEL_MODAL, + dialogType: NewChannelModal, + }; + this.props.actions?.openModal(newModal); + }; + render() { const body = ( + > + { + (this.state.values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( + <> +

+ + ) : null + } + ); return ( diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index 18025c00f6..b114e8da09 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -10,12 +10,11 @@ import ReactSelect, {components} from 'react-select'; import type {getOptionValue} from 'react-select/src/builtins'; import type {InputActionMeta} from 'react-select/src/types'; -import NewChannelModal from 'components/new_channel_modal/new_channel_modal'; import SaveButton from 'components/save_button'; import CloseCircleSolidIcon from 'components/widgets/icons/close_circle_solid_icon'; import Avatar from 'components/widgets/users/avatar'; -import {Constants, A11yCustomEventTypes, ModalIdentifiers} from 'utils/constants'; +import {Constants, A11yCustomEventTypes} from 'utils/constants'; import {imageURLForUser, getDisplayName, localizeMessage} from 'utils/utils'; import type {ModalData} from 'types/actions'; @@ -81,7 +80,7 @@ export type Props = { savingEnabled?: boolean; handleCancel?: () => void; customNoOptionsMessage?: React.ReactNode; - exitParentModal?: () => void; + children?: ReactNode; } export type State = { @@ -118,17 +117,6 @@ export class MultiSelect extends React.PureComponent, }; } - public openModal = (): void => { - if (this.props.exitParentModal) { - this.props.exitParentModal(); - } - const newModal = { - modalId: ModalIdentifiers.NEW_CHANNEL_MODAL, - dialogType: NewChannelModal, - }; - this.props.actions?.openModal(newModal); - }; - public componentDidMount() { const inputRef: unknown = this.reactSelectRef.current && this.reactSelectRef.current.select.inputRef; @@ -481,7 +469,6 @@ export class MultiSelect extends React.PureComponent, /> ); } - const lampIcon = () => Constants.LAMP_ICON; return ( <> @@ -539,31 +526,7 @@ export class MultiSelect extends React.PureComponent,
- { - (this.props.disableMultiSelectList && this.props.values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( - <> - - - ) : null - } + {this.props.children}
{ (!this.props.disableMultiSelectList || this.props.values.length <= (Constants.MAX_USERS_IN_GM - 1)) ? ( From 61098df56b1c8c084bd8c6170a991099b1ba11a9 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 26 Jul 2024 09:55:18 +0200 Subject: [PATCH 26/32] Fix: optional children --- .../channels/src/components/more_direct_channels/list/list.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index a7eccf8488..4243ff60d7 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -23,7 +23,7 @@ export const USERS_PER_PAGE = 50; export type Props = { addValue: (value: OptionValue) => void; - children: ReactNode; + children?: ReactNode; currentUserId: string; handleDelete: (values: OptionValue[]) => void; handlePageChange: (page: number, prevPage: number) => void; From b34d97d5527ce9b6057f36d363e323a81e395194 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 26 Jul 2024 10:20:59 +0200 Subject: [PATCH 27/32] Fix: snap --- .../__snapshots__/more_direct_channels.test.tsx.snap | 2 -- .../more_direct_channels/more_direct_channels.test.tsx | 1 + .../multiselect/__snapshots__/multiselect.test.tsx.snap | 9 ++++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap index 535cbcaf3c..6073e4686f 100644 --- a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap +++ b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap @@ -56,7 +56,6 @@ exports[`components/MoreDirectChannels should exclude deleted users if there is { process.nextTick(() => resolve({data: true})); }); }), + openModal: jest.fn().mockResolvedValue({data: true}), getProfilesInTeam: jest.fn().mockResolvedValue({data: true}), loadProfilesMissingStatus: jest.fn().mockResolvedValue({data: true}), searchProfiles: jest.fn().mockResolvedValue({data: true}), diff --git a/webapp/channels/src/components/multiselect/__snapshots__/multiselect.test.tsx.snap b/webapp/channels/src/components/multiselect/__snapshots__/multiselect.test.tsx.snap index 61c34af9a7..86d895b765 100644 --- a/webapp/channels/src/components/multiselect/__snapshots__/multiselect.test.tsx.snap +++ b/webapp/channels/src/components/multiselect/__snapshots__/multiselect.test.tsx.snap @@ -128,10 +128,11 @@ exports[`components/multiselect/multiselect MultiSelectList should match snapsho style={Object {}} > Date: Fri, 26 Jul 2024 13:51:51 +0200 Subject: [PATCH 28/32] Feat: modal for max user in pm Changelog: added --- .../more_direct_channels/list/list.tsx | 110 +++++++++--------- .../more_direct_channels.tsx | 37 +++--- .../components/multiselect/multiselect.tsx | 14 +-- 3 files changed, 74 insertions(+), 87 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/list/list.tsx b/webapp/channels/src/components/more_direct_channels/list/list.tsx index 4243ff60d7..5c4c6accc2 100644 --- a/webapp/channels/src/components/more_direct_channels/list/list.tsx +++ b/webapp/channels/src/components/more_direct_channels/list/list.tsx @@ -104,66 +104,64 @@ const List = React.forwardRef((props: Props, ref?: React.Ref - - ref={ref} - options={options} - optionRenderer={renderOptionValue} - intl={intl} - selectedItemRef={props.selectedItemRef} - values={props.values} - valueRenderer={renderValue} - ariaLabelRenderer={renderAriaLabel} - perPage={USERS_PER_PAGE} - handlePageChange={props.handlePageChange} - handleInput={props.search} - handleDelete={props.handleDelete} - handleAdd={props.addValue} - handleSubmit={props.handleSubmit} - noteText={note} - disableMultiSelectList={true} - maxValues={MAX_SELECTABLE_VALUES} - changeMessageColor='red' - showError={props.values.length === MAX_SELECTABLE_VALUES} - numRemainingText={ - props.values.length === MAX_SELECTABLE_VALUES ? ( - - ) : ( - - ) - } - buttonSubmitText={ + + ref={ref} + options={options} + optionRenderer={renderOptionValue} + intl={intl} + selectedItemRef={props.selectedItemRef} + values={props.values} + valueRenderer={renderValue} + ariaLabelRenderer={renderAriaLabel} + perPage={USERS_PER_PAGE} + handlePageChange={props.handlePageChange} + handleInput={props.search} + handleDelete={props.handleDelete} + handleAdd={props.addValue} + handleSubmit={props.handleSubmit} + noteText={note} + disableMultiSelectList={props.values.length > (Constants.MAX_USERS_IN_GM - 1)} + maxValues={MAX_SELECTABLE_VALUES} + changeMessageColor='red' + showError={props.values.length === MAX_SELECTABLE_VALUES} + numRemainingText={ + props.values.length === MAX_SELECTABLE_VALUES ? ( - } - buttonSubmitLoadingText={ + ) : ( - } - submitImmediatelyOn={handleSubmitImmediatelyOn} - saving={props.saving} - loading={props.loading} - users={props.users} - totalCount={props.totalCount} - placeholderText={intl.formatMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})} - - > - {props.children} - - + ) + } + buttonSubmitText={ + + } + buttonSubmitLoadingText={ + + } + submitImmediatelyOn={handleSubmitImmediatelyOn} + saving={props.saving} + loading={props.loading} + users={props.users} + totalCount={props.totalCount} + placeholderText={intl.formatMessage({id: 'multiselect.placeholder', defaultMessage: 'Search and add members'})} + + > + {props.children} + ); }); diff --git a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx index 3f5644a2cb..8f69fa5968 100644 --- a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx +++ b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx @@ -298,27 +298,26 @@ export default class MoreDirectChannels extends React.PureComponent { (this.state.values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( - <> - + ) : null } diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index b114e8da09..befca9cff5 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -17,8 +17,6 @@ import Avatar from 'components/widgets/users/avatar'; import {Constants, A11yCustomEventTypes} from 'utils/constants'; import {imageURLForUser, getDisplayName, localizeMessage} from 'utils/utils'; -import type {ModalData} from 'types/actions'; - import MultiSelectList from './multiselect_list'; export type Value = { @@ -31,13 +29,7 @@ export type Value = { disabled?: boolean; }; -type Actions = { - openModal:

(modalData: ModalData

) => void; - closeModal: (modalId: string) => void; -} - export type Props = { - actions?: Actions; ariaLabelRenderer: getOptionValue; backButtonClick?: () => void; backButtonClass?: string; @@ -472,7 +464,7 @@ export class MultiSelect extends React.PureComponent, return ( <> -

+
extends React.PureComponent, {this.props.children}
{ - (!this.props.disableMultiSelectList || this.props.values.length <= (Constants.MAX_USERS_IN_GM - 1)) ? ( - multiSelectList - ) : null + this.props.disableMultiSelectList ? null : multiSelectList }
Date: Wed, 7 Aug 2024 08:55:16 +0200 Subject: [PATCH 29/32] Added: Create channel tip compo Changelog: added --- .../create_channel_tip/create_channel_tip.tsx | 44 +++++++++++++++++++ .../more_direct_channels.tsx | 30 +++---------- 2 files changed, 50 insertions(+), 24 deletions(-) create mode 100644 webapp/channels/src/components/create_channel_tip/create_channel_tip.tsx diff --git a/webapp/channels/src/components/create_channel_tip/create_channel_tip.tsx b/webapp/channels/src/components/create_channel_tip/create_channel_tip.tsx new file mode 100644 index 0000000000..af889cd80b --- /dev/null +++ b/webapp/channels/src/components/create_channel_tip/create_channel_tip.tsx @@ -0,0 +1,44 @@ + +import React from 'react'; +import {FormattedMessage} from 'react-intl'; + +import type {OptionValue} from 'components/more_direct_channels/types'; + +import Constants from 'utils/constants'; + +interface Props { + values: OptionValue[]; + openModal: () => void; +} + +const CreateChannelTip: React.FC = ({values, openModal}) => { + const lampIcon = () => Constants.LAMP_ICON; + + return ( + (values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( + + + ) : null + + ); +}; + +export default CreateChannelTip; diff --git a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx index 8f69fa5968..44b0a87177 100644 --- a/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx +++ b/webapp/channels/src/components/more_direct_channels/more_direct_channels.tsx @@ -28,6 +28,8 @@ import { import type { OptionValue} from './types'; +import CreateChannelTip from '../create_channel_tip/create_channel_tip'; + export type Props = { currentUserId: string; currentTeamId: string; @@ -296,30 +298,10 @@ export default class MoreDirectChannels extends React.PureComponent - { - (this.state.values.length >= (Constants.MAX_USERS_IN_GM - 1)) ? ( - - - ) : null - } + ); From ad2a975d863e73d1e26790e166b61cf17b759013 Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 7 Aug 2024 08:59:40 +0200 Subject: [PATCH 30/32] FIx: Remove useless div --- .../src/components/multiselect/multiselect.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/webapp/channels/src/components/multiselect/multiselect.tsx b/webapp/channels/src/components/multiselect/multiselect.tsx index befca9cff5..3d550e3cfb 100644 --- a/webapp/channels/src/components/multiselect/multiselect.tsx +++ b/webapp/channels/src/components/multiselect/multiselect.tsx @@ -509,14 +509,10 @@ export class MultiSelect extends React.PureComponent,
-
- {numRemainingText} -
-
- {memberCount} -
- + {numRemainingText} + {memberCount}
{this.props.children}
From d5452bdc34233c63c3daae925acfcbb83834181e Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 7 Aug 2024 09:20:34 +0200 Subject: [PATCH 31/32] Fix: modal for dark theme --- webapp/channels/src/sass/components/_modal.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/channels/src/sass/components/_modal.scss b/webapp/channels/src/sass/components/_modal.scss index e2b686fa74..0230b6de08 100644 --- a/webapp/channels/src/sass/components/_modal.scss +++ b/webapp/channels/src/sass/components/_modal.scss @@ -1054,10 +1054,12 @@ background-color: #f2f2f2; padding-left: 20px; gap: 10px; + background-color: var(--ik-illustration-grey-15); + color: var(--center-channel-color); } .create-new-channel > :last-child { - margin-left: 100px; + margin-left: 50px; } .team-selector-modal, From 58bb3e6539eb62445b044a901bd4f9055a7c787c Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 7 Aug 2024 10:07:18 +0200 Subject: [PATCH 32/32] Fix: snap --- .../more_direct_channels.test.tsx.snap | 99 ++++++++++++++++++- .../__snapshots__/multiselect.test.tsx.snap | 78 ++++++--------- 2 files changed, 127 insertions(+), 50 deletions(-) diff --git a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap index 6073e4686f..2ae86905e8 100644 --- a/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap +++ b/webapp/channels/src/components/more_direct_channels/__snapshots__/more_direct_channels.test.tsx.snap @@ -269,7 +269,12 @@ exports[`components/MoreDirectChannels should exclude deleted users if there is ] } values={Array []} - /> + > + + + > + + -
-
- -
+ } + />
-
-
- -
+ } + />
-
-
- -
+ } + />