13 files changed
+943
-398
No files matched your search
Generated
+62
-6
@@ -15,6 +15,7 @@
|
||||
"@tanstack/react-query": "5.24.1",
|
||||
"@tanstack/react-query-devtools": "5.24.1",
|
||||
"@tanstack/react-virtual": "3.2.0",
|
||||
"@use-gesture/react": "10.3.1",
|
||||
"@vanilla-extract/css": "1.9.3",
|
||||
"@vanilla-extract/recipes": "0.3.0",
|
||||
"@vanilla-extract/vite-plugin": "3.7.1",
|
||||
@@ -32,6 +33,7 @@
|
||||
"file-saver": "2.0.5",
|
||||
"focus-trap-react": "10.0.2",
|
||||
"folds": "2.6.1",
|
||||
"framer-motion": "12.34.3",
|
||||
"html-dom-parser": "4.0.0",
|
||||
"html-react-parser": "4.2.0",
|
||||
"i18next": "23.12.2",
|
||||
@@ -5093,6 +5095,24 @@
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@use-gesture/core": {
|
||||
"version": "10.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@use-gesture/core/-/core-10.3.1.tgz",
|
||||
"integrity": "sha512-WcINiDt8WjqBdUXye25anHiNxPc0VOrlT8F6LLkU6cycrOGUDyY/yyFmsg3k8i5OLvv25llc0QC45GhR/C8llw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@use-gesture/react": {
|
||||
"version": "10.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@use-gesture/react/-/react-10.3.1.tgz",
|
||||
"integrity": "sha512-Yy19y6O2GJq8f7CHf7L0nxL8bf4PZCPaVOCgJrusOeFHY1LvHgYXnmnXg6N5iwAnbgbZCDjo60SiM6IPJi9C5g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@use-gesture/core": "10.3.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">= 16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vanilla-extract/babel-plugin-debug-ids": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@vanilla-extract/babel-plugin-debug-ids/-/babel-plugin-debug-ids-1.2.0.tgz",
|
||||
@@ -7448,15 +7468,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/folds": {
|
||||
<<<<<<< HEAD
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/folds/-/folds-2.6.0.tgz",
|
||||
"integrity": "sha512-9353l0KFBptqUXYBJhoZ0ZEs7ofLUeSmcZEtzn23IbAM1SG7R3tTQTk24lcLKJu95qMGxuC3no8MQTQExNHUNw==",
|
||||
=======
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/folds/-/folds-2.6.1.tgz",
|
||||
"integrity": "sha512-0L1ZSqwjFSg2fesa//C4DgP47Vp/KqDuzjAaOEYN21AvoptyVI+6OEXWrtIdE8DPQCZYr0bV+tqbrLyA6uAhaw==",
|
||||
>>>>>>> upstream/dev
|
||||
"license": "Apache-2.0",
|
||||
"peerDependencies": {
|
||||
"@vanilla-extract/css": "1.9.2",
|
||||
@@ -7475,6 +7489,33 @@
|
||||
"is-callable": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/framer-motion": {
|
||||
"version": "12.34.3",
|
||||
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.34.3.tgz",
|
||||
"integrity": "sha512-v81ecyZKYO/DfpTwHivqkxSUBzvceOpoI+wLfgCgoUIKxlFKEXdg0oR9imxwXumT4SFy8vRk9xzJ5l3/Du/55Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"motion-dom": "^12.34.3",
|
||||
"motion-utils": "^12.29.2",
|
||||
"tslib": "^2.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@emotion/is-prop-valid": "*",
|
||||
"react": "^18.0.0 || ^19.0.0",
|
||||
"react-dom": "^18.0.0 || ^19.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@emotion/is-prop-valid": {
|
||||
"optional": true
|
||||
},
|
||||
"react": {
|
||||
"optional": true
|
||||
},
|
||||
"react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/fs-extra": {
|
||||
"version": "11.3.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz",
|
||||
@@ -9154,6 +9195,21 @@
|
||||
"resolved": "https://registry.npmjs.org/modern-ahocorasick/-/modern-ahocorasick-1.1.0.tgz",
|
||||
"integrity": "sha512-sEKPVl2rM+MNVkGQt3ChdmD8YsigmXdn5NifZn6jiwn9LRJpWm8F3guhaqrJT/JOat6pwpbXEk6kv+b9DMIjsQ=="
|
||||
},
|
||||
"node_modules/motion-dom": {
|
||||
"version": "12.34.3",
|
||||
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.34.3.tgz",
|
||||
"integrity": "sha512-sYgFe+pR9aIM7o4fhs2aXtOI+oqlUd33N9Yoxcgo1Fv7M20sRkHtCmzE/VRNIcq7uNJ+qio+Xubt1FXH3pQ+eQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"motion-utils": "^12.29.2"
|
||||
}
|
||||
},
|
||||
"node_modules/motion-utils": {
|
||||
"version": "12.29.2",
|
||||
"resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.29.2.tgz",
|
||||
"integrity": "sha512-G3kc34H2cX2gI63RqU+cZq+zWRRPSsNIOjpdl9TN4AQwC4sgwYPl/Q/Obf/d53nOm569T0fYK+tcoSV50BWx8A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"@tanstack/react-query": "5.24.1",
|
||||
"@tanstack/react-query-devtools": "5.24.1",
|
||||
"@tanstack/react-virtual": "3.2.0",
|
||||
"@use-gesture/react": "10.3.1",
|
||||
"@vanilla-extract/css": "1.9.3",
|
||||
"@vanilla-extract/recipes": "0.3.0",
|
||||
"@vanilla-extract/vite-plugin": "3.7.1",
|
||||
@@ -44,6 +45,7 @@
|
||||
"file-saver": "2.0.5",
|
||||
"focus-trap-react": "10.0.2",
|
||||
"folds": "2.6.1",
|
||||
"framer-motion": "12.34.3",
|
||||
"html-dom-parser": "4.0.0",
|
||||
"html-react-parser": "4.2.0",
|
||||
"i18next": "23.12.2",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ReactNode, useCallback } from 'react';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { matchPath, useLocation, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
getDirectPath,
|
||||
@@ -7,7 +8,8 @@ import {
|
||||
getInboxPath,
|
||||
getSpacePath,
|
||||
} from '../pages/pathUtils';
|
||||
import { DIRECT_PATH, EXPLORE_PATH, HOME_PATH, INBOX_PATH, SPACE_PATH } from '../pages/paths';
|
||||
import { DIRECT_PATH, EXPLORE_PATH, HOME_PATH, INBOX_PATH, SPACE_PATH, HOME_ROOM_PATH, DIRECT_ROOM_PATH, SPACE_ROOM_PATH } from '../pages/paths';
|
||||
import { lastVisitedRoomIdAtom } from '../state/room/lastRoom';
|
||||
|
||||
type BackRouteHandlerProps = {
|
||||
children: (onBack: () => void) => ReactNode;
|
||||
@@ -15,8 +17,20 @@ type BackRouteHandlerProps = {
|
||||
export function BackRouteHandler({ children }: BackRouteHandlerProps) {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const setLastRoomId = useSetAtom(lastVisitedRoomIdAtom);
|
||||
|
||||
const goBack = useCallback(() => {
|
||||
const roomPaths = [HOME_ROOM_PATH, DIRECT_ROOM_PATH, SPACE_ROOM_PATH];
|
||||
|
||||
const roomMatch = roomPaths
|
||||
.map((path) => matchPath({ path, end: false }, location.pathname))
|
||||
.find((match) => match !== null);
|
||||
|
||||
const currentRoomIdOrAlias = roomMatch?.params.roomIdOrAlias;
|
||||
if (currentRoomIdOrAlias) {
|
||||
setLastRoomId(decodeURIComponent(currentRoomIdOrAlias));
|
||||
}
|
||||
|
||||
if (
|
||||
matchPath(
|
||||
{
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { motion, useMotionValue, useSpring } from 'framer-motion';
|
||||
import { useDrag } from '@use-gesture/react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { settingsAtom, RightSwipeAction } from '../state/settings';
|
||||
import { mobileOrTablet } from '../utils/user-agent';
|
||||
|
||||
interface SwipeableChatWrapperProps {
|
||||
children: ReactNode;
|
||||
onOpenSidebar?: () => void;
|
||||
onOpenMembers?: () => void;
|
||||
onReply?: () => void;
|
||||
}
|
||||
|
||||
export function SwipeableChatWrapper({
|
||||
children,
|
||||
onOpenSidebar,
|
||||
onOpenMembers,
|
||||
onReply
|
||||
}: SwipeableChatWrapperProps) {
|
||||
const settings = useAtomValue(settingsAtom);
|
||||
const x = useMotionValue(0);
|
||||
const springX = useSpring(x, { stiffness: 400, damping: 40 });
|
||||
|
||||
const bind = useDrag(({ active, movement: [mx], velocity: [vx], direction: [dx] }) => {
|
||||
if (!settings.mobileGestures || !mobileOrTablet()) return;
|
||||
|
||||
let val = mx;
|
||||
|
||||
const canSwipeRight = !!onOpenSidebar;
|
||||
const canSwipeLeft = settings.rightSwipeAction === RightSwipeAction.Members
|
||||
? !!onOpenMembers
|
||||
: !!onReply;
|
||||
|
||||
if (!canSwipeRight && val > 0) val = 0;
|
||||
if (!canSwipeLeft && val < 0) val = 0;
|
||||
|
||||
if (active) {
|
||||
x.set(val);
|
||||
} else {
|
||||
const swipeThreshold = 120;
|
||||
const velocityThreshold = 0.5;
|
||||
|
||||
if (val > swipeThreshold || (vx > velocityThreshold && dx > 0 && val > 0)) {
|
||||
onOpenSidebar?.();
|
||||
} else if (val < -swipeThreshold || (vx > velocityThreshold && dx < 0 && val < 0)) {
|
||||
if (settings.rightSwipeAction === RightSwipeAction.Members) {
|
||||
onOpenMembers?.();
|
||||
} else {
|
||||
onReply?.();
|
||||
}
|
||||
}
|
||||
x.set(0);
|
||||
}
|
||||
}, {
|
||||
axis: 'x',
|
||||
bounds: { left: -200, right: 200 },
|
||||
rubberband: true,
|
||||
filterTaps: true,
|
||||
});
|
||||
|
||||
if (!settings.mobileGestures || !mobileOrTablet()) {
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', flexGrow: 1, height: '100%', width: '100%' }}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
{...bind()}
|
||||
style={{
|
||||
touchAction: 'pan-y',
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
flexGrow: 1,
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
<motion.div
|
||||
style={{
|
||||
x: springX,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
flexGrow: 1,
|
||||
height: '100%',
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import { useMotionValue, useSpring, useTransform, motion } from 'framer-motion';
|
||||
import { useDrag } from '@use-gesture/react';
|
||||
import React, { useState } from 'react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { config, Icon, Icons } from 'folds';
|
||||
import { mobileOrTablet } from '../utils/user-agent';
|
||||
import { RightSwipeAction, settingsAtom } from '../state/settings';
|
||||
|
||||
export function SwipeableMessageWrapper({
|
||||
children,
|
||||
onReply,
|
||||
messageId,
|
||||
itemIndex
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
onReply: () => void;
|
||||
messageId: string;
|
||||
itemIndex: number;
|
||||
}) {
|
||||
const settings = useAtomValue(settingsAtom);
|
||||
const x = useMotionValue(0);
|
||||
const springX = useSpring(x, { stiffness: 400, damping: 40 });
|
||||
const [isReady, setIsReady] = useState(false);
|
||||
|
||||
const iconOpacity = useTransform(x, [0, -8], [0, 1]);
|
||||
|
||||
const isSwipeToReplyEnabled =
|
||||
settings.mobileGestures &&
|
||||
mobileOrTablet() &&
|
||||
settings.rightSwipeAction !== RightSwipeAction.Members;
|
||||
|
||||
const bind = useDrag(({ active, movement: [mx] }) => {
|
||||
if (!isSwipeToReplyEnabled) return;
|
||||
|
||||
if (active) {
|
||||
const val = mx < 0 ? mx : 0;
|
||||
x.set(Math.max(-80, val));
|
||||
setIsReady(mx < -50);
|
||||
} else {
|
||||
if (mx < -50) {
|
||||
if ('vibrate' in navigator) navigator.vibrate(10);
|
||||
onReply();
|
||||
}
|
||||
x.set(0);
|
||||
setIsReady(false);
|
||||
}
|
||||
}, {
|
||||
axis: 'x',
|
||||
bounds: { right: 0 },
|
||||
rubberband: true,
|
||||
filterTaps: true,
|
||||
pointer: { capture: true }
|
||||
});
|
||||
|
||||
if (!settings.mobileGestures || !mobileOrTablet()) {
|
||||
return (
|
||||
<div data-message-id={messageId} data-message-item={itemIndex}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
{...bind()}
|
||||
data-message-id={messageId}
|
||||
data-message-item={itemIndex}
|
||||
style={{ position: 'relative', touchAction: 'pan-y' }}
|
||||
>
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
paddingRight: config.space.S400,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
zIndex: 0,
|
||||
}}>
|
||||
<motion.div style={{ opacity: iconOpacity }}>
|
||||
<Icon
|
||||
src={Icons.ReplyArrow}
|
||||
size="400"
|
||||
style={{
|
||||
color: isReady ? 'var(--sable-surface-on-container)' : 'var(--sable-surface-container)',
|
||||
transition: 'color 0.2s'
|
||||
}}
|
||||
/>
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
<motion.div style={{
|
||||
x: springX,
|
||||
background: 'var(--sable-surface-container)',
|
||||
position: 'relative',
|
||||
zIndex: 1
|
||||
}}>
|
||||
{children}
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import { motion, useMotionValue, useSpring } from 'framer-motion';
|
||||
import { useDrag } from '@use-gesture/react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { settingsAtom } from '../state/settings';
|
||||
import { mobileOrTablet } from '../utils/user-agent';
|
||||
|
||||
interface SwipeableOverlayWrapperProps {
|
||||
children: ReactNode;
|
||||
onClose: () => void;
|
||||
direction: 'left' | 'right';
|
||||
}
|
||||
|
||||
export function SwipeableOverlayWrapper({
|
||||
children,
|
||||
onClose,
|
||||
direction
|
||||
}: SwipeableOverlayWrapperProps) {
|
||||
const settings = useAtomValue(settingsAtom);
|
||||
const x = useMotionValue(0);
|
||||
const springX = useSpring(x, { stiffness: 400, damping: 40 });
|
||||
|
||||
const bind = useDrag(({ active, movement: [mx], velocity: [vx], direction: [dx], event }) => {
|
||||
if (!settings.mobileGestures || !mobileOrTablet()) return;
|
||||
|
||||
event.stopPropagation();
|
||||
|
||||
let val = mx;
|
||||
|
||||
if (direction === 'left' && val > 0) val = 0;
|
||||
if (direction === 'right' && val < 0) val = 0;
|
||||
|
||||
if (active) {
|
||||
x.set(val);
|
||||
} else {
|
||||
const swipeThreshold = 100;
|
||||
const velocityThreshold = 0.5;
|
||||
|
||||
const swipedLeft = direction === 'left' && (val < -swipeThreshold || (vx > velocityThreshold && dx < 0));
|
||||
const swipedRight = direction === 'right' && (val > swipeThreshold || (vx > velocityThreshold && dx > 0));
|
||||
|
||||
if (swipedLeft || swipedRight) {
|
||||
onClose();
|
||||
}
|
||||
|
||||
x.set(0);
|
||||
}
|
||||
}, {
|
||||
axis: 'x',
|
||||
bounds: direction === 'left' ? { left: -300, right: 0 } : { left: 0, right: 300 },
|
||||
rubberband: true,
|
||||
filterTaps: true,
|
||||
pointer: { capture: true }
|
||||
});
|
||||
|
||||
if (!settings.mobileGestures || !mobileOrTablet()) {
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', flexGrow: 1, height: '100%', width: '100%' }}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
{...bind()}
|
||||
style={{
|
||||
touchAction: 'pan-y',
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
flexGrow: 1,
|
||||
height: '100%',
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<motion.div
|
||||
style={{
|
||||
x: springX,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
flexGrow: 1,
|
||||
height: '100%',
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -18,6 +18,8 @@ import { RoomSettingsPage } from '../../state/roomSettings';
|
||||
import { useRoom } from '../../hooks/useRoom';
|
||||
import { DeveloperTools } from '../common-settings/developer-tools';
|
||||
import { Cosmetics } from '../common-settings/cosmetics/Cosmetics';
|
||||
import { SwipeableChatWrapper } from '../../components/SwipeableChatWrapper';
|
||||
import { SwipeableOverlayWrapper } from '../../components/SwipeableOverlayWrapper';
|
||||
|
||||
type RoomSettingsMenuItem = {
|
||||
page: RoomSettingsPage;
|
||||
@@ -95,87 +97,95 @@ export function RoomSettings({ initialPage, requestClose }: RoomSettingsProps) {
|
||||
requestClose();
|
||||
};
|
||||
|
||||
const handleSwipeBack = () => {
|
||||
if (screenSize === ScreenSize.Mobile) {
|
||||
requestClose();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<PageRoot
|
||||
nav={
|
||||
screenSize === ScreenSize.Mobile && activePage !== undefined ? undefined : (
|
||||
<PageNav size="300">
|
||||
<PageNavHeader outlined={false}>
|
||||
<Box grow="Yes" gap="200">
|
||||
<Avatar size="200" radii="300">
|
||||
<RoomAvatar
|
||||
roomId={room.roomId}
|
||||
src={avatarUrl}
|
||||
alt={roomName}
|
||||
renderFallback={() => (
|
||||
<RoomIcon
|
||||
size="50"
|
||||
joinRule={joinRuleContent?.join_rule ?? JoinRule.Invite}
|
||||
filled
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Avatar>
|
||||
<Text size="H4" truncate>
|
||||
{roomName}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
{screenSize === ScreenSize.Mobile && (
|
||||
<IconButton onClick={requestClose} variant="Background">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
)}
|
||||
</Box>
|
||||
</PageNavHeader>
|
||||
<Box grow="Yes" direction="Column">
|
||||
<PageNavContent>
|
||||
<div style={{ flexGrow: 1 }}>
|
||||
{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
|
||||
<SwipeableOverlayWrapper direction="right" onClose={handleSwipeBack}>
|
||||
<PageRoot
|
||||
nav={
|
||||
screenSize === ScreenSize.Mobile && activePage !== undefined ? undefined : (
|
||||
<PageNav size="300">
|
||||
<PageNavHeader outlined={false}>
|
||||
<Box grow="Yes" gap="200">
|
||||
<Avatar size="200" radii="300">
|
||||
<RoomAvatar
|
||||
roomId={room.roomId}
|
||||
src={avatarUrl}
|
||||
alt={roomName}
|
||||
renderFallback={() => (
|
||||
<RoomIcon
|
||||
size="50"
|
||||
joinRule={joinRuleContent?.join_rule ?? JoinRule.Invite}
|
||||
filled
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Avatar>
|
||||
<Text size="H4" truncate>
|
||||
{roomName}
|
||||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
{screenSize === ScreenSize.Mobile && (
|
||||
<IconButton onClick={requestClose} variant="Background">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
)}
|
||||
</Box>
|
||||
</PageNavHeader>
|
||||
<Box grow="Yes" direction="Column">
|
||||
<PageNavContent>
|
||||
<div style={{ flexGrow: 1 }}>
|
||||
{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)}
|
||||
>
|
||||
{item.name}
|
||||
</Text>
|
||||
</MenuItem>
|
||||
))}
|
||||
</div>
|
||||
</PageNavContent>
|
||||
</Box>
|
||||
</PageNav>
|
||||
)
|
||||
}
|
||||
>
|
||||
{activePage === RoomSettingsPage.GeneralPage && (
|
||||
<General requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.MembersPage && (
|
||||
<Members requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.PermissionsPage && (
|
||||
<Permissions requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.CosmeticsPage && (
|
||||
<Cosmetics requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.EmojisStickersPage && (
|
||||
<EmojisStickers requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.DeveloperToolsPage && (
|
||||
<DeveloperTools requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
</PageRoot>
|
||||
<Text
|
||||
style={{
|
||||
fontWeight: activePage === item.page ? config.fontWeight.W600 : undefined,
|
||||
}}
|
||||
size="T300"
|
||||
truncate
|
||||
>
|
||||
{item.name}
|
||||
</Text>
|
||||
</MenuItem>
|
||||
))}
|
||||
</div>
|
||||
</PageNavContent>
|
||||
</Box>
|
||||
</PageNav>
|
||||
)
|
||||
}
|
||||
>
|
||||
{activePage === RoomSettingsPage.GeneralPage && (
|
||||
<General requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.MembersPage && (
|
||||
<Members requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.PermissionsPage && (
|
||||
<Permissions requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.CosmeticsPage && (
|
||||
<Cosmetics requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.EmojisStickersPage && (
|
||||
<EmojisStickers requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
{activePage === RoomSettingsPage.DeveloperToolsPage && (
|
||||
<DeveloperTools requestClose={handlePageRequestClose} />
|
||||
)}
|
||||
</PageRoot>
|
||||
</SwipeableOverlayWrapper>
|
||||
);
|
||||
}
|
||||
@@ -23,21 +23,21 @@ import {
|
||||
RoomEvent,
|
||||
RoomEventHandlerMap,
|
||||
} from 'matrix-js-sdk';
|
||||
import {HTMLReactParserOptions} from 'html-react-parser';
|
||||
import { HTMLReactParserOptions } from 'html-react-parser';
|
||||
import classNames from 'classnames';
|
||||
import {ReactEditor} from 'slate-react';
|
||||
import {Editor} from 'slate';
|
||||
import { ReactEditor } from 'slate-react';
|
||||
import { Editor } from 'slate';
|
||||
import to from 'await-to-js';
|
||||
import {useAtomValue, useSetAtom} from 'jotai';
|
||||
import {as, Badge, Box, Chip, color, config, ContainerColor, Icon, Icons, Line, Scroll, Text, toRem,} from 'folds';
|
||||
import {isKeyHotkey} from 'is-hotkey';
|
||||
import {Opts as LinkifyOpts} from 'linkifyjs';
|
||||
import {useTranslation} from 'react-i18next';
|
||||
import {eventWithShortcode, factoryEventSentBy, getMxIdLocalPart} from '../../utils/matrix';
|
||||
import {useMatrixClient} from '../../hooks/useMatrixClient';
|
||||
import {ItemRange, useVirtualPaginator} from '../../hooks/useVirtualPaginator';
|
||||
import {useAlive} from '../../hooks/useAlive';
|
||||
import {editableActiveElement, scrollToBottom} from '../../utils/dom';
|
||||
import { useAtomValue, useSetAtom } from 'jotai';
|
||||
import { as, Badge, Box, Chip, color, config, ContainerColor, Icon, Icons, Line, Scroll, Text, toRem, } from 'folds';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import { Opts as LinkifyOpts } from 'linkifyjs';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { eventWithShortcode, factoryEventSentBy, getMxIdLocalPart } from '../../utils/matrix';
|
||||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||
import { ItemRange, useVirtualPaginator } from '../../hooks/useVirtualPaginator';
|
||||
import { useAlive } from '../../hooks/useAlive';
|
||||
import { editableActiveElement, scrollToBottom } from '../../utils/dom';
|
||||
import {
|
||||
CompactPlaceholder,
|
||||
DefaultPlaceholder,
|
||||
@@ -69,43 +69,44 @@ import {
|
||||
isMembershipChanged,
|
||||
reactionOrEditEvent,
|
||||
} from '../../utils/room';
|
||||
import {useSetting} from '../../state/hooks/settings';
|
||||
import {MessageLayout, settingsAtom} from '../../state/settings';
|
||||
import {nicknamesAtom} from '../../state/nicknames';
|
||||
import {useMatrixEventRenderer} from '../../hooks/useMatrixEventRenderer';
|
||||
import {EncryptedContent, Event, Message, Reactions} from './message';
|
||||
import {useMemberEventParser} from '../../hooks/useMemberEventParser';
|
||||
import { useSetting } from '../../state/hooks/settings';
|
||||
import { MessageLayout, settingsAtom } from '../../state/settings';
|
||||
import { nicknamesAtom } from '../../state/nicknames';
|
||||
import { useMatrixEventRenderer } from '../../hooks/useMatrixEventRenderer';
|
||||
import { EncryptedContent, Event, Message, Reactions } from './message';
|
||||
import { useMemberEventParser } from '../../hooks/useMemberEventParser';
|
||||
import * as customHtmlCss from '../../styles/CustomHtml.css';
|
||||
import {RoomIntro} from '../../components/room-intro';
|
||||
import {getIntersectionObserverEntry, useIntersectionObserver,} from '../../hooks/useIntersectionObserver';
|
||||
import {markAsRead} from '../../utils/notifications';
|
||||
import {useDebounce} from '../../hooks/useDebounce';
|
||||
import {getResizeObserverEntry, useResizeObserver} from '../../hooks/useResizeObserver';
|
||||
import { RoomIntro } from '../../components/room-intro';
|
||||
import { getIntersectionObserverEntry, useIntersectionObserver, } from '../../hooks/useIntersectionObserver';
|
||||
import { markAsRead } from '../../utils/notifications';
|
||||
import { useDebounce } from '../../hooks/useDebounce';
|
||||
import { getResizeObserverEntry, useResizeObserver } from '../../hooks/useResizeObserver';
|
||||
import * as css from './RoomTimeline.css';
|
||||
import {inSameDay, minuteDifference, timeDayMonthYear, today, yesterday} from '../../utils/time';
|
||||
import {createMentionElement, isEmptyEditor, moveCursor} from '../../components/editor';
|
||||
import {roomIdToReplyDraftAtomFamily} from '../../state/room/roomInputDrafts';
|
||||
import {usePowerLevelsContext} from '../../hooks/usePowerLevels';
|
||||
import {GetContentCallback, MessageEvent, StateEvent} from '../../../types/matrix/room';
|
||||
import {useKeyDown} from '../../hooks/useKeyDown';
|
||||
import {useDocumentFocusChange} from '../../hooks/useDocumentFocusChange';
|
||||
import {RenderMessageContent} from '../../components/RenderMessageContent';
|
||||
import {Image} from '../../components/media';
|
||||
import {ImageViewer} from '../../components/image-viewer';
|
||||
import {roomToParentsAtom} from '../../state/room/roomToParents';
|
||||
import {useRoomUnread} from '../../state/hooks/unread';
|
||||
import {roomToUnreadAtom} from '../../state/room/roomToUnread';
|
||||
import {useMentionClickHandler} from '../../hooks/useMentionClickHandler';
|
||||
import {useSpoilerClickHandler} from '../../hooks/useSpoilerClickHandler';
|
||||
import {useRoomNavigate} from '../../hooks/useRoomNavigate';
|
||||
import {useMediaAuthentication} from '../../hooks/useMediaAuthentication';
|
||||
import {useIgnoredUsers} from '../../hooks/useIgnoredUsers';
|
||||
import {useImagePackRooms} from '../../hooks/useImagePackRooms';
|
||||
import {useOpenUserRoomProfile} from '../../state/hooks/userRoomProfile';
|
||||
import {useSpaceOptionally} from '../../hooks/useSpace';
|
||||
import {useRoomCreators} from '../../hooks/useRoomCreators';
|
||||
import {useRoomPermissions} from '../../hooks/useRoomPermissions';
|
||||
import {useGetMemberPowerTag} from '../../hooks/useMemberPowerTag';
|
||||
import { inSameDay, minuteDifference, timeDayMonthYear, today, yesterday } from '../../utils/time';
|
||||
import { createMentionElement, isEmptyEditor, moveCursor } from '../../components/editor';
|
||||
import { roomIdToReplyDraftAtomFamily } from '../../state/room/roomInputDrafts';
|
||||
import { usePowerLevelsContext } from '../../hooks/usePowerLevels';
|
||||
import { GetContentCallback, MessageEvent, StateEvent } from '../../../types/matrix/room';
|
||||
import { useKeyDown } from '../../hooks/useKeyDown';
|
||||
import { useDocumentFocusChange } from '../../hooks/useDocumentFocusChange';
|
||||
import { RenderMessageContent } from '../../components/RenderMessageContent';
|
||||
import { Image } from '../../components/media';
|
||||
import { ImageViewer } from '../../components/image-viewer';
|
||||
import { roomToParentsAtom } from '../../state/room/roomToParents';
|
||||
import { useRoomUnread } from '../../state/hooks/unread';
|
||||
import { roomToUnreadAtom } from '../../state/room/roomToUnread';
|
||||
import { useMentionClickHandler } from '../../hooks/useMentionClickHandler';
|
||||
import { useSpoilerClickHandler } from '../../hooks/useSpoilerClickHandler';
|
||||
import { useRoomNavigate } from '../../hooks/useRoomNavigate';
|
||||
import { useMediaAuthentication } from '../../hooks/useMediaAuthentication';
|
||||
import { useIgnoredUsers } from '../../hooks/useIgnoredUsers';
|
||||
import { useImagePackRooms } from '../../hooks/useImagePackRooms';
|
||||
import { useOpenUserRoomProfile } from '../../state/hooks/userRoomProfile';
|
||||
import { useSpaceOptionally } from '../../hooks/useSpace';
|
||||
import { useRoomCreators } from '../../hooks/useRoomCreators';
|
||||
import { useRoomPermissions } from '../../hooks/useRoomPermissions';
|
||||
import { useGetMemberPowerTag } from '../../hooks/useMemberPowerTag';
|
||||
import { SwipeableMessageWrapper } from '../../components/SwipeableMessageWrapper';
|
||||
|
||||
const TimelineFloat = as<'div', css.TimelineFloatVariants>(
|
||||
({ position, className, ...props }, ref) => (
|
||||
@@ -224,25 +225,25 @@ const useEventTimelineLoader = (
|
||||
onError: (err: Error | null) => void
|
||||
) => {
|
||||
return useCallback(
|
||||
async (eventId: string) => {
|
||||
const [err, replyEvtTimeline] = await to(
|
||||
mx.getEventTimeline(room.getUnfilteredTimelineSet(), eventId)
|
||||
);
|
||||
if (!replyEvtTimeline) {
|
||||
onError(err ?? null);
|
||||
return;
|
||||
}
|
||||
const linkedTimelines = getLinkedTimelines(replyEvtTimeline);
|
||||
const absIndex = getEventIdAbsoluteIndex(linkedTimelines, replyEvtTimeline, eventId);
|
||||
async (eventId: string) => {
|
||||
const [err, replyEvtTimeline] = await to(
|
||||
mx.getEventTimeline(room.getUnfilteredTimelineSet(), eventId)
|
||||
);
|
||||
if (!replyEvtTimeline) {
|
||||
onError(err ?? null);
|
||||
return;
|
||||
}
|
||||
const linkedTimelines = getLinkedTimelines(replyEvtTimeline);
|
||||
const absIndex = getEventIdAbsoluteIndex(linkedTimelines, replyEvtTimeline, eventId);
|
||||
|
||||
if (absIndex === undefined) {
|
||||
onError(err ?? null);
|
||||
return;
|
||||
}
|
||||
if (absIndex === undefined) {
|
||||
onError(err ?? null);
|
||||
return;
|
||||
}
|
||||
|
||||
onLoad(eventId, linkedTimelines, absIndex);
|
||||
},
|
||||
[mx, room, onLoad, onError]
|
||||
onLoad(eventId, linkedTimelines, absIndex);
|
||||
},
|
||||
[mx, room, onLoad, onError]
|
||||
);
|
||||
};
|
||||
|
||||
@@ -260,9 +261,9 @@ const useTimelinePagination = (
|
||||
let fetching = false;
|
||||
|
||||
const recalibratePagination = (
|
||||
linkedTimelines: EventTimeline[],
|
||||
timelinesEventsCount: number[],
|
||||
backwards: boolean
|
||||
linkedTimelines: EventTimeline[],
|
||||
timelinesEventsCount: number[],
|
||||
backwards: boolean
|
||||
) => {
|
||||
const topTimeline = linkedTimelines[0];
|
||||
const timelineMatch = (mt: EventTimeline) => (t: EventTimeline) => t === mt;
|
||||
@@ -272,36 +273,36 @@ const useTimelinePagination = (
|
||||
const topAddedTm = topTmIndex === -1 ? [] : newLTimelines.slice(0, topTmIndex);
|
||||
|
||||
const topTmAddedEvt =
|
||||
timelineToEventsCount(newLTimelines[topTmIndex]) - timelinesEventsCount[0];
|
||||
timelineToEventsCount(newLTimelines[topTmIndex]) - timelinesEventsCount[0];
|
||||
const offsetRange = getTimelinesEventsCount(topAddedTm) + (backwards ? topTmAddedEvt : 0);
|
||||
|
||||
setTimeline((currentTimeline) => ({
|
||||
linkedTimelines: newLTimelines,
|
||||
range:
|
||||
offsetRange > 0
|
||||
? {
|
||||
start: currentTimeline.range.start + offsetRange,
|
||||
end: currentTimeline.range.end + offsetRange,
|
||||
}
|
||||
: {...currentTimeline.range},
|
||||
offsetRange > 0
|
||||
? {
|
||||
start: currentTimeline.range.start + offsetRange,
|
||||
end: currentTimeline.range.end + offsetRange,
|
||||
}
|
||||
: { ...currentTimeline.range },
|
||||
}));
|
||||
};
|
||||
|
||||
return async (backwards: boolean) => {
|
||||
if (fetching) return;
|
||||
const {linkedTimelines: lTimelines} = timelineRef.current;
|
||||
const { linkedTimelines: lTimelines } = timelineRef.current;
|
||||
const timelinesEventsCount = lTimelines.map(timelineToEventsCount);
|
||||
|
||||
const timelineToPaginate = backwards ? lTimelines[0] : lTimelines[lTimelines.length - 1];
|
||||
if (!timelineToPaginate) return;
|
||||
|
||||
const paginationToken = timelineToPaginate.getPaginationToken(
|
||||
backwards ? Direction.Backward : Direction.Forward
|
||||
backwards ? Direction.Backward : Direction.Forward
|
||||
);
|
||||
if (
|
||||
!paginationToken &&
|
||||
getTimelinesEventsCount(lTimelines) !==
|
||||
getTimelinesEventsCount(getLinkedTimelines(timelineToPaginate))
|
||||
!paginationToken &&
|
||||
getTimelinesEventsCount(lTimelines) !==
|
||||
getTimelinesEventsCount(getLinkedTimelines(timelineToPaginate))
|
||||
) {
|
||||
recalibratePagination(lTimelines, timelinesEventsCount, backwards);
|
||||
return;
|
||||
@@ -309,19 +310,19 @@ const useTimelinePagination = (
|
||||
|
||||
fetching = true;
|
||||
const [err] = await to(
|
||||
mx.paginateEventTimeline(timelineToPaginate, {
|
||||
backwards,
|
||||
limit,
|
||||
})
|
||||
mx.paginateEventTimeline(timelineToPaginate, {
|
||||
backwards,
|
||||
limit,
|
||||
})
|
||||
);
|
||||
if (err) {
|
||||
// TODO: handle pagination error.
|
||||
return;
|
||||
}
|
||||
const fetchedTimeline =
|
||||
timelineToPaginate.getNeighbouringTimeline(
|
||||
backwards ? Direction.Backward : Direction.Forward
|
||||
) ?? timelineToPaginate;
|
||||
timelineToPaginate.getNeighbouringTimeline(
|
||||
backwards ? Direction.Backward : Direction.Forward
|
||||
) ?? timelineToPaginate;
|
||||
// Decrypt all event ahead of render cycle
|
||||
const roomId = fetchedTimeline.getRoomId();
|
||||
const room = roomId ? mx.getRoom(roomId) : null;
|
||||
@@ -952,15 +953,11 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
ReactEditor.focus(editor);
|
||||
moveCursor(editor);
|
||||
},
|
||||
[mx, room, editor]
|
||||
[mx, room, editor, nicknames]
|
||||
);
|
||||
|
||||
const handleReplyClick: MouseEventHandler<HTMLButtonElement> = useCallback(
|
||||
(evt, startThread = false) => {
|
||||
const replyId = evt.currentTarget.getAttribute('data-event-id');
|
||||
if (!replyId) {
|
||||
throw new Error('Button should have "data-event-id" attribute!');
|
||||
}
|
||||
const triggerReply = useCallback(
|
||||
(replyId: string, startThread = false) => {
|
||||
const replyEvt = room.findEventById(replyId);
|
||||
if (!replyEvt) return;
|
||||
const editedReply = getEditedEvent(replyId, replyEvt, room.getUnfilteredTimelineSet());
|
||||
@@ -984,6 +981,14 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
[room, setReplyDraft, editor]
|
||||
);
|
||||
|
||||
const handleReplyClick: MouseEventHandler<HTMLButtonElement> = useCallback(
|
||||
(evt) => {
|
||||
const replyId = evt.currentTarget.getAttribute('data-event-id');
|
||||
if (replyId) triggerReply(replyId);
|
||||
},
|
||||
[triggerReply]
|
||||
);
|
||||
|
||||
const handleReactionToggle = useCallback(
|
||||
(targetEventId: string, key: string, shortcode?: string) => {
|
||||
const relations = getEventReactions(room.getUnfilteredTimelineSet(), targetEventId);
|
||||
@@ -1040,73 +1045,79 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
getMemberDisplayName(room, senderId, nicknames) ?? getMxIdLocalPart(senderId) ?? senderId;
|
||||
|
||||
return (
|
||||
<Message
|
||||
key={mEvent.getId()}
|
||||
data-message-item={item}
|
||||
data-message-id={mEventId}
|
||||
room={room}
|
||||
mEvent={mEvent}
|
||||
messageSpacing={messageSpacing}
|
||||
messageLayout={messageLayout}
|
||||
collapse={collapse}
|
||||
highlight={highlighted}
|
||||
edit={editId === mEventId}
|
||||
canDelete={canRedact || (canDeleteOwn && mEvent.getSender() === mx.getUserId())}
|
||||
canSendReaction={canSendReaction}
|
||||
canPinEvent={canPinEvent}
|
||||
imagePackRooms={imagePackRooms}
|
||||
relations={hasReactions ? reactionRelations : undefined}
|
||||
onUserClick={handleUserClick}
|
||||
onUsernameClick={handleUsernameClick}
|
||||
onReplyClick={handleReplyClick}
|
||||
onReactionToggle={handleReactionToggle}
|
||||
onEditId={handleEdit}
|
||||
reply={
|
||||
replyEventId && (
|
||||
<Reply
|
||||
room={room}
|
||||
timelineSet={timelineSet}
|
||||
replyEventId={replyEventId}
|
||||
threadRootId={threadRootId}
|
||||
onClick={handleOpenReply}
|
||||
/>
|
||||
)
|
||||
}
|
||||
reactions={
|
||||
reactionRelations && (
|
||||
<Reactions
|
||||
style={{ marginTop: config.space.S200 }}
|
||||
room={room}
|
||||
relations={reactionRelations}
|
||||
mEventId={mEventId}
|
||||
canSendReaction={canSendReaction}
|
||||
onReactionToggle={handleReactionToggle}
|
||||
/>
|
||||
)
|
||||
}
|
||||
hideReadReceipts={hideActivity}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
memberPowerTag={getMemberPowerTag(senderId)}
|
||||
hour24Clock={hour24Clock}
|
||||
dateFormatString={dateFormatString}
|
||||
<SwipeableMessageWrapper
|
||||
messageId={mEventId}
|
||||
itemIndex={item}
|
||||
onReply={() => triggerReply(mEventId)}
|
||||
>
|
||||
{mEvent.isRedacted() ? (
|
||||
<RedactedContent reason={mEvent.getUnsigned().redacted_because?.content.reason} />
|
||||
) : (
|
||||
<RenderMessageContent
|
||||
displayName={senderDisplayName}
|
||||
msgType={mEvent.getContent().msgtype ?? ''}
|
||||
ts={mEvent.getTs()}
|
||||
edited={!!editedEvent}
|
||||
getContent={getContent}
|
||||
mediaAutoLoad={mediaAutoLoad}
|
||||
urlPreview={showUrlPreview}
|
||||
htmlReactParserOptions={htmlReactParserOptions}
|
||||
linkifyOpts={linkifyOpts}
|
||||
outlineAttachment={messageLayout === MessageLayout.Bubble}
|
||||
/>
|
||||
)}
|
||||
</Message>
|
||||
<Message
|
||||
key={mEvent.getId()}
|
||||
data-message-item={item}
|
||||
data-message-id={mEventId}
|
||||
room={room}
|
||||
mEvent={mEvent}
|
||||
messageSpacing={messageSpacing}
|
||||
messageLayout={messageLayout}
|
||||
collapse={collapse}
|
||||
highlight={highlighted}
|
||||
edit={editId === mEventId}
|
||||
canDelete={canRedact || (canDeleteOwn && mEvent.getSender() === mx.getUserId())}
|
||||
canSendReaction={canSendReaction}
|
||||
canPinEvent={canPinEvent}
|
||||
imagePackRooms={imagePackRooms}
|
||||
relations={hasReactions ? reactionRelations : undefined}
|
||||
onUserClick={handleUserClick}
|
||||
onUsernameClick={handleUsernameClick}
|
||||
onReplyClick={handleReplyClick}
|
||||
onReactionToggle={handleReactionToggle}
|
||||
onEditId={handleEdit}
|
||||
reply={
|
||||
replyEventId && (
|
||||
<Reply
|
||||
room={room}
|
||||
timelineSet={timelineSet}
|
||||
replyEventId={replyEventId}
|
||||
threadRootId={threadRootId}
|
||||
onClick={handleOpenReply}
|
||||
/>
|
||||
)
|
||||
}
|
||||
reactions={
|
||||
reactionRelations && (
|
||||
<Reactions
|
||||
style={{ marginTop: config.space.S200 }}
|
||||
room={room}
|
||||
relations={reactionRelations}
|
||||
mEventId={mEventId}
|
||||
canSendReaction={canSendReaction}
|
||||
onReactionToggle={handleReactionToggle}
|
||||
/>
|
||||
)
|
||||
}
|
||||
hideReadReceipts={hideActivity}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
memberPowerTag={getMemberPowerTag(senderId)}
|
||||
hour24Clock={hour24Clock}
|
||||
dateFormatString={dateFormatString}
|
||||
>
|
||||
{mEvent.isRedacted() ? (
|
||||
<RedactedContent reason={mEvent.getUnsigned().redacted_because?.content.reason} />
|
||||
) : (
|
||||
<RenderMessageContent
|
||||
displayName={senderDisplayName}
|
||||
msgType={mEvent.getContent().msgtype ?? ''}
|
||||
ts={mEvent.getTs()}
|
||||
edited={!!editedEvent}
|
||||
getContent={getContent}
|
||||
mediaAutoLoad={mediaAutoLoad}
|
||||
urlPreview={showUrlPreview}
|
||||
htmlReactParserOptions={htmlReactParserOptions}
|
||||
linkifyOpts={linkifyOpts}
|
||||
outlineAttachment={messageLayout === MessageLayout.Bubble}
|
||||
/>
|
||||
)}
|
||||
</Message>
|
||||
</SwipeableMessageWrapper>
|
||||
);
|
||||
},
|
||||
[MessageEvent.RoomMessageEncrypted]: (mEventId, mEvent, item, timelineSet, collapse) => {
|
||||
|
||||
@@ -22,6 +22,11 @@ import { useSetting } from '../../state/hooks/settings';
|
||||
import { useRoomPermissions } from '../../hooks/useRoomPermissions';
|
||||
import { useRoomCreators } from '../../hooks/useRoomCreators';
|
||||
import { ScreenSize, useScreenSizeContext } from '../../hooks/useScreenSize';
|
||||
import { SwipeableChatWrapper } from '../../components/SwipeableChatWrapper';
|
||||
import { BackRouteHandler } from '../../components/BackRouteHandler';
|
||||
import { useOpenRoomSettings } from '../../state/hooks/roomSettings';
|
||||
import { useSpaceOptionally } from '../../hooks/useSpace';
|
||||
import { RoomSettingsPage } from '../../state/roomSettings';
|
||||
|
||||
const FN_KEYS_REGEX = /^F\d+$/;
|
||||
const shouldFocusMessageField = (evt: KeyboardEvent): boolean => {
|
||||
@@ -90,58 +95,76 @@ export function RoomView({ room, eventId }: { room: Room; eventId?: string }) {
|
||||
)
|
||||
);
|
||||
|
||||
const openSettings = useOpenRoomSettings();
|
||||
const space = useSpaceOptionally();
|
||||
|
||||
const handleOpenMembers = useCallback(() => {
|
||||
if (screenSize === ScreenSize.Mobile) {
|
||||
openSettings(room.roomId, space?.roomId, RoomSettingsPage.MembersPage);
|
||||
}
|
||||
}, [screenSize, openSettings, room.roomId, space?.roomId]);
|
||||
|
||||
return (
|
||||
<Page
|
||||
ref={roomViewRef}
|
||||
style={
|
||||
room.isCallRoom() && screenSize === ScreenSize.Desktop
|
||||
? { maxWidth: toRem(399), minWidth: toRem(399) }
|
||||
: {}
|
||||
}
|
||||
>
|
||||
<Box grow="Yes" direction="Column">
|
||||
<RoomTimeline
|
||||
key={roomId}
|
||||
room={room}
|
||||
eventId={eventId}
|
||||
roomInputRef={roomInputRef}
|
||||
editor={editor}
|
||||
/>
|
||||
<RoomViewTyping room={room} />
|
||||
</Box>
|
||||
<Box shrink="No" direction="Column">
|
||||
<div style={{ padding: `0 ${config.space.S400}` }}>
|
||||
{tombstoneEvent ? (
|
||||
<RoomTombstone
|
||||
roomId={roomId}
|
||||
body={tombstoneEvent.getContent().body}
|
||||
replacementRoomId={tombstoneEvent.getContent().replacement_room}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
{canMessage && (
|
||||
<RoomInput
|
||||
room={room}
|
||||
editor={editor}
|
||||
roomId={roomId}
|
||||
fileDropContainerRef={roomViewRef}
|
||||
ref={roomInputRef}
|
||||
/>
|
||||
)}
|
||||
{!canMessage && (
|
||||
<RoomInputPlaceholder
|
||||
style={{ padding: config.space.S200 }}
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
>
|
||||
<Text align="Center">You do not have permission to post in this room</Text>
|
||||
</RoomInputPlaceholder>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{hideActivity ? <RoomViewFollowingPlaceholder /> : <RoomViewFollowing room={room} />}
|
||||
</Box>
|
||||
</Page>
|
||||
<BackRouteHandler>
|
||||
{(onBack) => (
|
||||
<Page
|
||||
ref={roomViewRef}
|
||||
style={
|
||||
room.isCallRoom() && screenSize === ScreenSize.Desktop
|
||||
? { maxWidth: toRem(399), minWidth: toRem(399) }
|
||||
: {}
|
||||
}
|
||||
>
|
||||
<SwipeableChatWrapper
|
||||
onOpenSidebar={onBack}
|
||||
onOpenMembers={handleOpenMembers}
|
||||
>
|
||||
<Box grow="Yes" direction="Column">
|
||||
<RoomTimeline
|
||||
key={roomId}
|
||||
room={room}
|
||||
eventId={eventId}
|
||||
roomInputRef={roomInputRef}
|
||||
editor={editor}
|
||||
/>
|
||||
<RoomViewTyping room={room} />
|
||||
</Box>
|
||||
<Box shrink="No" direction="Column">
|
||||
<div style={{ padding: `0 ${config.space.S400}` }}>
|
||||
{tombstoneEvent ? (
|
||||
<RoomTombstone
|
||||
roomId={roomId}
|
||||
body={tombstoneEvent.getContent().body}
|
||||
replacementRoomId={tombstoneEvent.getContent().replacement_room}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
{canMessage && (
|
||||
<RoomInput
|
||||
room={room}
|
||||
editor={editor}
|
||||
roomId={roomId}
|
||||
fileDropContainerRef={roomViewRef}
|
||||
ref={roomInputRef}
|
||||
/>
|
||||
)}
|
||||
{!canMessage && (
|
||||
<RoomInputPlaceholder
|
||||
style={{ padding: config.space.S200 }}
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
>
|
||||
<Text align="Center">You do not have permission to post in this room</Text>
|
||||
</RoomInputPlaceholder>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{hideActivity ? <RoomViewFollowingPlaceholder /> : <RoomViewFollowing room={room} />}
|
||||
</Box>
|
||||
</SwipeableChatWrapper>
|
||||
</Page>
|
||||
)}
|
||||
</BackRouteHandler>
|
||||
);
|
||||
}
|
||||
@@ -32,10 +32,10 @@ import FocusTrap from 'focus-trap-react';
|
||||
import { Page, PageContent, PageHeader } from '../../../components/page';
|
||||
import { SequenceCard } from '../../../components/sequence-card';
|
||||
import { useSetting } from '../../../state/hooks/settings';
|
||||
import { DateFormat, MessageLayout, MessageSpacing, settingsAtom } from '../../../state/settings';
|
||||
import { DateFormat, MessageLayout, MessageSpacing, RightSwipeAction, settingsAtom } from '../../../state/settings';
|
||||
import { SettingTile } from '../../../components/setting-tile';
|
||||
import { KeySymbol } from '../../../utils/key-symbol';
|
||||
import { isMacOS } from '../../../utils/user-agent';
|
||||
import { isMacOS, mobileOrTablet } from '../../../utils/user-agent';
|
||||
import {
|
||||
DarkTheme,
|
||||
LightTheme,
|
||||
@@ -707,7 +707,7 @@ function DateAndTime() {
|
||||
);
|
||||
}
|
||||
|
||||
function Editor() {
|
||||
function Editor({ isMobile }: { isMobile: boolean }) {
|
||||
const [enterForNewline, setEnterForNewline] = useSetting(settingsAtom, 'enterForNewline');
|
||||
const [isMarkdown, setIsMarkdown] = useSetting(settingsAtom, 'isMarkdown');
|
||||
const [hideActivity, setHideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
@@ -715,12 +715,11 @@ function Editor() {
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Editor</Text>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column" style={{ opacity: isMobile ? 0.5 : 1 }}>
|
||||
<SettingTile
|
||||
title="ENTER for Newline"
|
||||
description={`Use ${isMacOS() ? KeySymbol.Command : 'Ctrl'
|
||||
} + ENTER to send message and ENTER for newline. Ignored on mobile.`}
|
||||
after={<Switch variant="Primary" value={enterForNewline} onChange={setEnterForNewline} />}
|
||||
description={`Use ${isMacOS() ? KeySymbol.Command : 'Ctrl'} + ENTER to send message. ${isMobile ? '(Disabled on Mobile)' : ''}`}
|
||||
after={<Switch variant="Primary" value={enterForNewline} onChange={setEnterForNewline} disabled={isMobile} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
@@ -878,6 +877,111 @@ function SelectMessageSpacing() {
|
||||
);
|
||||
}
|
||||
|
||||
function SelectRightSwipeAction({ disabled }: { disabled?: boolean }) {
|
||||
const [menuCords, setMenuCords] = useState<RectCords>();
|
||||
const [action, setAction] = useSetting(settingsAtom, 'rightSwipeAction');
|
||||
|
||||
const options = [
|
||||
{ id: RightSwipeAction.Reply, name: 'Reply to Message' },
|
||||
{ id: RightSwipeAction.Members, name: 'Open Member List' },
|
||||
];
|
||||
|
||||
const handleMenu: MouseEventHandler<HTMLButtonElement> = (evt) => {
|
||||
setMenuCords(evt.currentTarget.getBoundingClientRect());
|
||||
};
|
||||
|
||||
const handleSelect = (val: RightSwipeAction) => {
|
||||
setAction(val);
|
||||
setMenuCords(undefined);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
size="300"
|
||||
variant="Secondary"
|
||||
outlined
|
||||
fill="Soft"
|
||||
radii="300"
|
||||
disabled={disabled}
|
||||
after={<Icon size="300" src={Icons.ChevronBottom} />}
|
||||
onClick={handleMenu}
|
||||
>
|
||||
<Text size="T300">
|
||||
{options.find((o) => o.id === action)?.name ?? action}
|
||||
</Text>
|
||||
</Button>
|
||||
<PopOut
|
||||
anchor={menuCords}
|
||||
offset={5}
|
||||
position="Bottom"
|
||||
align="End"
|
||||
content={
|
||||
<FocusTrap
|
||||
focusTrapOptions={{
|
||||
initialFocus: false,
|
||||
onDeactivate: () => setMenuCords(undefined),
|
||||
clickOutsideDeactivates: true,
|
||||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
>
|
||||
<Menu>
|
||||
<Box direction="Column" gap="100" style={{ padding: config.space.S100 }}>
|
||||
{options.map((option) => (
|
||||
<MenuItem
|
||||
key={option.id}
|
||||
size="300"
|
||||
variant={action === option.id ? 'Primary' : 'Surface'}
|
||||
radii="300"
|
||||
onClick={() => handleSelect(option.id)}
|
||||
>
|
||||
<Text size="T300">{option.name}</Text>
|
||||
</MenuItem>
|
||||
))}
|
||||
</Box>
|
||||
</Menu>
|
||||
</FocusTrap>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Gestures({ isMobile }: { isMobile: boolean }) {
|
||||
const [mobileGestures, setMobileGestures] = useSetting(settingsAtom, 'mobileGestures');
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="100" style={{ opacity: isMobile ? 1 : 0.5 }}>
|
||||
<Text size="L400">Gestures {!isMobile && "(Mobile Only)"}</Text>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Enable Swiping"
|
||||
description="Swipe left for rooms, swipe right for actions."
|
||||
after={
|
||||
<Switch
|
||||
variant="Primary"
|
||||
value={mobileGestures}
|
||||
onChange={setMobileGestures}
|
||||
disabled={!isMobile}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Right Swipe Action"
|
||||
description="What happens when you swipe right on a message."
|
||||
after={
|
||||
<SelectRightSwipeAction
|
||||
disabled={!isMobile || !mobileGestures}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
function Messages() {
|
||||
const [legacyUsernameColor, setLegacyUsernameColor] = useSetting(
|
||||
settingsAtom,
|
||||
@@ -1003,7 +1107,8 @@ export function General({ requestClose }: GeneralProps) {
|
||||
<Box direction="Column" gap="700">
|
||||
<Appearance />
|
||||
<DateAndTime />
|
||||
<Editor />
|
||||
<Gestures isMobile={mobileOrTablet()} />
|
||||
<Editor isMobile={mobileOrTablet()} />
|
||||
<Messages />
|
||||
</Box>
|
||||
</PageContent>
|
||||
|
||||
@@ -86,6 +86,11 @@ import { BreakWord } from '../../../styles/Text.css';
|
||||
import { InviteUserPrompt } from '../../../components/invite-user-prompt';
|
||||
import { CallNavStatus } from '../../../features/room-nav/RoomCallNavStatus';
|
||||
import { useCallState } from '../call/CallProvider';
|
||||
import { SwipeableChatWrapper } from '../../../components/SwipeableChatWrapper';
|
||||
import { mobileOrTablet } from '../../../utils/user-agent';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { lastVisitedRoomIdAtom } from '../../../state/room/lastRoom';
|
||||
import { SwipeableOverlayWrapper } from '../../../components/SwipeableOverlayWrapper';
|
||||
|
||||
type SpaceMenuProps = {
|
||||
room: Room;
|
||||
@@ -350,7 +355,7 @@ export function SpaceTombstone({ roomId, replacementRoomId }: SpaceTombstoneProp
|
||||
</Box>
|
||||
<Box direction="Column" shrink="No">
|
||||
{replacementRoom?.getMyMembership() === Membership.Join ||
|
||||
joinState.status === AsyncStatus.Success ? (
|
||||
joinState.status === AsyncStatus.Success ? (
|
||||
<Button onClick={handleOpen} size="300" variant="Success" fill="Solid" radii="300">
|
||||
<Text size="B300">Open New Space</Text>
|
||||
</Button>
|
||||
@@ -449,103 +454,115 @@ export function Space() {
|
||||
const getToLink = (roomId: string) =>
|
||||
getSpaceRoomPath(spaceIdOrAlias, getCanonicalAliasOrRoomId(mx, roomId));
|
||||
|
||||
const navigate = useNavigate();
|
||||
const lastRoomId = useAtomValue(lastVisitedRoomIdAtom);
|
||||
|
||||
const handleSwipeToRoom = useCallback(() => {
|
||||
if (mobileOrTablet() && lastRoomId) {
|
||||
const roomAliasOrId = getCanonicalAliasOrRoomId(mx, lastRoomId);
|
||||
navigate(getSpaceRoomPath(spaceIdOrAlias, roomAliasOrId));
|
||||
}
|
||||
}, [lastRoomId, spaceIdOrAlias, mx, navigate]);
|
||||
|
||||
return (
|
||||
<PageNav>
|
||||
<SpaceHeader />
|
||||
<PageNavContent scrollRef={scrollRef}>
|
||||
<Box direction="Column" gap="300">
|
||||
{tombstoneEvent && (
|
||||
<SpaceTombstone
|
||||
roomId={space.roomId}
|
||||
replacementRoomId={tombstoneEvent.getContent().replacement_room}
|
||||
/>
|
||||
)}
|
||||
<NavCategory>
|
||||
<NavItem variant="Background" radii="400" aria-selected={lobbySelected}>
|
||||
<NavLink to={getSpaceLobbyPath(getCanonicalAliasOrRoomId(mx, space.roomId))}>
|
||||
<NavItemContent>
|
||||
<Box as="span" grow="Yes" alignItems="Center" gap="200">
|
||||
<Avatar size="200" radii="400">
|
||||
<Icon src={Icons.Flag} size="100" filled={lobbySelected} />
|
||||
</Avatar>
|
||||
<Box as="span" grow="Yes">
|
||||
<Text as="span" size="Inherit" truncate>
|
||||
Lobby
|
||||
</Text>
|
||||
<SwipeableOverlayWrapper direction="left" onClose={handleSwipeToRoom}>
|
||||
<SpaceHeader />
|
||||
<PageNavContent scrollRef={scrollRef}>
|
||||
<Box direction="Column" gap="300">
|
||||
{tombstoneEvent && (
|
||||
<SpaceTombstone
|
||||
roomId={space.roomId}
|
||||
replacementRoomId={tombstoneEvent.getContent().replacement_room}
|
||||
/>
|
||||
)}
|
||||
<NavCategory>
|
||||
<NavItem variant="Background" radii="400" aria-selected={lobbySelected}>
|
||||
<NavLink to={getSpaceLobbyPath(getCanonicalAliasOrRoomId(mx, space.roomId))}>
|
||||
<NavItemContent>
|
||||
<Box as="span" grow="Yes" alignItems="Center" gap="200">
|
||||
<Avatar size="200" radii="400">
|
||||
<Icon src={Icons.Flag} size="100" filled={lobbySelected} />
|
||||
</Avatar>
|
||||
<Box as="span" grow="Yes">
|
||||
<Text as="span" size="Inherit" truncate>
|
||||
Lobby
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
</NavItemContent>
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
<NavItem variant="Background" radii="400" aria-selected={searchSelected}>
|
||||
<NavLink to={getSpaceSearchPath(getCanonicalAliasOrRoomId(mx, space.roomId))}>
|
||||
<NavItemContent>
|
||||
<Box as="span" grow="Yes" alignItems="Center" gap="200">
|
||||
<Avatar size="200" radii="400">
|
||||
<Icon src={Icons.Search} size="100" filled={searchSelected} />
|
||||
</Avatar>
|
||||
<Box as="span" grow="Yes">
|
||||
<Text as="span" size="Inherit" truncate>
|
||||
Message Search
|
||||
</Text>
|
||||
</NavItemContent>
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
<NavItem variant="Background" radii="400" aria-selected={searchSelected}>
|
||||
<NavLink to={getSpaceSearchPath(getCanonicalAliasOrRoomId(mx, space.roomId))}>
|
||||
<NavItemContent>
|
||||
<Box as="span" grow="Yes" alignItems="Center" gap="200">
|
||||
<Avatar size="200" radii="400">
|
||||
<Icon src={Icons.Search} size="100" filled={searchSelected} />
|
||||
</Avatar>
|
||||
<Box as="span" grow="Yes">
|
||||
<Text as="span" size="Inherit" truncate>
|
||||
Message Search
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
</NavItemContent>
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
</NavCategory>
|
||||
<NavCategory
|
||||
style={{
|
||||
height: virtualizer.getTotalSize(),
|
||||
position: 'relative',
|
||||
}}
|
||||
>
|
||||
{virtualizer.getVirtualItems().map((vItem) => {
|
||||
const { roomId } = hierarchy[vItem.index] ?? {};
|
||||
const room = mx.getRoom(roomId);
|
||||
if (!room) return null;
|
||||
</NavItemContent>
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
</NavCategory>
|
||||
<NavCategory
|
||||
style={{
|
||||
height: virtualizer.getTotalSize(),
|
||||
position: 'relative',
|
||||
}}
|
||||
>
|
||||
{virtualizer.getVirtualItems().map((vItem) => {
|
||||
const { roomId } = hierarchy[vItem.index] ?? {};
|
||||
const room = mx.getRoom(roomId);
|
||||
if (!room) return null;
|
||||
|
||||
if (room.isSpaceRoom()) {
|
||||
const categoryId = makeNavCategoryId(space.roomId, roomId);
|
||||
if (room.isSpaceRoom()) {
|
||||
const categoryId = makeNavCategoryId(space.roomId, roomId);
|
||||
|
||||
return (
|
||||
<VirtualTile
|
||||
virtualItem={vItem}
|
||||
key={vItem.index}
|
||||
ref={virtualizer.measureElement}
|
||||
>
|
||||
<div style={{ paddingTop: vItem.index === 0 ? undefined : config.space.S400 }}>
|
||||
<NavCategoryHeader>
|
||||
<RoomNavCategoryButton
|
||||
data-category-id={categoryId}
|
||||
onClick={handleCategoryClick}
|
||||
closed={closedCategories.has(categoryId)}
|
||||
>
|
||||
{roomId === space.roomId ? 'Rooms' : room?.name}
|
||||
</RoomNavCategoryButton>
|
||||
</NavCategoryHeader>
|
||||
</div>
|
||||
</VirtualTile>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<VirtualTile
|
||||
virtualItem={vItem}
|
||||
key={vItem.index}
|
||||
ref={virtualizer.measureElement}
|
||||
>
|
||||
<div style={{ paddingTop: vItem.index === 0 ? undefined : config.space.S400 }}>
|
||||
<NavCategoryHeader>
|
||||
<RoomNavCategoryButton
|
||||
data-category-id={categoryId}
|
||||
onClick={handleCategoryClick}
|
||||
closed={closedCategories.has(categoryId)}
|
||||
>
|
||||
{roomId === space.roomId ? 'Rooms' : room?.name}
|
||||
</RoomNavCategoryButton>
|
||||
</NavCategoryHeader>
|
||||
</div>
|
||||
<VirtualTile virtualItem={vItem} key={vItem.index} ref={virtualizer.measureElement}>
|
||||
<RoomNavItem
|
||||
room={room}
|
||||
selected={selectedRoomId === roomId}
|
||||
showAvatar={mDirects.has(roomId)}
|
||||
direct={mDirects.has(roomId)}
|
||||
linkPath={getToLink(roomId)}
|
||||
notificationMode={getRoomNotificationMode(notificationPreferences, room.roomId)}
|
||||
/>
|
||||
</VirtualTile>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<VirtualTile virtualItem={vItem} key={vItem.index} ref={virtualizer.measureElement}>
|
||||
<RoomNavItem
|
||||
room={room}
|
||||
selected={selectedRoomId === roomId}
|
||||
showAvatar={mDirects.has(roomId)}
|
||||
direct={mDirects.has(roomId)}
|
||||
linkPath={getToLink(roomId)}
|
||||
notificationMode={getRoomNotificationMode(notificationPreferences, room.roomId)}
|
||||
/>
|
||||
</VirtualTile>
|
||||
);
|
||||
})}
|
||||
</NavCategory>
|
||||
</Box>
|
||||
</PageNavContent>
|
||||
<CallNavStatus />
|
||||
</PageNav>
|
||||
})}
|
||||
</NavCategory>
|
||||
</Box>
|
||||
</PageNavContent>
|
||||
<CallNavStatus />
|
||||
</SwipeableOverlayWrapper>
|
||||
</PageNav >
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { atom } from 'jotai';
|
||||
|
||||
// This is only used for mobile swipe gestures
|
||||
// It is not particularly accurate and shouldn't be used for much else
|
||||
// unless you plan major refractors
|
||||
export const lastVisitedRoomIdAtom = atom<string | undefined>(undefined);
|
||||
@@ -9,6 +9,11 @@ export enum MessageLayout {
|
||||
Bubble = 2,
|
||||
}
|
||||
|
||||
export enum RightSwipeAction {
|
||||
Members = 'members',
|
||||
Reply = 'reply',
|
||||
}
|
||||
|
||||
export type JumboEmojiSize = 'none' | 'extraSmall' | 'small' | 'normal' | 'large' | 'extraLarge';
|
||||
|
||||
export interface Settings {
|
||||
@@ -46,6 +51,10 @@ export interface Settings {
|
||||
|
||||
// Cosmetics!
|
||||
jumboEmojiSize: JumboEmojiSize;
|
||||
|
||||
// Sable features!
|
||||
mobileGestures: boolean;
|
||||
rightSwipeAction: RightSwipeAction;
|
||||
}
|
||||
|
||||
const defaultSettings: Settings = {
|
||||
@@ -82,7 +91,11 @@ const defaultSettings: Settings = {
|
||||
developerTools: false,
|
||||
|
||||
// Cosmetics!
|
||||
jumboEmojiSize: 'normal'
|
||||
jumboEmojiSize: 'normal',
|
||||
|
||||
// Sable features!
|
||||
mobileGestures: true,
|
||||
rightSwipeAction: RightSwipeAction.Reply,
|
||||
};
|
||||
|
||||
export const getSettings = () => {
|
||||
|
||||
Reference in new issue
Block a user