chore: upgrade i18next 26, prettier 3, fontsource-variable, domhandler 6, lint-staged 17
CI / Build & Quality Checks (push) Successful in 10m13s
CI / Build & Quality Checks (push) Successful in 10m13s
- i18next 23->26 + react-i18next 15->17 - prettier 2->3, reformat all files - replace @fontsource/inter with @fontsource-variable/inter 5, update import path - domhandler 5->6 (aligns with transitive deps) - lint-staged 16->17
This commit is contained in:
@@ -89,7 +89,7 @@ const useSettingsMenuItems = (): SettingsMenuItem[] =>
|
||||
icon: Icons.Info,
|
||||
},
|
||||
],
|
||||
[]
|
||||
[],
|
||||
);
|
||||
|
||||
type SettingsProps = {
|
||||
@@ -103,7 +103,7 @@ export function Settings({ initialPage, requestClose }: SettingsProps) {
|
||||
const profile = useUserProfile(userId);
|
||||
const displayName = profile.displayName ?? getMxIdLocalPart(userId) ?? userId;
|
||||
const avatarUrl = profile.avatarUrl
|
||||
? mxcUrlToHttp(mx, profile.avatarUrl, useAuthentication, 96, 96, 'crop') ?? undefined
|
||||
? (mxcUrlToHttp(mx, profile.avatarUrl, useAuthentication, 96, 96, 'crop') ?? undefined)
|
||||
: undefined;
|
||||
|
||||
const screenSize = useScreenSizeContext();
|
||||
|
||||
@@ -9,7 +9,7 @@ import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
||||
export function ContactInformation() {
|
||||
const mx = useMatrixClient();
|
||||
const [threePIdsState, loadThreePIds] = useAsyncCallback(
|
||||
useCallback(() => mx.getThreePids(), [mx])
|
||||
useCallback(() => mx.getThreePids(), [mx]),
|
||||
);
|
||||
const threePIds =
|
||||
threePIdsState.status === AsyncStatus.Success ? threePIdsState.data.threepids : undefined;
|
||||
|
||||
@@ -19,8 +19,8 @@ function IgnoreUserInput({ userList }: { userList: string[] }) {
|
||||
async (uId: string) => {
|
||||
await mx.setIgnoredUsers([...userList, uId]);
|
||||
},
|
||||
[mx, userList]
|
||||
)
|
||||
[mx, userList],
|
||||
),
|
||||
);
|
||||
const ignoring = ignoreState.status === AsyncStatus.Loading;
|
||||
|
||||
@@ -102,8 +102,8 @@ function IgnoredUserChip({ userId, userList }: { userId: string; userList: strin
|
||||
const [unignoreState, unignore] = useAsyncCallback(
|
||||
useCallback(
|
||||
() => mx.setIgnoredUsers(userList.filter((uId) => uId !== userId)),
|
||||
[mx, userId, userList]
|
||||
)
|
||||
[mx, userId, userList],
|
||||
),
|
||||
);
|
||||
|
||||
const handleUnignore = () => unignore();
|
||||
|
||||
@@ -57,7 +57,7 @@ function ProfileAvatar({ profile, userId }: ProfileProps) {
|
||||
|
||||
const defaultDisplayName = profile.displayName ?? getMxIdLocalPart(userId) ?? userId;
|
||||
const avatarUrl = profile.avatarUrl
|
||||
? mxcUrlToHttp(mx, profile.avatarUrl, useAuthentication, 96, 96, 'crop') ?? undefined
|
||||
? (mxcUrlToHttp(mx, profile.avatarUrl, useAuthentication, 96, 96, 'crop') ?? undefined)
|
||||
: undefined;
|
||||
|
||||
const [imageFile, setImageFile] = useState<File>();
|
||||
@@ -79,7 +79,7 @@ function ProfileAvatar({ profile, userId }: ProfileProps) {
|
||||
mx.setAvatarUrl(mxc);
|
||||
handleRemoveUpload();
|
||||
},
|
||||
[mx, handleRemoveUpload]
|
||||
[mx, handleRemoveUpload],
|
||||
);
|
||||
|
||||
const handleRemoveAvatar = () => {
|
||||
@@ -219,7 +219,7 @@ function ProfileDisplayName({ profile, userId }: ProfileProps) {
|
||||
const [displayName, setDisplayName] = useState<string>(defaultDisplayName);
|
||||
|
||||
const [changeState, changeDisplayName] = useAsyncCallback(
|
||||
useCallback((name: string) => mx.setDisplayName(name), [mx])
|
||||
useCallback((name: string) => mx.setDisplayName(name), [mx]),
|
||||
);
|
||||
const changingDisplayName = changeState.status === AsyncStatus.Loading;
|
||||
|
||||
|
||||
@@ -15,14 +15,14 @@ type AccountDataProps = {
|
||||
export function AccountData({ expand, onExpandToggle, onSelect }: AccountDataProps) {
|
||||
const mx = useMatrixClient();
|
||||
const [accountDataTypes, setAccountDataKeys] = useState(() =>
|
||||
Array.from(mx.store.accountData.keys())
|
||||
Array.from(mx.store.accountData.keys()),
|
||||
);
|
||||
|
||||
useAccountDataCallback(
|
||||
mx,
|
||||
useCallback(() => {
|
||||
setAccountDataKeys(Array.from(mx.store.accountData.keys()));
|
||||
}, [mx])
|
||||
}, [mx]),
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -27,7 +27,7 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
||||
async (type, content) => {
|
||||
await mx.setAccountData(type, content);
|
||||
},
|
||||
[mx]
|
||||
[mx],
|
||||
);
|
||||
|
||||
if (accountDataType !== undefined) {
|
||||
|
||||
@@ -86,7 +86,7 @@ export function DeviceKeyDetails({ crypto }: DeviceKeyDetailsProps) {
|
||||
useCallback(() => {
|
||||
const keys = crypto.getOwnDeviceKeys();
|
||||
return keys;
|
||||
}, [crypto])
|
||||
}, [crypto]),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -118,8 +118,8 @@ function DeviceRename({ device, onCancel, onRename, refreshDeviceList }: DeviceR
|
||||
await mx.setDeviceDetails(device.device_id, { display_name: name });
|
||||
await refreshDeviceList();
|
||||
},
|
||||
[mx, device.device_id, refreshDeviceList]
|
||||
)
|
||||
[mx, device.device_id, refreshDeviceList],
|
||||
),
|
||||
);
|
||||
|
||||
const renaming = renameState.status === AsyncStatus.Loading;
|
||||
|
||||
@@ -49,19 +49,19 @@ export function Devices({ requestClose }: DevicesProps) {
|
||||
const verificationStatus = useDeviceVerificationStatus(
|
||||
crypto,
|
||||
mx.getSafeUserId(),
|
||||
currentDevice?.device_id
|
||||
currentDevice?.device_id,
|
||||
);
|
||||
|
||||
const otherDevicesId = useDeviceIds(otherDevices);
|
||||
const unverifiedDeviceCount = useUnverifiedDeviceCount(
|
||||
crypto,
|
||||
mx.getSafeUserId(),
|
||||
otherDevicesId
|
||||
otherDevicesId,
|
||||
);
|
||||
|
||||
const defaultSecretStorageKeyId = useSecretStorageDefaultKeyId();
|
||||
const defaultSecretStorageKeyContent = useSecretStorageKeyContent(
|
||||
defaultSecretStorageKeyId ?? ''
|
||||
defaultSecretStorageKeyId ?? '',
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -30,8 +30,8 @@ function ExportKeys() {
|
||||
});
|
||||
FileSaver.saveAs(blob, 'lotus-keys.txt');
|
||||
},
|
||||
[mx]
|
||||
)
|
||||
[mx],
|
||||
),
|
||||
);
|
||||
|
||||
const exporting = exportState.status === AsyncStatus.Loading;
|
||||
@@ -176,8 +176,8 @@ function ImportKeys({ file, onDone }: ImportKeysProps) {
|
||||
|
||||
await crypto.importRoomKeysAsJson(keys);
|
||||
},
|
||||
[file, mx]
|
||||
)
|
||||
[file, mx],
|
||||
),
|
||||
);
|
||||
|
||||
const decrypting = decryptState.status === AsyncStatus.Loading;
|
||||
|
||||
@@ -37,7 +37,7 @@ export function OtherDevices({ devices, refreshDeviceList, showVerification }: O
|
||||
withSearchParam(authUrl, {
|
||||
action: accountManagementActions.sessionsList,
|
||||
}),
|
||||
'_blank'
|
||||
'_blank',
|
||||
);
|
||||
}, [authMetadata, accountManagementActions]);
|
||||
|
||||
@@ -51,10 +51,10 @@ export function OtherDevices({ devices, refreshDeviceList, showVerification }: O
|
||||
action: accountManagementActions.sessionEnd,
|
||||
device_id: deviceId,
|
||||
}),
|
||||
'_blank'
|
||||
'_blank',
|
||||
);
|
||||
},
|
||||
[authMetadata, accountManagementActions]
|
||||
[authMetadata, accountManagementActions],
|
||||
);
|
||||
|
||||
const handleToggleDelete = useCallback((deviceId: string) => {
|
||||
@@ -78,7 +78,7 @@ export function OtherDevices({ devices, refreshDeviceList, showVerification }: O
|
||||
async (authDict?: AuthDict) => {
|
||||
await mx.deleteMultipleDevices(Array.from(deleted), authDict);
|
||||
},
|
||||
[mx, deleted]
|
||||
[mx, deleted],
|
||||
),
|
||||
useCallback(
|
||||
(state: typeof deleteState) => {
|
||||
@@ -88,11 +88,11 @@ export function OtherDevices({ devices, refreshDeviceList, showVerification }: O
|
||||
}
|
||||
setDeleteState(state);
|
||||
},
|
||||
[refreshDeviceList]
|
||||
)
|
||||
[refreshDeviceList],
|
||||
),
|
||||
);
|
||||
const [authData, deleteError] = useUIAMatrixError(
|
||||
deleteState.status === AsyncStatus.Error ? deleteState.error : undefined
|
||||
deleteState.status === AsyncStatus.Error ? deleteState.error : undefined,
|
||||
);
|
||||
const deleting = deleteState.status === AsyncStatus.Loading || authData !== undefined;
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ export function VerifyOtherDeviceTile({ crypto, deviceId }: VerifyOtherDeviceTil
|
||||
const requestPromise = crypto.requestDeviceVerification(mx.getSafeUserId(), deviceId);
|
||||
return requestPromise;
|
||||
}, [mx, crypto, deviceId]),
|
||||
setRequestState
|
||||
setRequestState,
|
||||
);
|
||||
|
||||
const handleExit = useCallback(() => {
|
||||
@@ -277,7 +277,7 @@ export function DeviceVerificationOptions() {
|
||||
withSearchParam(authUrl, {
|
||||
action: accountManagementActions.crossSigningReset,
|
||||
}),
|
||||
'_blank'
|
||||
'_blank',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ function GlobalPackSelector({
|
||||
const removeSelected = (adds: PackAddress[]) => {
|
||||
setSelected((addresses) => {
|
||||
const newAddresses = addresses.filter(
|
||||
(addr) => !adds.find((address) => packAddressEqual(addr, address))
|
||||
(addr) => !adds.find((address) => packAddressEqual(addr, address)),
|
||||
);
|
||||
return newAddresses;
|
||||
});
|
||||
@@ -141,7 +141,7 @@ function GlobalPackSelector({
|
||||
.map((pack) => pack.address)
|
||||
.filter((addr) => addr !== undefined);
|
||||
const allSelected = roomPackAddresses.every((addr) =>
|
||||
selected.find((address) => packAddressEqual(addr, address))
|
||||
selected.find((address) => packAddressEqual(addr, address)),
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -269,9 +269,9 @@ export function GlobalPacks({ onViewPack }: GlobalPacksProps) {
|
||||
const nonGlobalPacks = useMemo(
|
||||
() =>
|
||||
roomsImagePack.filter(
|
||||
(pack) => !globalPacks.find((p) => packAddressEqual(pack.address, p.address))
|
||||
(pack) => !globalPacks.find((p) => packAddressEqual(pack.address, p.address)),
|
||||
),
|
||||
[roomsImagePack, globalPacks]
|
||||
[roomsImagePack, globalPacks],
|
||||
);
|
||||
|
||||
const [selectedPacks, setSelectedPacks] = useState<PackAddress[]>([]);
|
||||
@@ -280,9 +280,9 @@ export function GlobalPacks({ onViewPack }: GlobalPacksProps) {
|
||||
const unselectedGlobalPacks = useMemo(
|
||||
() =>
|
||||
nonGlobalPacks.filter(
|
||||
(pack) => !selectedPacks.find((addr) => packAddressEqual(pack.address, addr))
|
||||
(pack) => !selectedPacks.find((addr) => packAddressEqual(pack.address, addr)),
|
||||
),
|
||||
[selectedPacks, nonGlobalPacks]
|
||||
[selectedPacks, nonGlobalPacks],
|
||||
);
|
||||
|
||||
const handleRemove = (address: PackAddress) => {
|
||||
@@ -321,7 +321,7 @@ export function GlobalPacks({ onViewPack }: GlobalPacksProps) {
|
||||
});
|
||||
|
||||
await mx.setAccountData(AccountDataEvent.PoniesEmoteRooms, updatedContent);
|
||||
}, [mx, selectedPacks, removedPacks])
|
||||
}, [mx, selectedPacks, removedPacks]),
|
||||
);
|
||||
|
||||
const resetChanges = useCallback(() => {
|
||||
|
||||
@@ -85,7 +85,7 @@ const ThemeSelector = as<'div', ThemeSelectorProps>(
|
||||
))}
|
||||
</Box>
|
||||
</Menu>
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
function SelectTheme({ disabled }: { disabled?: boolean }) {
|
||||
@@ -321,7 +321,7 @@ function Appearance() {
|
||||
const [twitterEmoji, setTwitterEmoji] = useSetting(settingsAtom, 'twitterEmoji');
|
||||
const [perMessageProfiles, setPerMessageProfiles] = useSetting(
|
||||
settingsAtom,
|
||||
'perMessageProfiles'
|
||||
'perMessageProfiles',
|
||||
);
|
||||
const [lotusTerminal, setLotusTerminal] = useSetting(settingsAtom, 'lotusTerminal');
|
||||
|
||||
@@ -831,7 +831,7 @@ function Calls() {
|
||||
const [cameraOnJoin, setCameraOnJoin] = useSetting(settingsAtom, 'cameraOnJoin');
|
||||
const [callNoiseSuppression, setCallNoiseSuppression] = useSetting(
|
||||
settingsAtom,
|
||||
'callNoiseSuppression'
|
||||
'callNoiseSuppression',
|
||||
);
|
||||
const [pttMode, setPttMode] = useSetting(settingsAtom, 'pttMode');
|
||||
const [pttKey, setPttKey] = useSetting(settingsAtom, 'pttKey');
|
||||
@@ -843,7 +843,7 @@ function Calls() {
|
||||
if (keyListenerRef.current)
|
||||
window.removeEventListener('keydown', keyListenerRef.current, true);
|
||||
},
|
||||
[]
|
||||
[],
|
||||
);
|
||||
|
||||
const handleKeyBind = useCallback(() => {
|
||||
@@ -1104,15 +1104,15 @@ function SelectMessageSpacing() {
|
||||
function Messages() {
|
||||
const [legacyUsernameColor, setLegacyUsernameColor] = useSetting(
|
||||
settingsAtom,
|
||||
'legacyUsernameColor'
|
||||
'legacyUsernameColor',
|
||||
);
|
||||
const [hideMembershipEvents, setHideMembershipEvents] = useSetting(
|
||||
settingsAtom,
|
||||
'hideMembershipEvents'
|
||||
'hideMembershipEvents',
|
||||
);
|
||||
const [hideNickAvatarEvents, setHideNickAvatarEvents] = useSetting(
|
||||
settingsAtom,
|
||||
'hideNickAvatarEvents'
|
||||
'hideNickAvatarEvents',
|
||||
);
|
||||
const [mediaAutoLoad, setMediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad');
|
||||
const [urlPreview, setUrlPreview] = useSetting(settingsAtom, 'urlPreview');
|
||||
|
||||
@@ -18,7 +18,7 @@ import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||
const getAllMessageDefaultRule = (
|
||||
ruleId: RuleId,
|
||||
encrypted: boolean,
|
||||
oneToOne: boolean
|
||||
oneToOne: boolean,
|
||||
): PushRuleData => {
|
||||
const conditions: PushRuleCondition[] = [];
|
||||
if (oneToOne)
|
||||
@@ -66,7 +66,7 @@ function AllMessagesModeSwitcher({
|
||||
const actions = getModeActions(mode);
|
||||
await mx.setPushRuleActions('global', kind, ruleId, actions);
|
||||
},
|
||||
[mx, getModeActions, kind, ruleId]
|
||||
[mx, getModeActions, kind, ruleId],
|
||||
);
|
||||
|
||||
return <NotificationModeSwitcher pushRule={pushRule} onChange={handleChange} />;
|
||||
@@ -76,7 +76,7 @@ export function AllMessagesNotifications() {
|
||||
const pushRulesEvt = useAccountData(AccountDataEvent.PushRules);
|
||||
const pushRules = useMemo(
|
||||
() => pushRulesEvt?.getContent<IPushRules>() ?? { global: {} },
|
||||
[pushRulesEvt]
|
||||
[pushRulesEvt],
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -33,8 +33,8 @@ function KeywordInput() {
|
||||
});
|
||||
setKeyword('');
|
||||
},
|
||||
[mx]
|
||||
)
|
||||
[mx],
|
||||
),
|
||||
);
|
||||
const addingKeyword = keywordState.status === AsyncStatus.Loading;
|
||||
|
||||
@@ -114,8 +114,8 @@ function KeywordCross({ pushRule }: PushRulesProps) {
|
||||
const [removeState, remove] = useAsyncCallback(
|
||||
useCallback(
|
||||
() => mx.deletePushRule('global', PushRuleKind.ContentSpecific, pushRule.rule_id),
|
||||
[mx, pushRule]
|
||||
)
|
||||
[mx, pushRule],
|
||||
),
|
||||
);
|
||||
|
||||
const removing = removeState.status === AsyncStatus.Loading;
|
||||
@@ -145,10 +145,10 @@ function KeywordModeSwitcher({ pushRule }: PushRulesProps) {
|
||||
'global',
|
||||
PushRuleKind.ContentSpecific,
|
||||
pushRule.rule_id,
|
||||
actions
|
||||
actions,
|
||||
);
|
||||
},
|
||||
[mx, getModeActions, pushRule]
|
||||
[mx, getModeActions, pushRule],
|
||||
);
|
||||
|
||||
return <NotificationModeSwitcher pushRule={pushRule} onChange={handleChange} />;
|
||||
@@ -158,13 +158,13 @@ export function KeywordMessagesNotifications() {
|
||||
const pushRulesEvt = useAccountData(AccountDataEvent.PushRules);
|
||||
const pushRules = useMemo(
|
||||
() => pushRulesEvt?.getContent<IPushRules>() ?? { global: {} },
|
||||
[pushRulesEvt]
|
||||
[pushRulesEvt],
|
||||
);
|
||||
|
||||
const keywordPushRules = useMemo(() => {
|
||||
const content = pushRules.global.content ?? [];
|
||||
return content.filter(
|
||||
(pushRule) => pushRule.default === false && typeof pushRule.pattern === 'string'
|
||||
(pushRule) => pushRule.default === false && typeof pushRule.pattern === 'string',
|
||||
);
|
||||
}, [pushRules]);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const useNotificationModeStr = (): Record<NotificationMode, string> =>
|
||||
[NotificationMode.Notify]: 'Notify Silent',
|
||||
[NotificationMode.NotifyLoud]: 'Notify Loud',
|
||||
}),
|
||||
[]
|
||||
[],
|
||||
);
|
||||
|
||||
type NotificationModeSwitcherProps = {
|
||||
|
||||
@@ -32,7 +32,7 @@ const getDefaultIsUserMention = (userId: string): PushRuleData =>
|
||||
key: 'content.m\\.mentions.user_ids',
|
||||
value: userId,
|
||||
},
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
const DefaultContainsDisplayName = makePushRuleData(
|
||||
@@ -43,7 +43,7 @@ const DefaultContainsDisplayName = makePushRuleData(
|
||||
{
|
||||
kind: ConditionKind.ContainsDisplayName,
|
||||
},
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
const getDefaultContainsUsername = (username: string) =>
|
||||
@@ -52,7 +52,7 @@ const getDefaultContainsUsername = (username: string) =>
|
||||
RuleId.ContainsUserName,
|
||||
getNotificationModeActions(NotificationMode.NotifyLoud, { highlight: true }),
|
||||
undefined,
|
||||
username
|
||||
username,
|
||||
);
|
||||
|
||||
const DefaultIsRoomMention = makePushRuleData(
|
||||
@@ -69,7 +69,7 @@ const DefaultIsRoomMention = makePushRuleData(
|
||||
kind: ConditionKind.SenderNotificationPermission,
|
||||
key: 'room',
|
||||
},
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
const DefaultAtRoomNotification = makePushRuleData(
|
||||
@@ -86,7 +86,7 @@ const DefaultAtRoomNotification = makePushRuleData(
|
||||
kind: ConditionKind.SenderNotificationPermission,
|
||||
key: 'room',
|
||||
},
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
type PushRulesProps = {
|
||||
@@ -105,7 +105,7 @@ function MentionModeSwitcher({ ruleId, pushRules, defaultPushRuleData }: PushRul
|
||||
const actions = getModeActions(mode);
|
||||
await mx.setPushRuleActions('global', kind, ruleId, actions);
|
||||
},
|
||||
[mx, getModeActions, kind, ruleId]
|
||||
[mx, getModeActions, kind, ruleId],
|
||||
);
|
||||
|
||||
return <NotificationModeSwitcher pushRule={pushRule} onChange={handleChange} />;
|
||||
@@ -118,7 +118,7 @@ export function SpecialMessagesNotifications() {
|
||||
const pushRulesEvt = useAccountData(AccountDataEvent.PushRules);
|
||||
const pushRules = useMemo(
|
||||
() => pushRulesEvt?.getContent<IPushRules>() ?? { global: {} },
|
||||
[pushRulesEvt]
|
||||
[pushRulesEvt],
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -39,8 +39,8 @@ function EmailNotification() {
|
||||
kind: null,
|
||||
} as unknown as IPusherRequest);
|
||||
},
|
||||
[mx]
|
||||
)
|
||||
[mx],
|
||||
),
|
||||
);
|
||||
|
||||
const handleChange = (value: boolean) => {
|
||||
@@ -89,7 +89,7 @@ export function SystemNotification() {
|
||||
const [showNotifications, setShowNotifications] = useSetting(settingsAtom, 'showNotifications');
|
||||
const [isNotificationSounds, setIsNotificationSounds] = useSetting(
|
||||
settingsAtom,
|
||||
'isNotificationSounds'
|
||||
'isNotificationSounds',
|
||||
);
|
||||
|
||||
const requestNotificationPermission = () => {
|
||||
|
||||
Reference in New Issue
Block a user