Type the crypto, settings, and component any sites. [skip build]
This commit is contained in:
@@ -27,7 +27,7 @@ const SOUND_FILES: Record<CallSoundType, string> = {
|
||||
* In dev or browser, sounds are served from public/sound/.
|
||||
*/
|
||||
async function resolveSoundBaseUrl(): Promise<string> {
|
||||
const electronAudio = (window as any).electron?.audio;
|
||||
const electronAudio = window.electron?.audio;
|
||||
if (electronAudio?.getSoundBaseUrl) {
|
||||
const base: string | null = await electronAudio.getSoundBaseUrl();
|
||||
if (base) return base;
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
Text,
|
||||
} from 'folds';
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import { MatrixError } from 'matrix-js-sdk';
|
||||
import { EventType, MatrixError } from 'matrix-js-sdk';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { Icon, Icons } from '../../../components/icons';
|
||||
import { SequenceCard } from '../../../components/sequence-card';
|
||||
@@ -45,7 +45,7 @@ export function RoomEncryption({ permissions }: RoomEncryptionProps) {
|
||||
|
||||
const [enableState, enable] = useAsyncCallback(
|
||||
useCallback(async () => {
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomEncryption as any, {
|
||||
await mx.sendStateEvent(room.roomId, EventType.RoomEncryption, {
|
||||
algorithm: ROOM_ENC_ALGO,
|
||||
});
|
||||
}, [mx, room.roomId]),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { MouseEventHandler, useCallback, useMemo, useState } from 'react';
|
||||
import { Button, color, config, Menu, MenuItem, PopOut, RectCords, Spinner, Text } from 'folds';
|
||||
import { HistoryVisibility, MatrixError } from 'matrix-js-sdk';
|
||||
import { EventType, HistoryVisibility, MatrixError } from 'matrix-js-sdk';
|
||||
import { RoomHistoryVisibilityEventContent } from 'matrix-js-sdk/lib/types';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { Icon, Icons } from '../../../components/icons';
|
||||
@@ -65,7 +65,7 @@ export function RoomHistoryVisibility({ permissions }: RoomHistoryVisibilityProp
|
||||
const content: RoomHistoryVisibilityEventContent = {
|
||||
history_visibility: visibility,
|
||||
};
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomHistoryVisibility as any, content);
|
||||
await mx.sendStateEvent(room.roomId, EventType.RoomHistoryVisibility, content);
|
||||
},
|
||||
[mx, room.roomId],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { color, Text } from 'folds';
|
||||
import { JoinRule, MatrixError, RestrictedAllowType } from 'matrix-js-sdk';
|
||||
import { EventType, JoinRule, MatrixError, RestrictedAllowType } from 'matrix-js-sdk';
|
||||
import { RoomJoinRulesEventContent } from 'matrix-js-sdk/lib/types';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import {
|
||||
@@ -113,7 +113,7 @@ export function RoomJoinRules({ permissions }: RoomJoinRulesProps) {
|
||||
join_rule: joinRule as JoinRule,
|
||||
};
|
||||
if (allow.length > 0) c.allow = allow;
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomJoinRules as any, c);
|
||||
await mx.sendStateEvent(room.roomId, EventType.RoomJoinRules, c);
|
||||
},
|
||||
[mx, room, space, subspaces, roomIdToParents],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable react/no-array-index-key */
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { Badge, Box, Button, Chip, config, Menu, Spinner, Text } from 'folds';
|
||||
import { EventType } from 'matrix-js-sdk';
|
||||
import { produce } from 'immer';
|
||||
import { Icon, Icons } from '../../../components/icons';
|
||||
import { SequenceCard } from '../../../components/sequence-card';
|
||||
@@ -16,7 +17,6 @@ import { PermissionGroup } from './types';
|
||||
import { getPowerLevelTag, getPowers, usePowerLevelTags } from '../../../hooks/usePowerLevelTags';
|
||||
import { useRoom } from '../../../hooks/useRoom';
|
||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||
import { StateEvent } from '../../../../types/matrix/room';
|
||||
import { PowerSwitcher } from '../../../components/power';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
||||
import { useAlive } from '../../../hooks/useAlive';
|
||||
@@ -86,7 +86,7 @@ export function PermissionGroups({
|
||||
|
||||
return draftPowerLevels;
|
||||
});
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomPowerLevels as any, editedPowerLevels);
|
||||
await mx.sendStateEvent(room.roomId, EventType.RoomPowerLevels, editedPowerLevels);
|
||||
}, [mx, room, powerLevels, permissionUpdate, permissionGroups]),
|
||||
);
|
||||
|
||||
|
||||
@@ -13,10 +13,11 @@ import {
|
||||
Spinner,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { EventType } from 'matrix-js-sdk';
|
||||
import { Icon, Icons } from '../../components/icons';
|
||||
import { HierarchyItem } from '../../hooks/useSpaceHierarchy';
|
||||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||
import { MSpaceChildContent, StateEvent } from '../../../types/matrix/room';
|
||||
import { MSpaceChildContent } from '../../../types/matrix/room';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
||||
import { UseStateProvider } from '../../components/UseStateProvider';
|
||||
import { LeaveSpacePrompt } from '../../components/leave-space-prompt';
|
||||
@@ -47,7 +48,7 @@ function SuggestMenuItem({
|
||||
const [toggleState, handleToggleSuggested] = useAsyncCallback(
|
||||
useCallback(() => {
|
||||
const newContent: MSpaceChildContent = { ...content, suggested: !content.suggested };
|
||||
return mx.sendStateEvent(parentId, StateEvent.SpaceChild as any, newContent, roomId);
|
||||
return mx.sendStateEvent(parentId, EventType.SpaceChild, newContent, roomId);
|
||||
}, [mx, parentId, roomId, content]),
|
||||
);
|
||||
|
||||
@@ -84,7 +85,7 @@ function RemoveMenuItem({
|
||||
|
||||
const [removeState, handleRemove] = useAsyncCallback(
|
||||
useCallback(
|
||||
() => mx.sendStateEvent(parentId, StateEvent.SpaceChild as any, {}, roomId),
|
||||
() => mx.sendStateEvent(parentId, EventType.SpaceChild, {}, roomId),
|
||||
[mx, parentId, roomId],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -36,7 +36,9 @@ export function RoomTombstone({ roomId, body, replacementRoomId }: RoomTombstone
|
||||
<Text size="T400">{body || 'This room has been replaced and is no longer active.'}</Text>
|
||||
{joinState.status === AsyncStatus.Error && (
|
||||
<Text style={{ color: color.Critical.Main }} size="T200">
|
||||
{(joinState.error as any)?.message ?? 'Failed to join replacement room!'}
|
||||
{joinState.error instanceof Error
|
||||
? joinState.error.message
|
||||
: 'Failed to join replacement room!'}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
@@ -97,7 +97,7 @@ export const Reactions = as<'div', ReactionsProps>(
|
||||
})}
|
||||
{reactions.length > 0 && (
|
||||
<Overlay
|
||||
onContextMenu={(evt: any) => {
|
||||
onContextMenu={(evt) => {
|
||||
evt.stopPropagation();
|
||||
}}
|
||||
open={!!viewer}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable react/destructuring-assignment */
|
||||
import React, { forwardRef, MouseEventHandler, useCallback, useMemo, useRef } from 'react';
|
||||
import { MatrixEvent, Room } from 'matrix-js-sdk';
|
||||
import { EventType, MatrixEvent, Room } from 'matrix-js-sdk';
|
||||
import { RoomPinnedEventsEventContent } from 'matrix-js-sdk/lib/types';
|
||||
import {
|
||||
Avatar,
|
||||
@@ -123,7 +123,7 @@ function PinnedMessage({
|
||||
pinned: content.pinned.filter((id) => id !== eventId),
|
||||
};
|
||||
|
||||
return mx.sendStateEvent(room.roomId, StateEvent.RoomPinnedEvents as any, newContent);
|
||||
return mx.sendStateEvent(room.roomId, EventType.RoomPinnedEvents, newContent);
|
||||
}, [room, eventId, mx]),
|
||||
);
|
||||
|
||||
|
||||
@@ -366,8 +366,8 @@ function ProfileBanner() {
|
||||
handleRemoveUpload();
|
||||
// Sync user object to propagate changes throughout app
|
||||
await syncUserAvatar();
|
||||
} catch (e: any) {
|
||||
const errorMsg = e?.message || 'Unknown error';
|
||||
} catch (e) {
|
||||
const errorMsg = e instanceof Error ? e.message : 'Unknown error';
|
||||
console.error('[ProfileBanner] setUserBanner failed:', e);
|
||||
setError(`Failed to save banner: ${errorMsg}`);
|
||||
}
|
||||
@@ -391,8 +391,8 @@ function ProfileBanner() {
|
||||
}
|
||||
setAvatarFile(undefined);
|
||||
await syncUserAvatar();
|
||||
} catch (e: any) {
|
||||
setError(`Failed to save avatar: ${e?.message || 'Unknown error'}`);
|
||||
} catch (e) {
|
||||
setError(`Failed to save avatar: ${e instanceof Error ? e.message : 'Unknown error'}`);
|
||||
}
|
||||
setSaving(false);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user