Apply the auto-fixable lint rules and the formatter, and drop the Vite build artifacts.
Checks / checks (push) Successful in 2m11s
Trigger cinny-mobile / dispatch (push) Successful in 1s

This commit is contained in:
2026-11-01 04:23:53 +11:00
parent 3cd159a63e
commit a6ad8651b3
605 changed files with 11480 additions and 9125 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
import React, { MouseEventHandler, useState } from 'react';
import { Box, config, Menu, PopOut, RectCords, Text } from 'folds';
import { Icon, Icons } from '../../../components/icons';
import FocusTrap from 'focus-trap-react';
import { useNavigate } from 'react-router-dom';
import { Icon, Icons } from '../../../components/icons';
import { SidebarAvatar, SidebarItem, SidebarItemTooltip } from '../../../components/sidebar';
import { stopPropagation } from '../../../utils/keyboard';
import { SequenceCard } from '../../../components/sequence-card';
@@ -122,7 +122,7 @@ export function CreateTab() {
? withSearchParam<_RoomSearchParams>(path, {
viaServers: encodeSearchParamValueArray(viaServers),
})
: path
: path,
);
}}
/>
+12 -10
View File
@@ -1,9 +1,9 @@
import React, { MouseEventHandler, forwardRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { Box, Menu, MenuItem, PopOut, RectCords, Text, config, toRem } from 'folds';
import { Icon, Icons } from '../../../components/icons';
import FocusTrap from 'focus-trap-react';
import { useAtomValue } from 'jotai';
import { Icon, Icons } from '../../../components/icons';
import PaarrotSVG from '../../../../../public/res/svg/paarrot.svg';
import PaarrotUnreadSVG from '../../../../../public/res/svg/paarrot-unread.svg';
import PaarrotHighlightSVG from '../../../../../public/res/svg/paarrot-highlight.svg';
@@ -111,8 +111,8 @@ export function DirectTab() {
directUnread?.highlight
? PaarrotHighlightSVG
: directUnread?.total
? PaarrotUnreadSVG
: PaarrotSVG
? PaarrotUnreadSVG
: PaarrotSVG
}
alt="Direct Messages"
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
@@ -121,13 +121,15 @@ export function DirectTab() {
)}
</SidebarItemTooltip>
{directUnread && directUnread.total > 0 && (
<div style={{
position: 'absolute',
bottom: '2px',
right: '2px',
pointerEvents: 'none',
zIndex: 2,
}}>
<div
style={{
position: 'absolute',
bottom: '2px',
right: '2px',
pointerEvents: 'none',
zIndex: 2,
}}
>
<UnreadBadge highlight={directUnread.highlight > 0} count={directUnread.total} />
</div>
)}
+1 -1
View File
@@ -1,8 +1,8 @@
import { Icon, Icons } from '../../../components/icons';
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { useAtomValue } from 'jotai';
import { Icon, Icons } from '../../../components/icons';
import { SidebarAvatar, SidebarItem, SidebarItemTooltip } from '../../../components/sidebar';
import { useExploreSelected } from '../../../hooks/router/useExploreSelected';
import {
+10 -5
View File
@@ -1,10 +1,10 @@
import React, { MouseEventHandler, forwardRef, useState } from 'react';
import { useNavigateWithTransition } from '../../../hooks/useViewTransitions';
import { Box, Line, Menu, MenuItem, PopOut, RectCords, Text, config, toRem } from 'folds';
import { Icon, Icons } from '../../../components/icons';
import { useAtomValue } from 'jotai';
import FocusTrap from 'focus-trap-react';
import { useOrphanRooms } from '../../../state/hooks/roomList';
import { Icon, Icons } from '../../../components/icons';
import { useNavigateWithTransition } from '../../../hooks/useViewTransitions';
import { useOrphanRooms, useOrphanSpaces } from '../../../state/hooks/roomList';
import { useMatrixClient } from '../../../hooks/useMatrixClient';
import { mDirectAtom } from '../../../state/mDirectList';
import { roomToParentsAtom } from '../../../state/room/roomToParents';
@@ -27,9 +27,14 @@ import { useMarkRoomsAsRead } from '../../../hooks/useMarkAsRead';
import { stopPropagation } from '../../../utils/keyboard';
import { useSetting } from '../../../state/hooks/settings';
import { settingsAtom } from '../../../state/settings';
import { makeHideHomeContent, parseHiddenSpaces, parseSidebar, useHiddenSpaces, useSidebarItems } from '../../../hooks/useSidebarItems';
import {
makeHideHomeContent,
parseHiddenSpaces,
parseSidebar,
useHiddenSpaces,
useSidebarItems,
} from '../../../hooks/useSidebarItems';
import { AccountDataEvent } from '../../../../types/matrix/accountData';
import { useOrphanSpaces } from '../../../state/hooks/roomList';
type HomeMenuProps = {
requestClose: () => void;
+2 -2
View File
@@ -1,8 +1,8 @@
import { Icon, Icons } from '../../../components/icons';
import React from 'react';
import { useAtomValue } from 'jotai';
import { Icon, Icons } from '../../../components/icons';
import { useNavigateWithTransition } from '../../../hooks/useViewTransitions';
import { useAtomValue } from 'jotai';
import {
SidebarAvatar,
SidebarItem,
+1 -1
View File
@@ -1,7 +1,7 @@
import { Icon, Icons } from '../../../components/icons';
import React from 'react';
import { useAtom } from 'jotai';
import { Icon, Icons } from '../../../components/icons';
import { SidebarAvatar, SidebarItem, SidebarItemTooltip } from '../../../components/sidebar';
import { searchModalAtom } from '../../../state/searchModal';
import * as sidebarCss from '../../../components/sidebar/Sidebar.css';
+13 -15
View File
@@ -1,7 +1,7 @@
import React, { MouseEventHandler, useState } from 'react';
import { Box, config, Line, Menu, MenuItem, PopOut, RectCords, Text } from 'folds';
import { Icon, Icons } from '../../../components/icons';
import FocusTrap from 'focus-trap-react';
import { Icon, Icons } from '../../../components/icons';
import { useNavigateWithTransition } from '../../../hooks/useViewTransitions';
import { SidebarItem, SidebarAvatar } from '../../../components/sidebar';
import { UserAvatar } from '../../../components/user-avatar';
@@ -37,15 +37,16 @@ export function SettingsTab() {
const [customStatusOpen, setCustomStatusOpen] = useState(false);
const displayName = profile.displayName ?? getMxIdLocalPart(userId ?? '') ?? userId ?? '';
const avatarUrl = profile.avatarUrl && userId
? mxcUrlToHttp(mx, profile.avatarUrl, useAuthentication, 96, 96, 'crop') ?? undefined
: undefined;
const avatarUrl =
profile.avatarUrl && userId
? (mxcUrlToHttp(mx, profile.avatarUrl, useAuthentication, 96, 96, 'crop') ?? undefined)
: undefined;
const { assetUrls } = useOtherUserCollectibles(userId ?? '');
const avatarDecorationUrl = pickAvatarDecorationUrl(assetUrls);
const nameplateUrl = pickNameplateUrl(assetUrls);
const [sidebarNameplateOpacity] = useSetting(settingsAtom, 'sidebarNameplateOpacity');
const nameplateIsVideo = Boolean(
assetUrls['nameplate:animated'] || assetUrls['nameplate:asset.webm']
assetUrls['nameplate:animated'] || assetUrls['nameplate:asset.webm'],
);
const openSettings = () => setSettings(true);
@@ -105,7 +106,7 @@ export function SettingsTab() {
)}
</div>
</SidebarAvatar>
<PopOut
anchor={menuAnchor}
position="Right"
@@ -129,12 +130,12 @@ export function SettingsTab() {
</Box>
<Line variant="Surface" size="300" />
<Box direction="Column" gap="100" style={{ padding: config.space.S100 }}>
<MenuItem
<MenuItem
onClick={() => {
setMenuAnchor(undefined);
navigate(`${getLoginPath()}?add-account=true`);
}}
size="300"
}}
size="300"
radii="300"
>
<Box gap="200" alignItems="Center">
@@ -185,12 +186,9 @@ export function SettingsTab() {
</FocusTrap>
}
/>
<CustomStatusDialog
open={customStatusOpen}
onClose={() => setCustomStatusOpen(false)}
/>
<CustomStatusDialog open={customStatusOpen} onClose={() => setCustomStatusOpen(false)} />
{settings && (
<Modal500 requestClose={closeSettings}>
<Settings requestClose={closeSettings} />
+50 -39
View File
@@ -9,9 +9,18 @@ import React, {
useRef,
useState,
} from 'react';
import { useNavigateWithTransition } from '../../../hooks/useViewTransitions';
import { Box, IconButton, Line, Menu, MenuItem, PopOut, RectCords, Text, config, toRem } from 'folds';
import { Icon, Icons } from '../../../components/icons';
import {
Box,
IconButton,
Line,
Menu,
MenuItem,
PopOut,
RectCords,
Text,
config,
toRem,
} from 'folds';
import { useAtom, useAtomValue } from 'jotai';
import { Room } from 'matrix-js-sdk';
import {
@@ -27,6 +36,8 @@ import {
import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
import FocusTrap from 'focus-trap-react';
import { Icon, Icons } from '../../../components/icons';
import { useNavigateWithTransition } from '../../../hooks/useViewTransitions';
import {
useOrphanRooms,
useOrphanSpaces,
@@ -118,7 +129,7 @@ const SpaceMenu = forwardRef<HTMLDivElement, SpaceMenuProps>(
const allChild = useSpaceChildren(
allRoomsAtom,
room.roomId,
useRecursiveChildScopeFactory(mx, roomToParents)
useRecursiveChildScopeFactory(mx, roomToParents),
);
const unread = useRoomsUnread(allChild, roomToUnreadAtom);
@@ -276,7 +287,7 @@ const SpaceMenu = forwardRef<HTMLDivElement, SpaceMenuProps>(
</Box>
</Menu>
);
}
},
);
type InstructionType = Instruction['type'];
@@ -291,7 +302,7 @@ const useDraggableItem = (
item: SidebarDraggable,
targetRef: RefObject<HTMLElement>,
onDragging: (item?: SidebarDraggable) => void,
dragHandleRef?: RefObject<HTMLElement>
dragHandleRef?: RefObject<HTMLElement>,
): boolean => {
const [dragging, setDragging] = useState(false);
@@ -321,7 +332,7 @@ const useDraggableItem = (
const useDropTarget = (
item: SidebarDraggable,
targetRef: RefObject<HTMLElement>
targetRef: RefObject<HTMLElement>,
): Instruction | undefined => {
const [dropState, setDropState] = useState<Instruction>();
@@ -348,7 +359,7 @@ const useDropTarget = (
indentPerLevel: 0,
mode: 'standard',
block,
}
},
);
const instruction: Instruction | null = extractInstruction(insData);
@@ -370,7 +381,7 @@ const useDropTarget = (
function useDropTargetInstruction<T extends InstructionType>(
item: SidebarDraggable,
targetRef: RefObject<HTMLElement>,
instructionType: T
instructionType: T,
): T | undefined {
const [dropState, setDropState] = useState<T>();
@@ -406,8 +417,8 @@ const useDnDMonitor = (
onReorder: (
draggable: SidebarDraggable,
container: SidebarDraggable,
instruction: InstructionType
) => void
instruction: InstructionType,
) => void,
) => {
useEffect(() => {
const scrollElement = scrollRef.current;
@@ -424,15 +435,14 @@ const useDnDMonitor = (
const item = source.data.item as SidebarDraggable;
const containerItem = dropTargets[0].data.item as SidebarDraggable;
const instructionType = dropTargets[0].data.instructionType as
| InstructionType
| undefined;
InstructionType | undefined;
if (!instructionType) return;
onReorder(item, containerItem, instructionType);
},
}),
autoScrollForElements({
element: scrollElement,
})
}),
);
}, [scrollRef, onDragging, onReorder]);
};
@@ -469,7 +479,7 @@ function SpaceTab({
spaceId: space.roomId,
}
: space.roomId,
[folder, space]
[folder, space],
);
useDraggableItem(spaceDraggable, targetRef, onDragging);
@@ -701,16 +711,18 @@ function HiddenSpacesFolder({
const orphanRooms = useOrphanRooms(mx, allRoomsAtom, mDirects, roomToParents);
const homeUnread = useRoomsUnread(orphanRooms, roomToUnreadAtom);
const handleContextMenu = (spaceId: string): MouseEventHandler<HTMLButtonElement> => (evt) => {
evt.preventDefault();
const cords = evt.currentTarget.getBoundingClientRect();
setMenuSpaceId(spaceId);
setMenuIsHome(false);
setMenuAnchor((currentState) => {
if (currentState) return undefined;
return cords;
});
};
const handleContextMenu =
(spaceId: string): MouseEventHandler<HTMLButtonElement> =>
(evt) => {
evt.preventDefault();
const cords = evt.currentTarget.getBoundingClientRect();
setMenuSpaceId(spaceId);
setMenuIsHome(false);
setMenuAnchor((currentState) => {
if (currentState) return undefined;
return cords;
});
};
const handleHomeContextMenu: MouseEventHandler<HTMLButtonElement> = (evt) => {
evt.preventDefault();
@@ -752,12 +764,13 @@ function HiddenSpacesFolder({
<RoomsUnreadProvider rooms={hiddenSpaces}>
{(unread) => {
// Combine space unreads with home unreads if home is hidden
const totalUnread = homeHidden && homeUnread
? {
total: (unread?.total ?? 0) + homeUnread.total,
highlight: (unread?.highlight ?? 0) + homeUnread.highlight,
}
: unread;
const totalUnread =
homeHidden && homeUnread
? {
total: (unread?.total ?? 0) + homeUnread.total,
highlight: (unread?.highlight ?? 0) + homeUnread.highlight,
}
: unread;
return (
<SidebarItem
@@ -844,9 +857,7 @@ function HiddenSpacesFolder({
roomId={space.roomId}
src={getRoomAvatarUrl(mx, space, 96, useAuthentication) ?? undefined}
alt={space.name}
renderFallback={() => (
<Text size="H6">{nameInitials(space.name, 2)}</Text>
)}
renderFallback={() => <Text size="H6">{nameInitials(space.name, 2)}</Text>}
/>
</SidebarAvatar>
)}
@@ -1044,8 +1055,8 @@ export function SpaceTabs({ scrollRef }: SpaceTabsProps) {
localEchoSidebarItem(parseSidebar(mx, orphanSpaces, newSpacesContent));
mx.setAccountData(AccountDataEvent.CinnySpaces, newSpacesContent);
},
[mx, sidebarItems, setOpenedFolder, localEchoSidebarItem, orphanSpaces]
)
[mx, sidebarItems, setOpenedFolder, localEchoSidebarItem, orphanSpaces],
),
);
const selectedSpaceId = useSelectedSpace();
@@ -1090,7 +1101,7 @@ export function SpaceTabs({ scrollRef }: SpaceTabsProps) {
localEchoSidebarItem(parseSidebar(mx, orphanSpaces, newSpacesContent));
mx.setAccountData(AccountDataEvent.CinnySpaces, newSpacesContent);
},
[mx, sidebarItems, orphanSpaces, localEchoSidebarItem]
[mx, sidebarItems, orphanSpaces, localEchoSidebarItem],
);
const handleHide = useCallback(
@@ -1100,7 +1111,7 @@ export function SpaceTabs({ scrollRef }: SpaceTabsProps) {
localEchoHiddenSpaces(parseHiddenSpaces(mx, newContent));
mx.setAccountData(AccountDataEvent.CinnySpaces, newContent);
},
[mx, orphanSpaces, localEchoSidebarItem, localEchoHiddenSpaces]
[mx, orphanSpaces, localEchoSidebarItem, localEchoHiddenSpaces],
);
if (sidebarItems.length === 0) return null;
@@ -1226,7 +1237,7 @@ export function HiddenSpacesTabs() {
localEchoHiddenSpaces(parseHiddenSpaces(mx, newContent));
mx.setAccountData(AccountDataEvent.CinnySpaces, newContent);
},
[mx, orphanSpaces, localEchoSidebarItem, localEchoHiddenSpaces]
[mx, orphanSpaces, localEchoSidebarItem, localEchoHiddenSpaces],
);
const handleUnhideHome = useCallback(() => {
@@ -30,7 +30,7 @@ function UnverifiedIndicator() {
const verificationStatus = useDeviceVerificationStatus(
crypto,
mx.getSafeUserId(),
currentDevice?.device_id
currentDevice?.device_id,
);
const unverified = verificationStatus === VerificationStatus.Unverified;
@@ -38,7 +38,7 @@ function UnverifiedIndicator() {
const unverifiedDeviceCount = useUnverifiedDeviceCount(
crypto,
mx.getSafeUserId(),
otherDevicesId
otherDevicesId,
);
const [settings, setSettings] = useState(false);