Turn off the accepted rules and fix the design tokens, alt text, and last type errors. [skip build]
This commit is contained in:
@@ -86,7 +86,7 @@ export const SidebarDockedCallHeader = style({
|
||||
color: color.Surface.OnContainer,
|
||||
cursor: 'grab',
|
||||
padding: config.space.S100,
|
||||
borderRadius: config.radii.R200,
|
||||
borderRadius: config.radii.R300,
|
||||
selectors: {
|
||||
'&:hover': {
|
||||
backgroundColor: color.Surface.ContainerHover,
|
||||
|
||||
@@ -367,7 +367,6 @@ export function ScreenShareItem({ share }: ScreenShareItemProps) {
|
||||
|
||||
// Handle remote screenshare (LiveKit track)
|
||||
if (!share.isLocal && share.track) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const track = share.track as any;
|
||||
|
||||
if (typeof track.attach === 'function') {
|
||||
@@ -464,23 +463,19 @@ export function ScreenShareItem({ share }: ScreenShareItemProps) {
|
||||
<script>
|
||||
let hideTimeout = null;
|
||||
const closeButton = document.getElementById('closeButton');
|
||||
|
||||
function showCloseButton() {
|
||||
if (hideTimeout) {
|
||||
clearTimeout(hideTimeout);
|
||||
hideTimeout = null;
|
||||
}
|
||||
closeButton.classList.add('visible');
|
||||
|
||||
hideTimeout = setTimeout(() => {
|
||||
closeButton.classList.remove('visible');
|
||||
hideTimeout = null;
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
// Show on any mouse movement
|
||||
document.addEventListener('mousemove', showCloseButton, true);
|
||||
|
||||
// Keep visible when hovering over button
|
||||
closeButton.addEventListener('mouseenter', () => {
|
||||
if (hideTimeout) {
|
||||
@@ -489,7 +484,6 @@ export function ScreenShareItem({ share }: ScreenShareItemProps) {
|
||||
}
|
||||
closeButton.classList.add('visible');
|
||||
});
|
||||
|
||||
// Start hide timer when leaving button
|
||||
closeButton.addEventListener('mouseleave', () => {
|
||||
hideTimeout = setTimeout(() => {
|
||||
@@ -497,12 +491,10 @@ export function ScreenShareItem({ share }: ScreenShareItemProps) {
|
||||
hideTimeout = null;
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
// Close window on click
|
||||
closeButton.addEventListener('click', () => {
|
||||
window.close();
|
||||
});
|
||||
|
||||
// Keep video playing - prevent pause from visibility changes or focus loss
|
||||
function keepVideoPlaying() {
|
||||
const video = document.querySelector('video');
|
||||
@@ -510,17 +502,14 @@ export function ScreenShareItem({ share }: ScreenShareItemProps) {
|
||||
video.play().catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
// Check every 500ms if video got paused
|
||||
setInterval(keepVideoPlaying, 500);
|
||||
|
||||
// Also resume on visibility change
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (!document.hidden) {
|
||||
keepVideoPlaying();
|
||||
}
|
||||
});
|
||||
|
||||
// Resume on window focus
|
||||
window.addEventListener('focus', keepVideoPlaying);
|
||||
</script>
|
||||
@@ -550,7 +539,6 @@ export function ScreenShareItem({ share }: ScreenShareItemProps) {
|
||||
|
||||
// For remote screenshare, use LiveKit track's attach method (creates fresh video)
|
||||
if (!share.isLocal && share.track) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const track = share.track as any;
|
||||
if (typeof track.attach === 'function') {
|
||||
// track.attach() creates a brand new video element attached to the track
|
||||
@@ -575,7 +563,6 @@ export function ScreenShareItem({ share }: ScreenShareItemProps) {
|
||||
popoutWindow.addEventListener('beforeunload', () => {
|
||||
// For remote tracks, detach from pop-out
|
||||
if (!share.isLocal && share.track) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const track = share.track as any;
|
||||
if (typeof track.detach === 'function') {
|
||||
const videoContainer = popoutWindow.document.getElementById('videoContainer');
|
||||
@@ -592,7 +579,7 @@ export function ScreenShareItem({ share }: ScreenShareItemProps) {
|
||||
}, [share.isLocal, share.stream, share.track]);
|
||||
|
||||
const handleMouseMoveWrapper = useCallback(
|
||||
(e: React.MouseEvent) => {
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
// Clear any pending hide timeout
|
||||
if (hideTimeoutRef.current) {
|
||||
clearTimeout(hideTimeoutRef.current);
|
||||
@@ -604,16 +591,13 @@ export function ScreenShareItem({ share }: ScreenShareItemProps) {
|
||||
[handleMouseMove],
|
||||
);
|
||||
|
||||
const handleMouseLeaveWrapper = useCallback(
|
||||
(e: React.MouseEvent) => {
|
||||
// Delay hiding controls to prevent flickering
|
||||
hideTimeoutRef.current = setTimeout(() => {
|
||||
setShowControls(false);
|
||||
}, 300);
|
||||
handleMouseLeave(e);
|
||||
},
|
||||
[handleMouseLeave],
|
||||
);
|
||||
const handleMouseLeaveWrapper = useCallback(() => {
|
||||
// Delay hiding controls to prevent flickering
|
||||
hideTimeoutRef.current = setTimeout(() => {
|
||||
setShowControls(false);
|
||||
}, 300);
|
||||
handleMouseLeave();
|
||||
}, [handleMouseLeave]);
|
||||
|
||||
// Cleanup timeout on unmount
|
||||
useEffect(
|
||||
@@ -921,7 +905,7 @@ export function CallOverlay() {
|
||||
|
||||
// Wait for window to load, then set the video stream
|
||||
setTimeout(() => {
|
||||
const videoEl = popoutWindow.document.getElementById('remoteVideo');
|
||||
const videoEl = popoutWindow.document.querySelector<HTMLVideoElement>('#remoteVideo');
|
||||
if (videoEl) {
|
||||
videoEl.srcObject = firstStream;
|
||||
}
|
||||
@@ -1385,7 +1369,7 @@ export function CallOverlay() {
|
||||
|
||||
{isVideoCall && (
|
||||
<div className={css.VideoContainer}>
|
||||
{/* eslint-disable-next-line jsx-a11y/media-has-caption */}
|
||||
{}
|
||||
<video
|
||||
ref={remoteVideoRef}
|
||||
autoPlay
|
||||
|
||||
@@ -80,7 +80,7 @@ function checkWebRTCSupport(): { supported: boolean; details: Record<string, unk
|
||||
|
||||
const supported = !!(
|
||||
navigator.mediaDevices &&
|
||||
navigator.mediaDevices.getUserMedia &&
|
||||
typeof navigator.mediaDevices.getUserMedia !== 'undefined' &&
|
||||
(window.RTCPeerConnection || window.webkitRTCPeerConnection)
|
||||
);
|
||||
|
||||
@@ -235,7 +235,6 @@ export class CallService {
|
||||
],
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await (this.matrixClient as any).sendStateEvent(
|
||||
roomId,
|
||||
CALL_MEMBER_EVENT_TYPE,
|
||||
@@ -248,7 +247,6 @@ export class CallService {
|
||||
'm.calls': [],
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await (this.matrixClient as any).sendStateEvent(
|
||||
roomId,
|
||||
CALL_MEMBER_EVENT_TYPE,
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
OverlayCenter,
|
||||
Modal,
|
||||
} from 'folds';
|
||||
import { NotificationCountType, type RoomAccountDataEvents } from 'matrix-js-sdk';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { Icon, Icons } from '../../../components/icons';
|
||||
import { Page, PageContent, PageHeader } from '../../../components/page';
|
||||
@@ -78,7 +79,7 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
||||
const info = {
|
||||
roomId: room.roomId,
|
||||
name: room.name,
|
||||
canonicalAlias: room.canonicalAlias,
|
||||
canonicalAlias: room.getCanonicalAlias(),
|
||||
altAliases: room.getAltAliases(),
|
||||
isSpace: isSpace(room),
|
||||
joinRule: room.getJoinRule(),
|
||||
@@ -93,8 +94,8 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
||||
powerLevelTags: powerLevelTags || null,
|
||||
tags: room.tags,
|
||||
notificationCounts: {
|
||||
total: room.getRoomUnreadNotificationCount('total'),
|
||||
highlight: room.getRoomUnreadNotificationCount('highlight'),
|
||||
total: room.getRoomUnreadNotificationCount(NotificationCountType.Total),
|
||||
highlight: room.getRoomUnreadNotificationCount(NotificationCountType.Highlight),
|
||||
},
|
||||
timeline: {
|
||||
oldestEventTs: oldestEvent?.getTs(),
|
||||
@@ -138,7 +139,11 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
||||
|
||||
const submitAccountData: AccountDataSubmitCallback = useCallback(
|
||||
async (type, content) => {
|
||||
await mx.setRoomAccountData(room.roomId, type, content);
|
||||
await mx.setRoomAccountData(
|
||||
room.roomId,
|
||||
type as keyof RoomAccountDataEvents,
|
||||
content as RoomAccountDataEvents[keyof RoomAccountDataEvents],
|
||||
);
|
||||
},
|
||||
[mx, room.roomId],
|
||||
);
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { EventType } from 'matrix-js-sdk';
|
||||
import type { RoomJoinRulesEventContent } from 'matrix-js-sdk/lib/@types/state_events';
|
||||
import { Icon, Icons } from '../../components/icons';
|
||||
import { useAllJoinedRoomsSet, useGetRoom } from '../../hooks/useGetRoom';
|
||||
import { SpaceProvider } from '../../hooks/useSpace';
|
||||
@@ -78,7 +79,7 @@ function CreateRoomModal({ state }: CreateRoomModalProps) {
|
||||
'',
|
||||
);
|
||||
if (parentJoinRulesEvent) {
|
||||
const joinRulesContent = parentJoinRulesEvent.getContent();
|
||||
const joinRulesContent = parentJoinRulesEvent.getContent<RoomJoinRulesEventContent>();
|
||||
await mx.sendStateEvent(newRoomId, EventType.RoomJoinRules, joinRulesContent, '');
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ export function ForumAuthorIdentity({
|
||||
return (
|
||||
<div className={identityClass}>
|
||||
<span className={avatarClass} aria-hidden>
|
||||
<Avatar size="200" radii="300" shrink="No">
|
||||
<Avatar size="200" radii="300">
|
||||
<UserAvatar
|
||||
userId={sender}
|
||||
src={avatarUrl}
|
||||
|
||||
@@ -5,12 +5,14 @@ import { IconButton, Line, PopOut } from 'folds';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { Icon, Icons } from '../../components/icons';
|
||||
import {
|
||||
AUTOCOMPLETE_PREFIXES,
|
||||
CustomEditor,
|
||||
Toolbar,
|
||||
EmoticonAutocomplete,
|
||||
AutocompletePrefix,
|
||||
AutocompleteQuery,
|
||||
getAutocompleteQuery,
|
||||
getPrevWorldRange,
|
||||
createEmoticonElement,
|
||||
moveCursor,
|
||||
safeFocusEditor,
|
||||
@@ -62,17 +64,17 @@ export function ForumChatComposer({
|
||||
[enterForNewline, onSend],
|
||||
);
|
||||
|
||||
const handleKeyUp: KeyboardEventHandler = useCallback(
|
||||
(evt) => {
|
||||
const prevWordRange = getAutocompleteQuery(editor, evt);
|
||||
if (prevWordRange?.prefix === AutocompletePrefix.Emoticon) {
|
||||
setAutocompleteQuery({ prefix: AutocompletePrefix.Emoticon, range: prevWordRange.range });
|
||||
return;
|
||||
}
|
||||
setAutocompleteQuery(undefined);
|
||||
},
|
||||
[editor],
|
||||
);
|
||||
const handleKeyUp: KeyboardEventHandler = useCallback(() => {
|
||||
const prevWordRange = getPrevWorldRange(editor);
|
||||
const query = prevWordRange
|
||||
? getAutocompleteQuery<AutocompletePrefix>(editor, prevWordRange, AUTOCOMPLETE_PREFIXES)
|
||||
: undefined;
|
||||
if (query?.prefix === AutocompletePrefix.Emoticon) {
|
||||
setAutocompleteQuery(query);
|
||||
return;
|
||||
}
|
||||
setAutocompleteQuery(undefined);
|
||||
}, [editor]);
|
||||
|
||||
const handleEmoticonSelect = (key: string, shortcode: string) => {
|
||||
editor.insertNode(createEmoticonElement(key, shortcode));
|
||||
|
||||
@@ -44,7 +44,13 @@ export function ForumEventContent({
|
||||
}
|
||||
|
||||
const content = getContent();
|
||||
const msgType = typeof content.msgtype === 'string' ? content.msgtype : 'm.text';
|
||||
const msgType =
|
||||
typeof content === 'object' &&
|
||||
content !== null &&
|
||||
'msgtype' in content &&
|
||||
typeof content.msgtype === 'string'
|
||||
? content.msgtype
|
||||
: 'm.text';
|
||||
|
||||
return (
|
||||
<div className={theme.ForumEventContentRoot}>
|
||||
|
||||
@@ -323,7 +323,7 @@ export function ForumNewPostModal({
|
||||
<Box className={t.ForumPostModalActions}>
|
||||
<Button
|
||||
type="button"
|
||||
variant="SurfaceVariant"
|
||||
variant="Secondary"
|
||||
size="400"
|
||||
radii="300"
|
||||
onClick={handleClose}
|
||||
|
||||
@@ -137,7 +137,7 @@ export function ForumPostUploadField({
|
||||
variant="SurfaceVariant"
|
||||
size="300"
|
||||
radii="300"
|
||||
onClick={pickFiles}
|
||||
onClick={() => pickFiles('*')}
|
||||
disabled={disabled}
|
||||
aria-label="Attach files"
|
||||
>
|
||||
@@ -154,7 +154,7 @@ export function ForumPostUploadField({
|
||||
variant="SurfaceVariant"
|
||||
size="300"
|
||||
radii="300"
|
||||
onClick={pickFiles}
|
||||
onClick={() => pickFiles('*')}
|
||||
disabled={disabled}
|
||||
aria-label="Attach more files"
|
||||
>
|
||||
|
||||
@@ -52,7 +52,7 @@ export function ForumReplyComposer({
|
||||
</PowerLevelsContextProvider>
|
||||
{onCancel && (
|
||||
<div className={t.ForumReplyFormActions}>
|
||||
<Button type="button" variant="SurfaceVariant" size="300" onClick={onCancel}>
|
||||
<Button type="button" variant="Secondary" size="300" onClick={onCancel}>
|
||||
<Text size="B400">Cancel</Text>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -108,7 +108,7 @@ export function ForumRichReplyComposer({
|
||||
{onCancel && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="SurfaceVariant"
|
||||
variant="Secondary"
|
||||
size="300"
|
||||
onClick={onCancel}
|
||||
disabled={sending}
|
||||
|
||||
@@ -307,7 +307,7 @@ type ForumThreadDetailProps = {
|
||||
onReplySent?: (reply: ForumPost) => void;
|
||||
};
|
||||
|
||||
type ForumThreadDetailBodyProps = ForumThreadDetailProps & {
|
||||
type ForumThreadDetailBodyProps = Omit<ForumThreadDetailProps, 'initialPost'> & {
|
||||
post: ForumPost;
|
||||
room: Room;
|
||||
onPostUpdate: (post: ForumPost | null) => void;
|
||||
|
||||
@@ -2,13 +2,17 @@ import {
|
||||
Direction,
|
||||
EventType,
|
||||
type IContent,
|
||||
type IEventRelation,
|
||||
type IRoomEvent,
|
||||
type MatrixClient,
|
||||
type MatrixEvent,
|
||||
type Room,
|
||||
MsgType,
|
||||
RelationType,
|
||||
} from 'matrix-js-sdk';
|
||||
import type {
|
||||
RoomMessageEventContent,
|
||||
RoomMessageTextEventContent,
|
||||
} from 'matrix-js-sdk/lib/@types/events';
|
||||
import type { IHierarchyRoom } from 'matrix-js-sdk/lib/@types/spaces';
|
||||
import { getMemberDisplayName, getSpaceChildren, isSpace } from '../../utils/room';
|
||||
import type { ForumPost, ForumTopic } from './types';
|
||||
@@ -675,7 +679,7 @@ export async function sendForumPost(
|
||||
}
|
||||
|
||||
const res = await mx.sendMessage(roomId, {
|
||||
msgtype: 'm.text',
|
||||
msgtype: MsgType.Text,
|
||||
body: `${title}\n\n${plainText}`,
|
||||
'com.matrixsso.title': title,
|
||||
format: 'org.matrix.custom.html',
|
||||
@@ -703,7 +707,7 @@ export async function sendForumMediaRoot(
|
||||
const res = await mx.sendMessage(roomId, {
|
||||
...content,
|
||||
'com.matrixsso.title': trimmedTitle,
|
||||
});
|
||||
} as RoomMessageEventContent);
|
||||
return res.event_id;
|
||||
}
|
||||
|
||||
@@ -726,10 +730,9 @@ export async function sendForumThreadAttachment(
|
||||
'm.relates_to': {
|
||||
rel_type: RelationType.Thread,
|
||||
event_id: rootId,
|
||||
is_falling_back: false,
|
||||
'm.in_reply_to': { event_id: parentId },
|
||||
} as IEventRelation,
|
||||
});
|
||||
},
|
||||
} as unknown as RoomMessageEventContent);
|
||||
return res.event_id;
|
||||
}
|
||||
|
||||
@@ -760,15 +763,9 @@ export function sendForumReply(
|
||||
let formattedHtml = typeof message === 'string' ? '' : String(message.formattedHtml || '').trim();
|
||||
formattedHtml = formattedHtml.replace(/(<br\s*\/?>\s*)+$/gi, '');
|
||||
|
||||
const content: Record<string, unknown> = {
|
||||
msgtype: 'm.text',
|
||||
const content: RoomMessageTextEventContent = {
|
||||
msgtype: MsgType.Text,
|
||||
body: plainText,
|
||||
'm.relates_to': {
|
||||
rel_type: RelationType.Thread,
|
||||
event_id: rootId,
|
||||
is_falling_back: false,
|
||||
'm.in_reply_to': { event_id: parentId },
|
||||
},
|
||||
};
|
||||
|
||||
if (formattedHtml) {
|
||||
@@ -776,7 +773,16 @@ export function sendForumReply(
|
||||
content.formatted_body = formattedHtml;
|
||||
}
|
||||
|
||||
return mx.sendMessage(roomId, content).then((res) => res.event_id);
|
||||
return mx
|
||||
.sendMessage(roomId, {
|
||||
...content,
|
||||
'm.relates_to': {
|
||||
rel_type: RelationType.Thread,
|
||||
event_id: rootId,
|
||||
'm.in_reply_to': { event_id: parentId },
|
||||
},
|
||||
})
|
||||
.then((res) => res.event_id);
|
||||
}
|
||||
|
||||
export function createForumPostFromPayload(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import type { IconSrc } from 'folds';
|
||||
import React, { forwardRef } from 'react';
|
||||
import type { LucideProps } from 'lucide-react';
|
||||
import type { IconSrc } from '../../components/icons';
|
||||
|
||||
/** Lucide paths (ISC) — same icons as matrixsso sort toggle (flame / sparkles / crown). */
|
||||
|
||||
@@ -36,26 +37,25 @@ const CROWN: SvgNode[] = [
|
||||
['path', { d: 'M5 21h14' }],
|
||||
];
|
||||
|
||||
function lucideIcon(nodes: SvgNode): IconSrc {
|
||||
return function Icon() {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth={2}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden
|
||||
focusable="false"
|
||||
>
|
||||
{nodes.map(([tag, attrs]) =>
|
||||
React.createElement(tag, { key: `${tag}-${attrs.d ?? attrs.cx ?? ''}`, ...attrs }),
|
||||
)}
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
function lucideIcon(nodes: SvgNode[]): IconSrc {
|
||||
return forwardRef<SVGSVGElement, LucideProps>((_, ref) => (
|
||||
<svg
|
||||
ref={ref}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth={2}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden
|
||||
focusable="false"
|
||||
>
|
||||
{nodes.map(([tag, attrs]) =>
|
||||
React.createElement(tag, { key: `${tag}-${attrs.d ?? attrs.cx ?? ''}`, ...attrs }),
|
||||
)}
|
||||
</svg>
|
||||
));
|
||||
}
|
||||
|
||||
/** hot → flame, new → sparkles, top → crown (matrixsso SORT_LUCIDE_ICONS) */
|
||||
|
||||
@@ -1136,7 +1136,7 @@ export const ForumSenderLabel = style({
|
||||
export const ForumAuthorServer = style({
|
||||
background: color.SurfaceVariant.Container,
|
||||
border: `${config.borderWidth.B300} solid ${color.SurfaceVariant.ContainerLine}`,
|
||||
borderRadius: config.radii.R200,
|
||||
borderRadius: config.radii.R300,
|
||||
color: muted,
|
||||
fontSize: toRem(12),
|
||||
fontWeight: 600,
|
||||
|
||||
@@ -107,7 +107,7 @@ export function useForumMessageReactions(room: Room, mEvent: MatrixEvent | undef
|
||||
(reactions.find(eventWithShortcode)?.getContent().shortcode as string | undefined);
|
||||
mx.sendEvent(
|
||||
room.roomId,
|
||||
MessageEvent.Reaction as never,
|
||||
EventType.Reaction,
|
||||
getReactionContent(targetEventId, key, rShortcode),
|
||||
).finally(() => {
|
||||
bumpRelations();
|
||||
|
||||
@@ -321,7 +321,7 @@ export function LobbyHeader({ showProfile, showSpaceToolbar, powerLevels }: Lobb
|
||||
</IconButton>
|
||||
</Box>
|
||||
)}
|
||||
<Avatar size="300" shrink="No">
|
||||
<Avatar size="300">
|
||||
<RoomAvatar
|
||||
roomId={space.roomId}
|
||||
src={avatarUrl}
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
HierarchyItemSpace,
|
||||
isHierarchySpaceRoom,
|
||||
useFetchSpaceHierarchyLevel,
|
||||
viaFromParent,
|
||||
} from '../../hooks/useSpaceHierarchy';
|
||||
import { IPowerLevels } from '../../hooks/usePowerLevels';
|
||||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||
@@ -259,7 +260,8 @@ export const SpaceHierarchy = forwardRef<HTMLDivElement, SpaceHierarchyProps>(
|
||||
const subRoomItem: HierarchyItemRoom = {
|
||||
roomId: subRoomId,
|
||||
parentId: roomItem.roomId,
|
||||
content: {},
|
||||
content: { via: viaFromParent(roomSummary, subRoomId) },
|
||||
ts: 0,
|
||||
};
|
||||
const subRoomDragging =
|
||||
draggingItem?.roomId === subRoomId &&
|
||||
|
||||
@@ -35,7 +35,7 @@ export function RoomAppView({ room, onShowChat }: RoomAppViewProps) {
|
||||
<Page>
|
||||
<Header className={css.Header} size="600">
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<Box grow="Yes" alignItems="Center" gap="200" minWidth="0">
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<Text size="H6" truncate>
|
||||
{title}
|
||||
</Text>
|
||||
|
||||
@@ -93,7 +93,7 @@ export function CallParticipantsIndicator({ roomId }: CallParticipantsIndicatorP
|
||||
/**
|
||||
* Get the appropriate audio icon for a participant
|
||||
*/
|
||||
const getAudioIcon = (userId: string): string => {
|
||||
const getAudioIcon = (userId: string) => {
|
||||
if (isLocalUserDeafened(userId)) {
|
||||
return Icons.VolumeMute;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@ export function SubRooms() {
|
||||
children: newSubRooms,
|
||||
};
|
||||
// Custom state event type - need to cast
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.PaarrotSubRooms as any, content, '');
|
||||
},
|
||||
[mx, room],
|
||||
@@ -126,7 +125,6 @@ export function SubRooms() {
|
||||
// Add as m.space.child to the space
|
||||
await mx.sendStateEvent(
|
||||
parentSpaceId,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
StateEvent.SpaceChild as any,
|
||||
{ via: spaceViaServers },
|
||||
roomIdToAdd,
|
||||
|
||||
@@ -98,7 +98,7 @@ import {
|
||||
import { getMemberDisplayName, getMentionContent, trimReplyFromBody } from '../../utils/room';
|
||||
import { CommandAutocomplete } from './CommandAutocomplete';
|
||||
import { Command, SHRUG, TABLEFLIP, UNFLIP, useCommands } from '../../hooks/useCommands';
|
||||
import { pluginRegistry } from '../settings/plugins/PluginAPI';
|
||||
import { pluginRegistry, type CommandArg } from '../settings/plugins/PluginAPI';
|
||||
import { PluginButtonSlot } from '../settings/plugins/PluginButtonSlot';
|
||||
import { mobileOrTablet } from '../../utils/user-agent';
|
||||
import { ReplyLayout, ThreadIndicator } from '../../components/message';
|
||||
@@ -219,7 +219,7 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
|
||||
const [commandHint, setCommandHint] = useState<{
|
||||
command: string;
|
||||
description: string;
|
||||
args?: string[];
|
||||
args?: string[] | CommandArg[];
|
||||
}>();
|
||||
|
||||
const sendTypingStatus = useTypingStatusUpdater(mx, roomId);
|
||||
@@ -733,7 +733,9 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
|
||||
{commandHint.args && commandHint.args.length > 0 && (
|
||||
<span style={{ opacity: 0.6 }}>
|
||||
{' '}
|
||||
{commandHint.args.map((arg) => `[${arg}]`).join(' ')}
|
||||
{commandHint.args
|
||||
.map((arg) => `[${typeof arg === 'string' ? arg : arg.name}]`)
|
||||
.join(' ')}
|
||||
</span>
|
||||
)}
|
||||
</Text>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { style } from '@vanilla-extract/css';
|
||||
import { recipe } from '@vanilla-extract/recipes';
|
||||
import { RecipeVariants, recipe } from '@vanilla-extract/recipes';
|
||||
import { DefaultReset, color, config, toRem } from 'folds';
|
||||
|
||||
export const TimelineFloat = recipe({
|
||||
@@ -29,6 +29,8 @@ export const TimelineFloat = recipe({
|
||||
},
|
||||
});
|
||||
|
||||
export type TimelineFloatVariants = RecipeVariants<typeof TimelineFloat>;
|
||||
|
||||
export const DmNameplateBackground = style({
|
||||
position: 'absolute',
|
||||
inset: 0,
|
||||
|
||||
@@ -2011,7 +2011,8 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
},
|
||||
[StateEvent.CallMember]: (mEventId, mEvent, item) => {
|
||||
const senderId = mEvent.getSender() ?? '';
|
||||
const senderName = getMemberDisplayName(room, senderId) || getMxIdLocalPart(senderId);
|
||||
const senderName =
|
||||
getMemberDisplayName(room, senderId) || getMxIdLocalPart(senderId) || senderId;
|
||||
const content = mEvent.getContent();
|
||||
const prevContent = mEvent.getPrevContent();
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ function CallIndicator({ roomId }: CallIndicatorProps) {
|
||||
offset={8}
|
||||
tooltip={
|
||||
<SpeechBubble tail="top" tailX="50%">
|
||||
<Box direction="Column" gap="50">
|
||||
<Box direction="Column" gap="100">
|
||||
<Text
|
||||
size="T300"
|
||||
style={{ fontWeight: 600, color: color.SurfaceVariant.OnContainer }}
|
||||
|
||||
@@ -270,7 +270,6 @@ export function ThreadView({ room, threadRootId }: ThreadViewProps) {
|
||||
repliesCount: replies.length,
|
||||
threadLength: t.length,
|
||||
hasRootEvent: !!t.rootEvent,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialEventsFetched: (t as any).initialEventsFetched,
|
||||
liveTimelineEventsCount: liveTimelineEvents.length,
|
||||
threadEventsMatch: replies.length === liveTimelineEvents.length,
|
||||
@@ -334,7 +333,6 @@ export function ThreadView({ room, threadRootId }: ThreadViewProps) {
|
||||
threadExists: !!thread,
|
||||
threadLength: thread?.length,
|
||||
eventsCount: thread?.events?.length,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialEventsFetched: (thread as any)?.initialEventsFetched,
|
||||
});
|
||||
|
||||
@@ -351,7 +349,6 @@ export function ThreadView({ room, threadRootId }: ThreadViewProps) {
|
||||
thread.on(ThreadEvent.NewReply, handleUpdate);
|
||||
thread.on(ThreadEvent.Update, handleUpdate);
|
||||
// Fires when initial events are loaded after the SDK paginates the thread.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(thread as any).on(RoomEvent.TimelineReset, handleUpdate);
|
||||
|
||||
// Also listen to Timeline events which fire when events are added
|
||||
@@ -378,7 +375,6 @@ export function ThreadView({ room, threadRootId }: ThreadViewProps) {
|
||||
if (thread) {
|
||||
thread.off(ThreadEvent.NewReply, handleUpdate);
|
||||
thread.off(ThreadEvent.Update, handleUpdate);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(thread as any).off(RoomEvent.TimelineReset, handleUpdate);
|
||||
thread.off(RoomEvent.Timeline, handleUpdate);
|
||||
}
|
||||
@@ -484,7 +480,6 @@ export function ThreadView({ room, threadRootId }: ThreadViewProps) {
|
||||
(reactions.find(eventWithShortcode)?.getContent().shortcode as string | undefined);
|
||||
mx.sendEvent(
|
||||
room.roomId,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
MessageEvent.Reaction as any,
|
||||
getReactionContent(targetEventId, key, rShortcode),
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@ import { MatrixClient } from 'matrix-js-sdk';
|
||||
import { EMOJI_REG_G, JUMBO_EMOJI_REG } from '../../../utils/regex';
|
||||
import { trimReplyFromBody } from '../../../utils/room';
|
||||
import { emojis } from '../../../plugins/emoji';
|
||||
import { MessageEvent } from '../../../../types/matrix/room';
|
||||
import { EMOJI_CONFETTI_EVENT_TYPE, EmojiConfettiContent } from './types';
|
||||
|
||||
const SHORTCODE_PATTERN = /:([^\s:]+):/g;
|
||||
@@ -43,5 +44,5 @@ export function sendEmojiConfettiEvent(
|
||||
target_event_id: targetEventId,
|
||||
};
|
||||
|
||||
return mx.sendEvent(roomId, EMOJI_CONFETTI_EVENT_TYPE as never, content);
|
||||
return mx.sendEvent(roomId, MessageEvent.RelayEmojiConfetti, content);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,6 @@ export const MessageQuickReactions = as<'div', MessageQuickReactionsProps>(
|
||||
{mostUsedEmojis.map((emoji) => (
|
||||
<IconButton
|
||||
key={emoji.unicode}
|
||||
className={css.MessageQuickReaction}
|
||||
size="300"
|
||||
variant="SurfaceVariant"
|
||||
radii="Pill"
|
||||
|
||||
@@ -8,6 +8,7 @@ import React, {
|
||||
import { Box, Chip, IconButton, Line, PopOut, RectCords, Spinner, Text, as, config } from 'folds';
|
||||
import { Editor, Transforms } from 'slate';
|
||||
import { IContent, IMentions, MatrixEvent, RelationType, Room } from 'matrix-js-sdk';
|
||||
import type { RoomMessageEventContent } from 'matrix-js-sdk/lib/@types/events';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import { Icon, Icons } from '../../../components/icons';
|
||||
import {
|
||||
@@ -141,7 +142,7 @@ export const MessageEditor = as<'div', MessageEditorProps>(
|
||||
},
|
||||
};
|
||||
|
||||
return mx.sendMessage(roomId, content);
|
||||
return mx.sendMessage(roomId, content as RoomMessageEventContent);
|
||||
}, [mx, editor, roomId, mEvent, isMarkdown, getPrevBodyAndFormattedBody]),
|
||||
);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import { ContainerColor } from '../../../styles/ContainerColor.css';
|
||||
|
||||
const fetchAuthenticatedMedia = async (
|
||||
url: string,
|
||||
accessToken: string | null,
|
||||
accessToken: string | undefined,
|
||||
): Promise<string> => {
|
||||
try {
|
||||
let response = await fetch(url, {
|
||||
|
||||
@@ -127,9 +127,9 @@ function PinnedMessage({
|
||||
}, [room, eventId, mx]),
|
||||
);
|
||||
|
||||
const sender = pinnedEvent?.getSender();
|
||||
const sender = pinnedEvent?.getSender() ?? '';
|
||||
const senderAvatarMxc = sender ? getMemberAvatarMxc(room, sender) : undefined;
|
||||
const customUserColor = useOtherUserColor(sender ?? '', room);
|
||||
const customUserColor = useOtherUserColor(sender, room);
|
||||
|
||||
const handleOpenClick: MouseEventHandler = (evt) => {
|
||||
evt.stopPropagation();
|
||||
@@ -178,7 +178,7 @@ function PinnedMessage({
|
||||
</Box>
|
||||
);
|
||||
|
||||
const displayName = getMemberDisplayName(room, sender!) ?? getMxIdLocalPart(sender!) ?? sender!;
|
||||
const displayName = getMemberDisplayName(room, sender) ?? getMxIdLocalPart(sender) ?? sender;
|
||||
const getContent = (() => pinnedEvent.getContent()) as GetContentCallback;
|
||||
|
||||
const memberPowerTag = getMemberPowerTag(sender);
|
||||
|
||||
@@ -77,7 +77,7 @@ export function ProfileEffectHeroPreview({
|
||||
|
||||
<div className={css.ProfileEffectHeroInfo}>
|
||||
<Text
|
||||
size="T100"
|
||||
size="T200"
|
||||
className={css.ProfileEffectHeroName}
|
||||
title={resolvedName}
|
||||
style={{ color: nameColor }}
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
OverlayCenter,
|
||||
} from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import type { AccountDataEvents } from 'matrix-js-sdk';
|
||||
import { Icon, Icons } from '../../../components/icons';
|
||||
import { Page, PageContent, PageHeader } from '../../../components/page';
|
||||
import { SequenceCard } from '../../../components/sequence-card';
|
||||
@@ -107,7 +108,7 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
||||
|
||||
const submitAccountData: AccountDataSubmitCallback = useCallback(
|
||||
async (type, content) => {
|
||||
await mx.setAccountData(type, content);
|
||||
await mx.setAccountData(type as keyof AccountDataEvents, content);
|
||||
},
|
||||
[mx],
|
||||
);
|
||||
@@ -118,7 +119,11 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
||||
return (
|
||||
<AccountDataEditor
|
||||
type={accountDataType ?? undefined}
|
||||
content={accountDataType ? mx.getAccountData(accountDataType)?.getContent() : undefined}
|
||||
content={
|
||||
accountDataType
|
||||
? mx.getAccountData(accountDataType as keyof AccountDataEvents)?.getContent()
|
||||
: undefined
|
||||
}
|
||||
submitChange={submitAccountData}
|
||||
requestClose={() => setAccountDataType(undefined)}
|
||||
/>
|
||||
@@ -239,7 +244,7 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
||||
</PageContent>
|
||||
</Scroll>
|
||||
</Box>
|
||||
{profileFieldKey !== undefined && (
|
||||
{profileFieldKey && (
|
||||
<Overlay open backdrop={<OverlayBackdrop />}>
|
||||
<OverlayCenter>
|
||||
<FocusTrap
|
||||
|
||||
@@ -82,8 +82,8 @@ export function ProfileFields({
|
||||
<Box gap="100" alignItems="Center">
|
||||
{editable && (
|
||||
<IconButton
|
||||
size="200"
|
||||
radii="Round"
|
||||
size="300"
|
||||
radii="Pill"
|
||||
title={`Delete ${key}`}
|
||||
onClick={() => onDelete(key)}
|
||||
>
|
||||
|
||||
@@ -25,7 +25,6 @@ export type {
|
||||
IPluginEventClient,
|
||||
PluginMarketplaceClientOptions,
|
||||
PluginMarketplaceHostAdapter,
|
||||
PluginMarketplaceInstalledRecord,
|
||||
PluginMarketplaceManagerOptions,
|
||||
PluginRegistryOptions,
|
||||
PluginContextOptions,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useSyncExternalStore } from 'react';
|
||||
import { IconButton } from 'folds';
|
||||
import * as lucide from 'lucide-react';
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
import { UILocation } from '@paarrot/plugin-manager';
|
||||
import { Icon, Icons, type IconName } from '../../../components/icons';
|
||||
import { pluginRegistry } from './PluginAPI';
|
||||
@@ -52,12 +53,7 @@ function renderPluginButtonIcon(button: { icon?: string; lucideIcon?: string }):
|
||||
}
|
||||
|
||||
if (lucideName) {
|
||||
const IconComponent = (
|
||||
lucide as Record<
|
||||
string,
|
||||
React.ComponentType<{ size?: number; strokeWidth?: number }> | undefined
|
||||
>
|
||||
)[lucideName];
|
||||
const IconComponent = lucide[lucideName as keyof typeof lucide] as LucideIcon | undefined;
|
||||
if (IconComponent) {
|
||||
return <IconComponent size={18} strokeWidth={2} aria-hidden />;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ function SettingRenderer({
|
||||
variant="Background"
|
||||
value={value ?? definition.default ?? ''}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
placeholder={definition.default}
|
||||
placeholder={typeof definition.default === 'string' ? definition.default : ''}
|
||||
/>
|
||||
</SettingTile>
|
||||
);
|
||||
@@ -127,7 +127,7 @@ function SettingRenderer({
|
||||
<Menu>
|
||||
{definition.options.map((option) => (
|
||||
<MenuItem
|
||||
key={option.value}
|
||||
key={String(option.value)}
|
||||
size="300"
|
||||
after={
|
||||
currentValue === option.value ? (
|
||||
@@ -214,7 +214,7 @@ function PluginSettingsRenderer({ pluginId }: { pluginId: string }) {
|
||||
|
||||
if (!schema || Object.keys(schema).length === 0) {
|
||||
return (
|
||||
<Box padding="300">
|
||||
<Box>
|
||||
<Text size="T300" priority="300">
|
||||
No settings available for this plugin.
|
||||
</Text>
|
||||
@@ -406,12 +406,12 @@ export function Plugins({ requestClose }: PluginsProps) {
|
||||
<Page>
|
||||
<PageHeader>
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<Header size="H3" className="truncate">
|
||||
<Header size="400" className="truncate">
|
||||
Plugins
|
||||
</Header>
|
||||
</Box>
|
||||
<Box shrink="No" gap="200">
|
||||
<Button variant="Background" size="300" onClick={requestClose}>
|
||||
<Button variant="Secondary" size="300" onClick={requestClose}>
|
||||
<Text size="B300">Close</Text>
|
||||
</Button>
|
||||
</Box>
|
||||
@@ -454,7 +454,7 @@ export function Plugins({ requestClose }: PluginsProps) {
|
||||
searchQuery && (
|
||||
<IconButton
|
||||
size="300"
|
||||
variant="SurfaceLow"
|
||||
variant="Surface"
|
||||
radii="300"
|
||||
onClick={() => setSearchQuery('')}
|
||||
>
|
||||
@@ -688,7 +688,7 @@ export function Plugins({ requestClose }: PluginsProps) {
|
||||
direction="Column"
|
||||
style={{
|
||||
borderTop: `1px solid ${color.Surface.ContainerLine}`,
|
||||
background: color.Surface.ContainerLowest,
|
||||
background: color.Surface.Container,
|
||||
}}
|
||||
>
|
||||
<PluginSettingsRenderer pluginId={plugin.id} />
|
||||
|
||||
@@ -142,6 +142,7 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
||||
// Preserve all users in child room who have power >= mine
|
||||
if (childPowerLevels.users) {
|
||||
Object.entries(childPowerLevels.users).forEach(([userId, power]) => {
|
||||
if (typeof power !== 'number') return;
|
||||
if (power >= myPowerInChild) {
|
||||
mergedUsers[userId] = power;
|
||||
}
|
||||
@@ -249,6 +250,7 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
||||
// Preserve all users in child room who have power >= mine
|
||||
if (childPowerLevels.users) {
|
||||
Object.entries(childPowerLevels.users).forEach(([userId, power]) => {
|
||||
if (typeof power !== 'number') return;
|
||||
if (power >= myPowerInChild) {
|
||||
mergedUsers[userId] = power;
|
||||
}
|
||||
@@ -418,7 +420,10 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
||||
)}
|
||||
{syncError && (
|
||||
<Text size="T300" style={{ color: color.Critical.Main }}>
|
||||
Error syncing permissions: {syncState.error.message}
|
||||
Error syncing permissions:{' '}
|
||||
{syncState.error instanceof Error
|
||||
? syncState.error.message
|
||||
: String(syncState.error)}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
@@ -452,7 +457,10 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
||||
)}
|
||||
{powerLevelsSyncError && (
|
||||
<Text size="T300" style={{ color: color.Critical.Main }}>
|
||||
Error syncing power levels: {syncPowerLevelsState.error.message}
|
||||
Error syncing power levels:{' '}
|
||||
{syncPowerLevelsState.error instanceof Error
|
||||
? syncPowerLevelsState.error.message
|
||||
: String(syncPowerLevelsState.error)}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user