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