c54cb126ff
Fix settings modal regression: Modal500 was wrapped in useModalStyle(560), forcing maxWidth 560px and squishing the two-pane Settings layout (folds size="500" is ~50rem). Restore desktop width to the folds recipe while keeping mobile fullscreen. N-series fixes: - N13 ScheduledMessagesTray header: <Box as="button"> -> folds <Button> - N28 composer char counter: drop undefined --tc-surface-low + opacity, use priority="300" and config.space token - N31 collapsible "Read more" toggle: padded <Button> -> flush inline-button pattern matching (edited) link - N41 UserPrivateNotes "Saving..." now shows a folds <Spinner> - N43 Night Light slider: add accentColor; label opacity -> priority - N44 mention-highlight Reset: bare <button> -> folds <Button> (drops undefined --border-interactive-normal); Boot button kept (TDS-only) - N45 SelectTheme trigger variant -> Secondary to match SettingsSelect - N49 RoomInsights StatTile emoji -> folds <Icon> (Photo/VideoCamera/ Headphone/File) - N54/N57 PiP overlay badges + fullscreen button: token discipline (config.radii/space, folds Text); dark scrim kept for video legibility - N60 knock badge: match Pinned Messages pattern (no wrapper div, toRem insets, no hardcoded size overrides) - N62 unverified-device banner: 3px left-accent -> standard border via color.Warning.ContainerLine; drop opacity hacks - N65 Edit History: real "Load more" pagination (accumulate next_batch, de-dupe by id, re-sort by ts) replacing passive text - N66 search date fields: raw <input type="date"> -> folds <Input> - N67 SeasonalEffect z-index 9999 -> 9997 (below Night Light + modals) - N73 Pending Requests header uses css.MembersGroupLabel - N74 remove raw em-sized emoji <span> in RoomNavItem name - N85/N86 RemindMeDialog: <Box role="dialog"> -> folds <Dialog>; preset MenuItems -> Buttons (fixes invalid menuitem-in-dialog ARIA) Document deliberate WON'T FIX rationale for N9, N51, N61, N71, N75, N77. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
125 lines
3.6 KiB
TypeScript
125 lines
3.6 KiB
TypeScript
import React, { useMemo } from 'react';
|
|
import FocusTrap from 'focus-trap-react';
|
|
import {
|
|
Box,
|
|
Button,
|
|
config,
|
|
Dialog,
|
|
Header,
|
|
Icon,
|
|
IconButton,
|
|
Icons,
|
|
Line,
|
|
Overlay,
|
|
OverlayBackdrop,
|
|
OverlayCenter,
|
|
Text,
|
|
} from 'folds';
|
|
import { stopPropagation } from '../../../utils/keyboard';
|
|
import { useReminders } from '../../../hooks/useReminders';
|
|
import { useModalStyle } from '../../../hooks/useModalStyle';
|
|
|
|
type RemindMeDialogProps = {
|
|
roomId: string;
|
|
eventId: string;
|
|
previewText: string;
|
|
onClose: () => void;
|
|
};
|
|
|
|
function getPresets(): Array<{ label: string; ms: number }> {
|
|
const tomorrow = new Date();
|
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
tomorrow.setHours(9, 0, 0, 0);
|
|
const timeLabel = tomorrow.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
return [
|
|
{ label: 'In 20 minutes', ms: 20 * 60_000 },
|
|
{ label: 'In 1 hour', ms: 60 * 60_000 },
|
|
{ label: 'In 3 hours', ms: 3 * 60 * 60_000 },
|
|
{ label: `Tomorrow at ${timeLabel}`, ms: tomorrow.getTime() - Date.now() },
|
|
];
|
|
}
|
|
|
|
export function RemindMeDialog({ roomId, eventId, previewText, onClose }: RemindMeDialogProps) {
|
|
const modalStyle = useModalStyle(320);
|
|
const { addReminder } = useReminders();
|
|
const presets = useMemo(() => getPresets(), []);
|
|
|
|
const handlePick = async (ms: number) => {
|
|
await addReminder({
|
|
roomId,
|
|
eventId,
|
|
timestamp: Date.now() + ms,
|
|
message: previewText || 'Reminder',
|
|
});
|
|
onClose();
|
|
};
|
|
|
|
return (
|
|
<Overlay open backdrop={<OverlayBackdrop />}>
|
|
<OverlayCenter>
|
|
<FocusTrap
|
|
focusTrapOptions={{
|
|
initialFocus: false,
|
|
onDeactivate: onClose,
|
|
clickOutsideDeactivates: true,
|
|
escapeDeactivates: stopPropagation,
|
|
}}
|
|
>
|
|
<Dialog
|
|
variant="Surface"
|
|
role="dialog"
|
|
aria-modal="true"
|
|
aria-labelledby="remind-me-title"
|
|
style={modalStyle}
|
|
>
|
|
<Header
|
|
variant="Surface"
|
|
size="500"
|
|
style={{
|
|
padding: `0 ${config.space.S200} 0 ${config.space.S400}`,
|
|
borderBottomWidth: config.borderWidth.B300,
|
|
}}
|
|
>
|
|
<Box grow="Yes" alignItems="Center" gap="200">
|
|
<Icon src={Icons.Clock} size="100" />
|
|
<Text id="remind-me-title" size="H4">
|
|
Remind Me
|
|
</Text>
|
|
</Box>
|
|
<IconButton size="300" radii="300" onClick={onClose} aria-label="Close">
|
|
<Icon src={Icons.Cross} />
|
|
</IconButton>
|
|
</Header>
|
|
{previewText && (
|
|
<>
|
|
<Box style={{ padding: `${config.space.S200} ${config.space.S400}` }}>
|
|
<Text size="T200" priority="300" truncate>
|
|
{previewText}
|
|
</Text>
|
|
</Box>
|
|
<Line size="300" />
|
|
</>
|
|
)}
|
|
<Box direction="Column" gap="100" style={{ padding: config.space.S200 }}>
|
|
{presets.map((p) => (
|
|
<Button
|
|
key={p.label}
|
|
size="300"
|
|
variant="Secondary"
|
|
fill="Soft"
|
|
radii="300"
|
|
onClick={() => handlePick(p.ms)}
|
|
>
|
|
<Text size="B300" truncate>
|
|
{p.label}
|
|
</Text>
|
|
</Button>
|
|
))}
|
|
</Box>
|
|
</Dialog>
|
|
</FocusTrap>
|
|
</OverlayCenter>
|
|
</Overlay>
|
|
);
|
|
}
|