Fix the ref, upload, keyframes, and implicit-any type errors. [skip build]
Checks / checks (push) Successful in 2m6s
Trigger cinny-mobile / dispatch (push) Successful in 1s

This commit is contained in:
2026-11-02 00:51:31 +11:00
parent 45f38f2ac8
commit 1e3d630b1a
30 changed files with 134 additions and 98 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ type ConfirmPasswordMatchProps = {
children: ( children: (
match: boolean, match: boolean,
doMatch: () => void, doMatch: () => void,
passRef: RefObject<HTMLInputElement>, passRef: RefObject<HTMLInputElement | null>,
confPassRef: RefObject<HTMLInputElement>, confPassRef: RefObject<HTMLInputElement | null>,
) => ReactNode; ) => ReactNode;
}; };
export function ConfirmPasswordMatch({ initialValue, children }: ConfirmPasswordMatchProps) { export function ConfirmPasswordMatch({ initialValue, children }: ConfirmPasswordMatchProps) {
+24 -26
View File
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { style } from '@vanilla-extract/css'; import { keyframes, style } from '@vanilla-extract/css';
const transitionContainer = style({ const transitionContainer = style({
position: 'relative', position: 'relative',
@@ -14,36 +14,34 @@ const transitionContent = style({
height: '100%', height: '100%',
}); });
const routeFadeSlideIn = keyframes({
from: {
opacity: 0,
transform: 'translateX(12px)',
},
to: {
opacity: 1,
transform: 'translateX(0)',
},
});
const animateIn = style({ const animateIn = style({
animation: 'routeFadeSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1)', animation: `${routeFadeSlideIn} 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,
'@keyframes': { });
routeFadeSlideIn: {
from: { const routeFadeSlideOut = keyframes({
opacity: 0, from: {
transform: 'translateX(12px)', opacity: 1,
}, transform: 'translateX(0)',
to: { },
opacity: 1, to: {
transform: 'translateX(0)', opacity: 0,
}, transform: 'translateX(-12px)',
},
}, },
}); });
const animateOut = style({ const animateOut = style({
animation: 'routeFadeSlideOut 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards', animation: `${routeFadeSlideOut} 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards`,
'@keyframes': {
routeFadeSlideOut: {
from: {
opacity: 1,
transform: 'translateX(0)',
},
to: {
opacity: 0,
transform: 'translateX(-12px)',
},
},
},
}); });
interface RouteTransitionProps { interface RouteTransitionProps {
@@ -192,7 +192,7 @@ const DEFAULT_CATEGORY_ID = makeNavCategoryId('direct', 'direct');
* Props for the DirectList component * Props for the DirectList component
*/ */
export type DirectListProps = { export type DirectListProps = {
scrollRef: React.RefObject<HTMLDivElement>; scrollRef: React.RefObject<HTMLDivElement | null>;
showCreateButton?: boolean; showCreateButton?: boolean;
showCategoryHeader?: boolean; showCategoryHeader?: boolean;
}; };
@@ -296,7 +296,7 @@ function StickerSidebar({ activeGroupAtom, packs, onScrollToGroup }: StickerSide
} }
type EmojiGroupHolderProps = { type EmojiGroupHolderProps = {
contentScrollRef: RefObject<HTMLDivElement>; contentScrollRef: RefObject<HTMLDivElement | null>;
previewAtom: PrimitiveAtom<PreviewData | undefined>; previewAtom: PrimitiveAtom<PreviewData | undefined>;
children?: ReactNode; children?: ReactNode;
onGroupItemClick: MouseEventHandler; onGroupItemClick: MouseEventHandler;
@@ -121,6 +121,7 @@ export const ImagePackContent = as<'div', ImagePackContentProps>(
url: data.mxc, url: data.mxc,
info: getImageInfo(imgEl, data.file), info: getImageInfo(imgEl, data.file),
}; };
if (!data.file.name) return;
const image = PackImageReader.fromPackImage( const image = PackImageReader.fromPackImage(
getFileNameWithoutExt(data.file.name), getFileNameWithoutExt(data.file.name),
packImage, packImage,
@@ -10,8 +10,8 @@ import {
export const ScrollTopContainer = as< export const ScrollTopContainer = as<
'div', 'div',
{ {
scrollRef?: RefObject<HTMLElement>; scrollRef?: RefObject<HTMLElement | null>;
anchorRef: RefObject<HTMLElement>; anchorRef: RefObject<HTMLElement | null>;
onVisibilityChange?: (onTop: boolean) => void; onVisibilityChange?: (onTop: boolean) => void;
} }
>(({ className, scrollRef, anchorRef, onVisibilityChange, ...props }, ref) => { >(({ className, scrollRef, anchorRef, onVisibilityChange, ...props }, ref) => {
+17 -8
View File
@@ -1,5 +1,6 @@
import { style, keyframes } from '@vanilla-extract/css'; import { style, keyframes } from '@vanilla-extract/css';
import { color, config } from 'folds'; import { color, config } from 'folds';
import { AppRegionStyleRule } from '../../../types/utils';
const wipeIn = keyframes({ const wipeIn = keyframes({
'0%': { '0%': {
@@ -23,7 +24,7 @@ const wipeOut = keyframes({
}, },
}); });
export const NewMessagePill = style({ const newMessagePill: AppRegionStyleRule = {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
gap: config.space.S100, gap: config.space.S100,
@@ -45,7 +46,9 @@ export const NewMessagePill = style({
backgroundColor: '#388E3C', backgroundColor: '#388E3C',
}, },
}, },
}); };
export const NewMessagePill = style(newMessagePill);
export const NewMessagePillExiting = style({ export const NewMessagePillExiting = style({
animation: `${wipeOut} 0.2s ease-in forwards`, animation: `${wipeOut} 0.2s ease-in forwards`,
@@ -65,7 +68,7 @@ export const TitleBar = style({
WebkitUserSelect: 'none', WebkitUserSelect: 'none',
}); });
export const TitleBarDragRegion = style({ const titleBarDragRegion: AppRegionStyleRule = {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
height: '100%', height: '100%',
@@ -74,14 +77,18 @@ export const TitleBarDragRegion = style({
cursor: 'default', cursor: 'default',
WebkitAppRegion: 'drag', WebkitAppRegion: 'drag',
color: color.Surface.OnContainer, color: color.Surface.OnContainer,
}); };
export const TitleBarBackButton = style({ export const TitleBarDragRegion = style(titleBarDragRegion);
const titleBarBackButton: AppRegionStyleRule = {
WebkitAppRegion: 'no-drag', WebkitAppRegion: 'no-drag',
flexShrink: 0, flexShrink: 0,
}); };
export const SyncStatusBadge = style({ export const TitleBarBackButton = style(titleBarBackButton);
const syncStatusBadge: AppRegionStyleRule = {
position: 'absolute', position: 'absolute',
left: '50%', left: '50%',
top: '50%', top: '50%',
@@ -94,7 +101,9 @@ export const SyncStatusBadge = style({
zIndex: 1001, zIndex: 1001,
pointerEvents: 'none', pointerEvents: 'none',
WebkitAppRegion: 'no-drag', WebkitAppRegion: 'no-drag',
}); };
export const SyncStatusBadge = style(syncStatusBadge);
export const SyncStatusSuccess = style({ export const SyncStatusSuccess = style({
backgroundColor: color.Success.Container, backgroundColor: color.Success.Container,
+1 -1
View File
@@ -49,7 +49,7 @@ export function TitleBar({ mx, children }: TitleBarProps) {
const roomId = useAtomValue(activeRoomIdAtom); const roomId = useAtomValue(activeRoomIdAtom);
const [notifications, setNotifications] = useState<NewMessageNotification[]>([]); const [notifications, setNotifications] = useState<NewMessageNotification[]>([]);
const dismissTimersRef = useRef<Map<string, ReturnType<typeof setTimeout>>>(new Map()); const dismissTimersRef = useRef<Map<string, ReturnType<typeof setTimeout>>>(new Map());
const lastMxRef = useRef<MatrixClient | undefined>(); const lastMxRef = useRef<MatrixClient | undefined>(undefined);
const navigate = useNavigate(); const navigate = useNavigate();
const roomToParents = useAtomValue(roomToParentsAtom); const roomToParents = useAtomValue(roomToParentsAtom);
const mDirects = useAtomValue(mDirectAtom); const mDirects = useAtomValue(mDirectAtom);
@@ -1,19 +1,22 @@
import { keyframes, style } from '@vanilla-extract/css'; import { keyframes, style } from '@vanilla-extract/css';
import { color, config, toRem } from 'folds'; import { color, config, toRem } from 'folds';
import { AppRegionStyleRule } from '../../../types/utils';
const indeterminate = keyframes({ const indeterminate = keyframes({
'0%': { transform: 'translateX(-100%)' }, '0%': { transform: 'translateX(-100%)' },
'100%': { transform: 'translateX(250%)' }, '100%': { transform: 'translateX(250%)' },
}); });
export const IdleSlot = style({ const idleSlot: AppRegionStyleRule = {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
height: '100%', height: '100%',
WebkitAppRegion: 'no-drag', WebkitAppRegion: 'no-drag',
flexShrink: 0, flexShrink: 0,
}); };
export const IdleSlot = style(idleSlot);
export const GhostCheck = style({ export const GhostCheck = style({
all: 'unset', all: 'unset',
@@ -38,7 +41,7 @@ export const GhostCheck = style({
}, },
}); });
export const Bar = style({ const bar: AppRegionStyleRule = {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
gap: config.space.S200, gap: config.space.S200,
@@ -52,7 +55,9 @@ export const Bar = style({
WebkitAppRegion: 'no-drag', WebkitAppRegion: 'no-drag',
flexShrink: 0, flexShrink: 0,
boxSizing: 'border-box', boxSizing: 'border-box',
}); };
export const Bar = style(bar);
export const BarTrack = style({ export const BarTrack = style({
position: 'relative', position: 'relative',
@@ -92,7 +97,7 @@ export const BarLabel = style({
textAlign: 'right', textAlign: 'right',
}); });
export const Chip = style({ const chip: AppRegionStyleRule = {
height: toRem(22), height: toRem(22),
maxWidth: toRem(260), maxWidth: toRem(260),
padding: `0 ${config.space.S100} 0 ${config.space.S200}`, padding: `0 ${config.space.S100} 0 ${config.space.S200}`,
@@ -102,7 +107,9 @@ export const Chip = style({
WebkitAppRegion: 'no-drag', WebkitAppRegion: 'no-drag',
flexShrink: 0, flexShrink: 0,
boxSizing: 'border-box', boxSizing: 'border-box',
}); };
export const Chip = style(chip);
export const ChipText = style({ export const ChipText = style({
maxWidth: toRem(140), maxWidth: toRem(140),
@@ -7,8 +7,8 @@ import { useMatrixClient } from '../../hooks/useMatrixClient';
import { useFilePicker } from '../../hooks/useFilePicker'; import { useFilePicker } from '../../hooks/useFilePicker';
import { safeFile } from '../../utils/mimeTypes'; import { safeFile } from '../../utils/mimeTypes';
import { fulfilledPromiseSettledResult } from '../../utils/common'; import { fulfilledPromiseSettledResult } from '../../utils/common';
import { TUploadContent } from '../../utils/matrix';
import { import {
TUploadContent,
TUploadItem, TUploadItem,
TUploadMetadata, TUploadMetadata,
roomIdToUploadItemsAtomFamily, roomIdToUploadItemsAtomFamily,
@@ -199,7 +199,7 @@ export function ForumPostUploadField({
export function useForumPostUploads(roomId: string) { export function useForumPostUploads(roomId: string) {
const mx = useMatrixClient(); const mx = useMatrixClient();
const [selectedFiles, setSelectedFiles] = useAtom(roomIdToUploadItemsAtomFamily(roomId)); const [selectedFiles, setSelectedFiles] = useAtom(roomIdToUploadItemsAtomFamily(roomId));
const uploadBoardHandlers = useRef<UploadBoardImperativeHandlers>(); const uploadBoardHandlers = useRef<UploadBoardImperativeHandlers | undefined>(undefined);
const uploadResolverRef = useRef<{ const uploadResolverRef = useRef<{
resolve: (contents: IContent[]) => void; resolve: (contents: IContent[]) => void;
reject: (err: unknown) => void; reject: (err: unknown) => void;
@@ -13,7 +13,7 @@ type ForumReplyComposerProps = {
roomId: string; roomId: string;
threadRootId: string; threadRootId: string;
replyToEventId: string; replyToEventId: string;
fileDropContainerRef: RefObject<HTMLElement>; fileDropContainerRef: RefObject<HTMLElement | null>;
onSent?: () => void; onSent?: () => void;
onCancel?: () => void; onCancel?: () => void;
}; };
+2 -2
View File
@@ -124,7 +124,7 @@ type ForumThreadMessageProps = {
room: Room; room: Room;
roomId: string; roomId: string;
threadRootId: string; threadRootId: string;
fileDropContainerRef: RefObject<HTMLElement>; fileDropContainerRef: RefObject<HTMLElement | null>;
editEventId?: string; editEventId?: string;
onEditEventId: (eventId?: string) => void; onEditEventId: (eventId?: string) => void;
onComposerSent: () => void; onComposerSent: () => void;
@@ -303,7 +303,7 @@ type ForumThreadDetailProps = {
rootEventId: string; rootEventId: string;
titleHint?: string; titleHint?: string;
initialPost?: ForumPost | null; initialPost?: ForumPost | null;
fileDropContainerRef?: RefObject<HTMLElement>; fileDropContainerRef?: RefObject<HTMLElement | null>;
onReplySent?: (reply: ForumPost) => void; onReplySent?: (reply: ForumPost) => void;
}; };
+3 -3
View File
@@ -20,9 +20,9 @@ export type CanDropCallback = (item: HierarchyItem, container: DropContainerData
export const useDraggableItem = ( export const useDraggableItem = (
item: HierarchyItem, item: HierarchyItem,
targetRef: RefObject<HTMLElement>, targetRef: RefObject<HTMLElement | null>,
onDragging: (item?: HierarchyItem) => void, onDragging: (item?: HierarchyItem) => void,
dragHandleRef?: RefObject<HTMLElement>, dragHandleRef?: RefObject<HTMLElement | null>,
): boolean => { ): boolean => {
const [dragging, setDragging] = useState(false); const [dragging, setDragging] = useState(false);
@@ -120,7 +120,7 @@ export function AfterItemDropTarget({
} }
export const useDnDMonitor = ( export const useDnDMonitor = (
scrollRef: RefObject<HTMLElement>, scrollRef: RefObject<HTMLElement | null>,
onDragging: (item?: HierarchyItem) => void, onDragging: (item?: HierarchyItem) => void,
onReorder: (item: HierarchyItem, container: DropContainerData) => void, onReorder: (item: HierarchyItem, container: DropContainerData) => void,
) => { ) => {
@@ -42,7 +42,7 @@ type MessageSearchProps = {
allowGlobal?: boolean; allowGlobal?: boolean;
rooms: string[]; rooms: string[];
senders?: string[]; senders?: string[];
scrollRef: RefObject<HTMLDivElement>; scrollRef: RefObject<HTMLDivElement | null>;
}; };
export function MessageSearch({ export function MessageSearch({
defaultRoomsFilterName, defaultRoomsFilterName,
@@ -6,7 +6,7 @@ import { Icon, Icons } from '../../components/icons';
type SearchProps = { type SearchProps = {
active?: boolean; active?: boolean;
loading?: boolean; loading?: boolean;
searchInputRef: RefObject<HTMLInputElement>; searchInputRef: RefObject<HTMLInputElement | null>;
onSearch: (term: string) => void; onSearch: (term: string) => void;
onReset: () => void; onReset: () => void;
}; };
+2 -2
View File
@@ -130,7 +130,7 @@ const createCarouselUuid = (): string => {
interface RoomInputProps { interface RoomInputProps {
editor: Editor; editor: Editor;
fileDropContainerRef: RefObject<HTMLElement>; fileDropContainerRef: RefObject<HTMLElement | null>;
roomId: string; roomId: string;
room: Room; room: Room;
/** When provided, all messages are sent as replies in this thread. */ /** When provided, all messages are sent as replies in this thread. */
@@ -207,7 +207,7 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
roomUploadAtomFamily, roomUploadAtomFamily,
selectedFiles.map((f) => f.file), selectedFiles.map((f) => f.file),
); );
const uploadBoardHandlers = useRef<UploadBoardImperativeHandlers>(); const uploadBoardHandlers = useRef<UploadBoardImperativeHandlers | undefined>(undefined);
const editorRef = useRef<HTMLDivElement>(null); const editorRef = useRef<HTMLDivElement>(null);
const imagePackRooms: Room[] = useImagePackRooms(roomId, roomToParents); const imagePackRooms: Room[] = useImagePackRooms(roomId, roomToParents);
+2 -2
View File
@@ -373,7 +373,7 @@ export const getEventIdAbsoluteIndex = (
type RoomTimelineProps = { type RoomTimelineProps = {
room: Room; room: Room;
eventId?: string; eventId?: string;
roomInputRef: RefObject<HTMLElement>; roomInputRef: RefObject<HTMLElement | null>;
editor: Editor; editor: Editor;
}; };
@@ -665,7 +665,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
const [unreadInfo, setUnreadInfo] = useState(() => const [unreadInfo, setUnreadInfo] = useState(() =>
getRoomUnreadInfo(room, scrollToLatestBehavior !== ScrollToLatestBehavior.Always), getRoomUnreadInfo(room, scrollToLatestBehavior !== ScrollToLatestBehavior.Always),
); );
const readUptoEventIdRef = useRef<string>(); const readUptoEventIdRef = useRef<string | undefined>(undefined);
if (unreadInfo) { if (unreadInfo) {
readUptoEventIdRef.current = unreadInfo.readUptoEventId; readUptoEventIdRef.current = unreadInfo.readUptoEventId;
} }
+1 -1
View File
@@ -262,7 +262,7 @@ export function Search({ requestClose }: SearchProps) {
allowOutsideClick: true, allowOutsideClick: true,
clickOutsideDeactivates: true, clickOutsideDeactivates: true,
onDeactivate: requestClose, onDeactivate: requestClose,
escapeDeactivates: (evt) => { escapeDeactivates: (evt: KeyboardEvent) => {
evt.stopPropagation(); evt.stopPropagation();
return true; return true;
}, },
+1 -1
View File
@@ -10,7 +10,7 @@ export function useDebounce<T extends unknown[]>(
callback: DebounceCallback<T>, callback: DebounceCallback<T>,
options?: DebounceOptions, options?: DebounceOptions,
): DebounceCallback<T> { ): DebounceCallback<T> {
const timeoutIdRef = useRef<number>(); const timeoutIdRef = useRef<number | undefined>(undefined);
const { wait, immediate } = options ?? {}; const { wait, immediate } = options ?? {};
const debounceCallback = useCallback( const debounceCallback = useCallback(
+2 -2
View File
@@ -11,10 +11,10 @@ export const useFileDropHandler = (onDrop: (file: File[]) => void): DragEventHan
); );
export const useFileDropZone = ( export const useFileDropZone = (
zoneRef: RefObject<HTMLElement> | undefined, zoneRef: RefObject<HTMLElement | null> | undefined,
onDrop: (file: File[]) => void, onDrop: (file: File[]) => void,
): boolean => { ): boolean => {
const dragStateRef = useRef<'start' | 'leave' | 'over'>(); const dragStateRef = useRef<'start' | 'leave' | 'over' | undefined>(undefined);
const [active, setActive] = useState(false); const [active, setActive] = useState(false);
useEffect(() => { useEffect(() => {
+1 -1
View File
@@ -14,7 +14,7 @@ export type UseInertialHorizontalScrollOptions = {
}; };
export type UseInertialHorizontalScrollResult = { export type UseInertialHorizontalScrollResult = {
scrollRef: RefObject<HTMLDivElement>; scrollRef: RefObject<HTMLDivElement | null>;
isDragging: boolean; isDragging: boolean;
canScrollBack: boolean; canScrollBack: boolean;
canScrollForward: boolean; canScrollForward: boolean;
+2 -2
View File
@@ -11,8 +11,8 @@ export function useThrottle<T extends unknown[]>(
callback: ThrottleCallback<T>, callback: ThrottleCallback<T>,
options?: ThrottleOptions, options?: ThrottleOptions,
): ThrottleCallback<T> { ): ThrottleCallback<T> {
const timeoutIdRef = useRef<number>(); const timeoutIdRef = useRef<number | undefined>(undefined);
const argsRef = useRef<T>(); const argsRef = useRef<T | undefined>(undefined);
const { wait, immediate } = options ?? {}; const { wait, immediate } = options ?? {};
const debounceCallback = useCallback( const debounceCallback = useCallback(
+15 -9
View File
@@ -167,16 +167,22 @@ export const useVirtualPaginator = <TScrollElement extends HTMLElement>(
const initialRenderRef = useRef(true); const initialRenderRef = useRef(true);
const restoreScrollRef = useRef<{ const restoreScrollRef = useRef<
scrollTop: number; | {
anchorOffsetTop: number; scrollTop: number;
anchorItem: number; anchorOffsetTop: number;
}>(); anchorItem: number;
}
| undefined
>(undefined);
const scrollToItemRef = useRef<{ const scrollToItemRef = useRef<
index: number; | {
opts?: ScrollToOptions; index: number;
}>(); opts?: ScrollToOptions;
}
| undefined
>(undefined);
const propRef = useRef({ const propRef = useRef({
range, range,
+1 -1
View File
@@ -216,7 +216,7 @@ function InviteNotifications() {
} }
function MessageNotifications() { function MessageNotifications() {
const notifRef = useRef<Notification>(); const notifRef = useRef<Notification | undefined>(undefined);
const unreadCacheRef = useRef<Map<string, UnreadInfo>>(new Map()); const unreadCacheRef = useRef<Map<string, UnreadInfo>>(new Map());
const mx = useMatrixClient(); const mx = useMatrixClient();
const useAuthentication = useMediaAuthentication(); const useAuthentication = useMediaAuthentication();
+1 -1
View File
@@ -85,7 +85,7 @@ const FALLBACK_ROOMS_LIMIT = 24;
type SearchProps = { type SearchProps = {
active?: boolean; active?: boolean;
loading?: boolean; loading?: boolean;
searchInputRef: RefObject<HTMLInputElement>; searchInputRef: RefObject<HTMLInputElement | null>;
onSearch: (term: string) => void; onSearch: (term: string) => void;
onReset: () => void; onReset: () => void;
}; };
+6 -6
View File
@@ -299,9 +299,9 @@ type SidebarDraggable = string | FolderDraggable;
const useDraggableItem = ( const useDraggableItem = (
item: SidebarDraggable, item: SidebarDraggable,
targetRef: RefObject<HTMLElement>, targetRef: RefObject<HTMLElement | null>,
onDragging: (item?: SidebarDraggable) => void, onDragging: (item?: SidebarDraggable) => void,
dragHandleRef?: RefObject<HTMLElement>, dragHandleRef?: RefObject<HTMLElement | null>,
): boolean => { ): boolean => {
const [dragging, setDragging] = useState(false); const [dragging, setDragging] = useState(false);
@@ -331,7 +331,7 @@ const useDraggableItem = (
const useDropTarget = ( const useDropTarget = (
item: SidebarDraggable, item: SidebarDraggable,
targetRef: RefObject<HTMLElement>, targetRef: RefObject<HTMLElement | null>,
): Instruction | undefined => { ): Instruction | undefined => {
const [dropState, setDropState] = useState<Instruction>(); const [dropState, setDropState] = useState<Instruction>();
@@ -379,7 +379,7 @@ const useDropTarget = (
function useDropTargetInstruction<T extends InstructionType>( function useDropTargetInstruction<T extends InstructionType>(
item: SidebarDraggable, item: SidebarDraggable,
targetRef: RefObject<HTMLElement>, targetRef: RefObject<HTMLElement | null>,
instructionType: T, instructionType: T,
): T | undefined { ): T | undefined {
const [dropState, setDropState] = useState<T>(); const [dropState, setDropState] = useState<T>();
@@ -411,7 +411,7 @@ function useDropTargetInstruction<T extends InstructionType>(
} }
const useDnDMonitor = ( const useDnDMonitor = (
scrollRef: RefObject<HTMLElement>, scrollRef: RefObject<HTMLElement | null>,
onDragging: (dragItem?: SidebarDraggable) => void, onDragging: (dragItem?: SidebarDraggable) => void,
onReorder: ( onReorder: (
draggable: SidebarDraggable, draggable: SidebarDraggable,
@@ -911,7 +911,7 @@ function HiddenSpacesFolder({
} }
type SpaceTabsProps = { type SpaceTabsProps = {
scrollRef: RefObject<HTMLDivElement>; scrollRef: RefObject<HTMLDivElement | null>;
}; };
export function SpaceTabs({ scrollRef }: SpaceTabsProps) { export function SpaceTabs({ scrollRef }: SpaceTabsProps) {
const navigate = useNavigateWithTransition(); const navigate = useNavigateWithTransition();
+20 -11
View File
@@ -382,17 +382,26 @@ class AndroidUnifiedPushManager {
const MatrixBackgroundSync = registerPlugin<MatrixBackgroundSyncPlugin>('MatrixBackgroundSync'); const MatrixBackgroundSync = registerPlugin<MatrixBackgroundSyncPlugin>('MatrixBackgroundSync');
this.listenerHandles = [ this.listenerHandles = [
await MatrixBackgroundSync.addListener('unifiedPushNewEndpoint', (event) => { await MatrixBackgroundSync.addListener(
this.handleNewEndpoint(event).catch((err) => { 'unifiedPushNewEndpoint',
console.error('[BackgroundSync] handleNewEndpoint failed:', err); (event: UnifiedPushEndpointEvent) => {
}); this.handleNewEndpoint(event).catch((err) => {
}), console.error('[BackgroundSync] handleNewEndpoint failed:', err);
await MatrixBackgroundSync.addListener('unifiedPushUnregistered', (event) => { });
this.handleUnregistered(event); },
}), ),
await MatrixBackgroundSync.addListener('unifiedPushRegistrationFailed', (event) => { await MatrixBackgroundSync.addListener(
this.handleRegistrationFailed(event); 'unifiedPushUnregistered',
}), (event: UnifiedPushUnregisteredEvent) => {
this.handleUnregistered(event);
},
),
await MatrixBackgroundSync.addListener(
'unifiedPushRegistrationFailed',
(event: UnifiedPushRegistrationFailedEvent) => {
this.handleRegistrationFailed(event);
},
),
]; ];
this.listenersReady = true; this.listenersReady = true;
} }
+1 -1
View File
@@ -7,7 +7,7 @@ import { timeHourMinute } from './time';
* This intercepts the copy event on the timeline and reformats the copied text. * This intercepts the copy event on the timeline and reformats the copied text.
*/ */
export const setupCopyHandler = ( export const setupCopyHandler = (
containerRef: React.RefObject<HTMLElement>, containerRef: React.RefObject<HTMLElement | null>,
getMessageData: (eventId: string) => { sender: string; ts: number; content: string } | null, getMessageData: (eventId: string) => { sender: string; ts: number; content: string } | null,
hour24Clock: boolean, hour24Clock: boolean,
): (() => void) => { ): (() => void) => {
+2 -1
View File
@@ -133,7 +133,8 @@ export const decryptFile = async (
return blob; return blob;
}; };
export type TUploadContent = File | Blob; // Producers can pass a plain Blob (decryptFile), so name is not always present.
export type TUploadContent = File | (Blob & { name?: string });
export type ContentUploadOptions = { export type ContentUploadOptions = {
name?: string; name?: string;
+5
View File
@@ -1,3 +1,8 @@
import { ComplexStyleRule } from '@vanilla-extract/css';
export type WithRequiredProp<Type extends object, Key extends keyof Type> = Type & { export type WithRequiredProp<Type extends object, Key extends keyof Type> = Type & {
[Property in Key]-?: Type[Property]; [Property in Key]-?: Type[Property];
}; };
// csstype has no WebkitAppRegion, and ComplexStyleRule is a type alias, so it can only be intersected.
export type AppRegionStyleRule = ComplexStyleRule & { WebkitAppRegion?: 'drag' | 'no-drag' };