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