Fix the small mechanical rules. [skip build]
This commit is contained in:
@@ -115,7 +115,7 @@ export class CallService {
|
||||
private wasMutedBeforeDeafen = false;
|
||||
|
||||
private readonly onAudioSettingsChanged = () => {
|
||||
void this.applyAudioCaptureSettings();
|
||||
this.applyAudioCaptureSettings();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -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 && (
|
||||
<>
|
||||
|
||||
@@ -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`);
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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't have permission to edit {nonSyncableChildren.length}{' '}
|
||||
other {nonSyncableChildren.length === 1 ? 'space/room' : 'spaces/rooms'}
|
||||
{nonSyncableChildren.length <= 5 && (
|
||||
<>: {nonSyncableChildren.map((c) => c.name).join(', ')}</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user