Fix the small mechanical rules. [skip build]
Checks / checks (push) Successful in 2m12s
Trigger cinny-mobile / dispatch (push) Successful in 1s

This commit is contained in:
2026-11-01 10:28:59 +11:00
parent bb85cd9778
commit 73554ecf7f
45 changed files with 331 additions and 347 deletions
+6 -6
View File
@@ -88,12 +88,12 @@ export function RouteTransition({ children }: RouteTransitionProps) {
};
}, [location, displayLocation]);
const className =
transitionStage === 'entering'
? `${transitionContent} ${animateIn}`
: transitionStage === 'exiting'
? `${transitionContent} ${animateOut}`
: transitionContent;
let className = transitionContent;
if (transitionStage === 'entering') {
className = `${transitionContent} ${animateIn}`;
} else if (transitionStage === 'exiting') {
className = `${transitionContent} ${animateOut}`;
}
return (
<div className={transitionContainer}>
@@ -119,16 +119,17 @@ export function RoomMentionAutocomplete({
}
const parentsList = Array.from(parents);
const [firstParent] = parentsList;
let chosenParent: string;
if (parentsList.length === 1) {
chosenParent = parentsList[0];
chosenParent = firstParent;
} else {
const orphanParents = parentsList.filter((p) => !roomToParents.has(p));
if (orphanParents.length > 0) {
chosenParent = guessPerfectParent(mx, currentRoomId, orphanParents) ?? orphanParents[0];
} else {
chosenParent = parentsList[0];
chosenParent = firstParent;
}
}
+8 -7
View File
@@ -21,17 +21,18 @@ export const Icon = forwardRef<SVGSVGElement, IconProps>(
) => {
const pixelSize = ICON_PIXEL_SIZES[size];
let iconStyle = style;
if (size === 'Inherit') {
iconStyle = { width: '1em', height: '1em', ...style };
} else if (pixelSize) {
iconStyle = { width: pixelSize, height: pixelSize, ...style };
}
return (
<LucideIconComponent
ref={ref}
className={classNames(iconStyles.Icon({ size }), className)}
style={
size === 'Inherit'
? { width: '1em', height: '1em', ...style }
: pixelSize
? { width: pixelSize, height: pixelSize, ...style }
: style
}
style={iconStyle}
// Lucide icons are stroke-based; solid fill turns faces (e.g. Smile) into blobs.
// Emphasize selection with a heavier stroke instead.
strokeWidth={filled ? 2.75 : 2}
@@ -70,10 +70,10 @@ function cornerPeelPaths(
const px = cx + ux * size;
const py = cy + uy * size;
let ax = 0;
let ay = 0;
let bx = 0;
let by = 0;
let ax;
let ay;
let bx;
let by;
if (id === 'tr') {
ax = clamp(Math.abs(ux) > eps ? px + (py * uy) / ux : px, 0, w);
+1 -1
View File
@@ -25,7 +25,7 @@ export const Time = as<'span', TimeProps & ComponentProps<typeof Text>>(
({ compact, hour24Clock, dateFormatString, ts, ...props }, ref) => {
const formattedTime = timeHourMinute(ts, hour24Clock);
let time = '';
let time;
if (compact) {
time = formattedTime;
} else if (today(ts)) {
@@ -24,17 +24,14 @@ export function SpeechBubble({
}: SpeechBubbleProps) {
const isMenu = variant === 'menu';
let tailClass: string | undefined;
if (tail === 'top') {
tailClass = isMenu ? css.SpeechBubbleMenuTailTop : css.SpeechBubbleTailTop;
}
return (
<div
className={classNames(
isMenu ? css.SpeechBubbleMenu : css.SpeechBubble,
tail === 'top'
? isMenu
? css.SpeechBubbleMenuTailTop
: css.SpeechBubbleTailTop
: undefined,
className,
)}
className={classNames(isMenu ? css.SpeechBubbleMenu : css.SpeechBubble, tailClass, className)}
style={{
...(tailX ? ({ ['--speech-tail-x' as string]: tailX } as React.CSSProperties) : null),
...style,
+3 -2
View File
@@ -564,10 +564,11 @@ export function TitleBar({ mx, children }: TitleBarProps) {
// Pick the best parent (or first if only one)
const parentsList = Array.from(parents);
const [firstParent] = parentsList;
let chosenParent: string;
if (parentsList.length === 1) {
chosenParent = parentsList[0];
chosenParent = firstParent;
} else {
// Use heuristic to pick best parent
// Prefer a parent that is itself a top-level space (orphan)
@@ -577,7 +578,7 @@ export function TitleBar({ mx, children }: TitleBarProps) {
chosenParent = guessPerfectParent(mx, currentRoomId, orphanParents) ?? orphanParents[0];
} else {
// All parents have parents themselves, just pick first and continue
chosenParent = parentsList[0];
chosenParent = firstParent;
}
}
@@ -133,7 +133,6 @@ export function UserHero({ userId, avatarUrl, avatarMxc, presence, children }: U
type UserHeroNameProps = {
displayName?: string;
userId: string;
avatarMxc?: string;
};
export function UserHeroName({ displayName, userId }: UserHeroNameProps) {
const username = getMxIdLocalPart(userId);
+1 -1
View File
@@ -115,7 +115,7 @@ export class CallService {
private wasMutedBeforeDeafen = false;
private readonly onAudioSettingsChanged = () => {
void this.applyAudioCaptureSettings();
this.applyAudioCaptureSettings();
};
/**
+28 -30
View File
@@ -67,41 +67,39 @@ export function getLiveKitHomeserverPriority(
}
}
}
} else {
} else if (isDM) {
// Starting new call - use original priority logic
if (isDM) {
console.log(`[getLiveKitHomeserverPriority] DM path - user homeserver first`);
// For DMs: user's homeserver first, then other member's homeserver
servers.push(userHomeserver);
console.log(`[getLiveKitHomeserverPriority] DM path - user homeserver first`);
// For DMs: user's homeserver first, then other member's homeserver
servers.push(userHomeserver);
const otherUserId = guessDmRoomUserId(room, myUserId);
console.log(`[getLiveKitHomeserverPriority] Other user ID: ${otherUserId}`);
if (otherUserId && otherUserId !== myUserId) {
const otherServer = getMxIdServer(otherUserId);
console.log(`[getLiveKitHomeserverPriority] Other user server: ${otherServer}`);
const userDomain = userHomeserver.replace('https://', '').replace('http://', '');
if (otherServer && otherServer !== userDomain) {
servers.push(`https://${otherServer}`);
}
}
} else {
console.log(`[getLiveKitHomeserverPriority] Channel path - room homeserver first`);
// For channels: room's homeserver first, then user's homeserver
const roomServer = getRoomServer(room.roomId);
console.log(`[getLiveKitHomeserverPriority] Room server from ID: ${roomServer}`);
if (roomServer) {
servers.push(`https://${roomServer}`);
}
// Fallback to user's homeserver if different
const otherUserId = guessDmRoomUserId(room, myUserId);
console.log(`[getLiveKitHomeserverPriority] Other user ID: ${otherUserId}`);
if (otherUserId && otherUserId !== myUserId) {
const otherServer = getMxIdServer(otherUserId);
console.log(`[getLiveKitHomeserverPriority] Other user server: ${otherServer}`);
const userDomain = userHomeserver.replace('https://', '').replace('http://', '');
console.log(
`[getLiveKitHomeserverPriority] User domain: ${userDomain}, room server: ${roomServer}`,
);
if (!roomServer || roomServer !== userDomain) {
servers.push(userHomeserver);
if (otherServer && otherServer !== userDomain) {
servers.push(`https://${otherServer}`);
}
}
} else {
console.log(`[getLiveKitHomeserverPriority] Channel path - room homeserver first`);
// For channels: room's homeserver first, then user's homeserver
const roomServer = getRoomServer(room.roomId);
console.log(`[getLiveKitHomeserverPriority] Room server from ID: ${roomServer}`);
if (roomServer) {
servers.push(`https://${roomServer}`);
}
// Fallback to user's homeserver if different
const userDomain = userHomeserver.replace('https://', '').replace('http://', '');
console.log(
`[getLiveKitHomeserverPriority] User domain: ${userDomain}, room server: ${roomServer}`,
);
if (!roomServer || roomServer !== userDomain) {
servers.push(userHomeserver);
}
}
console.log(`[getLiveKitHomeserverPriority] Final server list:`, servers);
+7 -7
View File
@@ -385,19 +385,19 @@ function ForumThreadDetailBody({
// Local echo can land slightly after send; refresh once more.
window.setTimeout(() => {
void reloadThread().then(applyLoaded);
reloadThread().then(applyLoaded);
}, 400);
}, [onReplySent, reloadThread]);
const handleDeleted = useCallback(() => {
void handleComposerSent();
handleComposerSent();
}, [handleComposerSent]);
useForumRoomLiveUpdates(
[room],
() => {
setContentRevision((revision) => revision + 1);
void reloadThread();
reloadThread();
},
{ threadRootId: rootEventId, wait: 150 },
);
@@ -418,14 +418,14 @@ function ForumThreadDetailBody({
const eventId = rootEvent.getId();
if (!eventId) return;
mx.redactEvent(roomId, eventId).then(() => {
void handleComposerSent();
handleComposerSent();
});
}, [handleComposerSent, mx, rootEvent, roomId]);
const handleEditRootClose = useCallback(() => {
setEditEventId(undefined);
setContentRevision((revision) => revision + 1);
void handleComposerSent();
handleComposerSent();
}, [handleComposerSent]);
const toggleBranch = useCallback((branchKey: string) => {
@@ -585,7 +585,7 @@ function ForumThreadDetailBody({
editEventId={editEventId}
onEditEventId={setEditEventId}
onComposerSent={() => {
void handleComposerSent();
handleComposerSent();
}}
onDeleted={handleDeleted}
onReplyTo={handleReplyTo}
@@ -607,7 +607,7 @@ function ForumThreadDetailBody({
replyToEventId={replyToEventId}
fileDropContainerRef={dropRef}
onSent={() => {
void handleComposerSent();
handleComposerSent();
}}
/>
</div>
@@ -91,14 +91,14 @@ export function ForumTopicSearchInput({
qualifierMatches.length,
]);
const suggestionCount =
suggestionMode === 'author'
? authorMatches.length
: suggestionMode === 'title'
? titleMatches.length
: suggestionMode === 'qualifier'
? qualifierMatches.length
: 0;
let suggestionCount = 0;
if (suggestionMode === 'author') {
suggestionCount = authorMatches.length;
} else if (suggestionMode === 'title') {
suggestionCount = titleMatches.length;
} else if (suggestionMode === 'qualifier') {
suggestionCount = qualifierMatches.length;
}
const showPills = suggestionMode !== null && suggestionCount > 0;
const parsed = parseTopicSearchQuery(value);
@@ -261,12 +261,12 @@ export function ForumTopicSearchInput({
event.preventDefault();
const tabKey =
suggestionMode === 'author'
? `author:${valueContext?.partial ?? ''}`
: suggestionMode === 'title'
? `title:${valueContext?.partial ?? ''}`
: `qualifier:${qualifierPartial}`;
let tabKey = `qualifier:${qualifierPartial}`;
if (suggestionMode === 'author') {
tabKey = `author:${valueContext?.partial ?? ''}`;
} else if (suggestionMode === 'title') {
tabKey = `title:${valueContext?.partial ?? ''}`;
}
const nextIndex = tabKey === tabPartial ? (highlightIndex + 1) % suggestionCount : 0;
setTabPartial(tabKey);
@@ -280,12 +280,12 @@ export function ForumTopicSearchInput({
setCaret(input.selectionStart ?? input.value.length);
};
const pillsLabel =
suggestionMode === 'author'
? 'Author suggestions'
: suggestionMode === 'title'
? 'Title suggestions'
: 'Search qualifiers';
let pillsLabel = 'Search qualifiers';
if (suggestionMode === 'author') {
pillsLabel = 'Author suggestions';
} else if (suggestionMode === 'title') {
pillsLabel = 'Title suggestions';
}
const matchKeys = new Set(qualifierMatches.map((item) => item.key));
+3 -3
View File
@@ -236,7 +236,7 @@ export function useForumBoard(scope: ForumBoardScope, forumSpace: Room) {
useEffect(() => {
if (loadingSections) return;
void refreshThreads();
refreshThreads();
}, [
loadingSections,
refreshThreads,
@@ -251,12 +251,12 @@ export function useForumBoard(scope: ForumBoardScope, forumSpace: Room) {
if (loadingSections) return [];
const roomScopes = scopesFromSelection(sections, filterQuery.category, filterQuery.topic);
return roomScopes
.map((scope) => mx.getRoom(scope.roomId))
.map((roomScope) => mx.getRoom(roomScope.roomId))
.filter((room): room is Room => room !== null);
}, [loadingSections, sections, filterQuery.category, filterQuery.topic, mx]);
useForumRoomLiveUpdates(scopedRooms, () => {
void refreshThreads({ silent: true });
refreshThreads({ silent: true });
});
const selectedPostId = query.post ?? null;
+1 -1
View File
@@ -190,7 +190,7 @@ function SpaceCardLobby() {
useEffect(() => {
let cancelled = false;
void (async () => {
(async () => {
try {
const all = await fetchAllHierarchyRooms(mx, space.roomId, 3);
if (cancelled) return;
@@ -152,11 +152,7 @@ export function CallParticipantsIndicator({ roomId }: CallParticipantsIndicatorP
size="50"
style={{
opacity: config.opacity.P500,
color: isDeafened
? 'var(--color-Critical-Main)'
: isMuted
? 'var(--color-Critical-Main)'
: undefined,
color: isDeafened || isMuted ? 'var(--color-Critical-Main)' : undefined,
}}
/>
<Text as="span" size="T200" truncate>
+2 -2
View File
@@ -365,13 +365,13 @@ export function RoomNavItem({
const avatarContent = avatarEvent?.getContent();
const avatarMxc =
avatarContent && typeof avatarContent.url === 'string' ? avatarContent.url : undefined;
const avatarUrl = avatarMxc
const parentAvatarUrl = avatarMxc
? (mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96, 'crop') ?? undefined)
: undefined;
return {
name: parentSpace.name,
avatarUrl,
avatarUrl: parentAvatarUrl,
roomId: parentSpace.roomId,
};
})();
+35 -34
View File
@@ -71,43 +71,44 @@ export function Room() {
),
);
let mainView: React.ReactNode;
if (!showMediaSolo) {
if (showAppView) {
mainView = <RoomAppView room={room} onShowChat={() => setPreferChat(true)} />;
} else if (forumRoom) {
mainView = <ForumRoomView room={room} eventId={eventId} />;
} else {
mainView = (
<Box grow="Yes" direction="Column" style={{ minWidth: 0, minHeight: 0 }}>
{hasAppUi && preferChat && (
<Box
shrink="No"
alignItems="Center"
justifyContent="SpaceBetween"
gap="200"
style={{
padding: `${config.space.S200} ${config.space.S300}`,
borderBottom: '1px solid var(--bq-surface-border, CurrentColor)',
}}
>
<Text size="T300">Room app available</Text>
<Button size="300" variant="Primary" radii="300" onClick={() => setPreferChat(false)}>
<Text size="B300">Show app</Text>
</Button>
</Box>
)}
<Box grow="Yes" direction="Column" style={{ minWidth: 0, minHeight: 0 }}>
<RoomView room={room} eventId={eventId} />
</Box>
</Box>
);
}
}
return (
<PowerLevelsContextProvider value={powerLevels}>
<Box grow="Yes">
{!showMediaSolo &&
(showAppView ? (
<RoomAppView room={room} onShowChat={() => setPreferChat(true)} />
) : forumRoom ? (
<ForumRoomView room={room} eventId={eventId} />
) : (
<Box grow="Yes" direction="Column" style={{ minWidth: 0, minHeight: 0 }}>
{hasAppUi && preferChat && (
<Box
shrink="No"
alignItems="Center"
justifyContent="SpaceBetween"
gap="200"
style={{
padding: `${config.space.S200} ${config.space.S300}`,
borderBottom: '1px solid var(--bq-surface-border, CurrentColor)',
}}
>
<Text size="T300">Room app available</Text>
<Button
size="300"
variant="Primary"
radii="300"
onClick={() => setPreferChat(false)}
>
<Text size="B300">Show app</Text>
</Button>
</Box>
)}
<Box grow="Yes" direction="Column" style={{ minWidth: 0, minHeight: 0 }}>
<RoomView room={room} eventId={eventId} />
</Box>
</Box>
))}
{mainView}
{showMediaSolo && <MediaDrawer room={room} solo />}
{!showMediaSolo && showRightDrawer && (
<>
+10 -12
View File
@@ -684,10 +684,10 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
);
const setReturnToEventId = useCallback(
(eventId: string | null) => {
if (eventId) setRoomReturnAnchor(room.roomId, eventId);
(targetEventId: string | null) => {
if (targetEventId) setRoomReturnAnchor(room.roomId, targetEventId);
else clearRoomReturnAnchor(room.roomId);
setReturnToEventIdState(eventId);
setReturnToEventIdState(targetEventId);
},
[room.roomId],
);
@@ -1345,11 +1345,11 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
// Setup copy handler for better copy formatting (Name - Time: Message)
useEffect(() => {
const getMessageData = (eventId: string) => {
const getMessageData = (messageEventId: string) => {
const timelineSet = room.getUnfilteredTimelineSet();
const evtTimeline = timelineSet.getTimelineForEvent(eventId);
const evtTimeline = timelineSet.getTimelineForEvent(messageEventId);
if (!evtTimeline) return null;
const mEvent = evtTimeline.getEvents().find((e) => e.getId() === eventId);
const mEvent = evtTimeline.getEvents().find((e) => e.getId() === messageEventId);
if (!mEvent) return null;
const sender =
getMemberDisplayName(room, mEvent.getSender() ?? '') ??
@@ -2231,13 +2231,11 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
`${senderName} ${startedWith} and ${opposite} ${cycles} times, then ${startedWith}`,
);
}
} else {
} else if (cycles === 1) {
// Ended on opposite action (equal joins/leaves or started-opposite pattern)
if (cycles === 1) {
summaryParts.push(`${senderName} ${startedWith}, then ${opposite}`);
} else {
summaryParts.push(`${senderName} ${startedWith} and ${opposite} ${cycles} times`);
}
summaryParts.push(`${senderName} ${startedWith}, then ${opposite}`);
} else {
summaryParts.push(`${senderName} ${startedWith} and ${opposite} ${cycles} times`);
}
} else if (joins > 1) {
summaryParts.push(`${senderName} joined ${joins} times`);
+6 -5
View File
@@ -546,11 +546,12 @@ export function RoomViewHeader({ forumLayout = false }: RoomViewHeaderProps) {
const searchParams: _SearchPathSearchParams = {
rooms: room.roomId,
};
const path = space
? getSpaceSearchPath(getCanonicalAliasOrRoomId(mx, space.roomId))
: isDirect || onDirectPath
? getDirectSearchPath()
: getHomeSearchPath();
let path = getHomeSearchPath();
if (space) {
path = getSpaceSearchPath(getCanonicalAliasOrRoomId(mx, space.roomId));
} else if (isDirect || onDirectPath) {
path = getDirectSearchPath();
}
navigate(withSearchParam(path, searchParams));
};
@@ -36,11 +36,7 @@ export function measureJumboGlyph(targetEventId: string): JumboGlyphMetrics | nu
0;
const isImg = glyph instanceof HTMLImageElement || glyph.tagName === 'IMG';
const size = isImg
? Math.max(rect.width, rect.height)
: fontSize > 0
? fontSize
: Math.max(rect.width, rect.height);
const size = isImg || fontSize <= 0 ? Math.max(rect.width, rect.height) : fontSize;
return {
mount,
@@ -340,11 +340,11 @@ export function createFireworkSim(
const spawnPlan = buildSpawnPlan(profile, primaryEmoji, startMs);
// Keep the spewing stand-in up for the whole fountain — not just a short flash.
const lastSpawnAt = spawnPlan.length > 0 ? spawnPlan[spawnPlan.length - 1].atMs : startMs;
const heroUntilMs = profile.morphTo
? profile.heroDurationMs != null
? startMs + profile.heroDurationMs
: lastSpawnAt + 120
: null;
let heroUntilMs = null;
if (profile.morphTo) {
heroUntilMs =
profile.heroDurationMs != null ? startMs + profile.heroDurationMs : lastSpawnAt + 120;
}
return {
particles: [],
@@ -30,10 +30,11 @@ export function sendEmojiConfettiEvent(
mx: MatrixClient,
roomId: string,
targetEventId: string,
emojis: string[],
emojiList: string[],
) {
const content: EmojiConfettiContent = {
emojis,
// emojis is the event content wire field
emojis: emojiList,
msgtype: EMOJI_CONFETTI_EVENT_TYPE,
target_event_id: targetEventId,
};
+8 -8
View File
@@ -901,14 +901,14 @@ export const Message = as<'div', MessageProps>(
</Box>
);
const presenceClass =
senderPresence?.presence === Presence.Online
? css.MessageAvatarOnline
: senderPresence?.presence === Presence.Unavailable
? css.MessageAvatarUnavailable
: senderPresence?.presence === Presence.Offline
? css.MessageAvatarOffline
: undefined;
let presenceClass;
if (senderPresence?.presence === Presence.Online) {
presenceClass = css.MessageAvatarOnline;
} else if (senderPresence?.presence === Presence.Unavailable) {
presenceClass = css.MessageAvatarUnavailable;
} else if (senderPresence?.presence === Presence.Offline) {
presenceClass = css.MessageAvatarOffline;
}
const avatarJSX = !collapse && messageLayout !== MessageLayout.Compact && (
<AvatarBase
+65 -72
View File
@@ -205,6 +205,70 @@ export function Settings({ initialPage, requestClose }: SettingsProps) {
const isSearching = searchQuery.trim().length > 0;
let navContent: React.ReactNode;
if (isSearching) {
if (searchResults.length > 0) {
navContent = searchResults.map(({ item }) => (
<button
key={`${item.page}-${item.title}`}
type="button"
className={SettingsSearchResult}
aria-pressed={activePage === item.page}
onClick={() => openSearchResult(item.page, item.title)}
>
<Box shrink="No" style={{ paddingTop: config.space.S100 }}>
<Icon
src={iconByPage.get(item.page) ?? Icons.Setting}
size="100"
filled={activePage === item.page}
/>
</Box>
<Box grow="Yes" direction="Column" gap="100" style={{ minWidth: 0 }}>
<Text
className={BreakWord}
size="T300"
style={{
fontWeight: activePage === item.page ? config.fontWeight.W600 : undefined,
}}
>
{item.title}
</Text>
<Text size="T200" priority="300">
{pageNameByPage.get(item.page)}
</Text>
</Box>
</button>
));
} else {
navContent = (
<Box direction="Column" alignItems="Center" style={{ padding: config.space.S400 }}>
<Text size="T300" priority="300" className={BreakWord}>
No settings match “{searchQuery.trim()}”
</Text>
</Box>
);
}
} else {
navContent = menuItems.map((item) => (
<MenuItem
key={item.name}
variant="Background"
radii="400"
aria-pressed={activePage === item.page}
before={<Icon src={item.icon} size="100" filled={activePage === item.page} />}
onClick={() => setActivePage(item.page)}
>
<Text
style={{ fontWeight: activePage === item.page ? config.fontWeight.W600 : undefined }}
size="T300"
truncate
>
{item.name}
</Text>
</MenuItem>
));
}
return (
<SettingsFocusProvider value={settingsFocus}>
<PageRoot
@@ -261,78 +325,7 @@ export function Settings({ initialPage, requestClose }: SettingsProps) {
/>
</Box>
<PageNavContent>
<div style={{ flexGrow: 1 }}>
{isSearching ? (
searchResults.length > 0 ? (
searchResults.map(({ item }) => (
<button
key={`${item.page}-${item.title}`}
type="button"
className={SettingsSearchResult}
aria-pressed={activePage === item.page}
onClick={() => openSearchResult(item.page, item.title)}
>
<Box shrink="No" style={{ paddingTop: config.space.S100 }}>
<Icon
src={iconByPage.get(item.page) ?? Icons.Setting}
size="100"
filled={activePage === item.page}
/>
</Box>
<Box grow="Yes" direction="Column" gap="100" style={{ minWidth: 0 }}>
<Text
className={BreakWord}
size="T300"
style={{
fontWeight:
activePage === item.page ? config.fontWeight.W600 : undefined,
}}
>
{item.title}
</Text>
<Text size="T200" priority="300">
{pageNameByPage.get(item.page)}
</Text>
</Box>
</button>
))
) : (
<Box
direction="Column"
alignItems="Center"
style={{ padding: config.space.S400 }}
>
<Text size="T300" priority="300" className={BreakWord}>
No settings match “{searchQuery.trim()}”
</Text>
</Box>
)
) : (
menuItems.map((item) => (
<MenuItem
key={item.name}
variant="Background"
radii="400"
aria-pressed={activePage === item.page}
before={
<Icon src={item.icon} size="100" filled={activePage === item.page} />
}
onClick={() => setActivePage(item.page)}
>
<Text
style={{
fontWeight:
activePage === item.page ? config.fontWeight.W600 : undefined,
}}
size="T300"
truncate
>
{item.name}
</Text>
</MenuItem>
))
)}
</div>
<div style={{ flexGrow: 1 }}>{navContent}</div>
</PageNavContent>
<Box style={{ padding: config.space.S200 }} shrink="No" direction="Column">
<UseStateProvider initial={false}>
@@ -390,9 +390,9 @@ function ProfileBanner({
setError(undefined);
try {
await mx.setAvatarUrl(upload.mxc);
const userId = mx.getUserId();
if (userId) {
const user = mx.getUser(userId);
const currentUserId = mx.getUserId();
if (currentUserId) {
const user = mx.getUser(currentUserId);
if (user && user.avatarUrl !== upload.mxc) {
user.setAvatarUrl(upload.mxc);
}
+40 -32
View File
@@ -771,6 +771,42 @@ export function Audio({ requestClose }: AudioProps) {
settings.autoGainControl,
]);
let micVariant: 'Critical' | 'Success' | 'Secondary';
if (micTestState === 'error') {
micVariant = 'Critical';
} else if (micTestState === 'done') {
micVariant = 'Success';
} else {
micVariant = 'Secondary';
}
let micLabel = 'Test';
if (micTestState === 'testing') {
micLabel = 'Testing...';
} else if (micTestState === 'done') {
micLabel = 'Done ✓';
} else if (micTestState === 'error') {
micLabel = 'Failed';
}
let speakerVariant: 'Critical' | 'Success' | 'Secondary';
if (speakerTestState === 'error') {
speakerVariant = 'Critical';
} else if (speakerTestState === 'done') {
speakerVariant = 'Success';
} else {
speakerVariant = 'Secondary';
}
let speakerLabel = 'Test';
if (speakerTestState === 'testing') {
speakerLabel = 'Playing...';
} else if (speakerTestState === 'done') {
speakerLabel = 'Done ✓';
} else if (speakerTestState === 'error') {
speakerLabel = 'Failed';
}
return (
<Page>
<PageHeader>
@@ -833,27 +869,13 @@ export function Audio({ requestClose }: AudioProps) {
<Box gap="200" alignItems="Center">
<Button
size="300"
variant={
micTestState === 'error'
? 'Critical'
: micTestState === 'done'
? 'Success'
: 'Secondary'
}
variant={micVariant}
fill="Soft"
radii="300"
onClick={handleTestMicrophone}
disabled={micTestState === 'testing' || micMonitoring}
>
<Text size="T300">
{micTestState === 'testing'
? 'Testing...'
: micTestState === 'done'
? 'Done ✓'
: micTestState === 'error'
? 'Failed'
: 'Test'}
</Text>
<Text size="T300">{micLabel}</Text>
</Button>
<Button
size="300"
@@ -915,27 +937,13 @@ export function Audio({ requestClose }: AudioProps) {
/>
<Button
size="300"
variant={
speakerTestState === 'error'
? 'Critical'
: speakerTestState === 'done'
? 'Success'
: 'Secondary'
}
variant={speakerVariant}
fill="Soft"
radii="300"
onClick={handleTestSpeaker}
disabled={speakerTestState === 'testing'}
>
<Text size="T300">
{speakerTestState === 'testing'
? 'Playing...'
: speakerTestState === 'done'
? 'Done ✓'
: speakerTestState === 'error'
? 'Failed'
: 'Test'}
</Text>
<Text size="T300">{speakerLabel}</Text>
</Button>
</Box>
}
@@ -98,9 +98,9 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
);
const handleProfileExpand = useCallback(
(expand: boolean) => {
setProfileExpand(expand);
if (expand) fetchProfileFields(profileUserId.trim());
(expanded: boolean) => {
setProfileExpand(expanded);
if (expanded) fetchProfileFields(profileUserId.trim());
},
[fetchProfileFields, profileUserId],
);
@@ -184,11 +184,12 @@ function AndroidPushNotifications() {
const refresh = useCallback(async () => {
setLoading(true);
const s = await getBackgroundSyncStatus();
const distributors = Array.isArray(s?.distributors)
? s.distributors
: typeof s?.distributors === 'string' && s.distributors && s.distributors !== '[]'
? [s.distributors]
: [];
let distributors: string[] = [];
if (Array.isArray(s?.distributors)) {
distributors = s.distributors;
} else if (typeof s?.distributors === 'string' && s.distributors && s.distributors !== '[]') {
distributors = [s.distributors];
}
setStatus(
s
? {
@@ -205,7 +206,7 @@ function AndroidPushNotifications() {
}, []);
useEffect(() => {
void refresh();
refresh();
}, [refresh]);
const [resetState, reset] = useAsyncCallback(
@@ -109,7 +109,7 @@ export function PluginLoader({ matrixClient, children }: PluginLoaderProps) {
};
}, [matrixClient]);
return <>{children}</>;
return children;
}
/**
@@ -367,10 +367,8 @@ export function Permissions({ requestClose }: PermissionsProps) {
have permission.
<Text as="span" style={{ color: color.Warning.Main }}>
{' '}
You don't have permission to edit {
nonSyncableChildren.length
} other{' '}
{nonSyncableChildren.length === 1 ? 'space/room' : 'spaces/rooms'}
You don&apos;t have permission to edit {nonSyncableChildren.length}{' '}
other {nonSyncableChildren.length === 1 ? 'space/room' : 'spaces/rooms'}
{nonSyncableChildren.length <= 5 && (
<>: {nonSyncableChildren.map((c) => c.name).join(', ')}</>
)}
+1 -1
View File
@@ -280,7 +280,7 @@ export function useAutoJoinOnSpaceVisit(space: Room | undefined): void {
const spaceId = space.roomId;
let cancelled = false;
void (async () => {
(async () => {
try {
await autoJoinSpaceChildren(mx, spaceId, (current, total) => {
if (!cancelled) {
+1 -1
View File
@@ -112,7 +112,7 @@ export const parseTimestampFlag = (input: string): number | undefined => {
const unit = match[2];
const now = Date.now(); // in milliseconds
let delta = 0;
let delta;
switch (unit) {
case 'd':
+1 -1
View File
@@ -25,7 +25,7 @@ export const useFilePasteHandler = (onPaste: (file: File[]) => void): ClipboardE
// preventDefault before the async read, or the editor also inserts text.
evt.preventDefault();
void readClipboardImage().then((clipboardImage) => {
readClipboardImage().then((clipboardImage) => {
if (clipboardImage) onPaste([clipboardImage]);
});
},
+1 -5
View File
@@ -91,11 +91,7 @@ const toMediaItem = (mEvent: MatrixEvent): RoomMediaItem | undefined => {
eventId,
msgtype,
thumbMxc,
thumbMimeType: usingThumbEnc
? info?.thumbnail_info?.mimetype
: thumbMxc
? info?.thumbnail_info?.mimetype
: undefined,
thumbMimeType: usingThumbEnc || thumbMxc ? info?.thumbnail_info?.mimetype : undefined,
thumbEncInfo: usingThumbEnc ? thumbFile : undefined,
fullMxc,
fullMimeType: info?.mimetype,
+3 -9
View File
@@ -182,15 +182,9 @@ function getCurrentRoomId(): string | null {
try {
// Get the pathname from URL
// Support both normal routing and hash routing
let { pathname } = window.location;
// If using hash router, parse from hash
if (window.location.hash) {
const hashMatch = window.location.hash.match(/#(.+)/);
if (hashMatch) {
pathname = hashMatch[1];
}
}
const hashMatch = window.location.hash.match(/#(.+)/);
const [, hashPath] = hashMatch ?? [];
const pathname = hashPath ?? window.location.pathname;
// URL patterns:
// /home/:roomIdOrAlias/:eventId?/
+1 -1
View File
@@ -674,7 +674,7 @@ function AndroidShareIntentHandler() {
return () => {
mounted = false;
void listenerHandle?.remove();
listenerHandle?.remove();
};
}, []);
+9 -7
View File
@@ -91,6 +91,14 @@ export function DirectTab() {
return cords;
});
};
let iconSrc = PaarrotSVG;
if (directUnread?.highlight) {
iconSrc = PaarrotHighlightSVG;
} else if (directUnread?.total) {
iconSrc = PaarrotUnreadSVG;
}
return (
<SidebarItem active={directSelected}>
<SidebarItemTooltip tooltip="Direct Messages">
@@ -102,13 +110,7 @@ export function DirectTab() {
onContextMenu={handleContextMenu}
>
<img
src={
directUnread?.highlight
? PaarrotHighlightSVG
: directUnread?.total
? PaarrotUnreadSVG
: PaarrotSVG
}
src={iconSrc}
alt="Direct Messages"
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
/>
+6 -2
View File
@@ -295,8 +295,12 @@ export function CodeBlock({ children }: { children: ChildNode[] }) {
const [override, setOverride] = useState(AUTO_LANGUAGE);
const [menuCords, setMenuCords] = useState<RectCords>();
const activeLanguage =
override === AUTO_LANGUAGE ? language : override === PLAIN_LANGUAGE ? undefined : override;
let activeLanguage: string | undefined = override;
if (override === AUTO_LANGUAGE) {
activeLanguage = language;
} else if (override === PLAIN_LANGUAGE) {
activeLanguage = undefined;
}
const languageLabel =
override === AUTO_LANGUAGE
? (language ?? 'Code')
+3 -3
View File
@@ -316,7 +316,7 @@ class AndroidUnifiedPushManager {
}
this.distributorSetupAttempted = true;
void this.tryRequestDistributorSetup();
this.tryRequestDistributorSetup();
}
/** Re-opens distributor selection once after ACTION_REQUIRED and logs actionable status. */
@@ -385,12 +385,12 @@ class AndroidUnifiedPushManager {
this.listenerHandles = [
await MatrixBackgroundSync.addListener('unifiedPushNewEndpoint', (event) => {
void this.handleNewEndpoint(event).catch((err) => {
this.handleNewEndpoint(event).catch((err) => {
console.error('[BackgroundSync] handleNewEndpoint failed:', err);
});
}),
await MatrixBackgroundSync.addListener('unifiedPushUnregistered', (event) => {
void this.handleUnregistered(event);
this.handleUnregistered(event);
}),
await MatrixBackgroundSync.addListener('unifiedPushRegistrationFailed', (event) => {
this.handleRegistrationFailed(event);
+1 -1
View File
@@ -139,7 +139,7 @@ export const randomStr = (len = 12): string => {
export const suffixRename = (name: string, validator: (newName: string) => boolean): string => {
let suffix = 1;
let newName = name;
let newName;
do {
newName = name + suffix;
suffix += 1;
+2 -4
View File
@@ -68,9 +68,6 @@ export const setupCopyHandler = (
// Format the time
const timeStr = timeHourMinute(data.ts, hour24Clock);
// Extract the selected text from within this message's content
let selectedText = '';
// Create a range for this message's content
const contentRange = document.createRange();
contentRange.selectNodeContents(contentEl);
@@ -88,7 +85,8 @@ export const setupCopyHandler = (
extractRange.setEnd(contentRange.endContainer, contentRange.endOffset);
}
selectedText = extractRange.toString().trim();
// Extract the selected text from within this message's content
const selectedText = extractRange.toString().trim();
if (selectedText) {
messages.push({
+4 -4
View File
@@ -289,14 +289,14 @@ export function groupCollectibleItems(items: DiscordCollectibleItem[]): Collecti
return [...map.entries()]
.map(([id, groupItems]) => {
const items = dedupeVariantItems(groupItems).sort((a, b) =>
const sortedItems = dedupeVariantItems(groupItems).sort((a, b) =>
variantItemLabel(a).localeCompare(variantItemLabel(b)),
);
return {
id,
name: variantGroupDisplayName(items[0]),
category: items[0].category,
items,
name: variantGroupDisplayName(sortedItems[0]),
category: sortedItems[0].category,
items: sortedItems,
};
})
.sort((a, b) => a.name.localeCompare(b.name));
+9 -7
View File
@@ -83,13 +83,14 @@ export function parseColorPreference(value: unknown): ColorPreference | undefine
if (!value || typeof value !== 'object') return undefined;
const obj = value as Record<string, unknown>;
const on_dark =
const onDark =
typeof obj.on_dark === 'string' && isValidHexColor(obj.on_dark) ? obj.on_dark : undefined;
const on_light =
const onLight =
typeof obj.on_light === 'string' && isValidHexColor(obj.on_light) ? obj.on_light : undefined;
if (!on_dark && !on_light) return undefined;
return { on_dark, on_light };
if (!onDark && !onLight) return undefined;
// on_dark/on_light are the MSC4522 wire keys, so the property names stay
return { on_dark: onDark, on_light: onLight };
}
export function extractColorPreferenceFromProfile(
@@ -128,10 +129,10 @@ export function extractBannerUrlFromProfile(profile: Record<string, unknown>): s
function parseStoredCollectible(value: unknown): StoredCollectible | undefined {
if (!value || typeof value !== 'object') return undefined;
const obj = value as Record<string, unknown>;
const sku_id = typeof obj.sku_id === 'string' ? obj.sku_id : undefined;
const skuId = typeof obj.sku_id === 'string' ? obj.sku_id : undefined;
const name = typeof obj.name === 'string' ? obj.name : undefined;
const { assets } = obj;
if (!sku_id || !name || !assets || typeof assets !== 'object') return undefined;
if (!skuId || !name || !assets || typeof assets !== 'object') return undefined;
const parsedAssets: Record<string, string> = {};
Object.entries(assets as Record<string, unknown>).forEach(([key, mxc]) => {
@@ -142,7 +143,8 @@ function parseStoredCollectible(value: unknown): StoredCollectible | undefined {
if (Object.keys(parsedAssets).length === 0) return undefined;
return {
sku_id,
// sku_id is the Discord collectible wire key
sku_id: skuId,
name,
assets: parsedAssets,
effect: obj.effect,
@@ -44,6 +44,5 @@ export function registerDesktopMediaSaver(): void {
registerMediaSaver(async (blob, filename) => {
await saveWithElectron(blob, filename);
});
return;
}
}
+6 -7
View File
@@ -134,7 +134,6 @@ export const focusWindow = async (): Promise<void> => {
if (electron?.window?.focus) {
await electron.window.focus();
}
return;
} catch (err) {
console.warn('Failed to focus Electron window:', err);
}
@@ -426,12 +425,12 @@ export const readClipboardImage = async (): Promise<File | null> => {
if (electron?.clipboard?.readImage) {
const result = await electron.clipboard.readImage();
// IPC may return a data URL string or { success, data } depending on path.
const dataUrl =
typeof result === 'string'
? result
: result && typeof result === 'object' && typeof result.data === 'string'
? result.data
: null;
let dataUrl = null;
if (typeof result === 'string') {
dataUrl = result;
} else if (result && typeof result === 'object' && typeof result.data === 'string') {
dataUrl = result.data;
}
if (!dataUrl) return null;
// Convert data URL to File