diff --git a/src/app/features/call/CallControls.tsx b/src/app/features/call/CallControls.tsx index 4688ce8a..6643069c 100644 --- a/src/app/features/call/CallControls.tsx +++ b/src/app/features/call/CallControls.tsx @@ -1,4 +1,4 @@ -import { MouseEventHandler, useCallback, useRef, useState } from 'react'; +import { MouseEventHandler, useCallback, useEffect, useRef, useState } from 'react'; import { Box, Button, @@ -15,7 +15,13 @@ import { toRem, } from 'folds'; import FocusTrap from 'focus-trap-react'; -import { SequenceCard } from '../../components/sequence-card'; +import { SequenceCard } from '$components/sequence-card'; +import { CallEmbed, useCallControlState } from '$plugins/call'; +import { stopPropagation } from '$utils/keyboard'; +import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback'; +import { useRoom } from '$hooks/useRoom'; +import { ScreenSize, useScreenSizeContext } from '$hooks/useScreenSize'; +import { useCallPreferences } from '$state/hooks/callPreferences'; import * as css from './styles.css'; import { ChatButton, @@ -25,11 +31,6 @@ import { SoundButton, VideoButton, } from './Controls'; -import { CallEmbed, useCallControlState } from '../../plugins/call'; -import { stopPropagation } from '../../utils/keyboard'; -import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback'; -import { useRoom } from '../../hooks/useRoom'; -import { ScreenSize, useScreenSizeContext } from '../../hooks/useScreenSize'; type CallControlsProps = { callEmbed: CallEmbed; @@ -45,6 +46,12 @@ export function CallControls({ callEmbed }: CallControlsProps) { callEmbed.control ); + const { setPreferences } = useCallPreferences(); + + useEffect(() => { + setPreferences({ microphone, video, sound }); + }, [microphone, video, sound, setPreferences]); + const [cords, setCords] = useState(); const handleOpenMenu: MouseEventHandler = (evt) => { diff --git a/src/app/features/thread-mockup/ThreadMockupPage.tsx b/src/app/features/thread-mockup/ThreadMockupPage.tsx deleted file mode 100644 index 669270a7..00000000 --- a/src/app/features/thread-mockup/ThreadMockupPage.tsx +++ /dev/null @@ -1,684 +0,0 @@ -import { useState } from 'react'; -import { - Box, - Chip, - Header, - Icon, - IconButton, - Icons, - Line, - Scroll, - Text, - config, - toRem, -} from 'folds'; -import { Page, PageHeader } from '$components/page'; -import * as css from './thread-mockup.css'; - -// --------------------------------------------------------------------------- -// Mock data -// --------------------------------------------------------------------------- - -type MockReply = { - id: string; - sender: string; - senderColor: string; - initial: string; - body: string; - time: string; -}; - -type MockMessage = { - id: string; - sender: string; - senderColor: string; - initial: string; - body: string; - time: string; - threadCount?: number; - threadPreview?: string; - threadParticipants?: { initial: string; color: string }[]; -}; - -const MESSAGES: MockMessage[] = [ - { - id: 'msg1', - sender: 'Alice', - senderColor: '#a855f7', - initial: 'A', - body: 'Has anyone looked at the new design system yet?', - time: '11:02 AM', - }, - { - id: 'msg2', - sender: 'Bob', - senderColor: '#3b82f6', - initial: 'B', - body: 'Yeah! I think we should move the navigation to the left sidebar. What does everyone think about that?', - time: '11:05 AM', - threadCount: 4, - threadPreview: 'Carol: I agree, it makes more sense for larger screens', - threadParticipants: [ - { initial: 'C', color: '#ec4899' }, - { initial: 'D', color: '#10b981' }, - { initial: 'A', color: '#a855f7' }, - ], - }, - { - id: 'msg3', - sender: 'Carol', - senderColor: '#ec4899', - initial: 'C', - body: 'I pushed the updated mockups to Figma, check them out when you get a chance 🎨', - time: '11:22 AM', - }, - { - id: 'msg4', - sender: 'Alice', - senderColor: '#a855f7', - initial: 'A', - body: 'Looks great! One question — are we keeping the current colour palette or exploring new options?', - time: '11:24 AM', - threadCount: 2, - threadPreview: 'Bob: I think we should try a few options first', - threadParticipants: [{ initial: 'B', color: '#3b82f6' }], - }, -]; - -const REPLIES: Record = { - msg2: [ - { - id: 'r1', - sender: 'Carol', - senderColor: '#ec4899', - initial: 'C', - body: 'I agree, it makes more sense for larger screens', - time: '11:08 AM', - }, - { - id: 'r2', - sender: 'Dave', - senderColor: '#10b981', - initial: 'D', - body: 'Could work on mobile too with a bottom sheet pattern', - time: '11:10 AM', - }, - { - id: 'r3', - sender: 'Alice', - senderColor: '#a855f7', - initial: 'A', - body: 'Good point! Maybe collapsible by default on mobile?', - time: '11:12 AM', - }, - { - id: 'r4', - sender: 'Bob', - senderColor: '#3b82f6', - initial: 'B', - body: 'Yes, and we can persist the open/closed state per session', - time: '11:14 AM', - }, - ], - msg4: [ - { - id: 'r5', - sender: 'Bob', - senderColor: '#3b82f6', - initial: 'B', - body: "I think we should try a few options first — let's create some variations", - time: '11:26 AM', - }, - { - id: 'r6', - sender: 'Carol', - senderColor: '#ec4899', - initial: 'C', - body: "Agreed, let's make it fully themeable from the start", - time: '11:31 AM', - }, - ], -}; - -// --------------------------------------------------------------------------- -// Sub-components -// --------------------------------------------------------------------------- - -type AvatarCircleProps = { - initial: string; - color: string; - small?: boolean; -}; - -function AvatarCircle({ initial, color, small }: AvatarCircleProps) { - return ( -
- {initial} -
- ); -} - -type MockReplyItemProps = { - reply: MockReply; -}; - -function MockReplyItem({ reply }: MockReplyItemProps) { - return ( -
- - - - - {reply.sender} - - - {reply.time} - - - {reply.body} - -
- ); -} - -type ThreadChipProps = { - message: MockMessage; - onClick?: () => void; - active?: boolean; -}; - -function ThreadCountChip({ message, onClick, active }: ThreadChipProps) { - if (!message.threadCount) return null; - return ( -
-
- {message.threadParticipants?.map((p) => ( - - ))} -
- } - > - - {message.threadCount} {message.threadCount === 1 ? 'reply' : 'replies'} - - - {message.threadPreview && ( - - {message.threadPreview} - - )} -
- ); -} - -type MessageItemProps = { - message: MockMessage; - onOpenThread?: () => void; - active?: boolean; - showThreadChip?: boolean; -}; - -function MessageItem({ message, onOpenThread, active, showThreadChip = true }: MessageItemProps) { - return ( - -
- - - - - {message.sender} - - - {message.time} - - - {message.body} - - {message.threadCount && ( - - - - )} -
- {showThreadChip && message.threadCount && ( - - )} -
- ); -} - -// --------------------------------------------------------------------------- -// Thread Panel (shared between Side Panel and Overlay variants) -// --------------------------------------------------------------------------- - -type ThreadPanelProps = { - messageId: string; - onClose: () => void; -}; - -function ThreadPanelContents({ messageId, onClose }: ThreadPanelProps) { - const rootMsg = MESSAGES.find((m) => m.id === messageId); - const replies = REPLIES[messageId] ?? []; - if (!rootMsg) return null; - - return ( - <> -
- - - - - Thread - - - - # general - - - - - -
- - - {/* Root message */} -
- - - - - - {rootMsg.sender} - - - {rootMsg.time} - - - {rootMsg.body} - - -
- - {/* Reply count label */} - - - {replies.length} {replies.length === 1 ? 'reply' : 'replies'} - - - - - {/* Replies */} - - {replies.map((reply) => ( - - ))} - -
- - {/* Thread input */} -
- - -
- - Reply in thread… - -
- - - -
-
- - ); -} - -// --------------------------------------------------------------------------- -// Variant A: Side Panel -// --------------------------------------------------------------------------- - -function SidePanelVariant() { - const [openThread, setOpenThread] = useState('msg2'); - - return ( -
- {/* Timeline */} -
- - - {MESSAGES.map((msg) => ( - - setOpenThread(openThread === msg.id ? '' : msg.id)} - active={openThread === msg.id} - /> - - ))} - - - - {/* Room input */} -
- - -
- - Message # general… - -
- - - -
-
-
- - {/* Thread panel */} - {openThread && ( - <> - -
- setOpenThread('')} /> -
- - )} -
- ); -} - -// --------------------------------------------------------------------------- -// Variant B: Inline Replies -// --------------------------------------------------------------------------- - -function InlineVariant() { - const [expanded, setExpanded] = useState>({ msg2: true }); - - const toggle = (id: string) => setExpanded((prev) => ({ ...prev, [id]: !prev[id] })); - - return ( -
-
- - - {MESSAGES.map((msg) => ( - - {/* Message row (no chip, controls handled inline) */} - - - {/* Inline expand/collapse */} - {msg.threadCount && ( -
- toggle(msg.id)} - before={ - - } - > - - {expanded[msg.id] ? 'Collapse' : `Show ${msg.threadCount} replies`} - {!expanded[msg.id] && msg.threadPreview && ( - - — {msg.threadPreview} - - )} - - -
- )} - - {/* Expanded inline replies */} - {msg.threadCount && expanded[msg.id] && ( -
- - {(REPLIES[msg.id] ?? []).map((reply) => ( - - ))} - - {/* Inline reply input */} - - -
- - Reply to thread… - -
-
-
- )} -
- ))} -
-
- -
- - -
- - Message # general… - -
- - - -
-
-
-
- ); -} - -// --------------------------------------------------------------------------- -// Variant C: Overlay Panel -// --------------------------------------------------------------------------- - -function OverlayVariant() { - const [openThread, setOpenThread] = useState(null); - - return ( -
- {/* Timeline */} -
- - - {MESSAGES.map((msg) => ( - setOpenThread(msg.id)} - active={openThread === msg.id} - /> - ))} - - - -
- - -
- - Message # general… - -
- - - -
-
-
- - {/* Overlay */} - {openThread && ( - // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -
{ - if (e.target === e.currentTarget) setOpenThread(null); - }} - > -
- setOpenThread(null)} /> -
-
- )} -
- ); -} - -// --------------------------------------------------------------------------- -// Variant descriptions -// --------------------------------------------------------------------------- - -const VARIANTS = [ - { - id: 'side-panel' as const, - label: 'Side Panel', - icon: Icons.Thread, - description: - 'Thread opens as a persistent side panel next to the timeline (à la Discord/Slack)', - }, - { - id: 'inline' as const, - label: 'Inline', - icon: Icons.ThreadReply, - description: 'Replies expand inline below their parent message — no extra panel needed', - }, - { - id: 'overlay' as const, - label: 'Overlay', - icon: Icons.ThreadUnread, - description: 'Thread slides in as a floating overlay on top of the timeline', - }, -] as const; - -type VariantId = (typeof VARIANTS)[number]['id']; - -// --------------------------------------------------------------------------- -// Page -// --------------------------------------------------------------------------- - -export function ThreadMockupPage() { - const [variant, setVariant] = useState('side-panel'); - const currentVariant = VARIANTS.find((v) => v.id === variant)!; - - return ( - - {/* Simulated room header */} - - - - - general - - - Design system discussion - - - - {/* Variant badge */} - - - - Mockup: - - - {currentVariant.label} - - - - - {/* Variant selector bar */} -
- - - Thread UI - - - Toggle between approaches: - - {VARIANTS.map((v) => ( - setVariant(v.id)} - before={} - > - {v.label} - - ))} - - - {currentVariant.description} - -
- - {/* Mockup content */} - {variant === 'side-panel' && } - {variant === 'inline' && } - {variant === 'overlay' && } -
- ); -} diff --git a/src/app/features/thread-mockup/index.ts b/src/app/features/thread-mockup/index.ts deleted file mode 100644 index 3e101e51..00000000 --- a/src/app/features/thread-mockup/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { ThreadMockupPage } from './ThreadMockupPage'; diff --git a/src/app/features/thread-mockup/thread-mockup.css.ts b/src/app/features/thread-mockup/thread-mockup.css.ts deleted file mode 100644 index 2c640ae3..00000000 --- a/src/app/features/thread-mockup/thread-mockup.css.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { style } from '@vanilla-extract/css'; -import { config, toRem } from 'folds'; - -export const MockupPage = style({ - height: '100%', - overflow: 'hidden', - display: 'flex', - flexDirection: 'column', -}); - -export const VariantBar = style({ - padding: `${config.space.S100} ${config.space.S300}`, - flexShrink: 0, - display: 'flex', - alignItems: 'center', - gap: config.space.S100, - borderBottomWidth: config.borderWidth.B300, - borderBottomStyle: 'solid', -}); - -export const ContentArea = style({ - flex: 1, - overflow: 'hidden', - display: 'flex', - position: 'relative', -}); - -export const Timeline = style({ - flex: 1, - overflow: 'hidden', - display: 'flex', - flexDirection: 'column', -}); - -export const TimelineScroll = style({ - flex: 1, - overflow: 'hidden', -}); - -export const MessageRow = style({ - padding: `${config.space.S100} ${config.space.S400}`, - display: 'flex', - gap: config.space.S300, - borderRadius: config.radii.R300, - transition: 'background 80ms', - selectors: { - '&:hover': { - backgroundColor: 'var(--mx-bg-surface-hover)', - }, - '&[data-active="true"]': { - backgroundColor: 'var(--mx-bg-surface-active)', - }, - }, -}); - -export const ThreadChipRow = style({ - paddingLeft: toRem(80), - paddingBottom: config.space.S100, - display: 'flex', - alignItems: 'center', - gap: config.space.S100, -}); - -export const InlineThreadContainer = style({ - marginLeft: toRem(80), - marginRight: config.space.S400, - marginBottom: config.space.S200, - paddingLeft: config.space.S300, - borderRadius: config.radii.R300, - borderLeftWidth: '2px', - borderLeftStyle: 'solid', - overflow: 'hidden', -}); - -export const InlineReplyRow = style({ - padding: `${config.space.S100} 0`, - display: 'flex', - gap: config.space.S200, -}); - -export const ThreadPanel = style({ - width: toRem(340), - flexShrink: 0, - overflow: 'hidden', - display: 'flex', - flexDirection: 'column', - borderLeftWidth: config.borderWidth.B300, - borderLeftStyle: 'solid', -}); - -export const ThreadPanelHeader = style({ - padding: `0 ${config.space.S200} 0 ${config.space.S300}`, - flexShrink: 0, - borderBottomWidth: config.borderWidth.B300, - borderBottomStyle: 'solid', -}); - -export const ThreadPanelScroll = style({ - flex: 1, - overflow: 'hidden', -}); - -export const ThreadRootMsg = style({ - padding: config.space.S300, - marginBottom: config.space.S100, - borderBottomWidth: config.borderWidth.B300, - borderBottomStyle: 'solid', -}); - -export const InputArea = style({ - padding: `${config.space.S200} ${config.space.S300}`, - flexShrink: 0, - borderTopWidth: config.borderWidth.B300, - borderTopStyle: 'solid', -}); - -export const MockInput = style({ - padding: `${config.space.S200} ${config.space.S300}`, - borderRadius: config.radii.R300, - borderWidth: config.borderWidth.B300, - borderStyle: 'solid', - flex: 1, - display: 'flex', - alignItems: 'center', -}); - -export const OverlayBackdrop = style({ - position: 'absolute', - inset: 0, - backgroundColor: 'rgba(0, 0, 0, 0.45)', - zIndex: 10, - display: 'flex', - justifyContent: 'flex-end', -}); - -export const OverlayPanel = style({ - width: toRem(400), - maxWidth: '100%', - height: '100%', - display: 'flex', - flexDirection: 'column', - overflow: 'hidden', -}); - -export const AvatarCircle = style({ - width: toRem(36), - height: toRem(36), - borderRadius: '50%', - flexShrink: 0, - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - fontWeight: 700, - fontSize: toRem(15), - color: 'white', - userSelect: 'none', -}); - -export const SmallAvatarCircle = style({ - width: toRem(24), - height: toRem(24), - borderRadius: '50%', - flexShrink: 0, - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - fontWeight: 600, - fontSize: toRem(11), - color: 'white', - userSelect: 'none', -}); - -export const ParticipantAvatars = style({ - display: 'flex', - alignItems: 'center', - gap: toRem(-4), -}); - -export const NewBadge = style({ - padding: `0 ${config.space.S100}`, - borderRadius: config.radii.R300, - fontSize: toRem(10), - fontWeight: 700, - letterSpacing: '0.04em', - color: 'white', - backgroundColor: 'var(--mx-tc-primary)', - flexShrink: 0, -}); diff --git a/src/app/pages/Router.tsx b/src/app/pages/Router.tsx index f5e7d3b7..f14567f7 100644 --- a/src/app/pages/Router.tsx +++ b/src/app/pages/Router.tsx @@ -26,13 +26,11 @@ import { NotificationJumper } from '$hooks/useNotificationJumper'; import { SearchModalRenderer } from '$features/search'; import { GlobalKeyboardShortcuts } from '$components/GlobalKeyboardShortcuts'; import { CallEmbedProvider } from '$components/CallEmbedProvider'; -import { ThreadMockupPage } from '$features/thread-mockup'; import { AuthLayout, Login, Register, ResetPassword } from './auth'; import { DIRECT_PATH, EXPLORE_PATH, HOME_PATH, - THREAD_MOCKUP_PATH, LOGIN_PATH, INBOX_PATH, REGISTER_PATH, @@ -345,7 +343,6 @@ export const createRouter = (clientConfig: ClientConfig, screenSize: ScreenSize) } /> } /> - } /> Page not found

} />
diff --git a/src/app/pages/client/WelcomePage.tsx b/src/app/pages/client/WelcomePage.tsx index 11705de7..6999759d 100644 --- a/src/app/pages/client/WelcomePage.tsx +++ b/src/app/pages/client/WelcomePage.tsx @@ -72,15 +72,6 @@ export function WelcomePage() { Features - diff --git a/src/app/pages/paths.ts b/src/app/pages/paths.ts index 9ff0a831..82f8c6dd 100644 --- a/src/app/pages/paths.ts +++ b/src/app/pages/paths.ts @@ -1,7 +1,5 @@ export const ROOT_PATH = '/'; -export const THREAD_MOCKUP_PATH = '/thread-mockup/'; - export type LoginPathSearchParams = { username?: string; email?: string;