Picker Refactoring: Follow-up (#4884)
This commit is contained in:
parent
73fb1fd2cf
commit
7d1eaa55da
@ -337,6 +337,11 @@ export async function downloadMedia(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DEBUG) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error('Failed to download media', args.url, err);
|
||||||
|
}
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,12 +100,16 @@ const ItemPicker = ({
|
|||||||
const lockedUnselectedValues = allowMultiple ? optionalProps.lockedUnselectedValues : undefined;
|
const lockedUnselectedValues = allowMultiple ? optionalProps.lockedUnselectedValues : undefined;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isSearchable) return;
|
if (!isSearchable) return undefined;
|
||||||
setTimeout(() => {
|
const timeoutId = window.setTimeout(() => {
|
||||||
requestMeasure(() => {
|
requestMeasure(() => {
|
||||||
inputRef.current!.focus();
|
inputRef.current?.focus();
|
||||||
});
|
});
|
||||||
}, FOCUS_DELAY_MS);
|
}, FOCUS_DELAY_MS);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.clearTimeout(timeoutId);
|
||||||
|
};
|
||||||
}, [isSearchable]);
|
}, [isSearchable]);
|
||||||
|
|
||||||
const selectedValues = useMemo(() => {
|
const selectedValues = useMemo(() => {
|
||||||
|
|||||||
@ -138,12 +138,16 @@ const PeerPicker = ({
|
|||||||
const shouldMinimize = selectedIds.length > MAX_FULL_ITEMS;
|
const shouldMinimize = selectedIds.length > MAX_FULL_ITEMS;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isSearchable) return;
|
if (!isSearchable) return undefined;
|
||||||
setTimeout(() => {
|
const timeoutId = window.setTimeout(() => {
|
||||||
requestMeasure(() => {
|
requestMeasure(() => {
|
||||||
inputRef.current!.focus();
|
inputRef.current?.focus();
|
||||||
});
|
});
|
||||||
}, FOCUS_DELAY_MS);
|
}, FOCUS_DELAY_MS);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.clearTimeout(timeoutId);
|
||||||
|
};
|
||||||
}, [isSearchable]);
|
}, [isSearchable]);
|
||||||
|
|
||||||
const lockedSelectedIdsSet = useMemo(() => new Set(lockedSelectedIds), [lockedSelectedIds]);
|
const lockedSelectedIdsSet = useMemo(() => new Set(lockedSelectedIds), [lockedSelectedIds]);
|
||||||
|
|||||||
@ -352,7 +352,7 @@ const ChatExtra: FC<OwnProps & StateProps> = ({
|
|||||||
<UserBirthday key={peerId} birthday={birthday} user={user!} isInSettings={isInSettings} />
|
<UserBirthday key={peerId} birthday={birthday} user={user!} isInSettings={isInSettings} />
|
||||||
)}
|
)}
|
||||||
{!isInSettings && (
|
{!isInSettings && (
|
||||||
<ListItem icon="unmute" ripple onClick={handleNotificationChange}>
|
<ListItem icon="unmute" narrow ripple onClick={handleNotificationChange}>
|
||||||
<span>{lang('Notifications')}</span>
|
<span>{lang('Notifications')}</span>
|
||||||
<Switcher
|
<Switcher
|
||||||
id="group-notifications"
|
id="group-notifications"
|
||||||
@ -379,7 +379,7 @@ const ChatExtra: FC<OwnProps & StateProps> = ({
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
)}
|
)}
|
||||||
{hasSavedMessages && !isInSettings && (
|
{hasSavedMessages && !isInSettings && (
|
||||||
<ListItem icon="saved-messages" ripple onClick={handleOpenSavedDialog}>
|
<ListItem icon="saved-messages" narrow ripple onClick={handleOpenSavedDialog}>
|
||||||
<span>{lang('SavedMessagesTab')}</span>
|
<span>{lang('SavedMessagesTab')}</span>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -21,8 +21,7 @@ function PremiumStatusItem({ premiumSection }: OwnProps) {
|
|||||||
return (
|
return (
|
||||||
<div className="settings-item">
|
<div className="settings-item">
|
||||||
<ListItem
|
<ListItem
|
||||||
leftElement={<StarIcon className="icon" type="premium" size="big" />}
|
leftElement={<StarIcon className="icon ListItem-main-icon" type="premium" size="big" />}
|
||||||
className="settings-main-menu-star"
|
|
||||||
onClick={handleOpenPremiumModal}
|
onClick={handleOpenPremiumModal}
|
||||||
>
|
>
|
||||||
{lang('PrivacyLastSeenPremium')}
|
{lang('PrivacyLastSeenPremium')}
|
||||||
|
|||||||
@ -119,7 +119,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ListItem.narrow {
|
.ListItem.narrow:not(.multiline) {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
||||||
.ListItem-button {
|
.ListItem-button {
|
||||||
@ -187,8 +187,9 @@
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 1.3125rem;
|
line-height: 1.3125rem;
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
margin-top: 2rem;
|
margin-top: 1rem;
|
||||||
margin-bottom: 0.75rem;
|
margin-bottom: 0.75rem;
|
||||||
|
padding-inline-start: 1rem;
|
||||||
|
|
||||||
&.premium-info {
|
&.premium-info {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
|
|||||||
@ -193,7 +193,7 @@ const SettingsActiveSessions: FC<OwnProps & StateProps> = ({
|
|||||||
{lang('TerminateOldSessionHeader')}
|
{lang('TerminateOldSessionHeader')}
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<p>{lang('IfInactiveFor')}</p>
|
<p className="settings-item-description-larger">{lang('IfInactiveFor')}</p>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
name="session_ttl"
|
name="session_ttl"
|
||||||
options={AUTO_TERMINATE_OPTIONS}
|
options={AUTO_TERMINATE_OPTIONS}
|
||||||
|
|||||||
@ -172,7 +172,6 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
{canBuyPremium && (
|
{canBuyPremium && (
|
||||||
<ListItem
|
<ListItem
|
||||||
leftElement={<StarIcon className="icon ListItem-main-icon" type="premium" size="big" />}
|
leftElement={<StarIcon className="icon ListItem-main-icon" type="premium" size="big" />}
|
||||||
className="settings-main-menu-star"
|
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => openPremiumModal()}
|
onClick={() => openPremiumModal()}
|
||||||
@ -183,7 +182,6 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
{shouldDisplayStars && (
|
{shouldDisplayStars && (
|
||||||
<ListItem
|
<ListItem
|
||||||
leftElement={<StarIcon className="icon ListItem-main-icon" type="gold" size="big" />}
|
leftElement={<StarIcon className="icon ListItem-main-icon" type="gold" size="big" />}
|
||||||
className="settings-main-menu-star"
|
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => openStarsBalanceModal({})}
|
onClick={() => openStarsBalanceModal({})}
|
||||||
@ -197,7 +195,6 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
{isGiveawayAvailable && (
|
{isGiveawayAvailable && (
|
||||||
<ListItem
|
<ListItem
|
||||||
icon="gift"
|
icon="gift"
|
||||||
className="settings-main-menu-star"
|
|
||||||
narrow
|
narrow
|
||||||
// eslint-disable-next-line react/jsx-no-bind
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
onClick={() => openPremiumGiftingModal()}
|
onClick={() => openPremiumGiftingModal()}
|
||||||
|
|||||||
@ -55,8 +55,7 @@ const SettingsPrivacyLastSeen = ({
|
|||||||
)}
|
)}
|
||||||
<div className="settings-item">
|
<div className="settings-item">
|
||||||
<ListItem
|
<ListItem
|
||||||
leftElement={<StarIcon className="icon" type="premium" size="big" />}
|
leftElement={<StarIcon className="icon ListItem-main-icon" type="premium" size="big" />}
|
||||||
className="settings-main-menu-star"
|
|
||||||
onClick={handleOpenPremiumModal}
|
onClick={handleOpenPremiumModal}
|
||||||
>
|
>
|
||||||
{isCurrentUserPremium ? lang('PrivacyLastSeenPremiumForPremium') : lang('PrivacyLastSeenPremium')}
|
{isCurrentUserPremium ? lang('PrivacyLastSeenPremiumForPremium') : lang('PrivacyLastSeenPremium')}
|
||||||
|
|||||||
@ -66,6 +66,7 @@ const SettingsPrivacyPublicProfilePhoto: FC<OwnProps> = ({
|
|||||||
return (
|
return (
|
||||||
<div className="settings-item">
|
<div className="settings-item">
|
||||||
<ListItem
|
<ListItem
|
||||||
|
narrow
|
||||||
icon="camera-add"
|
icon="camera-add"
|
||||||
onClick={handleOpenFileSelector}
|
onClick={handleOpenFileSelector}
|
||||||
>
|
>
|
||||||
@ -79,6 +80,7 @@ const SettingsPrivacyPublicProfilePhoto: FC<OwnProps> = ({
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
{currentUserFallbackPhoto && (
|
{currentUserFallbackPhoto && (
|
||||||
<ListItem
|
<ListItem
|
||||||
|
narrow
|
||||||
leftElement={<Avatar photo={currentUserFallbackPhoto} size="mini" className={styles.fallbackPhoto} />}
|
leftElement={<Avatar photo={currentUserFallbackPhoto} size="mini" className={styles.fallbackPhoto} />}
|
||||||
onClick={openDeleteFallbackPhotoModal}
|
onClick={openDeleteFallbackPhotoModal}
|
||||||
destructive
|
destructive
|
||||||
|
|||||||
@ -328,7 +328,6 @@ const ManageChannel: FC<OwnProps & StateProps> = ({
|
|||||||
<ListItem
|
<ListItem
|
||||||
icon="delete-user"
|
icon="delete-user"
|
||||||
multiline
|
multiline
|
||||||
narrow
|
|
||||||
onClick={handleRemovedUsersClick}
|
onClick={handleRemovedUsersClick}
|
||||||
>
|
>
|
||||||
<span className="title">{lang('ChannelBlockedUsers')}</span>
|
<span className="title">{lang('ChannelBlockedUsers')}</span>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user