mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 17:11:17 -08:00
More hidden events & Phosphor Icons replacement & Add reactions button (#934)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description <!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. --> Copied from changesets :p Add more hidden timeline events with settings and rendering. #### Settings - Add a master Show Hidden Events toggle with per-type sub-toggles for message edits, redactions, reactions, and other unrecognized events - Sub-toggles stay visible beneath the master toggle and are disabled while hidden events are off - Fold the redacted-message tombstone setting into the redactions group and migrate existing tombstone preferences #### Timeline filtering and rendering - Show message edits as timeline events with reply navigation and an inline word/line diff between versions - Show reactions, message redactions, and reaction redactions as timeline events instead of message bubbles - Keep redacted reactions in the timeline as tombstones with redaction events linking back to them when possible - Improve reply-chip previews for edits, redactions, reactions, and redacted targets - Merge related edit and reaction events into the timeline when they are missing from pagination #### Safeguards - Hide forward, delete, and other message actions on timeline meta events that cannot be forwarded or meaningfully deleted - Disallow forwarding deleted messages and other non-message event types Migrated all icons to Phosphor Icons and added a setting to display globe/lock icon instead of the hash tag for the room sidebar. Added a reaction shortcut when a message already has a reaction. + fixed the polls changeset formatting a little, i think... #### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings ### AI disclosure: - [x] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. --> AI did the bit of test generation and assisted with some of the bulk icon replacement, although the icons were manually picked out.
This commit is contained in:
245 files changed
+4491
-1774
No files matched your search
@@ -0,0 +1,22 @@
|
||||
---
|
||||
default: minor
|
||||
---
|
||||
|
||||
Added more hidden timeline events with settings and rendering.
|
||||
|
||||
#### Settings
|
||||
|
||||
- Added a master Show Hidden Events toggle with per-type sub-toggles for message edits, redactions, reactions, and other unrecognized events
|
||||
- Sub-toggles stay visible beneath the master toggle and are disabled while hidden events are off
|
||||
|
||||
#### Timeline rendering
|
||||
|
||||
- Show message edits as timeline events with reply navigation and an inline word/line diff between versions
|
||||
- Show reactions, message redactions, and reaction redactions as timeline events
|
||||
- Keep redacted reactions in the timeline as tombstones with redaction events linking back to them when possible
|
||||
- Improve reply-chip previews for edits, redactions, reactions, and redacted targets
|
||||
|
||||
#### Safeguards
|
||||
|
||||
- Hide forward, delete, and other message actions on timeline meta events that cannot be forwarded or meaningfully deleted
|
||||
- Disallow forwarding deleted messages and other non-message event types
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
default: minor
|
||||
---
|
||||
|
||||
Added an inline add-reaction button at the end of message reaction lists.
|
||||
@@ -4,10 +4,10 @@ default: minor
|
||||
|
||||
Add polls!
|
||||
|
||||
## Add Polls with a new Menu for adding items
|
||||
#### Add Polls with a new Menu for adding items
|
||||
|
||||
- The polls have a simple style for showing and interfacing with poll events
|
||||
- There is now a simple interface for creating polls which integrates the spec
|
||||
- Now the Plus button on the bottom left can open a menu for selecting what to send, which will be useful for future options aswell
|
||||
- For the people that prefer to only add files with that button they can disable the menu and still create polls with the /poll command
|
||||
- You can see who voted for what in a clear menu
|
||||
- The polls have a simple style for showing and interfacing with poll events
|
||||
- There is now a simple interface for creating polls which integrates the spec
|
||||
- Now the Plus button on the bottom left can open a menu for selecting what to send, which will be useful for future options as well
|
||||
- For the people that prefer to only add files with that button they can disable the menu and still create polls with the /poll command
|
||||
- You can see who voted for what in a clear menu
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
default: patch
|
||||
---
|
||||
|
||||
Migrated all icons to Phosphor Icons and added a setting to display globe/lock icon instead of the hash tag for the room sidebar.
|
||||
@@ -3,8 +3,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Text,
|
||||
Icon,
|
||||
Icons,
|
||||
IconButton,
|
||||
Input,
|
||||
Button,
|
||||
@@ -15,6 +13,7 @@ import {
|
||||
Scroll,
|
||||
config,
|
||||
} from 'folds';
|
||||
import { ArrowLeft, composerIcon, sizedIcon, X } from '$components/icons/phosphor';
|
||||
import type { MatrixError } from '$types/matrix-sdk';
|
||||
import { Cursor } from '$plugins/text-area';
|
||||
import { syntaxErrorPosition } from '$utils/dom';
|
||||
@@ -289,14 +288,14 @@ export function AccountDataEditor({
|
||||
size="500"
|
||||
radii="Pill"
|
||||
onClick={requestClose}
|
||||
before={<Icon size="100" src={Icons.ArrowLeft} />}
|
||||
before={sizedIcon(ArrowLeft, '100')}
|
||||
>
|
||||
<Text size="T300">Developer Tools</Text>
|
||||
</Chip>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
@@ -9,9 +9,7 @@ import {
|
||||
Button,
|
||||
color,
|
||||
config,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Menu,
|
||||
percent,
|
||||
PopOut,
|
||||
@@ -30,6 +28,12 @@ import {
|
||||
} from '$hooks/useKeyBackup';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { useRestoreBackupOnVerification } from '$hooks/useRestoreBackupOnVerification';
|
||||
import {
|
||||
Download,
|
||||
DotsThreeOutlineVerticalIcon,
|
||||
sizedIcon,
|
||||
menuIcon,
|
||||
} from '$components/icons/phosphor';
|
||||
import { InfoCard } from './info-card';
|
||||
|
||||
type BackupStatusProps = {
|
||||
@@ -184,7 +188,7 @@ export function BackupRestoreTile({ crypto }: BackupRestoreTileProps) {
|
||||
radii="300"
|
||||
onClick={handleMenu}
|
||||
>
|
||||
<Icon size="100" src={Icons.VerticalDots} />
|
||||
{menuIcon(DotsThreeOutlineVerticalIcon, { weight: menuCords ? 'fill' : 'regular' })}
|
||||
</IconButton>
|
||||
<PopOut
|
||||
anchor={menuCords}
|
||||
@@ -233,7 +237,7 @@ export function BackupRestoreTile({ crypto }: BackupRestoreTileProps) {
|
||||
? undefined
|
||||
: handleRestore
|
||||
}
|
||||
before={<Icon size="100" src={Icons.Download} />}
|
||||
before={sizedIcon(Download, '100')}
|
||||
>
|
||||
<Text size="B300">Restore Backup</Text>
|
||||
</Button>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Box, Button, Dialog, Icon, Icons, Text, color, config } from 'folds';
|
||||
import { Box, Button, Dialog, Text, color, config } from 'folds';
|
||||
import { Warning, sizedIcon } from '$components/icons/phosphor';
|
||||
import * as Sentry from '@sentry/react';
|
||||
import { SplashScreen } from '$components/splash-screen';
|
||||
import { buildGitHubUrl } from '$features/bug-report/BugReportModal';
|
||||
|
||||
type ErrorPageProps = {
|
||||
error: Error;
|
||||
/** Sentry event ID — present when Sentry.ErrorBoundary captured the crash */
|
||||
/** Sentry event ID Epresent when Sentry.ErrorBoundary captured the crash */
|
||||
eventId?: string;
|
||||
};
|
||||
|
||||
@@ -48,12 +49,7 @@ export function ErrorPage({ error, eventId }: ErrorPageProps) {
|
||||
<Box style={{ padding: config.space.S400 }} direction="Column" gap="400">
|
||||
<Box direction="Column" gap="100">
|
||||
<Box alignItems="Center" gap="200">
|
||||
<Icon
|
||||
size="300"
|
||||
src={Icons.Warning}
|
||||
filled
|
||||
style={{ color: color.Critical.Main }}
|
||||
/>
|
||||
{sizedIcon(Warning, '300', { filled: true, style: { color: color.Critical.Main } })}
|
||||
<Text size="H2">Oops! Something went wrong</Text>
|
||||
</Box>
|
||||
<Text size="T300">
|
||||
|
||||
@@ -8,15 +8,14 @@ import {
|
||||
config,
|
||||
Dialog,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
OverlayCenter,
|
||||
Spinner,
|
||||
Text,
|
||||
} from 'folds';
|
||||
import { composerIcon, X } from '$components/icons/phosphor';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import * as Sentry from '@sentry/react';
|
||||
import {
|
||||
@@ -273,7 +272,7 @@ export function DeviceVerification({ request, onExit }: DeviceVerificationProps)
|
||||
<Text size="H4">Device Verification</Text>
|
||||
</Box>
|
||||
<IconButton size="300" radii="300" onClick={handleCancel}>
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box style={{ padding: config.space.S400 }} direction="Column" gap="400">
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
import type { FormEventHandler } from 'react';
|
||||
import { forwardRef, useCallback, useState } from 'react';
|
||||
import {
|
||||
Dialog,
|
||||
Header,
|
||||
Box,
|
||||
Text,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
config,
|
||||
Button,
|
||||
Chip,
|
||||
color,
|
||||
Spinner,
|
||||
} from 'folds';
|
||||
import { Dialog, Header, Box, Text, IconButton, config, Button, Chip, color, Spinner } from 'folds';
|
||||
import { composerIcon, X } from '$components/icons/phosphor';
|
||||
import FileSaver from 'file-saver';
|
||||
import to from 'await-to-js';
|
||||
import type { AuthDict, IAuthData, UIAuthCallback } from '$types/matrix-sdk';
|
||||
@@ -304,7 +292,7 @@ export const DeviceVerificationSetup = forwardRef<HTMLDivElement, DeviceVerifica
|
||||
<Text size="H4">Setup Device Verification</Text>
|
||||
</Box>
|
||||
<IconButton size="300" radii="300" onClick={onCancel}>
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box style={{ padding: config.space.S400 }} direction="Column" gap="400">
|
||||
@@ -339,7 +327,7 @@ export const DeviceVerificationReset = forwardRef<HTMLDivElement, DeviceVerifica
|
||||
<Text size="H4">Reset Device Verification</Text>
|
||||
</Box>
|
||||
<IconButton size="300" radii="300" onClick={onCancel}>
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
{reset ? (
|
||||
|
||||
@@ -3,8 +3,6 @@ import {
|
||||
Dialog,
|
||||
Header,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
Text,
|
||||
Button,
|
||||
Avatar,
|
||||
@@ -29,6 +27,7 @@ import {
|
||||
} from '$state/callEmbed';
|
||||
import { createDebugLogger } from '$utils/debugLogger';
|
||||
import { RoomAvatar } from './room-avatar';
|
||||
import { composerIcon, menuIcon, Phone, userFallbackIcon, X } from '$components/icons/phosphor';
|
||||
|
||||
const debugLog = createDebugLogger('IncomingCall');
|
||||
|
||||
@@ -85,7 +84,7 @@ export function IncomingCallInternal({ room, onClose }: IncomingCallInternalProp
|
||||
<Text size="H4">Incoming Call</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onClose} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
||||
@@ -95,7 +94,7 @@ export function IncomingCallInternal({ room, onClose }: IncomingCallInternalProp
|
||||
roomId={room.roomId}
|
||||
src={avatarUrl ?? undefined}
|
||||
alt={roomName}
|
||||
renderFallback={() => <Icon size="200" src={Icons.User} filled />}
|
||||
renderFallback={() => userFallbackIcon('lg')}
|
||||
/>
|
||||
</Avatar>
|
||||
|
||||
@@ -122,7 +121,7 @@ export function IncomingCallInternal({ room, onClose }: IncomingCallInternalProp
|
||||
variant="Primary"
|
||||
style={{ minWidth: '110px' }}
|
||||
onClick={handleAnswer}
|
||||
before={<Icon size="100" src={Icons.Phone} />}
|
||||
before={menuIcon(Phone)}
|
||||
>
|
||||
<Text size="B400">Answer</Text>
|
||||
</Button>
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import type { IconSrc, RectCords } from 'folds';
|
||||
import { config, Box, MenuItem, Text, Icon, Icons, PopOut, Menu, Button, Spinner } from 'folds';
|
||||
import type { RectCords } from 'folds';
|
||||
import { config, Box, MenuItem, Text, PopOut, Menu, Button, Spinner } from 'folds';
|
||||
import { JoinRule } from '$types/matrix-sdk';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { getRoomIconSrc } from '$utils/room';
|
||||
import { CaretDown, sizedIcon } from '$components/icons/phosphor';
|
||||
import { getRoomIconComponent, type RoomPhosphorIcon } from '$components/icons/roomIcons';
|
||||
|
||||
export type ExtraJoinRules = 'knock_restricted';
|
||||
export type ExtendedJoinRules = JoinRule | ExtraJoinRules;
|
||||
|
||||
type JoinRuleIcons = Record<ExtendedJoinRules, IconSrc>;
|
||||
type JoinRuleIcons = Record<ExtendedJoinRules, RoomPhosphorIcon>;
|
||||
|
||||
export const useJoinRuleIcons = (roomType?: string): JoinRuleIcons =>
|
||||
useMemo(
|
||||
() => ({
|
||||
[JoinRule.Invite]: getRoomIconSrc(Icons, roomType, JoinRule.Invite),
|
||||
[JoinRule.Knock]: getRoomIconSrc(Icons, roomType, JoinRule.Knock),
|
||||
knock_restricted: getRoomIconSrc(Icons, roomType, JoinRule.Restricted),
|
||||
[JoinRule.Restricted]: getRoomIconSrc(Icons, roomType, JoinRule.Restricted),
|
||||
[JoinRule.Public]: getRoomIconSrc(Icons, roomType, JoinRule.Public),
|
||||
[JoinRule.Private]: getRoomIconSrc(Icons, roomType, JoinRule.Private),
|
||||
[JoinRule.Invite]: getRoomIconComponent(roomType, JoinRule.Invite),
|
||||
[JoinRule.Knock]: getRoomIconComponent(roomType, JoinRule.Knock),
|
||||
knock_restricted: getRoomIconComponent(roomType, JoinRule.Restricted),
|
||||
[JoinRule.Restricted]: getRoomIconComponent(roomType, JoinRule.Restricted),
|
||||
[JoinRule.Public]: getRoomIconComponent(roomType, JoinRule.Public),
|
||||
[JoinRule.Private]: getRoomIconComponent(roomType, JoinRule.Private),
|
||||
}),
|
||||
[roomType]
|
||||
);
|
||||
@@ -97,7 +98,7 @@ export function JoinRulesSwitcher<T extends ExtendedJoinRules[]>({
|
||||
radii="300"
|
||||
aria-pressed={value === rule}
|
||||
onClick={() => handleChange(rule)}
|
||||
before={<Icon size="100" src={icons[rule]} />}
|
||||
before={sizedIcon(icons[rule], '100')}
|
||||
disabled={disabled}
|
||||
>
|
||||
<Box grow="Yes">
|
||||
@@ -116,12 +117,12 @@ export function JoinRulesSwitcher<T extends ExtendedJoinRules[]>({
|
||||
fill="Soft"
|
||||
radii="300"
|
||||
outlined
|
||||
before={<Icon size="100" src={icons[value] ?? icons[JoinRule.Restricted]} />}
|
||||
before={sizedIcon(icons[value] ?? icons[JoinRule.Restricted], '100')}
|
||||
after={
|
||||
changing ? (
|
||||
<Spinner size="100" variant="Secondary" fill="Soft" />
|
||||
) : (
|
||||
<Icon size="100" src={Icons.ChevronBottom} />
|
||||
sizedIcon(CaretDown, '100')
|
||||
)
|
||||
}
|
||||
onClick={handleOpenMenu}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { MouseEventHandler, ReactNode } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
import type { RectCords } from 'folds';
|
||||
import { Box, Text, Chip, Icon, Icons, PopOut, Menu, config, MenuItem, color } from 'folds';
|
||||
import { Box, Text, Chip, PopOut, Menu, config, MenuItem, color } from 'folds';
|
||||
import { CaretDown, sizedIcon } from '$components/icons/phosphor';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import type { SecretStorageKeyContent } from '$types/matrix/accountData';
|
||||
import { storePrivateKey } from '$client/secretStorageKeys';
|
||||
@@ -41,7 +42,7 @@ export function ManualVerificationMethodSwitcher({
|
||||
variant="Secondary"
|
||||
fill="Soft"
|
||||
radii="Pill"
|
||||
before={<Icon size="100" src={Icons.ChevronBottom} />}
|
||||
before={sizedIcon(CaretDown, '100')}
|
||||
onClick={handleMenu}
|
||||
>
|
||||
<Text as="span" size="B300">
|
||||
|
||||
@@ -7,9 +7,7 @@ import {
|
||||
Button,
|
||||
Chip,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Input,
|
||||
Menu,
|
||||
PopOut,
|
||||
@@ -19,6 +17,16 @@ import {
|
||||
as,
|
||||
config,
|
||||
} from 'folds';
|
||||
import {
|
||||
ArrowLeft,
|
||||
CaretLeft,
|
||||
CaretRight,
|
||||
Download,
|
||||
Minus,
|
||||
Plus,
|
||||
Warning,
|
||||
sizedIcon,
|
||||
} from '$components/icons/phosphor';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import FileSaver from 'file-saver';
|
||||
import { AsyncStatus } from '$hooks/useAsyncCallback';
|
||||
@@ -120,7 +128,7 @@ export const PdfViewer = as<'div', PdfViewerProps>(
|
||||
<Header className={css.PdfViewerHeader} size="400">
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<IconButton size="300" radii="300" onClick={requestClose}>
|
||||
<Icon size="50" src={Icons.ArrowLeft} />
|
||||
{sizedIcon(ArrowLeft, '50')}
|
||||
</IconButton>
|
||||
<Text size="T300" truncate>
|
||||
{name}
|
||||
@@ -135,7 +143,7 @@ export const PdfViewer = as<'div', PdfViewerProps>(
|
||||
onClick={zoomOut}
|
||||
aria-label="Zoom Out"
|
||||
>
|
||||
<Icon size="50" src={Icons.Minus} />
|
||||
{sizedIcon(Minus, '50')}
|
||||
</IconButton>
|
||||
<Chip variant="SurfaceVariant" radii="Pill" onClick={() => setZoom(zoom === 1 ? 2 : 1)}>
|
||||
<Text size="B300">{Math.round(zoom * 100)}%</Text>
|
||||
@@ -148,13 +156,13 @@ export const PdfViewer = as<'div', PdfViewerProps>(
|
||||
onClick={zoomIn}
|
||||
aria-label="Zoom In"
|
||||
>
|
||||
<Icon size="50" src={Icons.Plus} />
|
||||
{sizedIcon(Plus, '50')}
|
||||
</IconButton>
|
||||
<Chip
|
||||
variant="Primary"
|
||||
onClick={handleDownload}
|
||||
radii="300"
|
||||
before={<Icon size="50" src={Icons.Download} />}
|
||||
before={sizedIcon(Download, '50')}
|
||||
>
|
||||
<Text size="B300">Download</Text>
|
||||
</Chip>
|
||||
@@ -170,7 +178,7 @@ export const PdfViewer = as<'div', PdfViewerProps>(
|
||||
fill="Soft"
|
||||
size="300"
|
||||
radii="300"
|
||||
before={<Icon src={Icons.Warning} size="50" />}
|
||||
before={sizedIcon(Warning, '50')}
|
||||
onClick={loadPdfJS}
|
||||
>
|
||||
<Text size="B300">Retry</Text>
|
||||
@@ -201,7 +209,7 @@ export const PdfViewer = as<'div', PdfViewerProps>(
|
||||
<Chip
|
||||
variant="Secondary"
|
||||
radii="300"
|
||||
before={<Icon size="50" src={Icons.ChevronLeft} />}
|
||||
before={sizedIcon(CaretLeft, '50')}
|
||||
onClick={handlePrevPage}
|
||||
aria-disabled={pageNo <= 1}
|
||||
>
|
||||
@@ -263,7 +271,7 @@ export const PdfViewer = as<'div', PdfViewerProps>(
|
||||
<Chip
|
||||
variant="Primary"
|
||||
radii="300"
|
||||
after={<Icon size="50" src={Icons.ChevronRight} />}
|
||||
after={sizedIcon(CaretRight, '50')}
|
||||
onClick={handleNextPage}
|
||||
aria-disabled={pageNo >= docState.data.numPages}
|
||||
>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Box, Icon, Text } from 'folds';
|
||||
import { Box, Text } from 'folds';
|
||||
import type { ReactNode } from 'react';
|
||||
import { type MouseEventHandler } from 'react';
|
||||
import { SettingMenuSelector, type SettingMenuOption } from '$components/setting-menu-selector';
|
||||
import {
|
||||
getRoomNotificationModeIcon,
|
||||
roomNotificationModeIcon,
|
||||
RoomNotificationMode,
|
||||
useSetRoomNotificationPreference,
|
||||
} from '$hooks/useRoomsNotificationPreferences';
|
||||
@@ -61,7 +61,7 @@ export function RoomNotificationModeSwitcher({
|
||||
gap="200"
|
||||
style={option.value === RoomNotificationMode.Unset ? { minHeight: '48px' } : undefined}
|
||||
>
|
||||
<Icon size="100" src={getRoomNotificationModeIcon(option.value)} filled={selected} />
|
||||
{roomNotificationModeIcon(option.value, { weight: selected ? 'fill' : 'regular' })}
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="T300">{selected ? <b>{option.label}</b> : option.label}</Text>
|
||||
{option.description && (
|
||||
|
||||
@@ -3,7 +3,8 @@ import { useDrag } from '@use-gesture/react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { config, Icon, Icons } from 'folds';
|
||||
import { config } from 'folds';
|
||||
import { ArrowBendUpRightIcon, PHOSPHOR_SIZE } from '$components/icons/phosphor';
|
||||
import { mobileOrTablet } from '$utils/user-agent';
|
||||
import { RightSwipeAction, settingsAtom } from '$state/settings';
|
||||
|
||||
@@ -49,9 +50,8 @@ function ActiveSwipeWrapper({ children, onReply }: { children: ReactNode; onRepl
|
||||
}}
|
||||
>
|
||||
<motion.div style={{ opacity: iconOpacity }}>
|
||||
<Icon
|
||||
src={Icons.ReplyArrow}
|
||||
size="400"
|
||||
<ArrowBendUpRightIcon
|
||||
size={PHOSPHOR_SIZE.toolbar}
|
||||
style={{
|
||||
color: isReady
|
||||
? 'var(--sable-surface-on-container)'
|
||||
|
||||
@@ -7,11 +7,10 @@ import {
|
||||
Text,
|
||||
TooltipProvider,
|
||||
Tooltip,
|
||||
Icons,
|
||||
Icon,
|
||||
Chip,
|
||||
IconButton,
|
||||
} from 'folds';
|
||||
import { sizedIcon, X } from '$components/icons/phosphor';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
|
||||
export type UIAFlowOverlayProps = {
|
||||
@@ -60,7 +59,7 @@ export function UIAFlowOverlay({
|
||||
radii="Pill"
|
||||
outlined
|
||||
>
|
||||
<Icon size="50" src={Icons.Cross} />
|
||||
{sizedIcon(X, '50')}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
|
||||
@@ -4,8 +4,6 @@ import {
|
||||
Button,
|
||||
Chip,
|
||||
config,
|
||||
Icon,
|
||||
Icons,
|
||||
Input,
|
||||
Line,
|
||||
Menu,
|
||||
@@ -15,6 +13,7 @@ import {
|
||||
Text,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { Plus, X, sizedIcon } from '$components/icons/phosphor';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { getMxIdServer } from '$utils/mxIdHelper';
|
||||
@@ -161,7 +160,7 @@ export function AdditionalCreatorInput({
|
||||
key={creator}
|
||||
variant="Secondary"
|
||||
radii="Pill"
|
||||
after={<Icon size="50" src={Icons.Cross} />}
|
||||
after={sizedIcon(X, '50')}
|
||||
onClick={() => onRemove(creator)}
|
||||
disabled={disabled}
|
||||
>
|
||||
@@ -284,7 +283,7 @@ export function AdditionalCreatorInput({
|
||||
aria-pressed={!!menuCords}
|
||||
disabled={disabled}
|
||||
>
|
||||
<Icon size="50" src={Icons.Plus} />
|
||||
{sizedIcon(Plus, '50')}
|
||||
</Chip>
|
||||
</PopOut>
|
||||
</Box>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { IconSrc } from 'folds';
|
||||
import { Box, Text, Icon, Icons, config } from 'folds';
|
||||
import type { ReactNode } from 'react';
|
||||
import { Box, Text, config } from 'folds';
|
||||
import { Check, sizedIcon } from '$components/icons/phosphor';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
import { CreateRoomAccess } from './types';
|
||||
@@ -9,7 +10,7 @@ type CreateRoomAccessSelectorProps = {
|
||||
onSelect: (value: CreateRoomAccess) => void;
|
||||
canRestrict?: boolean;
|
||||
disabled?: boolean;
|
||||
getIcon: (access: CreateRoomAccess) => IconSrc;
|
||||
getIcon: (access: CreateRoomAccess) => ReactNode;
|
||||
};
|
||||
export function CreateRoomAccessSelector({
|
||||
value,
|
||||
@@ -33,8 +34,8 @@ export function CreateRoomAccessSelector({
|
||||
disabled={disabled}
|
||||
>
|
||||
<SettingTile
|
||||
before={<Icon size="400" src={getIcon(CreateRoomAccess.Restricted)} />}
|
||||
after={value === CreateRoomAccess.Restricted && <Icon src={Icons.Check} />}
|
||||
before={getIcon(CreateRoomAccess.Restricted)}
|
||||
after={value === CreateRoomAccess.Restricted && sizedIcon(Check)}
|
||||
>
|
||||
<Text size="H6">Restricted</Text>
|
||||
<Text size="T300" priority="300">
|
||||
@@ -55,8 +56,8 @@ export function CreateRoomAccessSelector({
|
||||
disabled={disabled}
|
||||
>
|
||||
<SettingTile
|
||||
before={<Icon size="400" src={getIcon(CreateRoomAccess.Private)} />}
|
||||
after={value === CreateRoomAccess.Private && <Icon src={Icons.Check} />}
|
||||
before={getIcon(CreateRoomAccess.Private)}
|
||||
after={value === CreateRoomAccess.Private && sizedIcon(Check)}
|
||||
>
|
||||
<Text size="H6">Private</Text>
|
||||
<Text size="T300" priority="300">
|
||||
@@ -76,8 +77,8 @@ export function CreateRoomAccessSelector({
|
||||
disabled={disabled}
|
||||
>
|
||||
<SettingTile
|
||||
before={<Icon size="400" src={getIcon(CreateRoomAccess.Public)} />}
|
||||
after={value === CreateRoomAccess.Public && <Icon src={Icons.Check} />}
|
||||
before={getIcon(CreateRoomAccess.Public)}
|
||||
after={value === CreateRoomAccess.Public && sizedIcon(Check)}
|
||||
>
|
||||
<Text size="H6">Public</Text>
|
||||
<Text size="T300" priority="300">
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { FormEventHandler, KeyboardEventHandler } from 'react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { MatrixError } from '$types/matrix-sdk';
|
||||
import { Box, color, Icon, Icons, Input, Spinner, Text, toRem } from 'folds';
|
||||
import { Box, color, Input, Spinner, Text, toRem } from 'folds';
|
||||
import { Hash, Warning, sizedIcon } from '$components/icons/phosphor';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { replaceSpaceWithDash } from '$utils/common';
|
||||
@@ -84,7 +85,7 @@ export function CreateRoomAliasInput({ disabled }: { disabled?: boolean }) {
|
||||
aliasAvail.status === AsyncStatus.Loading ? (
|
||||
<Spinner size="100" variant="Secondary" />
|
||||
) : (
|
||||
<Icon size="100" src={Icons.Hash} />
|
||||
sizedIcon(Hash, '100')
|
||||
)
|
||||
}
|
||||
after={
|
||||
@@ -102,7 +103,7 @@ export function CreateRoomAliasInput({ disabled }: { disabled?: boolean }) {
|
||||
/>
|
||||
{aliasAvailable === false && (
|
||||
<Box style={{ color: color.Critical.Main }} alignItems="Center" gap="100">
|
||||
<Icon src={Icons.Warning} filled size="50" />
|
||||
{sizedIcon(Warning, '50', { filled: true })}
|
||||
<Text size="T200">
|
||||
<b>This address is already taken. Please select a different one.</b>
|
||||
</Text>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { IconSrc } from 'folds';
|
||||
import { Box, Text, Icon, Icons, config } from 'folds';
|
||||
import type { ReactNode } from 'react';
|
||||
import { Box, Text, config } from 'folds';
|
||||
import { Check, sizedIcon } from '$components/icons/phosphor';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
import { BetaNoticeBadge } from '$components/BetaNoticeBadge';
|
||||
@@ -9,7 +10,7 @@ type CreateRoomTypeSelectorProps = {
|
||||
value?: CreateRoomType;
|
||||
onSelect: (value: CreateRoomType) => void;
|
||||
disabled?: boolean;
|
||||
getIcon: (type: CreateRoomType) => IconSrc;
|
||||
getIcon: (type: CreateRoomType) => ReactNode;
|
||||
};
|
||||
export function CreateRoomTypeSelector({
|
||||
value,
|
||||
@@ -31,8 +32,8 @@ export function CreateRoomTypeSelector({
|
||||
disabled={disabled}
|
||||
>
|
||||
<SettingTile
|
||||
before={<Icon size="400" src={getIcon(CreateRoomType.TextRoom)} />}
|
||||
after={value === CreateRoomType.TextRoom && <Icon src={Icons.Check} />}
|
||||
before={getIcon(CreateRoomType.TextRoom)}
|
||||
after={value === CreateRoomType.TextRoom && sizedIcon(Check)}
|
||||
>
|
||||
<Box gap="200" alignItems="Baseline">
|
||||
<Text size="H6" style={{ flexShrink: 0 }}>
|
||||
@@ -56,8 +57,8 @@ export function CreateRoomTypeSelector({
|
||||
disabled={disabled}
|
||||
>
|
||||
<SettingTile
|
||||
before={<Icon size="400" src={getIcon(CreateRoomType.VoiceRoom)} />}
|
||||
after={value === CreateRoomType.VoiceRoom && <Icon src={Icons.Check} />}
|
||||
before={getIcon(CreateRoomType.VoiceRoom)}
|
||||
after={value === CreateRoomType.VoiceRoom && sizedIcon(Check)}
|
||||
>
|
||||
<Box gap="200" alignItems="Baseline">
|
||||
<Text size="H6" style={{ flexShrink: 0 }}>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useState } from 'react';
|
||||
import type { RectCords } from 'folds';
|
||||
import { Box, Button, Chip, config, Icon, Icons, Menu, PopOut, Text, toRem } from 'folds';
|
||||
import { Box, Button, Chip, config, Menu, PopOut, Text, toRem } from 'folds';
|
||||
import { CaretDown, CaretUp, sizedIcon } from '$components/icons/phosphor';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
@@ -94,7 +95,7 @@ export function RoomVersionSelector({
|
||||
fill="Soft"
|
||||
radii="300"
|
||||
aria-pressed={!!menuCords}
|
||||
before={<Icon size="50" src={menuCords ? Icons.ChevronTop : Icons.ChevronBottom} />}
|
||||
before={sizedIcon(menuCords ? CaretUp : CaretDown, '50')}
|
||||
disabled={disabled}
|
||||
>
|
||||
<Text size="B300">{value}</Text>
|
||||
|
||||
@@ -4,9 +4,7 @@ import {
|
||||
Button,
|
||||
Dialog,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
OverlayCenter,
|
||||
@@ -15,6 +13,7 @@ import {
|
||||
color,
|
||||
config,
|
||||
} from 'folds';
|
||||
import { composerIcon, X } from '$components/icons/phosphor';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
|
||||
type DirectInvitePromptProps = {
|
||||
@@ -56,7 +55,7 @@ export function DirectInvitePrompt({
|
||||
<Text size="H4">Invite another Member</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box style={{ padding: config.space.S400 }} direction="Column" gap="400">
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import type { IconSrc, RectCords } from 'folds';
|
||||
import type { RectCords } from 'folds';
|
||||
import {
|
||||
Badge,
|
||||
Box,
|
||||
config,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Line,
|
||||
Menu,
|
||||
PopOut,
|
||||
@@ -32,6 +30,26 @@ import {
|
||||
INLINE_HOTKEYS,
|
||||
} from './keyboard';
|
||||
import * as css from './Editor.css';
|
||||
import {
|
||||
CaretDown,
|
||||
Code,
|
||||
CodeBlock,
|
||||
composerIcon,
|
||||
EyeSlash,
|
||||
sizedIcon,
|
||||
ListBullets,
|
||||
ListNumbers,
|
||||
Quotes,
|
||||
TextAa,
|
||||
TextB,
|
||||
TextHOne,
|
||||
TextHThree,
|
||||
TextHTwo,
|
||||
TextItalic,
|
||||
TextStrikethrough,
|
||||
TextUnderline,
|
||||
type PhosphorIcon,
|
||||
} from '$components/icons/phosphor';
|
||||
|
||||
function BtnTooltip({ text, shortCode }: { text: string; shortCode?: string }) {
|
||||
return (
|
||||
@@ -52,7 +70,7 @@ function BtnTooltip({ text, shortCode }: { text: string; shortCode?: string }) {
|
||||
|
||||
type MarkdownInlineButtonProps = {
|
||||
marker: string;
|
||||
icon: IconSrc;
|
||||
icon: PhosphorIcon;
|
||||
tooltip: ReactNode;
|
||||
};
|
||||
|
||||
@@ -74,7 +92,7 @@ function MarkdownInlineButton({ marker, icon, tooltip }: MarkdownInlineButtonPro
|
||||
size="400"
|
||||
radii="300"
|
||||
>
|
||||
<Icon size="200" src={icon} />
|
||||
{sizedIcon(icon, '200')}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -83,7 +101,7 @@ function MarkdownInlineButton({ marker, icon, tooltip }: MarkdownInlineButtonPro
|
||||
|
||||
type MarkdownBlockButtonProps = {
|
||||
prefix: string;
|
||||
icon: IconSrc;
|
||||
icon: PhosphorIcon;
|
||||
tooltip: ReactNode;
|
||||
};
|
||||
|
||||
@@ -105,7 +123,7 @@ function MarkdownBlockButton({ prefix, icon, tooltip }: MarkdownBlockButtonProps
|
||||
size="400"
|
||||
radii="300"
|
||||
>
|
||||
<Icon size="200" src={icon} />
|
||||
{sizedIcon(icon, '200')}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -157,7 +175,7 @@ function MarkdownHeadingButton() {
|
||||
size="400"
|
||||
radii="300"
|
||||
>
|
||||
<Icon size="200" src={Icons.Heading1} />
|
||||
{sizedIcon(TextHOne, '200')}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -172,7 +190,7 @@ function MarkdownHeadingButton() {
|
||||
size="400"
|
||||
radii="300"
|
||||
>
|
||||
<Icon size="200" src={Icons.Heading2} />
|
||||
{sizedIcon(TextHTwo, '200')}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -187,7 +205,7 @@ function MarkdownHeadingButton() {
|
||||
size="400"
|
||||
radii="300"
|
||||
>
|
||||
<Icon size="200" src={Icons.Heading3} />
|
||||
{sizedIcon(TextHThree, '200')}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -205,8 +223,8 @@ function MarkdownHeadingButton() {
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={!!anchor}
|
||||
>
|
||||
<Icon size="200" src={Icons.Heading1} />
|
||||
<Icon size="200" src={Icons.ChevronBottom} />
|
||||
{sizedIcon(TextHOne, '200')}
|
||||
{sizedIcon(CaretDown, '200')}
|
||||
</IconButton>
|
||||
</PopOut>
|
||||
);
|
||||
@@ -222,32 +240,32 @@ export function MarkdownToolbar() {
|
||||
<Box shrink="No" gap="100">
|
||||
<MarkdownInlineButton
|
||||
marker={INLINE_HOTKEYS['mod+b']!}
|
||||
icon={Icons.Bold}
|
||||
icon={TextB}
|
||||
tooltip={<BtnTooltip text="Bold" shortCode={`${modKey} + B`} />}
|
||||
/>
|
||||
<MarkdownInlineButton
|
||||
marker={INLINE_HOTKEYS['mod+i']!}
|
||||
icon={Icons.Italic}
|
||||
icon={TextItalic}
|
||||
tooltip={<BtnTooltip text="Italic" shortCode={`${modKey} + I`} />}
|
||||
/>
|
||||
<MarkdownInlineButton
|
||||
marker={INLINE_HOTKEYS['mod+u']!}
|
||||
icon={Icons.Underline}
|
||||
icon={TextUnderline}
|
||||
tooltip={<BtnTooltip text="Underline" shortCode={`${modKey} + U`} />}
|
||||
/>
|
||||
<MarkdownInlineButton
|
||||
marker={INLINE_HOTKEYS['mod+s']!}
|
||||
icon={Icons.Strike}
|
||||
icon={TextStrikethrough}
|
||||
tooltip={<BtnTooltip text="Strike Through" shortCode={`${modKey} + S`} />}
|
||||
/>
|
||||
<MarkdownInlineButton
|
||||
marker={INLINE_HOTKEYS['mod+[']!}
|
||||
icon={Icons.Code}
|
||||
icon={Code}
|
||||
tooltip={<BtnTooltip text="Inline Code" shortCode={`${modKey} + [`} />}
|
||||
/>
|
||||
<MarkdownInlineButton
|
||||
marker={INLINE_HOTKEYS['mod+h']!}
|
||||
icon={Icons.EyeBlind}
|
||||
icon={EyeSlash}
|
||||
tooltip={<BtnTooltip text="Spoiler" shortCode={`${modKey} + H`} />}
|
||||
/>
|
||||
</Box>
|
||||
@@ -255,22 +273,22 @@ export function MarkdownToolbar() {
|
||||
<Box shrink="No" gap="100">
|
||||
<MarkdownBlockButton
|
||||
prefix={BLOCK_HOTKEYS["mod+'"]!}
|
||||
icon={Icons.BlockQuote}
|
||||
icon={Quotes}
|
||||
tooltip={<BtnTooltip text="Block Quote" shortCode={`${modKey} + '`} />}
|
||||
/>
|
||||
<MarkdownBlockButton
|
||||
prefix={BLOCK_HOTKEYS['mod+;']!}
|
||||
icon={Icons.BlockCode}
|
||||
icon={CodeBlock}
|
||||
tooltip={<BtnTooltip text="Block Code" shortCode={`${modKey} + ;`} />}
|
||||
/>
|
||||
<MarkdownBlockButton
|
||||
prefix={BLOCK_HOTKEYS['mod+7']!}
|
||||
icon={Icons.OrderList}
|
||||
icon={ListNumbers}
|
||||
tooltip={<BtnTooltip text="Ordered List" shortCode={`${modKey} + 7`} />}
|
||||
/>
|
||||
<MarkdownBlockButton
|
||||
prefix={BLOCK_HOTKEYS['mod+8']!}
|
||||
icon={Icons.UnorderList}
|
||||
icon={ListBullets}
|
||||
tooltip={<BtnTooltip text="Unordered List" shortCode={`${modKey} + 8`} />}
|
||||
/>
|
||||
<MarkdownHeadingButton />
|
||||
@@ -310,7 +328,7 @@ export function MarkdownFormattingToolbarToggle({
|
||||
aria-label={composerToolbarOpen ? 'Hide formatting toolbar' : 'Show formatting toolbar'}
|
||||
onClick={() => setComposerToolbarOpen(!composerToolbarOpen)}
|
||||
>
|
||||
<Icon src={composerToolbarOpen ? Icons.AlphabetUnderline : Icons.Alphabet} />
|
||||
{composerToolbarOpen ? composerIcon(TextUnderline) : composerIcon(TextAa)}
|
||||
</IconButton>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import type { Editor } from 'slate';
|
||||
import { ReactEditor } from 'slate-react';
|
||||
import { Avatar, Icon, Icons, MenuItem, Text } from 'folds';
|
||||
import { Avatar, MenuItem, Text } from 'folds';
|
||||
import { Hash, sizedIcon } from '$components/icons/phosphor';
|
||||
import type { MatrixClient } from '$types/matrix-sdk';
|
||||
import { JoinRule } from '$types/matrix-sdk';
|
||||
import { useAtomValue } from 'jotai';
|
||||
@@ -49,11 +50,7 @@ function UnknownRoomMentionItem({
|
||||
radii="300"
|
||||
onKeyDown={(evt: ReactKeyboardEvent<HTMLButtonElement>) => onTabPress(evt, handleSelect)}
|
||||
onClick={handleSelect}
|
||||
before={
|
||||
<Avatar size="200">
|
||||
<Icon src={Icons.Hash} size="100" />
|
||||
</Avatar>
|
||||
}
|
||||
before={<Avatar size="200">{sizedIcon(Hash, '100')}</Avatar>}
|
||||
>
|
||||
<Text style={{ flexGrow: 1 }} size="B400">
|
||||
{roomAlias}
|
||||
|
||||
@@ -2,7 +2,8 @@ import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
|
||||
import { useEffect } from 'react';
|
||||
import type { Editor } from 'slate';
|
||||
import { ReactEditor } from 'slate-react';
|
||||
import { Avatar, Icon, Icons, MenuItem, Text } from 'folds';
|
||||
import { Avatar, MenuItem, Text } from 'folds';
|
||||
import { userFallbackIcon } from '$components/icons/phosphor';
|
||||
import type { MatrixClient, Room, RoomMember } from '$types/matrix-sdk';
|
||||
|
||||
import { useRoomMembers } from '$hooks/useRoomMembers';
|
||||
@@ -55,10 +56,7 @@ function UnknownMentionItem({
|
||||
onClick={() => handleAutocomplete(userId, name)}
|
||||
before={
|
||||
<Avatar size="200">
|
||||
<UserAvatar
|
||||
userId={userId}
|
||||
renderFallback={() => <Icon size="50" src={Icons.User} filled />}
|
||||
/>
|
||||
<UserAvatar userId={userId} renderFallback={() => userFallbackIcon('sm')} />
|
||||
</Avatar>
|
||||
}
|
||||
>
|
||||
@@ -198,7 +196,7 @@ export function UserMentionAutocomplete({
|
||||
userId={roomMember.userId}
|
||||
src={avatarUrl ?? undefined}
|
||||
alt={getName(roomMember)}
|
||||
renderFallback={() => <Icon size="50" src={Icons.User} filled />}
|
||||
renderFallback={() => userFallbackIcon('sm')}
|
||||
/>
|
||||
</Avatar>
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ import type {
|
||||
RefObject,
|
||||
} from 'react';
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { Box, config, Icons, Scroll } from 'folds';
|
||||
import { Box, config, Scroll } from 'folds';
|
||||
import { ClockCounterClockwise } from '$components/icons/phosphor';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import type { Room } from '$types/matrix-sdk';
|
||||
@@ -201,7 +202,7 @@ function EmojiSidebar({
|
||||
active={activeGroupId === RECENT_GROUP_ID}
|
||||
id={RECENT_GROUP_ID}
|
||||
label="Recent"
|
||||
icon={Icons.RecentClock}
|
||||
icon={ClockCounterClockwise}
|
||||
onClick={handleScrollToGroup}
|
||||
/>
|
||||
</SidebarStack>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Box, toRem, config, Icons, Icon, Text } from 'folds';
|
||||
import { Box, toRem, config, Text } from 'folds';
|
||||
import { dropzoneIcon, Sticker } from '$components/icons/phosphor';
|
||||
|
||||
export function NoStickerPacks() {
|
||||
return (
|
||||
@@ -9,7 +10,7 @@ export function NoStickerPacks() {
|
||||
direction="Column"
|
||||
gap="300"
|
||||
>
|
||||
<Icon size="600" src={Icons.Sticker} />
|
||||
{dropzoneIcon(Sticker)}
|
||||
<Box direction="Inherit">
|
||||
<Text align="Center">No Sticker Packs!</Text>
|
||||
<Text priority="300" align="Center" size="T200">
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { ChangeEventHandler } from 'react';
|
||||
import { useRef } from 'react';
|
||||
import { Input, Chip, Icon, Icons, Text } from 'folds';
|
||||
import { Input, Chip, Text } from 'folds';
|
||||
import { mobileOrTablet } from '$utils/user-agent';
|
||||
import { ArrowRight, sizedIcon, MagnifyingGlass } from '$components/icons/phosphor';
|
||||
|
||||
type SearchInputProps = {
|
||||
query?: string;
|
||||
@@ -35,14 +36,14 @@ export function SearchInput({
|
||||
<Chip
|
||||
variant="Primary"
|
||||
radii="Pill"
|
||||
after={<Icon src={Icons.ArrowRight} size="50" />}
|
||||
after={sizedIcon(ArrowRight, '50')}
|
||||
outlined
|
||||
onClick={handleReact}
|
||||
>
|
||||
<Text size="L400">React</Text>
|
||||
</Chip>
|
||||
) : (
|
||||
<Icon src={Icons.Search} size="50" />
|
||||
sizedIcon(MagnifyingGlass, '50')
|
||||
)
|
||||
}
|
||||
onChange={onChange}
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import type { IconSrc } from 'folds';
|
||||
import {
|
||||
Box,
|
||||
Scroll,
|
||||
Line,
|
||||
as,
|
||||
TooltipProvider,
|
||||
Tooltip,
|
||||
Text,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
} from 'folds';
|
||||
import { Box, Scroll, Line, as, TooltipProvider, Tooltip, Text, IconButton } from 'folds';
|
||||
import classNames from 'classnames';
|
||||
import { sizedIcon, Image, type PhosphorIcon } from '$components/icons/phosphor';
|
||||
import * as css from './styles.css';
|
||||
|
||||
export function Sidebar({ children }: { children: ReactNode }) {
|
||||
@@ -87,7 +76,7 @@ type GroupIconProps<T extends string> = {
|
||||
active: boolean;
|
||||
id: T;
|
||||
label: string;
|
||||
icon: IconSrc;
|
||||
icon: PhosphorIcon;
|
||||
onClick: (id: T) => void;
|
||||
};
|
||||
export function GroupIcon<T extends string>({
|
||||
@@ -99,7 +88,7 @@ export function GroupIcon<T extends string>({
|
||||
}: GroupIconProps<T>) {
|
||||
return (
|
||||
<SidebarBtn active={active} id={id} label={label} onClick={onClick}>
|
||||
<Icon src={icon} filled={active} />
|
||||
{sizedIcon(icon, '200', { filled: active })}
|
||||
</SidebarBtn>
|
||||
);
|
||||
}
|
||||
@@ -123,7 +112,7 @@ export function ImageGroupIcon<T extends string>({
|
||||
{url ? (
|
||||
<img className={css.SidebarBtnImg} src={url} alt={label} />
|
||||
) : (
|
||||
<Icon src={Icons.Photo} filled={active} />
|
||||
sizedIcon(Image, '200', { filled: active })
|
||||
)}
|
||||
</SidebarBtn>
|
||||
);
|
||||
|
||||
@@ -1,22 +1,31 @@
|
||||
import { useMemo } from 'react';
|
||||
import type { IconSrc } from 'folds';
|
||||
import { Icons } from 'folds';
|
||||
|
||||
import { EmojiGroupId } from '$plugins/emoji';
|
||||
import type { PhosphorIcon } from '$components/icons/phosphor';
|
||||
import {
|
||||
Basketball,
|
||||
Coffee,
|
||||
Flag,
|
||||
Image,
|
||||
Leaf,
|
||||
Lightbulb,
|
||||
Peace,
|
||||
Smiley,
|
||||
} from '$components/icons/phosphor';
|
||||
|
||||
export type IEmojiGroupIcons = Record<EmojiGroupId, IconSrc>;
|
||||
export type IEmojiGroupIcons = Record<EmojiGroupId, PhosphorIcon>;
|
||||
|
||||
export const useEmojiGroupIcons = (): IEmojiGroupIcons =>
|
||||
useMemo(
|
||||
() => ({
|
||||
[EmojiGroupId.People]: Icons.Smile,
|
||||
[EmojiGroupId.Nature]: Icons.Leaf,
|
||||
[EmojiGroupId.Food]: Icons.Cup,
|
||||
[EmojiGroupId.Activity]: Icons.Ball,
|
||||
[EmojiGroupId.Travel]: Icons.Photo,
|
||||
[EmojiGroupId.Object]: Icons.Bulb,
|
||||
[EmojiGroupId.Symbol]: Icons.Peace,
|
||||
[EmojiGroupId.Flag]: Icons.Flag,
|
||||
[EmojiGroupId.People]: Smiley,
|
||||
[EmojiGroupId.Nature]: Leaf,
|
||||
[EmojiGroupId.Food]: Coffee,
|
||||
[EmojiGroupId.Activity]: Basketball,
|
||||
[EmojiGroupId.Travel]: Image,
|
||||
[EmojiGroupId.Object]: Lightbulb,
|
||||
[EmojiGroupId.Symbol]: Peace,
|
||||
[EmojiGroupId.Flag]: Flag,
|
||||
}),
|
||||
[]
|
||||
);
|
||||
@@ -3,9 +3,7 @@ import {
|
||||
Avatar,
|
||||
Box,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Scroll,
|
||||
@@ -25,6 +23,15 @@ import { getMouseEventCords } from '$utils/dom';
|
||||
import { useAtomValue, useSetAtom } from 'jotai';
|
||||
import { nicknamesAtom } from '$state/nicknames';
|
||||
import { UserAvatar } from '$components/user-avatar';
|
||||
import {
|
||||
userFallbackIcon,
|
||||
ArrowBendUpRightIcon,
|
||||
ChatTeardropDots,
|
||||
composerIcon,
|
||||
menuIcon,
|
||||
Trash,
|
||||
X,
|
||||
} from '$components/icons/phosphor';
|
||||
import { RenderBody, Time } from '$components/message';
|
||||
import { useSetting } from '$state/hooks/settings';
|
||||
import { settingsAtom } from '$state/settings';
|
||||
@@ -131,7 +138,7 @@ export const EventHistory = as<'div', EventHistoryProps>(
|
||||
<Menu className={css.MenuOptions}>
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.ReplyArrow} />}
|
||||
after={menuIcon(ArrowBendUpRightIcon)}
|
||||
radii="300"
|
||||
fill="None"
|
||||
variant="Secondary"
|
||||
@@ -146,7 +153,7 @@ export const EventHistory = as<'div', EventHistoryProps>(
|
||||
/>
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.ThreadReply} />}
|
||||
after={menuIcon(ChatTeardropDots)}
|
||||
radii="300"
|
||||
fill="None"
|
||||
variant="Secondary"
|
||||
@@ -162,7 +169,7 @@ export const EventHistory = as<'div', EventHistoryProps>(
|
||||
{canDelete && (
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.Delete} />}
|
||||
after={menuIcon(Trash)}
|
||||
radii="300"
|
||||
fill="None"
|
||||
variant="Critical"
|
||||
@@ -230,7 +237,7 @@ export const EventHistory = as<'div', EventHistoryProps>(
|
||||
<Text size="H3">Message version history</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={requestClose}>
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Header>
|
||||
@@ -258,7 +265,7 @@ export const EventHistory = as<'div', EventHistoryProps>(
|
||||
userId={readerId ?? ''}
|
||||
src={avatarUrl ?? undefined}
|
||||
alt={name}
|
||||
renderFallback={() => <Icon size="50" src={Icons.User} filled />}
|
||||
renderFallback={() => userFallbackIcon('sm')}
|
||||
/>
|
||||
</Avatar>
|
||||
}
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
MenuItem,
|
||||
Scroll,
|
||||
Text,
|
||||
as,
|
||||
config,
|
||||
} from 'folds';
|
||||
import { Avatar, Box, Header, IconButton, MenuItem, Scroll, Text, as, config } from 'folds';
|
||||
import type { Room } from '$types/matrix-sdk';
|
||||
import { useRoomEventReaders } from '$hooks/useRoomEventReaders';
|
||||
import { getMemberDisplayName } from '$utils/room';
|
||||
@@ -24,6 +12,7 @@ import { getMouseEventCords } from '$utils/dom';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { nicknamesAtom } from '$state/nicknames';
|
||||
import { UserAvatar } from '$components/user-avatar';
|
||||
import { composerIcon, userFallbackIcon, X } from '$components/icons/phosphor';
|
||||
import * as css from './EventReaders.css';
|
||||
|
||||
export type EventReadersProps = {
|
||||
@@ -55,7 +44,7 @@ export const EventReaders = as<'div', EventReadersProps>(
|
||||
<Text size="H3">Seen by</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={requestClose}>
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box grow="Yes" style={{ width: '100%', minWidth: 0 }}>
|
||||
@@ -101,7 +90,7 @@ export const EventReaders = as<'div', EventReadersProps>(
|
||||
userId={readerId}
|
||||
src={avatarUrl ?? undefined}
|
||||
alt={name}
|
||||
renderFallback={() => <Icon size="50" src={Icons.User} filled />}
|
||||
renderFallback={() => userFallbackIcon('sm')}
|
||||
/>
|
||||
</Avatar>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
import type { IconProps } from '@phosphor-icons/react';
|
||||
import {
|
||||
ArrowsDownUpIcon,
|
||||
ArrowBendUpRightIcon,
|
||||
ArrowDownIcon,
|
||||
ArrowLeftIcon,
|
||||
ArrowRightIcon,
|
||||
ArrowSquareOutIcon,
|
||||
ArrowUpIcon,
|
||||
ArrowsClockwiseIcon,
|
||||
AtIcon,
|
||||
BasketballIcon,
|
||||
BellIcon,
|
||||
BellRingingIcon,
|
||||
BellSlashIcon,
|
||||
CaretDownIcon,
|
||||
CaretLeftIcon,
|
||||
CaretRightIcon,
|
||||
CaretUpIcon,
|
||||
ChatCircleIcon,
|
||||
ChatCircleDotsIcon,
|
||||
ChatsIcon,
|
||||
ChatTeardropDotsIcon,
|
||||
CheckIcon,
|
||||
ChecksIcon,
|
||||
ClockIcon,
|
||||
ClockCounterClockwiseIcon,
|
||||
CodeIcon,
|
||||
CodeBlockIcon,
|
||||
CoffeeIcon,
|
||||
CompassIcon,
|
||||
DatabaseIcon,
|
||||
DevicesIcon,
|
||||
DotsThreeIcon,
|
||||
DotsThreeOutlineVerticalIcon,
|
||||
DownloadIcon,
|
||||
EnvelopeSimpleIcon,
|
||||
EyeIcon,
|
||||
EyeSlashIcon,
|
||||
FileIcon,
|
||||
FlagIcon,
|
||||
FlaskIcon,
|
||||
FlowerIcon,
|
||||
FunnelIcon,
|
||||
GearSixIcon,
|
||||
GlobeIcon,
|
||||
GridFourIcon,
|
||||
HardDrivesIcon,
|
||||
HashIcon,
|
||||
HashStraightIcon,
|
||||
HeadphonesIcon,
|
||||
HeartIcon,
|
||||
HouseIcon,
|
||||
ImageIcon,
|
||||
InfoIcon,
|
||||
KeyboardIcon,
|
||||
LeafIcon,
|
||||
LightbulbIcon,
|
||||
LinkIcon,
|
||||
ListBulletsIcon,
|
||||
ListNumbersIcon,
|
||||
LockIcon,
|
||||
MagnifyingGlassIcon,
|
||||
MapPinPlusIcon,
|
||||
MicrophoneIcon,
|
||||
MicrophoneSlashIcon,
|
||||
MinusIcon,
|
||||
MonitorIcon,
|
||||
PaintBrushIcon,
|
||||
PaletteIcon,
|
||||
PaperPlaneTiltIcon,
|
||||
PauseIcon,
|
||||
PawPrintIcon,
|
||||
PeaceIcon,
|
||||
PencilSimpleIcon,
|
||||
PhoneIcon,
|
||||
PhoneDisconnectIcon,
|
||||
PlayIcon,
|
||||
PlusIcon,
|
||||
PlusCircleIcon,
|
||||
PresentationIcon,
|
||||
ProhibitIcon,
|
||||
PushPinIcon,
|
||||
PushPinSlashIcon,
|
||||
QuotesIcon,
|
||||
ShareNetworkIcon,
|
||||
ShieldIcon,
|
||||
ShieldWarningIcon,
|
||||
SignInIcon,
|
||||
SignOutIcon,
|
||||
SmileyIcon,
|
||||
SmileyStickerIcon,
|
||||
SortAscendingIcon,
|
||||
SpeakerHighIcon,
|
||||
SpeakerSlashIcon,
|
||||
SquaresFourIcon,
|
||||
StarIcon,
|
||||
StickerIcon,
|
||||
StopIcon,
|
||||
SunIcon,
|
||||
TerminalIcon,
|
||||
TextAaIcon,
|
||||
TextBIcon,
|
||||
TextHOneIcon,
|
||||
TextHThreeIcon,
|
||||
TextHTwoIcon,
|
||||
TextItalicIcon,
|
||||
TextStrikethroughIcon,
|
||||
TextUnderlineIcon,
|
||||
TrashIcon,
|
||||
TrayIcon,
|
||||
TreeStructureIcon,
|
||||
UserIcon,
|
||||
UserCircleIcon,
|
||||
UserMinusIcon,
|
||||
UserPlusIcon,
|
||||
UsersThreeIcon,
|
||||
VideoCameraIcon,
|
||||
VideoCameraSlashIcon,
|
||||
WarningIcon,
|
||||
XIcon,
|
||||
} from '@phosphor-icons/react';
|
||||
import type { ComponentType, ReactNode } from 'react';
|
||||
|
||||
/** Inline (20px), toolbar (24px), and empty-state (40px) icon sizes. */
|
||||
export const PHOSPHOR_SIZE = {
|
||||
inline: 20,
|
||||
toolbar: 24,
|
||||
empty: 40,
|
||||
} as const;
|
||||
|
||||
/** Icon size tokens for `sizedIcon()` mapped to pixel values. */
|
||||
export type IconSizeToken = '50' | '100' | '200' | '300' | '400' | '500' | '600' | 'Inherit';
|
||||
|
||||
const ICON_SIZE_PX: Record<Exclude<IconSizeToken, 'Inherit'>, number> = {
|
||||
'50': 12,
|
||||
'100': 16,
|
||||
'200': 20,
|
||||
'300': 24,
|
||||
'400': 32,
|
||||
'500': 40,
|
||||
'600': 48,
|
||||
};
|
||||
|
||||
const timelineMutedStyle = { opacity: 0.6 } as const;
|
||||
|
||||
export type PhosphorIcon = ComponentType<IconProps>;
|
||||
|
||||
type SizedIconProps = IconProps & {
|
||||
/** Folds `Icon` `filled` prop — maps to Phosphor `fill` weight. */
|
||||
filled?: boolean;
|
||||
};
|
||||
|
||||
export function sizedIcon(
|
||||
Icon: PhosphorIcon,
|
||||
size: IconSizeToken = '200',
|
||||
props?: SizedIconProps
|
||||
): ReactNode {
|
||||
const { filled, weight, style, ...rest } = props ?? {};
|
||||
const resolvedWeight = weight ?? (filled ? 'fill' : 'regular');
|
||||
if (size === 'Inherit') {
|
||||
return <Icon size="1em" weight={resolvedWeight} style={style} {...rest} />;
|
||||
}
|
||||
return <Icon size={ICON_SIZE_PX[size]} weight={resolvedWeight} style={style} {...rest} />;
|
||||
}
|
||||
|
||||
export function timelineIcon(Icon: PhosphorIcon, props?: IconProps): ReactNode {
|
||||
return <Icon size={PHOSPHOR_SIZE.inline} style={timelineMutedStyle} {...props} />;
|
||||
}
|
||||
|
||||
export function menuIcon(Icon: PhosphorIcon, props?: IconProps): ReactNode {
|
||||
return <Icon size={PHOSPHOR_SIZE.inline} {...props} />;
|
||||
}
|
||||
|
||||
export function composerIcon(Icon: PhosphorIcon, props?: IconProps): ReactNode {
|
||||
return <Icon size={PHOSPHOR_SIZE.toolbar} {...props} />;
|
||||
}
|
||||
|
||||
export function chipIcon(Icon: PhosphorIcon, props?: IconProps): ReactNode {
|
||||
return <Icon size={PHOSPHOR_SIZE.inline} {...props} />;
|
||||
}
|
||||
|
||||
export function profileIcon(Icon: PhosphorIcon, props?: SizedIconProps): ReactNode {
|
||||
return sizedIcon(Icon, '100', props);
|
||||
}
|
||||
|
||||
/** Caret in chip `after` slots — flex-centered so Phosphor glyphs align with label text. */
|
||||
export function chipCaretIcon(Icon: PhosphorIcon, props?: IconProps): ReactNode {
|
||||
const { style, ...rest } = props ?? {};
|
||||
return (
|
||||
<span
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
lineHeight: 0,
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
<Icon size={PHOSPHOR_SIZE.inline} style={{ display: 'block', ...style }} {...rest} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** @deprecated Prefer composerIcon — same toolbar size. */
|
||||
export function navIcon(Icon: PhosphorIcon, props?: IconProps): ReactNode {
|
||||
return composerIcon(Icon, props);
|
||||
}
|
||||
|
||||
export function dropzoneIcon(Icon: PhosphorIcon, props?: IconProps): ReactNode {
|
||||
return <Icon size={PHOSPHOR_SIZE.empty} {...props} />;
|
||||
}
|
||||
|
||||
export function settingsNavIcon(Icon: PhosphorIcon, active: boolean, props?: IconProps): ReactNode {
|
||||
return <Icon size={PHOSPHOR_SIZE.inline} weight={active ? 'fill' : 'regular'} {...props} />;
|
||||
}
|
||||
|
||||
export type UserFallbackSize = 'sm' | 'md' | 'lg' | 'xl' | 'hero';
|
||||
|
||||
const USER_FALLBACK_SIZE = {
|
||||
sm: PHOSPHOR_SIZE.inline,
|
||||
md: PHOSPHOR_SIZE.inline,
|
||||
lg: PHOSPHOR_SIZE.toolbar,
|
||||
xl: PHOSPHOR_SIZE.toolbar,
|
||||
hero: PHOSPHOR_SIZE.empty,
|
||||
} as const;
|
||||
|
||||
export function userFallbackIcon(size: UserFallbackSize = 'md', props?: IconProps): ReactNode {
|
||||
return <UserIcon size={USER_FALLBACK_SIZE[size]} weight="regular" {...props} />;
|
||||
}
|
||||
|
||||
export {
|
||||
ArrowsDownUpIcon as ArrowsDownUp,
|
||||
ArrowBendUpRightIcon,
|
||||
ArrowDownIcon as ArrowDown,
|
||||
ArrowLeftIcon as ArrowLeft,
|
||||
ArrowRightIcon as ArrowRight,
|
||||
ArrowSquareOutIcon as ArrowSquareOut,
|
||||
ArrowUpIcon as ArrowUp,
|
||||
ArrowsClockwiseIcon as ArrowsClockwise,
|
||||
AtIcon as At,
|
||||
BasketballIcon as Basketball,
|
||||
BellIcon as Bell,
|
||||
BellRingingIcon as BellRinging,
|
||||
BellSlashIcon as BellSlash,
|
||||
CaretDownIcon as CaretDown,
|
||||
CaretLeftIcon as CaretLeft,
|
||||
CaretRightIcon as CaretRight,
|
||||
CaretUpIcon as CaretUp,
|
||||
ChatCircleIcon as ChatCircle,
|
||||
ChatCircleDotsIcon as ChatCircleDots,
|
||||
ChatsIcon as Chats,
|
||||
ChatTeardropDotsIcon as ChatTeardropDots,
|
||||
CheckIcon as Check,
|
||||
ChecksIcon as Checks,
|
||||
ClockIcon as Clock,
|
||||
ClockCounterClockwiseIcon as ClockCounterClockwise,
|
||||
CodeIcon as Code,
|
||||
CodeBlockIcon as CodeBlock,
|
||||
CoffeeIcon as Coffee,
|
||||
CompassIcon as Compass,
|
||||
DatabaseIcon as Database,
|
||||
DevicesIcon as Devices,
|
||||
DotsThreeIcon as DotsThree,
|
||||
DotsThreeOutlineVerticalIcon,
|
||||
DownloadIcon as Download,
|
||||
EnvelopeSimpleIcon as EnvelopeSimple,
|
||||
EyeIcon as Eye,
|
||||
EyeSlashIcon as EyeSlash,
|
||||
FileIcon as File,
|
||||
FlagIcon as Flag,
|
||||
FlaskIcon as Flask,
|
||||
FlowerIcon as Flower,
|
||||
FunnelIcon as Funnel,
|
||||
GearSixIcon as GearSix,
|
||||
GlobeIcon as Globe,
|
||||
GridFourIcon as GridFour,
|
||||
HardDrivesIcon as HardDrives,
|
||||
HashIcon as Hash,
|
||||
HashStraightIcon as HashStraight,
|
||||
HeadphonesIcon as Headphones,
|
||||
HeartIcon as Heart,
|
||||
HouseIcon as House,
|
||||
ImageIcon as Image,
|
||||
InfoIcon as Info,
|
||||
KeyboardIcon as Keyboard,
|
||||
LeafIcon as Leaf,
|
||||
LightbulbIcon as Lightbulb,
|
||||
LinkIcon as Link,
|
||||
ListBulletsIcon as ListBullets,
|
||||
ListNumbersIcon as ListNumbers,
|
||||
LockIcon as Lock,
|
||||
MagnifyingGlassIcon as MagnifyingGlass,
|
||||
MapPinPlusIcon,
|
||||
MicrophoneIcon as Microphone,
|
||||
MicrophoneSlashIcon as MicrophoneSlash,
|
||||
MinusIcon as Minus,
|
||||
MonitorIcon as Monitor,
|
||||
PaintBrushIcon as PaintBrush,
|
||||
PaletteIcon as Palette,
|
||||
PaperPlaneTiltIcon as PaperPlaneTilt,
|
||||
PauseIcon as Pause,
|
||||
PawPrintIcon as PawPrint,
|
||||
PeaceIcon as Peace,
|
||||
PencilSimpleIcon as PencilSimple,
|
||||
PhoneIcon as Phone,
|
||||
PhoneDisconnectIcon as PhoneDisconnect,
|
||||
PlayIcon as Play,
|
||||
PlusIcon as Plus,
|
||||
PlusCircleIcon as PlusCircle,
|
||||
PresentationIcon as Presentation,
|
||||
ProhibitIcon as Prohibit,
|
||||
PushPinIcon as PushPin,
|
||||
PushPinSlashIcon as PushPinSlash,
|
||||
QuotesIcon as Quotes,
|
||||
ShareNetworkIcon as ShareNetwork,
|
||||
ShieldIcon as Shield,
|
||||
ShieldWarningIcon as ShieldWarning,
|
||||
SignInIcon as SignIn,
|
||||
SignOutIcon as SignOut,
|
||||
SmileyIcon as Smiley,
|
||||
SmileyStickerIcon as SmileySticker,
|
||||
SortAscendingIcon as SortAscending,
|
||||
SpeakerHighIcon as SpeakerHigh,
|
||||
SpeakerSlashIcon as SpeakerSlash,
|
||||
SquaresFourIcon as SquaresFour,
|
||||
StarIcon as Star,
|
||||
StickerIcon as Sticker,
|
||||
StopIcon as Stop,
|
||||
SunIcon as Sun,
|
||||
TerminalIcon as Terminal,
|
||||
TextAaIcon as TextAa,
|
||||
TextBIcon as TextB,
|
||||
TextHOneIcon as TextHOne,
|
||||
TextHThreeIcon as TextHThree,
|
||||
TextHTwoIcon as TextHTwo,
|
||||
TextItalicIcon as TextItalic,
|
||||
TextStrikethroughIcon as TextStrikethrough,
|
||||
TextUnderlineIcon as TextUnderline,
|
||||
TrashIcon as Trash,
|
||||
TrayIcon as Tray,
|
||||
TreeStructureIcon as TreeStructure,
|
||||
UserIcon as User,
|
||||
UserCircleIcon as UserCircle,
|
||||
UserMinusIcon as UserMinus,
|
||||
UserPlusIcon as UserPlus,
|
||||
UsersThreeIcon as UsersThree,
|
||||
VideoCameraIcon as VideoCamera,
|
||||
VideoCameraSlashIcon as VideoCameraSlash,
|
||||
WarningIcon as Warning,
|
||||
XIcon as X,
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
import { JoinRule, RoomType } from '$types/matrix-sdk';
|
||||
import type { ComponentType } from 'react';
|
||||
import type { IconProps } from '@phosphor-icons/react';
|
||||
import { Globe, HashStraight, Lock, SpeakerHigh, SquaresFour } from './phosphor';
|
||||
|
||||
export type RoomPhosphorIcon = ComponentType<IconProps>;
|
||||
|
||||
export type RoomIconOverlay = 'globe' | 'lock';
|
||||
|
||||
const isRegularRoom = (roomType?: string): boolean =>
|
||||
roomType !== RoomType.Space && roomType !== RoomType.UnstableCall;
|
||||
|
||||
export function getRoomIconOverlay(
|
||||
roomType?: string,
|
||||
joinRule?: JoinRule
|
||||
): RoomIconOverlay | undefined {
|
||||
if (!isRegularRoom(roomType)) return undefined;
|
||||
|
||||
if (joinRule === JoinRule.Public) return 'globe';
|
||||
if (
|
||||
joinRule === JoinRule.Invite ||
|
||||
joinRule === JoinRule.Knock ||
|
||||
joinRule === JoinRule.Private
|
||||
) {
|
||||
return 'lock';
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getRoomIconOverlayComponent(overlay: RoomIconOverlay): RoomPhosphorIcon {
|
||||
return overlay === 'globe' ? Globe : Lock;
|
||||
}
|
||||
|
||||
export function getRoomStandaloneIconComponent(
|
||||
roomType?: string,
|
||||
joinRule?: JoinRule
|
||||
): RoomPhosphorIcon {
|
||||
if (roomType === RoomType.Space) {
|
||||
if (joinRule === JoinRule.Public) return Globe;
|
||||
if (
|
||||
joinRule === JoinRule.Invite ||
|
||||
joinRule === JoinRule.Knock ||
|
||||
joinRule === JoinRule.Private
|
||||
) {
|
||||
return Lock;
|
||||
}
|
||||
return SquaresFour;
|
||||
}
|
||||
|
||||
if (roomType === RoomType.UnstableCall) {
|
||||
if (joinRule === JoinRule.Public) return Globe;
|
||||
if (
|
||||
joinRule === JoinRule.Invite ||
|
||||
joinRule === JoinRule.Knock ||
|
||||
joinRule === JoinRule.Private
|
||||
) {
|
||||
return Lock;
|
||||
}
|
||||
return SpeakerHigh;
|
||||
}
|
||||
|
||||
if (joinRule === JoinRule.Public) return Globe;
|
||||
if (
|
||||
joinRule === JoinRule.Invite ||
|
||||
joinRule === JoinRule.Knock ||
|
||||
joinRule === JoinRule.Private
|
||||
) {
|
||||
return Lock;
|
||||
}
|
||||
return HashStraight;
|
||||
}
|
||||
|
||||
export function getRoomIconComponent(roomType?: string, joinRule?: JoinRule): RoomPhosphorIcon {
|
||||
if (roomType === RoomType.Space) {
|
||||
if (joinRule === JoinRule.Public) return Globe;
|
||||
if (
|
||||
joinRule === JoinRule.Invite ||
|
||||
joinRule === JoinRule.Knock ||
|
||||
joinRule === JoinRule.Private
|
||||
) {
|
||||
return Lock;
|
||||
}
|
||||
return SquaresFour;
|
||||
}
|
||||
|
||||
if (roomType === RoomType.UnstableCall) {
|
||||
if (joinRule === JoinRule.Public) return Globe;
|
||||
if (
|
||||
joinRule === JoinRule.Invite ||
|
||||
joinRule === JoinRule.Knock ||
|
||||
joinRule === JoinRule.Private
|
||||
) {
|
||||
return Lock;
|
||||
}
|
||||
return SpeakerHigh;
|
||||
}
|
||||
|
||||
return HashStraight;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import classNames from 'classnames';
|
||||
import { Box, Chip, Header, Icon, IconButton, Icons, Text, as } from 'folds';
|
||||
import { Box, Chip, Header, IconButton, Text, as } from 'folds';
|
||||
import { ArrowLeft, sizedIcon } from '$components/icons/phosphor';
|
||||
import * as css from './ImageEditor.css';
|
||||
|
||||
export type ImageEditorProps = {
|
||||
@@ -24,7 +25,7 @@ export const ImageEditor = as<'div', ImageEditorProps>(
|
||||
<Header className={css.ImageEditorHeader} size="400">
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<IconButton size="300" radii="300" onClick={requestClose}>
|
||||
<Icon size="50" src={Icons.ArrowLeft} />
|
||||
{sizedIcon(ArrowLeft, '50')}
|
||||
</IconButton>
|
||||
<Text size="T300" truncate>
|
||||
Image Editor
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Box, IconButton, Text, Icon, Icons, Scroll, Chip } from 'folds';
|
||||
import { Box, IconButton, Text, Scroll, Chip } from 'folds';
|
||||
import { ArrowLeft, composerIcon, sizedIcon, X } from '$components/icons/phosphor';
|
||||
import type { PackAddress } from '$plugins/custom-emoji';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { Page, PageHeader, PageContent } from '$components/page';
|
||||
@@ -22,14 +23,14 @@ export function ImagePackView({ address, requestClose }: ImagePackViewProps) {
|
||||
size="500"
|
||||
radii="Pill"
|
||||
onClick={requestClose}
|
||||
before={<Icon size="100" src={Icons.ArrowLeft} />}
|
||||
before={sizedIcon(ArrowLeft, '100')}
|
||||
>
|
||||
<Text size="T300">Emojis & Stickers</Text>
|
||||
</Chip>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { FormEventHandler, ReactNode } from 'react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { Badge, Box, Button, Chip, Icon, Icons, Input, Text } from 'folds';
|
||||
import { Badge, Box, Button, Chip, Input, Text } from 'folds';
|
||||
import { sizedIcon, Trash } from '$components/icons/phosphor';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import type { ImageUsage } from '$plugins/custom-emoji';
|
||||
import { imageUsageEqual, PackImageReader } from '$plugins/custom-emoji';
|
||||
@@ -74,7 +75,7 @@ export function ImageTile({
|
||||
radii="Pill"
|
||||
onClick={() => onDeleteToggle?.(defaultShortcode)}
|
||||
>
|
||||
{deleted ? <Text size="B300">Undo</Text> : <Icon size="50" src={Icons.Delete} />}
|
||||
{deleted ? <Text size="B300">Undo</Text> : sizedIcon(Trash, '50')}
|
||||
</Chip>
|
||||
{!deleted && (
|
||||
<Chip
|
||||
|
||||
@@ -7,12 +7,11 @@ import {
|
||||
AvatarImage,
|
||||
AvatarFallback,
|
||||
Button,
|
||||
Icon,
|
||||
Icons,
|
||||
Input,
|
||||
TextArea,
|
||||
Chip,
|
||||
} from 'folds';
|
||||
import { sizedIcon, PencilSimple } from '$components/icons/phosphor';
|
||||
import Linkify from 'linkify-react';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
@@ -77,7 +76,7 @@ export function ImagePackProfile({ meta, canEdit, onEdit }: ImagePackProfileProp
|
||||
variant="Secondary"
|
||||
fill="Soft"
|
||||
radii="300"
|
||||
before={<Icon size="50" src={Icons.Pencil} />}
|
||||
before={sizedIcon(PencilSimple, '50')}
|
||||
onClick={onEdit}
|
||||
outlined
|
||||
>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import type { RectCords } from 'folds';
|
||||
import { Box, Button, config, Icon, Icons, Menu, MenuItem, PopOut, Text } from 'folds';
|
||||
import { Box, Button, config, Menu, MenuItem, PopOut, Text } from 'folds';
|
||||
import { CaretDown, sizedIcon } from '$components/icons/phosphor';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { ImageUsage } from '$plugins/custom-emoji';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
@@ -78,7 +79,7 @@ export function UsageSwitcher({ usage, onChange, canEdit }: UsageSwitcherProps)
|
||||
type="button"
|
||||
outlined
|
||||
aria-disabled={!canEdit}
|
||||
after={canEdit && <Icon src={Icons.ChevronBottom} size="100" />}
|
||||
after={canEdit && sizedIcon(CaretDown, '100')}
|
||||
onClick={canEdit ? handleSelectUsage : undefined}
|
||||
>
|
||||
<Text size="B300">{getUsageStr(usage)}</Text>
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import FileSaver from 'file-saver';
|
||||
import classNames from 'classnames';
|
||||
import { Box, Chip, Header, Icon, IconButton, Icons, Text, as } from 'folds';
|
||||
import { Box, Chip, Header, IconButton, Text, as } from 'folds';
|
||||
import {
|
||||
ArrowLeft,
|
||||
ArrowsClockwise,
|
||||
Download,
|
||||
Image,
|
||||
Minus,
|
||||
Plus,
|
||||
sizedIcon,
|
||||
} from '$components/icons/phosphor';
|
||||
import { useImageGestures } from '$hooks/useImageGestures';
|
||||
import { useSetting } from '$state/hooks/settings';
|
||||
import { isPixelatedRendering, settingsAtom } from '$state/settings';
|
||||
@@ -83,7 +92,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
<Header className={css.ImageViewerHeader} size="400">
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<IconButton size="300" radii="300" onClick={requestClose}>
|
||||
<Icon size="50" src={Icons.ArrowLeft} />
|
||||
{sizedIcon(ArrowLeft, '200')}
|
||||
</IconButton>
|
||||
<Text size="T300" truncate>
|
||||
{alt}
|
||||
@@ -116,7 +125,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
aria-label="View Original Size"
|
||||
title="View Original Size"
|
||||
>
|
||||
<Icon size="50" src={Icons.Photo} />
|
||||
{sizedIcon(Image, '200')}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
variant="Surface"
|
||||
@@ -137,7 +146,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
aria-label="Reset Zoom"
|
||||
title="Zoom to Fill Container"
|
||||
>
|
||||
<Icon size="50" src={Icons.Reload} />
|
||||
{sizedIcon(ArrowsClockwise, '200')}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
variant={transforms.zoom < 1 ? 'Success' : 'SurfaceVariant'}
|
||||
@@ -148,7 +157,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
aria-label="Zoom Out"
|
||||
title="Zoom Out"
|
||||
>
|
||||
<Icon size="50" src={Icons.Minus} />
|
||||
{sizedIcon(Minus, '50')}
|
||||
</IconButton>
|
||||
<Chip
|
||||
variant="SurfaceVariant"
|
||||
@@ -216,13 +225,13 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
aria-label="Zoom In"
|
||||
title="Zoom In"
|
||||
>
|
||||
<Icon size="50" src={Icons.Plus} />
|
||||
{sizedIcon(Plus, '50')}
|
||||
</IconButton>
|
||||
<Chip
|
||||
variant="Primary"
|
||||
onClick={handleDownload}
|
||||
radii="300"
|
||||
before={<Icon size="50" src={Icons.Download} />}
|
||||
before={sizedIcon(Download, '50')}
|
||||
outlined
|
||||
>
|
||||
<Text size="B300">Download</Text>
|
||||
|
||||
@@ -9,8 +9,6 @@ import {
|
||||
config,
|
||||
Text,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
Input,
|
||||
Button,
|
||||
Spinner,
|
||||
@@ -32,6 +30,7 @@ import type { UseAsyncSearchOptions } from '$hooks/useAsyncSearch';
|
||||
import { useAsyncSearch } from '$hooks/useAsyncSearch';
|
||||
import { highlightText, makeHighlightRegex } from '$plugins/react-custom-html-parser';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { composerIcon, X } from '$components/icons/phosphor';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { BreakWord } from '$styles/Text.css';
|
||||
import { useAlive } from '$hooks/useAlive';
|
||||
@@ -170,7 +169,7 @@ export function InviteUserPrompt({ room, requestClose }: InviteUserProps) {
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton size="300" radii="300" onClick={requestClose}>
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Header>
|
||||
|
||||
@@ -11,12 +11,11 @@ import {
|
||||
Box,
|
||||
Text,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
Button,
|
||||
Input,
|
||||
color,
|
||||
} from 'folds';
|
||||
import { composerIcon, X } from '$components/icons/phosphor';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { isRoomAlias, isRoomId } from '$utils/matrix';
|
||||
import { parseMatrixToRoom, parseMatrixToRoomEvent, testMatrixTo } from '$plugins/matrix-to';
|
||||
@@ -84,7 +83,7 @@ export function JoinAddressPrompt({ onOpen, onCancel }: JoinAddressProps) {
|
||||
<Text size="H4">Join with Address</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box
|
||||
|
||||
@@ -11,8 +11,6 @@ import {
|
||||
Box,
|
||||
Text,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
Input,
|
||||
color,
|
||||
Button,
|
||||
@@ -22,6 +20,7 @@ import type { MatrixError } from '$types/matrix-sdk';
|
||||
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { composerIcon, X } from '$components/icons/phosphor';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { createDebugLogger } from '$utils/debugLogger';
|
||||
|
||||
@@ -85,7 +84,7 @@ export function KnockRoomPrompt({ roomId, via, onDone, onCancel }: KnockRoomProp
|
||||
<Text size="H4">Knock On Room</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box
|
||||
|
||||
@@ -10,8 +10,6 @@ import {
|
||||
Box,
|
||||
Text,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
color,
|
||||
Button,
|
||||
Spinner,
|
||||
@@ -19,6 +17,7 @@ import {
|
||||
import type { MatrixError } from '$types/matrix-sdk';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { composerIcon, X } from '$components/icons/phosphor';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { createDebugLogger } from '$utils/debugLogger';
|
||||
|
||||
@@ -74,7 +73,7 @@ export function LeaveRoomPrompt({ roomId, onDone, onCancel }: LeaveRoomPromptPro
|
||||
<Text size="H4">Leave Room</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box style={{ padding: config.space.S400 }} direction="Column" gap="400">
|
||||
|
||||
@@ -10,8 +10,6 @@ import {
|
||||
Box,
|
||||
Text,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
color,
|
||||
Button,
|
||||
Spinner,
|
||||
@@ -19,6 +17,7 @@ import {
|
||||
import type { MatrixError } from '$types/matrix-sdk';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { composerIcon, X } from '$components/icons/phosphor';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
|
||||
type LeaveSpacePromptProps = {
|
||||
@@ -69,7 +68,7 @@ export function LeaveSpacePrompt({ roomId, onDone, onCancel }: LeaveSpacePromptP
|
||||
<Text size="H4">Leave Space</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box style={{ padding: config.space.S400 }} direction="Column" gap="400">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { as, Avatar, Box, Icon, Icons, Text } from 'folds';
|
||||
import { as, Avatar, Box, Text } from 'folds';
|
||||
import { userFallbackIcon } from '$components/icons/phosphor';
|
||||
import type { MatrixClient, Room, RoomMember } from '$types/matrix-sdk';
|
||||
import { getMemberDisplayName } from '$utils/room';
|
||||
import { getMxIdLocalPart } from '$utils/matrix';
|
||||
@@ -44,7 +45,7 @@ export const MemberTile = as<'button', MemberTileProps>(
|
||||
userId={member.userId}
|
||||
src={avatarUrl ?? undefined}
|
||||
alt={name}
|
||||
renderFallback={() => <Icon size="300" src={Icons.User} filled />}
|
||||
renderFallback={() => userFallbackIcon('xl')}
|
||||
/>
|
||||
</Avatar>
|
||||
<Box grow="Yes" as="span" direction="Column">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Badge, Box, Icon, IconButton, Icons, Spinner, Text, as, toRem } from 'folds';
|
||||
import { Badge, Box, IconButton, Spinner, Text, as, toRem } from 'folds';
|
||||
import { Download, sizedIcon } from '$components/icons/phosphor';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useCallback } from 'react';
|
||||
import type { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
|
||||
@@ -48,7 +49,7 @@ export function FileDownloadButton({ filename, url, mimeType, encInfo }: FileDow
|
||||
{downloading ? (
|
||||
<Spinner size="100" variant={hasError ? 'Critical' : 'Secondary'} />
|
||||
) : (
|
||||
<Icon size="100" src={Icons.Download} />
|
||||
sizedIcon(Download, '100')
|
||||
)}
|
||||
</IconButton>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import { style } from '@vanilla-extract/css';
|
||||
import { color, config } from 'folds';
|
||||
|
||||
const mono = { fontFamily: 'var(--font-monospace)' };
|
||||
|
||||
export const DiffCodeBlock = style([
|
||||
mono,
|
||||
{
|
||||
margin: 0,
|
||||
color: color.SurfaceVariant.OnContainer,
|
||||
background: color.SurfaceVariant.Container,
|
||||
border: `${config.borderWidth.B300} solid ${color.SurfaceVariant.ContainerLine}`,
|
||||
borderRadius: config.radii.R300,
|
||||
padding: `${config.space.S100} ${config.space.S200}`,
|
||||
whiteSpace: 'pre-wrap',
|
||||
overflowWrap: 'anywhere',
|
||||
wordBreak: 'break-word',
|
||||
overflow: 'hidden',
|
||||
fontSize: 'inherit',
|
||||
lineHeight: 'inherit',
|
||||
},
|
||||
]);
|
||||
|
||||
export const DiffCodeBlockInner = style({
|
||||
display: 'block',
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
});
|
||||
|
||||
export const DiffLine = style([
|
||||
mono,
|
||||
{
|
||||
display: 'flex',
|
||||
gap: config.space.S200,
|
||||
whiteSpace: 'pre-wrap',
|
||||
overflowWrap: 'anywhere',
|
||||
wordBreak: 'break-word',
|
||||
},
|
||||
]);
|
||||
|
||||
export const DiffLinePrefix = style({
|
||||
flexShrink: 0,
|
||||
width: '1ch',
|
||||
opacity: config.opacity.P500,
|
||||
userSelect: 'none',
|
||||
});
|
||||
|
||||
export const DiffLineText = style({
|
||||
flexGrow: 1,
|
||||
minWidth: 0,
|
||||
});
|
||||
|
||||
export const DiffLineEqual = style({});
|
||||
|
||||
export const DiffLineDelete = style({
|
||||
backgroundColor: color.Critical.Container,
|
||||
color: color.Critical.OnContainer,
|
||||
});
|
||||
|
||||
export const DiffLineInsert = style({
|
||||
backgroundColor: color.Success.Container,
|
||||
color: color.Success.OnContainer,
|
||||
});
|
||||
|
||||
export const DiffExpand = style([
|
||||
mono,
|
||||
{
|
||||
display: 'flex',
|
||||
gap: config.space.S200,
|
||||
alignItems: 'center',
|
||||
width: '100%',
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
textAlign: 'left',
|
||||
cursor: 'pointer',
|
||||
background: 'transparent',
|
||||
border: 'none',
|
||||
color: 'inherit',
|
||||
opacity: config.opacity.P500,
|
||||
fontSize: 'inherit',
|
||||
lineHeight: 'inherit',
|
||||
whiteSpace: 'pre-wrap',
|
||||
overflowWrap: 'anywhere',
|
||||
wordBreak: 'break-word',
|
||||
selectors: {
|
||||
'&:hover': {
|
||||
opacity: 1,
|
||||
backgroundColor: color.SurfaceVariant.ContainerActive,
|
||||
},
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
export const DiffInlineDelete = style({
|
||||
backgroundColor: color.Critical.Container,
|
||||
color: color.Critical.OnContainer,
|
||||
textDecoration: 'line-through',
|
||||
borderRadius: config.radii.R300,
|
||||
});
|
||||
|
||||
export const DiffInlineInsert = style({
|
||||
backgroundColor: color.Success.Container,
|
||||
color: color.Success.OnContainer,
|
||||
borderRadius: config.radii.R300,
|
||||
});
|
||||
@@ -0,0 +1,179 @@
|
||||
import classNames from 'classnames';
|
||||
import { useCallback, useMemo, useState, type ReactNode } from 'react';
|
||||
import { Text } from 'folds';
|
||||
import { scaleSystemEmoji } from '$plugins/react-custom-html-parser';
|
||||
import { buildMessageDiffDisplay, type MessageDiffRow, type TextDiffPart } from '$utils/textDiff';
|
||||
|
||||
import * as css from './InlineTextDiff.css';
|
||||
|
||||
const SKIP_EXPAND_CHUNK = 20;
|
||||
|
||||
type InlineTextDiffProps = {
|
||||
oldText: string;
|
||||
newText: string;
|
||||
};
|
||||
|
||||
type CodeDiffRow = Exclude<MessageDiffRow, { type: 'skip' }>;
|
||||
|
||||
const renderInlineParts = (parts: TextDiffPart[]) =>
|
||||
parts.map((part, index) => {
|
||||
const content = scaleSystemEmoji(part.value);
|
||||
const key = `diff-${index}-${part.type}`;
|
||||
if (part.type === 'delete') {
|
||||
return (
|
||||
<span key={key} className={css.DiffInlineDelete}>
|
||||
{content}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
if (part.type === 'insert') {
|
||||
return (
|
||||
<span key={key} className={css.DiffInlineInsert}>
|
||||
{content}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return <span key={key}>{content}</span>;
|
||||
});
|
||||
|
||||
const renderCodeLine = (row: CodeDiffRow, key: string) => {
|
||||
const prefix = row.type === 'delete' ? '-' : row.type === 'insert' ? '+' : ' ';
|
||||
const lineClass =
|
||||
row.type === 'delete'
|
||||
? css.DiffLineDelete
|
||||
: row.type === 'insert'
|
||||
? css.DiffLineInsert
|
||||
: css.DiffLineEqual;
|
||||
|
||||
return (
|
||||
<div key={key} className={classNames(css.DiffLine, lineClass)}>
|
||||
<span className={css.DiffLinePrefix} aria-hidden>
|
||||
{prefix}
|
||||
</span>
|
||||
<span className={css.DiffLineText}>{scaleSystemEmoji(row.text)}</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
type DiffSkipRowsProps = {
|
||||
skipIndex: number;
|
||||
lines: string[];
|
||||
placement: 'before' | 'after' | 'between';
|
||||
revealed: number;
|
||||
onReveal: (skipIndex: number, amount: number) => void;
|
||||
};
|
||||
|
||||
function DiffSkipRows({ skipIndex, lines, placement, revealed, onReveal }: DiffSkipRowsProps) {
|
||||
const remaining = lines.length - revealed;
|
||||
const nextReveal = Math.min(SKIP_EXPAND_CHUNK, remaining);
|
||||
const expandUp = placement === 'before';
|
||||
const arrow = expandUp ? '↑' : '↓';
|
||||
const revealedLines =
|
||||
placement === 'before'
|
||||
? lines.slice(Math.max(0, lines.length - revealed))
|
||||
: lines.slice(0, revealed);
|
||||
|
||||
const label = `Expand ${remaining <= SKIP_EXPAND_CHUNK ? `all ${remaining}` : nextReveal} unchanged ${remaining === 1 ? 'line' : 'lines'}`;
|
||||
|
||||
const expandRow =
|
||||
remaining > 0 ? (
|
||||
<button
|
||||
type="button"
|
||||
className={css.DiffExpand}
|
||||
onClick={() => onReveal(skipIndex, nextReveal)}
|
||||
>
|
||||
<span className={css.DiffLinePrefix} aria-hidden>
|
||||
{' '}
|
||||
</span>
|
||||
<span className={css.DiffLineText}>
|
||||
{arrow} {label}
|
||||
</span>
|
||||
</button>
|
||||
) : null;
|
||||
|
||||
const revealedRows = revealedLines.map((line, lineIndex) =>
|
||||
renderCodeLine({ type: 'equal', text: line }, `skip-${skipIndex}-line-${lineIndex}`)
|
||||
);
|
||||
|
||||
if (expandUp) {
|
||||
return (
|
||||
<>
|
||||
{expandRow}
|
||||
{revealedRows}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{revealedRows}
|
||||
{expandRow}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function InlineDiffBlock({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<Text as="pre" size="T200" className={css.DiffCodeBlock}>
|
||||
<code className={css.DiffCodeBlockInner}>{children}</code>
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
|
||||
export function InlineTextDiff({ oldText, newText }: InlineTextDiffProps) {
|
||||
const display = useMemo(() => buildMessageDiffDisplay(oldText, newText), [oldText, newText]);
|
||||
const [revealedBySkip, setRevealedBySkip] = useState<Record<number, number>>({});
|
||||
|
||||
const revealSkip = useCallback((skipIndex: number, amount: number) => {
|
||||
setRevealedBySkip((prev) => ({
|
||||
...prev,
|
||||
[skipIndex]: (prev[skipIndex] ?? 0) + amount,
|
||||
}));
|
||||
}, []);
|
||||
|
||||
if (display.mode === 'inline') {
|
||||
if (display.parts.length === 0) {
|
||||
return <InlineDiffBlock>(empty)</InlineDiffBlock>;
|
||||
}
|
||||
|
||||
return (
|
||||
<InlineDiffBlock>
|
||||
<div className={classNames(css.DiffLine, css.DiffLineEqual)}>
|
||||
<span className={css.DiffLinePrefix} aria-hidden>
|
||||
{' '}
|
||||
</span>
|
||||
<span className={css.DiffLineText}>{renderInlineParts(display.parts)}</span>
|
||||
</div>
|
||||
</InlineDiffBlock>
|
||||
);
|
||||
}
|
||||
|
||||
if (display.rows.length === 0) {
|
||||
return <InlineDiffBlock>(empty)</InlineDiffBlock>;
|
||||
}
|
||||
|
||||
let skipIndex = 0;
|
||||
|
||||
return (
|
||||
<InlineDiffBlock>
|
||||
{display.rows.map((row, index) => {
|
||||
if (row.type === 'skip') {
|
||||
const currentSkipIndex = skipIndex;
|
||||
skipIndex += 1;
|
||||
return (
|
||||
<DiffSkipRows
|
||||
key={`skip-${currentSkipIndex}`}
|
||||
skipIndex={currentSkipIndex}
|
||||
lines={row.lines}
|
||||
placement={row.placement}
|
||||
revealed={revealedBySkip[currentSkipIndex] ?? 0}
|
||||
onReveal={revealSkip}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return renderCodeLine(row, `${row.type}-${row.text}-${index}`);
|
||||
})}
|
||||
</InlineDiffBlock>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { CSSProperties, ReactNode } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { Box, Chip, Icon, Icons, Text, toRem } from 'folds';
|
||||
import type { IContent, IPreviewUrlResponse } from '$types/matrix-sdk';
|
||||
import { Box, Chip, Text, toRem } from 'folds';
|
||||
import { ArrowSquareOut, sizedIcon, Link } from '$components/icons/phosphor';
|
||||
import type { IContent, IPreviewUrlResponse, MatrixClient } from '$types/matrix-sdk';
|
||||
import { JUMBO_EMOJI_REG } from '$utils/regex';
|
||||
import { trimReplyFromBody } from '$utils/room';
|
||||
import type {
|
||||
@@ -30,6 +31,7 @@ import {
|
||||
MessageDeletedContent,
|
||||
MessageEditedContent,
|
||||
MessageUnsupportedContent,
|
||||
ReactionDeletedContent,
|
||||
} from './content';
|
||||
import { MessageTextBody } from './layout';
|
||||
import { unwrapForwardedContent } from './modals/MessageForward';
|
||||
@@ -64,6 +66,34 @@ export function RedactedContent({ reason }: RedactedContentProps) {
|
||||
);
|
||||
}
|
||||
|
||||
type RedactedReactionContentProps = {
|
||||
reactionKey?: string;
|
||||
shortcode?: string;
|
||||
mx?: MatrixClient;
|
||||
useAuthentication?: boolean;
|
||||
reason?: string;
|
||||
};
|
||||
export function RedactedReactionContent({
|
||||
reactionKey,
|
||||
shortcode,
|
||||
mx,
|
||||
useAuthentication,
|
||||
reason,
|
||||
}: RedactedReactionContentProps) {
|
||||
return (
|
||||
<Text>
|
||||
<ReactionDeletedContent
|
||||
reactionKey={reactionKey}
|
||||
shortcode={shortcode}
|
||||
mx={mx}
|
||||
useAuthentication={useAuthentication}
|
||||
reason={reason}
|
||||
hideIcon
|
||||
/>
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
|
||||
type BrokenContentProps = {
|
||||
body?: string;
|
||||
};
|
||||
@@ -668,7 +698,7 @@ export function MLocation({ content, showMaps }: MLocationProps) {
|
||||
size="400"
|
||||
variant="SurfaceVariant"
|
||||
onClick={() => copyToClipboard(`${location.latitude}, ${location.longitude}`)}
|
||||
before={<Icon size="50" src={Icons.Link} />}
|
||||
before={sizedIcon(Link, '50')}
|
||||
className={css.LocationCoordsChip}
|
||||
>
|
||||
<Text size="T400">{`${location.latitude}, ${location.longitude}`}</Text>
|
||||
@@ -683,7 +713,7 @@ export function MLocation({ content, showMaps }: MLocationProps) {
|
||||
variant="Primary"
|
||||
radii="Pill"
|
||||
className={css.LocationExternalChip}
|
||||
before={<Icon src={Icons.External} size="50" />}
|
||||
before={sizedIcon(ArrowSquareOut, '50')}
|
||||
>
|
||||
<Text size="B300">Open Location</Text>
|
||||
</Chip>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { Box, Icon, Icons, Text, as } from 'folds';
|
||||
import { Box, Text, as } from 'folds';
|
||||
import { sizedIcon, Warning } from '$components/icons/phosphor';
|
||||
import classNames from 'classnames';
|
||||
import type { MatrixClient, MatrixEvent, Room } from '$types/matrix-sdk';
|
||||
import { getHexcodeForEmoji, getShortcodeFor } from '$plugins/emoji';
|
||||
@@ -35,11 +36,11 @@ export const Reaction = as<
|
||||
(() => {
|
||||
if (imgError)
|
||||
return (
|
||||
// Image loaded but fetch failed — show a small warning icon so the
|
||||
// Image loaded but fetch failed Eshow a small warning icon so the
|
||||
// reaction button still renders correctly and the user can see
|
||||
// something went wrong rather than a browser broken-image icon.
|
||||
<span title="Failed to load emoji image" aria-label="Failed to load emoji image">
|
||||
<Icon size="100" src={Icons.Warning} style={{ opacity: 0.5 }} />
|
||||
{sizedIcon(Warning, '100', { style: { opacity: 0.5 } })}
|
||||
</span>
|
||||
);
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { useState } from 'react';
|
||||
import { Text } from 'folds';
|
||||
import type { MatrixClient } from '$types/matrix-sdk';
|
||||
import { menuIcon, Warning } from '$components/icons/phosphor';
|
||||
import { scaleSystemEmoji } from '$plugins/react-custom-html-parser';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import * as css from './Reaction.css';
|
||||
|
||||
type ReactionKeyInlineProps = {
|
||||
mx: MatrixClient;
|
||||
reactionKey?: string;
|
||||
shortcode?: string;
|
||||
useAuthentication?: boolean;
|
||||
};
|
||||
|
||||
export function ReactionKeyInline({
|
||||
mx,
|
||||
reactionKey,
|
||||
shortcode,
|
||||
useAuthentication,
|
||||
}: ReactionKeyInlineProps) {
|
||||
const [imgError, setImgError] = useState(false);
|
||||
|
||||
if (!reactionKey) {
|
||||
if (shortcode) {
|
||||
return (
|
||||
<Text as="span" size="Inherit">
|
||||
:{shortcode}:
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (reactionKey.startsWith('mxc://')) {
|
||||
if (imgError) {
|
||||
return (
|
||||
<span title="Failed to load emoji image" aria-label="Failed to load emoji image">
|
||||
{menuIcon(Warning, { style: { opacity: 0.5 } })}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<img
|
||||
className={css.ReactionImg}
|
||||
src={mxcUrlToHttp(mx, reactionKey, useAuthentication) ?? reactionKey}
|
||||
alt={shortcode ?? 'reaction'}
|
||||
onError={() => setImgError(true)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Text as="span" size="Inherit" style={{ unicodeBidi: 'plaintext' }}>
|
||||
{scaleSystemEmoji(reactionKey)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { IconSrc } from 'folds';
|
||||
import { Box, Chip, Icon, Icons, Text, as, color, toRem } from 'folds';
|
||||
import { Box, Chip, Text, as, color, toRem } from 'folds';
|
||||
import type { EventTimelineSet, IMentions, Room, SessionMembershipData } from '$types/matrix-sdk';
|
||||
import { EventType, MsgType } from '$types/matrix-sdk';
|
||||
import type { MouseEventHandler, ReactNode } from 'react';
|
||||
@@ -8,7 +7,30 @@ import { useQueryClient } from '@tanstack/react-query';
|
||||
import classNames from 'classnames';
|
||||
import parse from 'html-react-parser';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { getMemberDisplayName, trimReplyFromBody, trimReplyFromFormattedBody } from '$utils/room';
|
||||
import {
|
||||
ArrowBendUpRightIcon,
|
||||
ArrowsClockwise,
|
||||
ChatCircle,
|
||||
chipIcon,
|
||||
Code,
|
||||
Hash,
|
||||
ListBullets,
|
||||
menuIcon,
|
||||
Phone,
|
||||
PhoneDisconnect,
|
||||
PushPin,
|
||||
timelineIcon,
|
||||
Trash,
|
||||
Smiley,
|
||||
} from '$components/icons/phosphor';
|
||||
import {
|
||||
getMemberDisplayName,
|
||||
getReactionKey,
|
||||
getReactionShortcode,
|
||||
getRedactionTargetId,
|
||||
trimReplyFromBody,
|
||||
trimReplyFromFormattedBody,
|
||||
} from '$utils/room';
|
||||
import { getMxIdLocalPart } from '$utils/matrix';
|
||||
import { randomNumberBetween } from '$utils/common';
|
||||
import { sanitizeCustomHtml } from '$utils/sanitize';
|
||||
@@ -41,15 +63,19 @@ import {
|
||||
MessageEmptyContent,
|
||||
MessageFailedContent,
|
||||
MessageUnsupportedContent,
|
||||
ReactionDeletedContent,
|
||||
} from './content';
|
||||
import * as css from './Reply.css';
|
||||
import { LinePlaceholder } from './placeholder';
|
||||
import { ReactionKeyInline } from './ReactionKeyInline';
|
||||
import { M_POLL_START, M_TEXT } from 'matrix-js-sdk';
|
||||
|
||||
const ROOM_REPLY_TIMELINE_EVENT_TYPES = new Set<string>([
|
||||
EventType.RoomMessage as string,
|
||||
EventType.RoomMessageEncrypted as string,
|
||||
EventType.Sticker as string,
|
||||
EventType.Reaction as string,
|
||||
EventType.RoomRedaction as string,
|
||||
]);
|
||||
|
||||
const nonEmptyTrimmed = (v: unknown): string | undefined => {
|
||||
@@ -77,25 +103,44 @@ export const replyPreviewBodyForTimelineEvent = (
|
||||
content: Record<string, unknown>,
|
||||
isRedacted: boolean
|
||||
): ReactNode | undefined => {
|
||||
if (!eventType || !ROOM_REPLY_TIMELINE_EVENT_TYPES.has(eventType)) return undefined;
|
||||
if (!eventType) return undefined;
|
||||
|
||||
if (eventType === (EventType.RoomRedaction as string)) {
|
||||
return 'redacted a message';
|
||||
}
|
||||
|
||||
if (eventType === (EventType.Reaction as string)) {
|
||||
if (isRedacted) {
|
||||
return <ReactionDeletedContent hideIcon />;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!ROOM_REPLY_TIMELINE_EVENT_TYPES.has(eventType)) return undefined;
|
||||
|
||||
const effectiveContent =
|
||||
content['m.new_content'] != null && typeof content['m.new_content'] === 'object'
|
||||
? (content['m.new_content'] as Record<string, unknown>)
|
||||
: content;
|
||||
|
||||
if (isRedacted) return <MessageDeletedContent />;
|
||||
|
||||
if (eventType === (EventType.Sticker as string)) {
|
||||
const stickerBody = nonEmptyTrimmed(content.body);
|
||||
const stickerBody = nonEmptyTrimmed(effectiveContent.body);
|
||||
if (stickerBody) return scaleSystemEmoji(stickerBody);
|
||||
return 'Sticker';
|
||||
}
|
||||
|
||||
const rawMsgtype = content.msgtype;
|
||||
const rawMsgtype = effectiveContent.msgtype;
|
||||
if (typeof rawMsgtype !== 'string') {
|
||||
return <MessageUnsupportedContent />;
|
||||
}
|
||||
const msgtype = rawMsgtype as MsgType;
|
||||
|
||||
const trimmedBody = nonEmptyTrimmed(
|
||||
typeof content.body === 'string' ? trimReplyFromBody(content.body) : ''
|
||||
typeof effectiveContent.body === 'string' ? trimReplyFromBody(effectiveContent.body) : ''
|
||||
);
|
||||
const filename = nonEmptyTrimmed(content.filename);
|
||||
const filename = nonEmptyTrimmed(effectiveContent.filename);
|
||||
if (trimmedBody) return undefined;
|
||||
|
||||
const attachmentLabel = filename;
|
||||
@@ -123,7 +168,7 @@ export const replyPreviewBodyForTimelineEvent = (
|
||||
type ReplyLayoutProps = {
|
||||
userColor?: string;
|
||||
username?: ReactNode;
|
||||
icon?: IconSrc;
|
||||
icon?: ReactNode;
|
||||
mentioned: boolean;
|
||||
replyIcon?: JSX.Element;
|
||||
};
|
||||
@@ -137,11 +182,11 @@ export const ReplyLayout = as<'div', ReplyLayoutProps>(
|
||||
ref={ref}
|
||||
>
|
||||
<Box style={{ color: userColor }} alignItems="Center" shrink="No">
|
||||
{replyIcon || <Icon size="100" src={Icons.ReplyArrow} />}
|
||||
{replyIcon ?? menuIcon(ArrowBendUpRightIcon)}
|
||||
</Box>
|
||||
{!!icon && <Icon style={{ opacity: 0.6 }} size="50" src={icon} />}
|
||||
{icon}
|
||||
<Box style={{ color: userColor, maxWidth: toRem(200) }} alignItems="Center" shrink="No">
|
||||
{mentioned && <Icon size="100" src={Icons.Mention} />}
|
||||
{mentioned && '@'}
|
||||
{username}
|
||||
</Box>
|
||||
<Box grow="Yes" className={css.ReplyContent}>
|
||||
@@ -160,7 +205,7 @@ export const ThreadIndicator = as<'div'>(({ ...props }, ref) => (
|
||||
{...props}
|
||||
ref={ref}
|
||||
>
|
||||
<Icon size="50" src={Icons.Thread} />
|
||||
{chipIcon(ChatCircle)}
|
||||
<Text size="L400">Thread</Text>
|
||||
</Box>
|
||||
));
|
||||
@@ -173,6 +218,7 @@ type ReplyProps = {
|
||||
mentions?: IMentions;
|
||||
onClick?: MouseEventHandler;
|
||||
replyIcon?: JSX.Element;
|
||||
previewBodyOverride?: string;
|
||||
};
|
||||
|
||||
export const sanitizeReplyFormattedPreview = (formattedBody: string): string => {
|
||||
@@ -190,7 +236,17 @@ export const sanitizeReplyFormattedPreview = (formattedBody: string): string =>
|
||||
|
||||
export const Reply = as<'div', ReplyProps>(
|
||||
(
|
||||
{ room, timelineSet, replyEventId, threadRootId, mentions, onClick, replyIcon, ...props },
|
||||
{
|
||||
room,
|
||||
timelineSet,
|
||||
replyEventId,
|
||||
threadRootId,
|
||||
mentions,
|
||||
onClick,
|
||||
replyIcon,
|
||||
previewBodyOverride,
|
||||
...props
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
const placeholderWidth = useMemo(() => randomNumberBetween(40, 400), []);
|
||||
@@ -203,19 +259,25 @@ export const Reply = as<'div', ReplyProps>(
|
||||
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const { body, formatted_body: formattedBody, format } = replyEvent?.getContent() ?? {};
|
||||
const extensibleContent = replyEvent?.getContent()[M_TEXT.name] as
|
||||
const rawContent = replyEvent?.getContent() ?? {};
|
||||
const contentForPreview =
|
||||
rawContent['m.new_content'] != null && typeof rawContent['m.new_content'] === 'object'
|
||||
? (rawContent['m.new_content'] as Record<string, unknown>)
|
||||
: rawContent;
|
||||
|
||||
const { body, formatted_body: formattedBody, format } = contentForPreview;
|
||||
const extensibleContent = contentForPreview[M_TEXT.name] as
|
||||
| string
|
||||
| { body: string }
|
||||
| undefined;
|
||||
const extensibleBody = (extensibleContent as { body: string })?.body ?? extensibleContent;
|
||||
const sender = replyEvent?.getSender();
|
||||
const eventType = replyEvent?.getType();
|
||||
const isRedacted = replyEvent?.isRedacted() === true;
|
||||
|
||||
const ignoredUsers = useIgnoredUsers();
|
||||
const isBlockedSender = !!sender && ignoredUsers.includes(sender);
|
||||
const { t } = useTranslation();
|
||||
const isRedacted = replyEvent?.isRedacted() === true;
|
||||
|
||||
const parseMemberEvent = useMemberEventParser();
|
||||
|
||||
@@ -232,7 +294,20 @@ export const Reply = as<'div', ReplyProps>(
|
||||
'incomingInlineImagesMaxHeight'
|
||||
);
|
||||
|
||||
const fallbackBody = isRedacted ? <MessageDeletedContent /> : <MessageFailedContent />;
|
||||
const fallbackBody =
|
||||
isRedacted && eventType === (EventType.Reaction as string) ? (
|
||||
<ReactionDeletedContent
|
||||
mx={mx}
|
||||
reactionKey={replyEvent ? getReactionKey(replyEvent) : undefined}
|
||||
shortcode={replyEvent ? getReactionShortcode(replyEvent) : undefined}
|
||||
useAuthentication={useAuthentication}
|
||||
hideIcon
|
||||
/>
|
||||
) : isRedacted ? (
|
||||
<MessageDeletedContent />
|
||||
) : (
|
||||
<MessageFailedContent />
|
||||
);
|
||||
|
||||
const badEncryption = replyEvent?.getContent().msgtype === 'm.bad.encrypted';
|
||||
const mentionClickHandler = useMentionClickHandler(room.roomId);
|
||||
@@ -252,7 +327,7 @@ export const Reply = as<'div', ReplyProps>(
|
||||
!replyEvent.getClearContent();
|
||||
|
||||
let bodyJSX: ReactNode = fallbackBody;
|
||||
let image: IconSrc | undefined;
|
||||
let image: ReactNode | undefined;
|
||||
let mentioned = sender != null && (mentions?.user_ids?.includes(sender) ?? false);
|
||||
|
||||
const replyLinkifyOpts = useMemo(
|
||||
@@ -279,7 +354,7 @@ export const Reply = as<'div', ReplyProps>(
|
||||
question: { [M_TEXT.name]?: string; body?: string };
|
||||
}
|
||||
)?.question;
|
||||
image = Icons.UnorderList;
|
||||
image = timelineIcon(ListBullets);
|
||||
bodyJSX = `'s poll asking ${(question[M_TEXT.name] as string) ?? question.body ?? ''}`;
|
||||
} else if (isFormattedReply && formattedBody !== '') {
|
||||
const sanitizedHtml = sanitizeReplyFormattedPreview(formattedBody);
|
||||
@@ -318,18 +393,57 @@ export const Reply = as<'div', ReplyProps>(
|
||||
</Box>
|
||||
);
|
||||
} else if (eventType === EventType.RoomName) {
|
||||
image = Icons.Hash;
|
||||
image = timelineIcon(Hash);
|
||||
bodyJSX = t('Organisms.RoomCommon.changed_room_name');
|
||||
} else if (eventType === EventType.RoomTopic) {
|
||||
image = Icons.Hash;
|
||||
image = timelineIcon(Hash);
|
||||
bodyJSX = ' changed room topic';
|
||||
} else if (eventType === EventType.RoomAvatar) {
|
||||
image = Icons.Hash;
|
||||
image = timelineIcon(Hash);
|
||||
bodyJSX = ' changed room avatar';
|
||||
} else if (eventType === EventType.GroupCallMemberPrefix && !!replyEvent) {
|
||||
const callJoined = replyEvent.getContent<SessionMembershipData>().application;
|
||||
image = callJoined ? Icons.Phone : Icons.PhoneDown;
|
||||
image = callJoined ? timelineIcon(Phone) : timelineIcon(PhoneDisconnect);
|
||||
bodyJSX = callJoined ? ' joined the call' : ' ended the call';
|
||||
} else if (eventType === EventType.RoomRedaction && replyEvent) {
|
||||
image = timelineIcon(Trash);
|
||||
const redactionTargetId = getRedactionTargetId(replyEvent);
|
||||
const redactionTarget = redactionTargetId
|
||||
? (timelineSet?.findEventById(redactionTargetId) ??
|
||||
room.findEventById(redactionTargetId) ??
|
||||
null)
|
||||
: null;
|
||||
bodyJSX =
|
||||
redactionTarget?.getType() === (EventType.Reaction as string)
|
||||
? ' redacted a reaction'
|
||||
: ' redacted a message';
|
||||
} else if (eventType === EventType.Reaction && !!replyEvent) {
|
||||
image = isRedacted ? timelineIcon(Trash) : timelineIcon(Smiley);
|
||||
if (isRedacted) {
|
||||
bodyJSX = (
|
||||
<ReactionDeletedContent
|
||||
mx={mx}
|
||||
reactionKey={getReactionKey(replyEvent)}
|
||||
shortcode={getReactionShortcode(replyEvent)}
|
||||
useAuthentication={useAuthentication}
|
||||
hideIcon
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
const reactionKey = getReactionKey(replyEvent);
|
||||
const reactionShortcode = getReactionShortcode(replyEvent);
|
||||
bodyJSX = (
|
||||
<>
|
||||
{' reacted with '}
|
||||
<ReactionKeyInline
|
||||
mx={mx}
|
||||
reactionKey={reactionKey}
|
||||
shortcode={reactionShortcode}
|
||||
useAuthentication={useAuthentication}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
} else if (eventType === EventType.RoomPinnedEvents && replyEvent) {
|
||||
const { pinned } = replyEvent.getContent();
|
||||
const prevPinned = replyEvent.getPrevContent().pinned;
|
||||
@@ -337,7 +451,7 @@ export const Reply = as<'div', ReplyProps>(
|
||||
prevPinned && pinned && pinned.filter((x: string) => !prevPinned.includes(x));
|
||||
const pinsRemoved =
|
||||
prevPinned && pinned && prevPinned.filter((x: string) => !pinned.includes(x));
|
||||
image = Icons.Pin;
|
||||
image = timelineIcon(PushPin);
|
||||
bodyJSX = (
|
||||
<>
|
||||
{(pinsAdded?.length > 0 &&
|
||||
@@ -361,7 +475,7 @@ export const Reply = as<'div', ReplyProps>(
|
||||
if (timelinePreview !== undefined) {
|
||||
bodyJSX = timelinePreview;
|
||||
} else if (replyEvent.isState()) {
|
||||
image = Icons.Code;
|
||||
image = timelineIcon(Code);
|
||||
bodyJSX = (
|
||||
<>
|
||||
{' sent '}
|
||||
@@ -373,6 +487,14 @@ export const Reply = as<'div', ReplyProps>(
|
||||
bodyJSX = <MessageUnsupportedContent />;
|
||||
}
|
||||
}
|
||||
if (typeof previewBodyOverride === 'string' && previewBodyOverride.length > 0 && !isRedacted) {
|
||||
const strippedOverride = trimReplyFromBody(previewBodyOverride).replaceAll(
|
||||
/(?:\r\n|\r|\n)/g,
|
||||
' '
|
||||
);
|
||||
bodyJSX = scaleSystemEmoji(strippedOverride);
|
||||
}
|
||||
|
||||
let replyContent = bodyJSX;
|
||||
if (isBlockedSender) {
|
||||
replyContent = <MessageBlockedContent />;
|
||||
@@ -407,22 +529,20 @@ export const Reply = as<'div', ReplyProps>(
|
||||
{replyContent}
|
||||
</Text>
|
||||
) : (
|
||||
(isRedacted && <MessageDeletedContent />) || (
|
||||
<LinePlaceholder
|
||||
style={{
|
||||
backgroundColor: color.SurfaceVariant.ContainerActive,
|
||||
width: toRem(placeholderWidth),
|
||||
maxWidth: '100%',
|
||||
}}
|
||||
/>
|
||||
)
|
||||
<LinePlaceholder
|
||||
style={{
|
||||
backgroundColor: color.SurfaceVariant.ContainerActive,
|
||||
width: toRem(placeholderWidth),
|
||||
maxWidth: '100%',
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</ReplyLayout>
|
||||
{replyEvent === null && (
|
||||
<Chip
|
||||
variant="Critical"
|
||||
radii="Pill"
|
||||
before={<Icon size="50" src={Icons.Reload} />}
|
||||
before={menuIcon(ArrowsClockwise)}
|
||||
onClick={(evt) => {
|
||||
evt.stopPropagation();
|
||||
void queryClient.invalidateQueries({
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* oxlint-disable jsx-a11y/media-has-caption */
|
||||
import type { ReactNode } from 'react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { Badge, Chip, Icon, IconButton, Icons, ProgressBar, Spinner, Text, toRem } from 'folds';
|
||||
import { Badge, Chip, IconButton, ProgressBar, Spinner, Text, toRem } from 'folds';
|
||||
import { sizedIcon, Pause, Play, SpeakerHigh, SpeakerSlash } from '$components/icons/phosphor';
|
||||
import type { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
|
||||
import { Range } from 'react-range';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
@@ -173,7 +174,7 @@ export function AudioContent({
|
||||
srcState.status === AsyncStatus.Loading || loading ? (
|
||||
<Spinner variant="Secondary" size="50" />
|
||||
) : (
|
||||
<Icon src={playing ? Icons.Pause : Icons.Play} size="50" filled={playing} />
|
||||
sizedIcon(playing ? Pause : Play, '50', { filled: playing })
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -194,7 +195,7 @@ export function AudioContent({
|
||||
onClick={() => setMute(!mute)}
|
||||
aria-pressed={mute}
|
||||
>
|
||||
<Icon src={mute ? Icons.VolumeMute : Icons.VolumeHigh} size="50" />
|
||||
{sizedIcon(mute ? SpeakerSlash : SpeakerHigh, '50')}
|
||||
</IconButton>
|
||||
<Range
|
||||
step={0.1}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { IconSrc } from 'folds';
|
||||
import { Box, Icon } from 'folds';
|
||||
import { Box } from 'folds';
|
||||
import type { ReactNode } from 'react';
|
||||
import { MessageLayout } from '$state/settings';
|
||||
import { BubbleLayout, CompactLayout, ModernLayout } from '$components/message/layout';
|
||||
@@ -7,10 +6,10 @@ import { BubbleLayout, CompactLayout, ModernLayout } from '$components/message/l
|
||||
export type EventContentProps = {
|
||||
messageLayout: number;
|
||||
time: ReactNode;
|
||||
iconSrc: IconSrc;
|
||||
icon: ReactNode;
|
||||
content: ReactNode;
|
||||
};
|
||||
export function EventContent({ messageLayout, time, iconSrc, content }: EventContentProps) {
|
||||
export function EventContent({ messageLayout, time, icon, content }: EventContentProps) {
|
||||
const beforeJSX = (
|
||||
<Box gap="300" justifyContent="SpaceBetween" alignItems="Center" grow="Yes">
|
||||
{messageLayout === (MessageLayout.Compact as number) && time}
|
||||
@@ -19,7 +18,7 @@ export function EventContent({ messageLayout, time, iconSrc, content }: EventCon
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
>
|
||||
<Icon style={{ opacity: 0.6 }} size="50" src={iconSrc} />
|
||||
{icon}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { Box, Icon, Icons, Text, as, color, config } from 'folds';
|
||||
import { Box, Text, as, color, config } from 'folds';
|
||||
import type { MatrixClient } from '$types/matrix-sdk';
|
||||
|
||||
import { Lock, timelineIcon, Trash, Warning, X } from '$components/icons/phosphor';
|
||||
import { ReactionKeyInline } from '../ReactionKeyInline';
|
||||
import { BreakWord } from '$styles/Text.css';
|
||||
|
||||
const warningStyle = { color: color.Warning.Main, opacity: config.opacity.P300 };
|
||||
@@ -8,7 +11,7 @@ const criticalStyle = { color: color.Critical.Main, opacity: config.opacity.P300
|
||||
export const MessageDeletedContent = as<'div', { children?: never; reason?: string }>(
|
||||
({ reason, ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={warningStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Delete} />
|
||||
{timelineIcon(Trash, { style: warningStyle })}
|
||||
{reason ? (
|
||||
<i>This message has been deleted. {reason}</i>
|
||||
) : (
|
||||
@@ -18,6 +21,43 @@ export const MessageDeletedContent = as<'div', { children?: never; reason?: stri
|
||||
)
|
||||
);
|
||||
|
||||
export const ReactionDeletedContent = as<
|
||||
'div',
|
||||
{
|
||||
children?: never;
|
||||
reactionKey?: string;
|
||||
shortcode?: string;
|
||||
mx?: MatrixClient;
|
||||
useAuthentication?: boolean;
|
||||
reason?: string;
|
||||
hideIcon?: boolean;
|
||||
}
|
||||
>(({ reactionKey, shortcode, mx, useAuthentication, reason, hideIcon, ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={warningStyle} {...props} ref={ref}>
|
||||
{!hideIcon && timelineIcon(Trash, { style: warningStyle })}
|
||||
{reactionKey || shortcode ? (
|
||||
<i>
|
||||
This reaction has been removed:{' '}
|
||||
{mx ? (
|
||||
<ReactionKeyInline
|
||||
mx={mx}
|
||||
reactionKey={reactionKey}
|
||||
shortcode={shortcode}
|
||||
useAuthentication={useAuthentication}
|
||||
/>
|
||||
) : (
|
||||
(reactionKey ?? `:${shortcode}:`)
|
||||
)}
|
||||
{reason ? ` ${reason}` : ''}
|
||||
</i>
|
||||
) : reason ? (
|
||||
<i>This reaction has been removed. {reason}</i>
|
||||
) : (
|
||||
<i>This reaction has been removed</i>
|
||||
)}
|
||||
</Box>
|
||||
));
|
||||
|
||||
export const MessageUnsupportedContent = as<'div', { children?: never; body?: string }>(
|
||||
({ body, ...props }, ref) => (
|
||||
<Box
|
||||
@@ -29,7 +69,7 @@ export const MessageUnsupportedContent = as<'div', { children?: never; body?: st
|
||||
{...props}
|
||||
ref={ref}
|
||||
>
|
||||
<Icon size="50" src={Icons.Warning} />
|
||||
{timelineIcon(Warning, { style: criticalStyle })}
|
||||
<span className={BreakWord} style={{ flex: '1 1 auto', minWidth: 0 }}>
|
||||
<i>Unsupported message</i>
|
||||
{body && `: ${body}`}
|
||||
@@ -41,21 +81,21 @@ export const MessageUnsupportedContent = as<'div', { children?: never; body?: st
|
||||
|
||||
export const MessageFailedContent = as<'div', { children?: never }>(({ ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Warning} />
|
||||
{timelineIcon(Warning, { style: criticalStyle })}
|
||||
<i>Failed to load message</i>
|
||||
</Box>
|
||||
));
|
||||
|
||||
export const MessageBadEncryptedContent = as<'div', { children?: never }>(({ ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={warningStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Lock} />
|
||||
{timelineIcon(Lock, { style: warningStyle })}
|
||||
<i>Unable to decrypt message</i>
|
||||
</Box>
|
||||
));
|
||||
|
||||
export const MessageNotDecryptedContent = as<'div', { children?: never }>(({ ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={warningStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Lock} />
|
||||
{timelineIcon(Lock, { style: warningStyle })}
|
||||
<i>This message is not decrypted yet</i>
|
||||
</Box>
|
||||
));
|
||||
@@ -72,7 +112,7 @@ export const MessageBrokenContent = as<'div', { children?: never; body?: string
|
||||
{...props}
|
||||
ref={ref}
|
||||
>
|
||||
<Icon size="50" src={Icons.Warning} />
|
||||
{timelineIcon(Warning, { style: criticalStyle })}
|
||||
<span className={BreakWord} style={{ flex: '1 1 auto', minWidth: 0 }}>
|
||||
<i>Broken message</i>
|
||||
{body && `: ${body}`}
|
||||
@@ -84,14 +124,14 @@ export const MessageBrokenContent = as<'div', { children?: never; body?: string
|
||||
|
||||
export const MessageEmptyContent = as<'div', { children?: never }>(({ ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Warning} />
|
||||
{timelineIcon(Warning, { style: criticalStyle })}
|
||||
<i>Empty message</i>
|
||||
</Box>
|
||||
));
|
||||
|
||||
export const MessageBlockedContent = as<'div', { children?: never }>(({ ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={warningStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Cross} />
|
||||
{timelineIcon(X, { style: warningStyle })}
|
||||
<i>Message from a blocked user</i>
|
||||
</Box>
|
||||
));
|
||||
|
||||
@@ -3,8 +3,6 @@ import { useCallback, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Icon,
|
||||
Icons,
|
||||
Modal,
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
@@ -15,6 +13,7 @@ import {
|
||||
TooltipProvider,
|
||||
as,
|
||||
} from 'folds';
|
||||
import { ArrowRight, Download, sizedIcon, Warning } from '$components/icons/phosphor';
|
||||
import FileSaver from 'file-saver';
|
||||
import type { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
@@ -52,7 +51,7 @@ const renderErrorButton = (retry: () => void, text: string) => (
|
||||
outlined
|
||||
radii="300"
|
||||
onClick={retry}
|
||||
before={<Icon size="100" src={Icons.Warning} filled />}
|
||||
before={sizedIcon(Warning, '100', { filled: true })}
|
||||
>
|
||||
<Text size="B400" truncate>
|
||||
{text}
|
||||
@@ -141,7 +140,7 @@ export function ReadTextFile({ body, mimeType, url, encInfo, renderViewer }: Rea
|
||||
textState.status === AsyncStatus.Loading ? (
|
||||
<Spinner fill="Solid" size="100" variant="Secondary" />
|
||||
) : (
|
||||
<Icon size="100" src={Icons.ArrowRight} filled />
|
||||
sizedIcon(ArrowRight, '100', { filled: true })
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -225,7 +224,7 @@ export function ReadPdfFile({ body, mimeType, url, encInfo, renderViewer }: Read
|
||||
pdfState.status === AsyncStatus.Loading ? (
|
||||
<Spinner fill="Solid" size="100" variant="Secondary" />
|
||||
) : (
|
||||
<Icon size="100" src={Icons.ArrowRight} filled />
|
||||
sizedIcon(ArrowRight, '100', { filled: true })
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -281,7 +280,7 @@ export function DownloadFile({ body, mimeType, url, info, encInfo }: DownloadFil
|
||||
downloadState.status === AsyncStatus.Loading ? (
|
||||
<Spinner fill="Soft" size="100" variant="Secondary" />
|
||||
) : (
|
||||
<Icon size="100" src={Icons.Download} filled />
|
||||
sizedIcon(Download, '100', { filled: true })
|
||||
)
|
||||
}
|
||||
>
|
||||
|
||||
@@ -5,8 +5,6 @@ import {
|
||||
Box,
|
||||
Button,
|
||||
Chip,
|
||||
Icon,
|
||||
Icons,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Modal,
|
||||
@@ -21,6 +19,7 @@ import {
|
||||
config,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { Eye, EyeSlash, menuIcon, sizedIcon, Image, Warning } from '$components/icons/phosphor';
|
||||
import classNames from 'classnames';
|
||||
import { BlurhashCanvas } from 'react-blurhash';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
@@ -272,7 +271,7 @@ export const ImageContent = as<'div', ImageContentProps>(
|
||||
radii="300"
|
||||
size="300"
|
||||
onClick={loadSrc}
|
||||
before={<Icon size="Inherit" src={Icons.Photo} filled />}
|
||||
before={sizedIcon(Image, 'Inherit', { filled: true })}
|
||||
>
|
||||
<Text size="B300">View</Text>
|
||||
</Button>
|
||||
@@ -364,7 +363,7 @@ export const ImageContent = as<'div', ImageContentProps>(
|
||||
outlined
|
||||
radii="300"
|
||||
onClick={handleRetry}
|
||||
before={<Icon size="Inherit" src={Icons.Warning} filled />}
|
||||
before={sizedIcon(Warning, 'Inherit', { filled: true })}
|
||||
>
|
||||
<Text size="B300">Retry</Text>
|
||||
</Button>
|
||||
@@ -377,7 +376,7 @@ export const ImageContent = as<'div', ImageContentProps>(
|
||||
<Menu style={{ padding: config.space.S0 }}>
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="200" src={blurred ? Icons.Eye : Icons.EyeBlind} />}
|
||||
after={menuIcon(blurred ? Eye : EyeSlash)}
|
||||
radii="300"
|
||||
fill="Soft"
|
||||
variant="Secondary"
|
||||
|
||||
@@ -5,8 +5,6 @@ import {
|
||||
Box,
|
||||
Button,
|
||||
Chip,
|
||||
Icon,
|
||||
Icons,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Spinner,
|
||||
@@ -16,6 +14,7 @@ import {
|
||||
as,
|
||||
config,
|
||||
} from 'folds';
|
||||
import { Eye, EyeSlash, menuIcon, sizedIcon, Play, Warning } from '$components/icons/phosphor';
|
||||
import classNames from 'classnames';
|
||||
import { BlurhashCanvas } from 'react-blurhash';
|
||||
import type { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
|
||||
@@ -147,7 +146,7 @@ export const VideoContent = as<'div', VideoContentProps>(
|
||||
radii="300"
|
||||
size="300"
|
||||
onClick={loadSrc}
|
||||
before={<Icon size="Inherit" src={Icons.Play} filled />}
|
||||
before={sizedIcon(Play, 'Inherit', { filled: true })}
|
||||
>
|
||||
<Text size="B300">Watch</Text>
|
||||
</Button>
|
||||
@@ -229,7 +228,7 @@ export const VideoContent = as<'div', VideoContentProps>(
|
||||
outlined
|
||||
radii="300"
|
||||
onClick={handleRetry}
|
||||
before={<Icon size="Inherit" src={Icons.Warning} filled />}
|
||||
before={sizedIcon(Warning, 'Inherit', { filled: true })}
|
||||
>
|
||||
<Text size="B300">Retry</Text>
|
||||
</Button>
|
||||
@@ -242,7 +241,7 @@ export const VideoContent = as<'div', VideoContentProps>(
|
||||
<Menu style={{ padding: config.space.S0 }}>
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="200" src={blurred ? Icons.Eye : Icons.EyeBlind} />}
|
||||
after={menuIcon(blurred ? Eye : EyeSlash)}
|
||||
radii="300"
|
||||
fill="Soft"
|
||||
variant="Secondary"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export * from './layout';
|
||||
export * from './placeholder';
|
||||
export * from './Reaction';
|
||||
export * from './ReactionKeyInline';
|
||||
export * from './InlineTextDiff';
|
||||
export * from './attachment';
|
||||
export * from './Reply';
|
||||
export * from './content';
|
||||
|
||||
@@ -7,8 +7,6 @@ import {
|
||||
Dialog,
|
||||
Header,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
Text,
|
||||
Input,
|
||||
Button,
|
||||
@@ -17,6 +15,7 @@ import {
|
||||
config,
|
||||
color,
|
||||
} from 'folds';
|
||||
import { menuIcon, Trash, X } from '$components/icons/phosphor';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { modalAtom, ModalType } from '$state/modal';
|
||||
@@ -32,7 +31,7 @@ export function MessageDeleteItem({ room, mEvent }: { room: Room; mEvent: Matrix
|
||||
return (
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.Delete} />}
|
||||
after={menuIcon(Trash)}
|
||||
radii="300"
|
||||
fill="None"
|
||||
variant="Critical"
|
||||
@@ -115,7 +114,7 @@ export function MessageDeleteInternal({ room, mEvent, onClose }: MessageDeleteIn
|
||||
<Text size="H4">Delete Message</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onClose} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{menuIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { MouseEvent } from 'react';
|
||||
import type { Room, MatrixEvent } from '$types/matrix-sdk';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { MenuItem, Icon, Icons, Text } from 'folds';
|
||||
import { MenuItem, Text } from 'folds';
|
||||
import { Clock, menuIcon } from '$components/icons/phosphor';
|
||||
import { getEventEdits } from '$utils/room';
|
||||
import { modalAtom, ModalType } from '$state/modal';
|
||||
import * as css from '$features/room/message/styles.css';
|
||||
@@ -21,7 +22,7 @@ export function MessageEditHistoryItem({
|
||||
return (
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.Clock} />}
|
||||
after={menuIcon(Clock)}
|
||||
radii="300"
|
||||
onClick={(e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { modalAtom, ModalType } from '$state/modal';
|
||||
import { Icon, Icons, MenuItem, Text, as } from 'folds';
|
||||
import { MenuItem, Text, as } from 'folds';
|
||||
import { ArrowRight, menuIcon } from '$components/icons/phosphor';
|
||||
import { useAtomValue, useSetAtom } from 'jotai';
|
||||
import type { MatrixEvent, Room } from '$types/matrix-sdk';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { allRoomsAtom } from '$state/room-list/roomList';
|
||||
import { useAllJoinedRoomsSet, useGetRoom } from '$hooks/useGetRoom';
|
||||
import { factoryRoomIdByActivity } from '$utils/sort';
|
||||
@@ -14,6 +15,7 @@ import { sanitizeCustomHtml, sanitizeText } from '$utils/sanitize';
|
||||
import { createDebugLogger } from '$utils/debugLogger';
|
||||
import * as Sentry from '@sentry/react';
|
||||
import { isRoomPrivate } from '$utils/roomVisibility';
|
||||
import { canForwardEvent } from '$utils/room';
|
||||
import * as prefix from '$unstable/prefixes';
|
||||
import { RoomSearchModal } from '$features/search';
|
||||
const debugLog = createDebugLogger('MessageForward');
|
||||
@@ -23,6 +25,8 @@ export const MessageForwardItem = as<'button', MessageForwardItemProps>(
|
||||
({ room, mEvent, onClose, ...props }: MessageForwardItemProps) => {
|
||||
const setModal = useSetAtom(modalAtom);
|
||||
|
||||
if (!canForwardEvent(mEvent)) return null;
|
||||
|
||||
const handleClick = () => {
|
||||
setModal({
|
||||
type: ModalType.Forward,
|
||||
@@ -35,7 +39,7 @@ export const MessageForwardItem = as<'button', MessageForwardItemProps>(
|
||||
return (
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.ArrowRight} />}
|
||||
after={menuIcon(ArrowRight)}
|
||||
radii="300"
|
||||
{...props}
|
||||
onClick={handleClick}
|
||||
@@ -92,12 +96,17 @@ export function MessageForwardInternal({
|
||||
onClose,
|
||||
}: Readonly<MessageForwardInternalProps>) {
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const forwardable = canForwardEvent(mEvent);
|
||||
const [isForwarding, setIsForwarding] = useState(false);
|
||||
const [forwardError, setForwardError] = useState<string | null>(null);
|
||||
const allRooms = useAtomValue(allRoomsAtom);
|
||||
const allJoinedRooms = useAllJoinedRoomsSet();
|
||||
const getRoom = useGetRoom(allJoinedRooms);
|
||||
|
||||
useEffect(() => {
|
||||
if (!forwardable) onClose();
|
||||
}, [forwardable, onClose]);
|
||||
|
||||
// possible targets to forward the message to
|
||||
const forwardTargets = useMemo(
|
||||
() =>
|
||||
@@ -259,6 +268,8 @@ export function MessageForwardInternal({
|
||||
[forwardError, forwardTargets, forwardToRoom, isForwarding]
|
||||
);
|
||||
|
||||
if (!forwardable) return null;
|
||||
|
||||
return <RoomSearchModal requestClose={onClose} pickRoom={pickRoom} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { MouseEvent } from 'react';
|
||||
import type { Room, Relations } from '$types/matrix-sdk';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { Icon, Icons, Text, MenuItem } from 'folds';
|
||||
import { Text, MenuItem } from 'folds';
|
||||
import { menuIcon, Smiley } from '$components/icons/phosphor';
|
||||
import { modalAtom, ModalType } from '$state/modal';
|
||||
import * as css from '$features/room/message/styles.css';
|
||||
import { ReactionViewer } from '$features/room/reaction-viewer';
|
||||
@@ -12,7 +13,7 @@ export function MessageAllReactionItem({ room, relations }: { room: Room; relati
|
||||
return (
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.Smile} />}
|
||||
after={menuIcon(Smiley)}
|
||||
radii="300"
|
||||
onClick={(e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { MouseEvent } from 'react';
|
||||
import type { Room } from '$types/matrix-sdk';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { MenuItem, Icon, Icons, Text } from 'folds';
|
||||
import { MenuItem, Text } from 'folds';
|
||||
import { Checks, menuIcon } from '$components/icons/phosphor';
|
||||
import { modalAtom, ModalType } from '$state/modal';
|
||||
import { EventReaders } from '$components/event-readers';
|
||||
import * as css from '$features/room/message/styles.css';
|
||||
@@ -12,7 +13,7 @@ export function MessageReadReceiptItem({ room, eventId }: { room: Room; eventId:
|
||||
return (
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.CheckTwice} />}
|
||||
after={menuIcon(Checks)}
|
||||
radii="300"
|
||||
onClick={(e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -7,8 +7,6 @@ import {
|
||||
Dialog,
|
||||
Header,
|
||||
IconButton,
|
||||
Icon,
|
||||
Icons,
|
||||
Text,
|
||||
Input,
|
||||
Button,
|
||||
@@ -17,6 +15,7 @@ import {
|
||||
config,
|
||||
color,
|
||||
} from 'folds';
|
||||
import { menuIcon, Warning, X } from '$components/icons/phosphor';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import * as css from '$features/room/message/styles.css';
|
||||
@@ -34,7 +33,7 @@ export function MessageReportItem({ room, mEvent }: { room: Room; mEvent: Matrix
|
||||
size="300"
|
||||
variant="Critical"
|
||||
fill="None"
|
||||
after={<Icon size="100" src={Icons.Warning} />}
|
||||
after={menuIcon(Warning)}
|
||||
radii="300"
|
||||
onClick={(e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
@@ -114,7 +113,7 @@ export function MessageReportInternal({ room, mEvent, onClose }: MessageReportIn
|
||||
<Text size="H4">Report Message</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onClose} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{menuIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { MouseEvent } from 'react';
|
||||
import type { Room, MatrixEvent } from '$types/matrix-sdk';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { MenuItem, Icon, Icons, Text } from 'folds';
|
||||
import { MenuItem, Text } from 'folds';
|
||||
import { CodeBlock, menuIcon } from '$components/icons/phosphor';
|
||||
import { TextViewer } from '$components/text-viewer';
|
||||
import { getEventEdits } from '$utils/room';
|
||||
import { modalAtom, ModalType } from '$state/modal';
|
||||
@@ -13,7 +14,7 @@ export function MessageSourceCodeItem({ room, mEvent }: { room: Room; mEvent: Ma
|
||||
return (
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.BlockCode} />}
|
||||
after={menuIcon(CodeBlock)}
|
||||
radii="300"
|
||||
onClick={(e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useAtom } from 'jotai';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { Box, Icon, IconButton, Icons, Text } from 'folds';
|
||||
import { Box, IconButton, Text } from 'folds';
|
||||
import { sizedIcon, X } from '$components/icons/phosphor';
|
||||
import { createLogger } from '$utils/debug';
|
||||
import type { InAppBannerNotification } from '$state/sessions';
|
||||
import { inAppBannerAtom } from '$state/sessions';
|
||||
@@ -70,7 +71,7 @@ function BannerItem({ notification, onDismiss }: BannerItemProps) {
|
||||
dismissAnimTimerRef.current = setTimeout(() => onDismiss(notification.id), 200);
|
||||
}, [notification.id, onDismiss]);
|
||||
|
||||
// Auto-dismiss timer — only runs when not paused.
|
||||
// Auto-dismiss timer Eonly runs when not paused.
|
||||
useEffect(() => {
|
||||
if (paused) return undefined;
|
||||
const remaining = BANNER_DURATION_MS - elapsedRef.current;
|
||||
@@ -132,7 +133,7 @@ function BannerItem({ notification, onDismiss }: BannerItemProps) {
|
||||
{notification.senderName ?? notification.title}
|
||||
{(notification.roomName || notification.serverName) && (
|
||||
<span className={css.BannerSubtitle}>
|
||||
{' ('}
|
||||
{' ('}
|
||||
{notification.roomName && `#${notification.roomName}`}
|
||||
{notification.roomName && notification.serverName && ', '}
|
||||
{notification.serverName})
|
||||
@@ -157,7 +158,7 @@ function BannerItem({ notification, onDismiss }: BannerItemProps) {
|
||||
}}
|
||||
aria-label="Dismiss notification"
|
||||
>
|
||||
<Icon size="100" src={Icons.Cross} />
|
||||
{sizedIcon(X, '100')}
|
||||
</IconButton>
|
||||
</Box>
|
||||
<div
|
||||
@@ -226,7 +227,7 @@ export function NotificationBanner() {
|
||||
log.log('[Banner] Duplicate banner, skipping:', banner.id);
|
||||
return prev;
|
||||
}
|
||||
// Keep at most 3 visible at once — drop the oldest if over limit.
|
||||
// Keep at most 3 visible at once Edrop the oldest if over limit.
|
||||
const next = [...prev, banner];
|
||||
log.log('[Banner] Adding to queue, new length:', next.length);
|
||||
return next.length > 3 ? next.slice(next.length - 3) : next;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { ComponentProps } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { Icon, IconButton, Input, config, Icons } from 'folds';
|
||||
import { IconButton, Input, config } from 'folds';
|
||||
import { Eye, EyeSlash, sizedIcon } from '$components/icons/phosphor';
|
||||
import { UseStateProvider } from '$components/UseStateProvider';
|
||||
|
||||
type PasswordInputProps = Omit<ComponentProps<typeof Input>, 'type' | 'size'> & {
|
||||
@@ -30,11 +31,9 @@ export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
|
||||
size="300"
|
||||
radii="300"
|
||||
>
|
||||
<Icon
|
||||
style={{ opacity: config.opacity.P300 }}
|
||||
size="100"
|
||||
src={visible ? Icons.Eye : Icons.EyeBlind}
|
||||
/>
|
||||
{sizedIcon(visible ? Eye : EyeSlash, '100', {
|
||||
style: { opacity: config.opacity.P300 },
|
||||
})}
|
||||
</IconButton>
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { style } from '@vanilla-extract/css';
|
||||
import { color } from 'folds';
|
||||
import { style, styleVariants } from '@vanilla-extract/css';
|
||||
import { color, config } from 'folds';
|
||||
|
||||
export const RoomAvatar = style({
|
||||
backgroundColor: color.Secondary.Container,
|
||||
@@ -12,3 +12,62 @@ export const RoomAvatar = style({
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const RoomIconRoot = style({
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
lineHeight: 0,
|
||||
overflow: 'visible',
|
||||
});
|
||||
|
||||
export const RoomIconComposite = style({
|
||||
position: 'relative',
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
lineHeight: 0,
|
||||
flexShrink: 0,
|
||||
overflow: 'visible',
|
||||
});
|
||||
|
||||
export const RoomIconBadge = style({
|
||||
position: 'absolute',
|
||||
top: '-4%',
|
||||
right: '-4%',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
aspectRatio: '1',
|
||||
boxSizing: 'border-box',
|
||||
backgroundColor: color.Background.Container,
|
||||
lineHeight: 0,
|
||||
zIndex: 1,
|
||||
overflow: 'visible',
|
||||
pointerEvents: 'none',
|
||||
});
|
||||
|
||||
export const RoomIconBadgeShape = styleVariants({
|
||||
globe: {
|
||||
width: '62%',
|
||||
padding: 0,
|
||||
borderRadius: '50%',
|
||||
},
|
||||
lock: {
|
||||
width: '64%',
|
||||
padding: 0,
|
||||
borderTopLeftRadius: config.radii.R300,
|
||||
borderTopRightRadius: config.radii.R300,
|
||||
borderBottomLeftRadius: '20%',
|
||||
borderBottomRightRadius: '20%',
|
||||
},
|
||||
});
|
||||
|
||||
export const RoomIconBadgeIcon = style({
|
||||
display: 'flex',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
flexShrink: 0,
|
||||
});
|
||||
@@ -1,8 +1,16 @@
|
||||
import type { JoinRule } from '$types/matrix-sdk';
|
||||
import { AvatarFallback, Icon, Icons, color } from 'folds';
|
||||
import type { ComponentProps, ReactNode } from 'react';
|
||||
import { AvatarFallback, color } from 'folds';
|
||||
import type { ReactNode } from 'react';
|
||||
import { forwardRef, useEffect, useState } from 'react';
|
||||
import { getRoomIconSrc } from '$utils/room';
|
||||
import type { IconProps } from '@phosphor-icons/react';
|
||||
import classNames from 'classnames';
|
||||
import { sizedIcon, type IconSizeToken } from '$components/icons/phosphor';
|
||||
import {
|
||||
getRoomIconComponent,
|
||||
getRoomIconOverlay,
|
||||
getRoomIconOverlayComponent,
|
||||
getRoomStandaloneIconComponent,
|
||||
} from '$components/icons/roomIcons';
|
||||
import colorMXID from '$utils/colorMXID';
|
||||
import * as css from './RoomAvatar.css';
|
||||
import { AvatarImage } from './AvatarImage';
|
||||
@@ -39,11 +47,47 @@ export function RoomAvatar({ roomId, src, alt, renderFallback, uniformIcons }: R
|
||||
}
|
||||
|
||||
export const RoomIcon = forwardRef<
|
||||
SVGSVGElement,
|
||||
Omit<ComponentProps<typeof Icon>, 'src'> & {
|
||||
HTMLSpanElement,
|
||||
Omit<IconProps, 'ref'> & {
|
||||
joinRule?: JoinRule;
|
||||
roomType?: string;
|
||||
size?: IconSizeToken;
|
||||
filled?: boolean;
|
||||
withOverlay?: boolean;
|
||||
}
|
||||
>(({ joinRule, roomType, ...props }, ref) => (
|
||||
<Icon src={getRoomIconSrc(Icons, roomType, joinRule)} {...props} ref={ref} />
|
||||
));
|
||||
>(
|
||||
(
|
||||
{ joinRule, roomType, size = '200', filled, withOverlay = true, className, style, ...props },
|
||||
ref
|
||||
) => {
|
||||
const Icon = withOverlay
|
||||
? getRoomIconComponent(roomType, joinRule)
|
||||
: getRoomStandaloneIconComponent(roomType, joinRule);
|
||||
const overlay = withOverlay ? getRoomIconOverlay(roomType, joinRule) : undefined;
|
||||
|
||||
if (overlay) {
|
||||
const OverlayIcon = getRoomIconOverlayComponent(overlay);
|
||||
return (
|
||||
<span ref={ref} className={classNames(css.RoomIconRoot, className)} style={style}>
|
||||
<span className={css.RoomIconComposite}>
|
||||
{sizedIcon(Icon, size, { ...props, filled })}
|
||||
<span
|
||||
className={classNames(css.RoomIconBadge, css.RoomIconBadgeShape[overlay])}
|
||||
aria-hidden
|
||||
>
|
||||
<span className={css.RoomIconBadgeIcon}>
|
||||
<OverlayIcon size="100%" weight="regular" color={props.color} />
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<span ref={ref} className={classNames(css.RoomIconRoot, className)} style={style}>
|
||||
{sizedIcon(Icon, size, { ...props, filled })}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -8,8 +8,6 @@ import {
|
||||
Box,
|
||||
Button,
|
||||
Dialog,
|
||||
Icon,
|
||||
Icons,
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
OverlayCenter,
|
||||
@@ -22,6 +20,7 @@ import {
|
||||
} from 'folds';
|
||||
import classNames from 'classnames';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { userFallbackIcon } from '$components/icons/phosphor';
|
||||
import { getMxIdLocalPart, mxcUrlToHttp } from '$utils/matrix';
|
||||
import { nameInitials } from '$utils/common';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
@@ -284,7 +283,7 @@ export const RoomCard = as<'div', RoomCardProps>(
|
||||
</Box>
|
||||
{typeof joinedMemberCount === 'number' && (
|
||||
<Box gap="100">
|
||||
<Icon size="50" src={Icons.User} />
|
||||
{userFallbackIcon('sm')}
|
||||
<Text size="T200">{`${formatCompactNumber(joinedMemberCount)} Members`}</Text>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Avatar, Box, Button, Icon, Icons, Spinner, Text, as } from 'folds';
|
||||
import { Avatar, Box, Button, Spinner, Text, as } from 'folds';
|
||||
import type { Room } from '$types/matrix-sdk';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import type { IRoomCreateContent } from '$types/matrix/room';
|
||||
@@ -20,6 +20,7 @@ import { settingsAtom } from '$state/settings';
|
||||
import { RoomAvatar } from '$components/room-avatar';
|
||||
import { InviteUserPrompt } from '$components/invite-user-prompt';
|
||||
import { InfoCard } from '$components/info-card';
|
||||
import { userFallbackIcon } from '$components/icons/phosphor';
|
||||
import { DirectInvitePrompt } from '$components/direct-invite-prompt';
|
||||
import { EventType, KnownMembership } from '$types/matrix-sdk';
|
||||
|
||||
@@ -117,7 +118,7 @@ export const RoomIntro = as<'div', RoomIntroProps>(({ room, ...props }, ref) =>
|
||||
{isDirectConversation && (
|
||||
<InfoCard
|
||||
variant="Primary"
|
||||
before={<Icon size="100" src={Icons.User} />}
|
||||
before={userFallbackIcon('md')}
|
||||
beforeAlign="Center"
|
||||
description="This is a direct message"
|
||||
after={
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { as, Box, Header, Icon, IconButton, Icons, Modal, Scroll, Text } from 'folds';
|
||||
import { as, Box, Header, IconButton, Modal, Scroll, Text } from 'folds';
|
||||
import { composerIcon, X } from '$components/icons/phosphor';
|
||||
import classNames from 'classnames';
|
||||
import Linkify from 'linkify-react';
|
||||
import { LINKIFY_OPTS, scaleSystemEmoji } from '$plugins/react-custom-html-parser';
|
||||
@@ -26,7 +27,7 @@ export const RoomTopicViewer = as<
|
||||
</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={requestClose} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Scroll data-room-topic className={css.ModalScroll} size="300" hideTrack>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import type { RectCords } from 'folds';
|
||||
import { Box, Button, config, Icon, Icons, Menu, MenuItem, PopOut, Spinner, Text } from 'folds';
|
||||
import { Box, Button, config, Menu, MenuItem, PopOut, Spinner, Text } from 'folds';
|
||||
import { CaretDown, sizedIcon } from '$components/icons/phosphor';
|
||||
import {
|
||||
type ComponentPropsWithoutRef,
|
||||
type MouseEventHandler,
|
||||
@@ -96,13 +97,7 @@ export function SettingMenuSelector<T extends string>({
|
||||
outlined
|
||||
fill="Soft"
|
||||
radii="300"
|
||||
after={
|
||||
loading ? (
|
||||
<Spinner variant="Secondary" size="300" />
|
||||
) : (
|
||||
<Icon size="300" src={Icons.ChevronBottom} />
|
||||
)
|
||||
}
|
||||
after={loading ? <Spinner variant="Secondary" size="300" /> : sizedIcon(CaretDown, '300')}
|
||||
onClick={handleOpenMenu}
|
||||
disabled={isDisabled}
|
||||
>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Box, Icon, IconButton, Icons, Text } from 'folds';
|
||||
import { Box, IconButton, Text } from 'folds';
|
||||
import { Check, Link, sizedIcon } from '$components/icons/phosphor';
|
||||
import { BreakWord } from '$styles/Text.css';
|
||||
import { buildSettingsLink } from '$features/settings/settingsLink';
|
||||
import { copyToClipboard } from '$utils/dom';
|
||||
@@ -58,7 +59,7 @@ function SettingTileSettingLinkAction({
|
||||
fill="None"
|
||||
radii="Inherit"
|
||||
>
|
||||
<Icon src={copied ? Icons.Check : Icons.Link} size="50" />
|
||||
{sizedIcon(copied ? Check : Link, '50')}
|
||||
</IconButton>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { Box, Button, Icon, Icons, Text } from 'folds';
|
||||
import { Box, Button, Text } from 'folds';
|
||||
import { Shield, sizedIcon } from '$components/icons/phosphor';
|
||||
import * as css from './TelemetryConsentBanner.css';
|
||||
|
||||
const SENTRY_KEY = 'sable_sentry_enabled';
|
||||
@@ -41,7 +42,7 @@ export function TelemetryConsentBanner() {
|
||||
aria-label="Crash reporting prompt"
|
||||
>
|
||||
<div className={css.Header}>
|
||||
<Icon src={Icons.Shield} size="400" />
|
||||
{sizedIcon(Shield, '400')}
|
||||
<div className={css.HeaderText}>
|
||||
<Text size="H4">Help improve Sable</Text>
|
||||
<Text size="T300" priority="300">
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { ComponentProps, HTMLAttributes } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { Box, Chip, Header, Icon, IconButton, Icons, Scroll, Text, as } from 'folds';
|
||||
import { Box, Chip, Header, IconButton, Scroll, Text, as } from 'folds';
|
||||
import { ArrowLeft, sizedIcon } from '$components/icons/phosphor';
|
||||
import { CodeHighlightRenderer } from '$components/code-highlight';
|
||||
import { copyToClipboard } from '$utils/dom';
|
||||
import * as css from './TextViewer.css';
|
||||
@@ -48,7 +49,7 @@ export const TextViewer = as<'div', TextViewerProps>(
|
||||
<Header className={css.TextViewerHeader} size="400">
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<IconButton size="300" radii="300" onClick={requestClose}>
|
||||
<Icon size="50" src={Icons.ArrowLeft} />
|
||||
{sizedIcon(ArrowLeft, '50')}
|
||||
</IconButton>
|
||||
<Text size="T300" truncate>
|
||||
{name}
|
||||
|
||||
@@ -6,14 +6,13 @@ import {
|
||||
config,
|
||||
Dialog,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
OverlayCenter,
|
||||
Text,
|
||||
} from 'folds';
|
||||
import { sizedIcon, X } from '$components/icons/phosphor';
|
||||
import { useStore } from 'jotai/react';
|
||||
|
||||
import { useOptionalClientConfig } from '$hooks/useClientConfig';
|
||||
@@ -116,7 +115,7 @@ export function ThemeMigrationBanner() {
|
||||
disabled={busy}
|
||||
aria-label="Close"
|
||||
>
|
||||
<Icon src={Icons.Cross} size="100" />
|
||||
{sizedIcon(X, '100')}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box style={{ padding: config.space.S400 }} direction="Column" gap="400">
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
import { type ReactNode, useCallback, useMemo } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Text,
|
||||
Tooltip,
|
||||
TooltipProvider,
|
||||
toRem,
|
||||
config,
|
||||
} from 'folds';
|
||||
import { Box, Button, IconButton, Text, Tooltip, TooltipProvider, toRem, config } from 'folds';
|
||||
import { Check, Download, Link, Star, Warning, sizedIcon } from '$components/icons/phosphor';
|
||||
|
||||
import { useTimeoutToggle } from '$hooks/useTimeoutToggle';
|
||||
import { copyToClipboard } from '$utils/dom';
|
||||
@@ -109,14 +99,17 @@ export function ThemePreviewCard({
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<Icon
|
||||
<span
|
||||
ref={triggerRef}
|
||||
src={Icons.Warning}
|
||||
size="100"
|
||||
filled
|
||||
style={{ color: 'var(--sable-warn-on-container)', flexShrink: 0 }}
|
||||
aria-label="Third-party theme"
|
||||
/>
|
||||
style={{
|
||||
color: 'var(--sable-warn-on-container)',
|
||||
flexShrink: 0,
|
||||
display: 'inline-flex',
|
||||
}}
|
||||
>
|
||||
{sizedIcon(Warning, '100', { filled: true })}
|
||||
</span>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
)}
|
||||
@@ -141,7 +134,7 @@ export function ThemePreviewCard({
|
||||
handleCopy().catch(() => undefined);
|
||||
}}
|
||||
>
|
||||
<Icon size="200" src={copied ? Icons.Check : Icons.Link} />
|
||||
{sizedIcon(copied ? Check : Link, '200')}
|
||||
</IconButton>
|
||||
)}
|
||||
|
||||
@@ -157,7 +150,7 @@ export function ThemePreviewCard({
|
||||
onExport();
|
||||
}}
|
||||
>
|
||||
<Icon size="200" src={Icons.Download} />
|
||||
{sizedIcon(Download, '200')}
|
||||
</IconButton>
|
||||
)}
|
||||
|
||||
@@ -173,7 +166,7 @@ export function ThemePreviewCard({
|
||||
Promise.resolve(onToggleFavorite()).catch(() => undefined);
|
||||
}}
|
||||
>
|
||||
<Icon size="200" src={Icons.Star} filled={isFavorited} />
|
||||
{sizedIcon(Star, '200', { filled: isFavorited })}
|
||||
</IconButton>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Box, Button, color, config, Dialog, Header, Icon, IconButton, Icons, Text } from 'folds';
|
||||
import { Box, Button, color, config, Dialog, Header, IconButton, Text } from 'folds';
|
||||
import { Warning, composerIcon, sizedIcon, X } from '$components/icons/phosphor';
|
||||
import type { FormEventHandler } from 'react';
|
||||
import { AuthType } from '$types/matrix-sdk';
|
||||
import { PasswordInput } from '$components/password-input';
|
||||
@@ -46,7 +47,7 @@ export function PasswordStage({
|
||||
<Text size="H4">Account Password</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box
|
||||
@@ -66,7 +67,7 @@ export function PasswordStage({
|
||||
<PasswordInput size="400" name="passwordInput" outlined autoFocus required />
|
||||
{errorCode && (
|
||||
<Box alignItems="Center" gap="100" style={{ color: color.Critical.Main }}>
|
||||
<Icon size="50" src={Icons.Warning} filled />
|
||||
{sizedIcon(Warning, '50', { filled: true })}
|
||||
<Text size="T200">
|
||||
<b>
|
||||
{errorCode === (ErrorCode.M_FORBIDDEN as string)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Box, Button, color, config, Dialog, Header, Icon, IconButton, Icons, Text } from 'folds';
|
||||
import { Box, Button, color, config, Dialog, Header, IconButton, Text } from 'folds';
|
||||
import { Warning, composerIcon, sizedIcon, X } from '$components/icons/phosphor';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import type { StageComponentProps } from './types';
|
||||
|
||||
@@ -57,7 +58,7 @@ export function SSOStage({
|
||||
<Text size="H4">SSO Login</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box
|
||||
@@ -70,7 +71,7 @@ export function SSOStage({
|
||||
</Text>
|
||||
{errorCode && (
|
||||
<Box alignItems="Center" gap="100" style={{ color: color.Critical.Main }}>
|
||||
<Icon size="50" src={Icons.Warning} filled />
|
||||
{sizedIcon(Warning, '50', { filled: true })}
|
||||
<Text size="T200">
|
||||
<b>{`${errorCode}: ${error}`}</b>
|
||||
</Text>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { MutableRefObject, ReactNode } from 'react';
|
||||
import { useImperativeHandle, useRef } from 'react';
|
||||
import { Badge, Box, Chip, Header, Icon, Icons, Spinner, Text, as, percent } from 'folds';
|
||||
import { Badge, Box, Chip, Header, Spinner, Text, as, percent } from 'folds';
|
||||
import { CaretRight, CaretUp, PaperPlaneTilt, X, sizedIcon } from '$components/icons/phosphor';
|
||||
import classNames from 'classnames';
|
||||
import { useAtomValue } from 'jotai';
|
||||
|
||||
@@ -87,7 +88,7 @@ export function UploadBoardHeader({
|
||||
grow="Yes"
|
||||
gap="100"
|
||||
>
|
||||
<Icon src={open ? Icons.ChevronTop : Icons.ChevronRight} size="50" />
|
||||
{sizedIcon(open ? CaretUp : CaretRight, '50')}
|
||||
<Text size="H6">Files</Text>
|
||||
</Box>
|
||||
<Box className={css.UploadBoardHeaderContent} alignItems="Center" gap="100">
|
||||
@@ -98,7 +99,7 @@ export function UploadBoardHeader({
|
||||
variant="Primary"
|
||||
radii="Pill"
|
||||
outlined
|
||||
after={<Icon src={Icons.Send} size="50" filled />}
|
||||
after={sizedIcon(PaperPlaneTilt, '50', { filled: true })}
|
||||
>
|
||||
<Text size="B300">Send</Text>
|
||||
</Chip>
|
||||
@@ -122,7 +123,7 @@ export function UploadBoardHeader({
|
||||
onClick={handleCancel}
|
||||
variant="SurfaceVariant"
|
||||
radii="Pill"
|
||||
after={<Icon src={Icons.Cross} size="50" />}
|
||||
after={sizedIcon(X, '50')}
|
||||
>
|
||||
<Text size="B300">{uploads.length === 1 ? 'Remove' : 'Remove All'}</Text>
|
||||
</Chip>
|
||||
|
||||
@@ -1,13 +1,31 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Chip, Icon, IconButton, Icons, Text, color } from 'folds';
|
||||
import { Chip, IconButton, Text, color } from 'folds';
|
||||
import {
|
||||
Check,
|
||||
File,
|
||||
Image,
|
||||
Play,
|
||||
VideoCamera,
|
||||
X,
|
||||
sizedIcon,
|
||||
type PhosphorIcon,
|
||||
} from '$components/icons/phosphor';
|
||||
import type { TUploadAtom, UploadSuccess } from '$state/upload';
|
||||
import { UploadStatus, useBindUploadAtom } from '$state/upload';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import type { TUploadContent } from '$utils/matrix';
|
||||
import { bytesToSize, getFileTypeIcon } from '$utils/common';
|
||||
import { bytesToSize } from '$utils/common';
|
||||
import { useMediaConfig } from '$hooks/useMediaConfig';
|
||||
import { UploadCard, UploadCardError, CompactUploadCardProgress } from './UploadCard';
|
||||
|
||||
function getFileTypeIconComponent(fileType: string): PhosphorIcon {
|
||||
const type = fileType.toLowerCase();
|
||||
if (type.startsWith('audio')) return Play;
|
||||
if (type.startsWith('video')) return VideoCamera;
|
||||
if (type.startsWith('image')) return Image;
|
||||
return File;
|
||||
}
|
||||
|
||||
type CompactUploadCardRendererProps = {
|
||||
isEncrypted?: boolean;
|
||||
uploadAtom: TUploadAtom;
|
||||
@@ -48,7 +66,7 @@ export function CompactUploadCardRenderer({
|
||||
compact
|
||||
outlined
|
||||
radii="300"
|
||||
before={<Icon src={getFileTypeIcon(Icons, file.type)} />}
|
||||
before={sizedIcon(getFileTypeIconComponent(file.type))}
|
||||
after={
|
||||
<>
|
||||
{upload.status === UploadStatus.Error && (
|
||||
@@ -70,7 +88,7 @@ export function CompactUploadCardRenderer({
|
||||
radii="Pill"
|
||||
size="300"
|
||||
>
|
||||
<Icon src={Icons.Cross} size="200" />
|
||||
{sizedIcon(X, '200')}
|
||||
</IconButton>
|
||||
</>
|
||||
}
|
||||
@@ -80,7 +98,7 @@ export function CompactUploadCardRenderer({
|
||||
<Text size="H6" truncate>
|
||||
{file.name}
|
||||
</Text>
|
||||
<Icon style={{ color: color.Success.Main }} src={Icons.Check} size="100" />
|
||||
{sizedIcon(Check, '100', { style: { color: color.Success.Main } })}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Badge, Box, Icon, Icons, ProgressBar, Text, percent } from 'folds';
|
||||
import { Badge, Box, ProgressBar, Text, percent } from 'folds';
|
||||
import { Warning, sizedIcon } from '$components/icons/phosphor';
|
||||
import type { ReactNode } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
@@ -80,7 +81,7 @@ type UploadCardErrorProps = {
|
||||
export function UploadCardError({ children }: UploadCardErrorProps) {
|
||||
return (
|
||||
<Box className={css.UploadCardError} alignItems="Center" gap="300">
|
||||
<Icon src={Icons.Warning} size="50" />
|
||||
{sizedIcon(Warning, '50')}
|
||||
{children}
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -3,9 +3,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Chip,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Scroll,
|
||||
Text,
|
||||
Tooltip,
|
||||
@@ -14,6 +12,18 @@ import {
|
||||
config,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import {
|
||||
Check,
|
||||
EyeSlash,
|
||||
File,
|
||||
Image,
|
||||
Info,
|
||||
PencilSimple,
|
||||
VideoCamera,
|
||||
X,
|
||||
sizedIcon,
|
||||
type PhosphorIcon,
|
||||
} from '$components/icons/phosphor';
|
||||
import type { HTMLReactParserOptions } from 'html-react-parser';
|
||||
import { Play, Pause } from '@phosphor-icons/react';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
@@ -25,7 +35,7 @@ import type { UploadSuccess } from '$state/upload';
|
||||
import { UploadStatus, useBindUploadAtom } from '$state/upload';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import type { TUploadContent } from '$utils/matrix';
|
||||
import { bytesToSize, getFileTypeIcon } from '$utils/common';
|
||||
import { bytesToSize } from '$utils/common';
|
||||
import type { TUploadItem, TUploadMetadata } from '$state/room/roomInputDrafts';
|
||||
import { roomUploadAtomFamily } from '$state/room/roomInputDrafts';
|
||||
import { useObjectURL } from '$hooks/useObjectURL';
|
||||
@@ -37,6 +47,14 @@ import { UploadCard, UploadCardError, UploadCardProgress } from './UploadCard';
|
||||
import * as css from './UploadCard.css';
|
||||
import { DescriptionEditor } from './UploadDescriptionEditor';
|
||||
|
||||
function getFileTypeIconComponent(fileType: string): PhosphorIcon {
|
||||
const type = fileType.toLowerCase();
|
||||
if (type.startsWith('audio')) return Play;
|
||||
if (type.startsWith('video')) return VideoCamera;
|
||||
if (type.startsWith('image')) return Image;
|
||||
return File;
|
||||
}
|
||||
|
||||
type PreviewImageProps = {
|
||||
fileItem: TUploadItem;
|
||||
};
|
||||
@@ -207,7 +225,7 @@ function PreviewAudio({ fileItem }: PreviewAudioProps) {
|
||||
setCurrentTime(targetTime);
|
||||
} else {
|
||||
// Metadata not yet loaded (Firefox, first scrub before load() resolves).
|
||||
// Do NOT call load() again here — that resets currentTime to 0 and
|
||||
// Do NOT call load() again here Ethat resets currentTime to 0 and
|
||||
// restarts the fetch. load() was already called in the useEffect;
|
||||
// just wait for the in-flight loadedmetadata event.
|
||||
el.addEventListener(
|
||||
@@ -336,7 +354,7 @@ function MediaPreview({ fileItem, onSpoiler, children }: MediaPreviewProps) {
|
||||
fill="Soft"
|
||||
radii="Pill"
|
||||
aria-pressed={metadata.markedAsSpoiler}
|
||||
before={<Icon src={Icons.EyeBlind} size="50" />}
|
||||
before={sizedIcon(EyeSlash, '50')}
|
||||
onClick={() => onSpoiler(!metadata.markedAsSpoiler)}
|
||||
>
|
||||
<Text size="B300">Spoiler</Text>
|
||||
@@ -429,7 +447,7 @@ export function UploadCardRenderer({
|
||||
return (
|
||||
<UploadCard
|
||||
radii="300"
|
||||
before={<Icon src={getFileTypeIcon(Icons, file.type)} />}
|
||||
before={sizedIcon(getFileTypeIconComponent(file.type))}
|
||||
after={
|
||||
<>
|
||||
{upload.status === UploadStatus.Error && (
|
||||
@@ -454,7 +472,7 @@ export function UploadCardRenderer({
|
||||
radii="Pill"
|
||||
size="300"
|
||||
>
|
||||
<Icon src={Icons.Pencil} size="50" />
|
||||
{sizedIcon(PencilSimple, '50')}
|
||||
</IconButton>
|
||||
)}
|
||||
{isDescribed && (
|
||||
@@ -470,7 +488,7 @@ export function UploadCardRenderer({
|
||||
</Tooltip>
|
||||
}
|
||||
>
|
||||
{(triggerRef) => <Icon ref={triggerRef} src={Icons.Info} size="50" />}
|
||||
{(triggerRef) => <span ref={triggerRef}>{sizedIcon(Info, '50')}</span>}
|
||||
</TooltipProvider>
|
||||
)}
|
||||
|
||||
@@ -481,7 +499,7 @@ export function UploadCardRenderer({
|
||||
radii="Pill"
|
||||
size="300"
|
||||
>
|
||||
<Icon src={Icons.Cross} size="200" />
|
||||
{sizedIcon(X, '200')}
|
||||
</IconButton>
|
||||
</>
|
||||
}
|
||||
@@ -561,9 +579,8 @@ export function UploadCardRenderer({
|
||||
<Text size="H6" truncate>
|
||||
{file.name}
|
||||
</Text>
|
||||
{upload.status === UploadStatus.Success && (
|
||||
<Icon style={{ color: color.Success.Main }} src={Icons.Check} size="100" />
|
||||
)}
|
||||
{upload.status === UploadStatus.Success &&
|
||||
sizedIcon(Check, '100', { style: { color: color.Success.Main } })}
|
||||
</UploadCard>
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,8 @@ import type { KeyboardEventHandler } from 'react';
|
||||
import { useCallback, useEffect, useState, useRef } from 'react';
|
||||
import type { Room } from '$types/matrix-sdk';
|
||||
import type { RectCords } from 'folds';
|
||||
import { Box, Chip, Icon, IconButton, Icons, PopOut, Spinner, Text, config } from 'folds';
|
||||
import { Box, Chip, IconButton, PopOut, Spinner, Text, config } from 'folds';
|
||||
import { Smiley, sizedIcon } from '$components/icons/phosphor';
|
||||
import { Editor, Transforms } from 'slate';
|
||||
import { ReactEditor } from 'slate-react';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
@@ -229,7 +230,7 @@ export function DescriptionEditor({
|
||||
radii="300"
|
||||
onClick={(evt) => setAnchor(evt.currentTarget.getBoundingClientRect())}
|
||||
>
|
||||
<Icon size="400" src={Icons.Smile} filled={anchor !== undefined} />
|
||||
{sizedIcon(Smiley, '400', { filled: anchor !== undefined })}
|
||||
</IconButton>
|
||||
</PopOut>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Box, Badge, Icon, IconButton, Icons, Spinner, Text, as, toRem } from 'folds';
|
||||
import { Box, Badge, IconButton, Spinner, Text, as, toRem } from 'folds';
|
||||
import { Link, sizedIcon } from '$components/icons/phosphor';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useSetting } from '$state/hooks/settings';
|
||||
import { settingsAtom } from '$state/settings';
|
||||
@@ -66,7 +67,7 @@ type EmbedOpenButtonProps = {
|
||||
export function EmbedOpenButton({ url }: EmbedOpenButtonProps) {
|
||||
return (
|
||||
<IconButton size="300" radii="300" onClick={() => window.open(url, '_blank')}>
|
||||
<Icon size="100" src={Icons.Link} />
|
||||
{sizedIcon(Link, '100')}
|
||||
</IconButton>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Box, Icon, Icons, Text, toRem, config } from 'folds';
|
||||
import { Box, Text, toRem, config } from 'folds';
|
||||
import { Warning, sizedIcon } from '$components/icons/phosphor';
|
||||
|
||||
type ThemeThirdPartyBannerProps = {
|
||||
hostLabel: string;
|
||||
@@ -26,7 +27,7 @@ export function ThemeThirdPartyBanner({ hostLabel, kind = 'theme' }: ThemeThirdP
|
||||
}}
|
||||
>
|
||||
<Box direction="Row" gap="200" alignItems="Start">
|
||||
<Icon src={Icons.Warning} size="100" filled />
|
||||
{sizedIcon(Warning, '100', { filled: true })}
|
||||
<Box direction="Column" gap="100" grow="Yes" style={{ minWidth: 0 }}>
|
||||
<Text size="T300" style={{ fontWeight: 600 }}>
|
||||
{title}
|
||||
|
||||
@@ -2,9 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import {
|
||||
Box,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Spinner,
|
||||
Switch,
|
||||
Text,
|
||||
@@ -13,6 +11,7 @@ import {
|
||||
config,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { Check, Link, Star, Warning, sizedIcon } from '$components/icons/phosphor';
|
||||
|
||||
import { useClientConfig } from '$hooks/useClientConfig';
|
||||
import { useTimeoutToggle } from '$hooks/useTimeoutToggle';
|
||||
@@ -285,14 +284,17 @@ export function TweakPreviewUrlCard({ url }: { url: string }) {
|
||||
}
|
||||
>
|
||||
{(triggerRef) => (
|
||||
<Icon
|
||||
<span
|
||||
ref={triggerRef}
|
||||
src={Icons.Warning}
|
||||
size="100"
|
||||
filled
|
||||
style={{ color: 'var(--sable-warn-on-container)', flexShrink: 0 }}
|
||||
aria-label="Third-party tweak"
|
||||
/>
|
||||
style={{
|
||||
color: 'var(--sable-warn-on-container)',
|
||||
flexShrink: 0,
|
||||
display: 'inline-flex',
|
||||
}}
|
||||
>
|
||||
{sizedIcon(Warning, '100', { filled: true })}
|
||||
</span>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
)}
|
||||
@@ -319,7 +321,7 @@ export function TweakPreviewUrlCard({ url }: { url: string }) {
|
||||
handleCopy().catch(() => undefined);
|
||||
}}
|
||||
>
|
||||
<Icon size="200" src={copied ? Icons.Check : Icons.Link} />
|
||||
{sizedIcon(copied ? Check : Link, '200')}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
size="300"
|
||||
@@ -332,7 +334,7 @@ export function TweakPreviewUrlCard({ url }: { url: string }) {
|
||||
toggleFavorite().catch(() => undefined);
|
||||
}}
|
||||
>
|
||||
<Icon size="200" src={Icons.Star} filled={isFav} />
|
||||
{sizedIcon(Star, '200', { filled: isFav })}
|
||||
</IconButton>
|
||||
<Switch
|
||||
variant="Primary"
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import type { MatrixClient } from '$types/matrix-sdk';
|
||||
import type { IPreviewUrlResponse } from '$types/matrix-sdk';
|
||||
import {
|
||||
Box,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Scroll,
|
||||
Spinner,
|
||||
Text,
|
||||
as,
|
||||
color,
|
||||
config,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { Box, IconButton, Scroll, Spinner, Text, as, color, config, toRem } from 'folds';
|
||||
import { ArrowLeft, ArrowRight, sizedIcon } from '$components/icons/phosphor';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { mxcUrlToHttp, downloadMedia } from '$utils/matrix';
|
||||
@@ -35,7 +24,7 @@ const linkStyles = { color: color.Success.Main };
|
||||
// Module-level in-flight deduplication: prevents N+1 concurrent requests when a
|
||||
// large event batch renders many UrlPreviewCard instances for the same URL.
|
||||
// Scoped by MatrixClient to avoid cross-account dedup if multiple clients exist.
|
||||
// Inner cache keyed by URL only (not ts) — the same URL shows the same preview
|
||||
// Inner cache keyed by URL only (not ts) †Ethe same URL shows the same preview
|
||||
// regardless of which message referenced it. Promises are evicted after settling
|
||||
// so a later render can retry after network recovery.
|
||||
const previewRequestCache = new WeakMap<MatrixClient, Map<string, Promise<IPreviewUrlResponse>>>();
|
||||
@@ -461,7 +450,7 @@ export const UrlPreviewHolder = as<'div'>(({ children, ...props }, ref) => {
|
||||
outlined
|
||||
onClick={handleScrollBack}
|
||||
>
|
||||
<Icon size="300" src={Icons.ArrowLeft} />
|
||||
{sizedIcon(ArrowLeft, '300')}
|
||||
</IconButton>
|
||||
</>
|
||||
)}
|
||||
@@ -486,7 +475,7 @@ export const UrlPreviewHolder = as<'div'>(({ children, ...props }, ref) => {
|
||||
outlined
|
||||
onClick={handleScrollFront}
|
||||
>
|
||||
<Icon size="300" src={Icons.ArrowRight} />
|
||||
{sizedIcon(ArrowRight, '300')}
|
||||
</IconButton>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { RectCords } from 'folds';
|
||||
import { Chip, config, Icon, Icons, Menu, MenuItem, PopOut, Text } from 'folds';
|
||||
import { Chip, config, Menu, MenuItem, PopOut, Text } from 'folds';
|
||||
import { CaretDown, profileIcon } from '$components/icons/phosphor';
|
||||
import type { CSSProperties } from 'react';
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useState } from 'react';
|
||||
@@ -106,13 +107,7 @@ export function CreatorChip({
|
||||
variant={cardColor ? undefined : 'Success'}
|
||||
outlined={!cardColor}
|
||||
radii="Pill"
|
||||
before={
|
||||
cords ? (
|
||||
<Icon size="50" src={Icons.ChevronBottom} />
|
||||
) : (
|
||||
<PowerColorBadge color={tag.color} />
|
||||
)
|
||||
}
|
||||
before={cords ? profileIcon(CaretDown) : <PowerColorBadge color={tag.color} />}
|
||||
after={tagIconSrc ? <PowerIcon size="50" iconSrc={tagIconSrc} /> : undefined}
|
||||
onClick={open}
|
||||
aria-pressed={!!cords}
|
||||
|
||||
@@ -6,9 +6,7 @@ import {
|
||||
config,
|
||||
Dialog,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Line,
|
||||
Menu,
|
||||
MenuItem,
|
||||
@@ -20,6 +18,7 @@ import {
|
||||
Text,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { CaretDown, menuIcon, profileIcon, X } from '$components/icons/phosphor';
|
||||
import type { CSSProperties } from 'react';
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
@@ -76,7 +75,7 @@ function SelfDemoteAlert({ power, onCancel, onChange }: SelfDemoteAlertProps) {
|
||||
<Text size="H4">Self Demotion</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{menuIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box style={{ padding: config.space.S400, paddingTop: 0 }} direction="Column" gap="500">
|
||||
@@ -126,7 +125,7 @@ function SharedPowerAlert({ power, onCancel, onChange }: SharedPowerAlertProps)
|
||||
<Text size="H4">Shared Power</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
{menuIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Box style={{ padding: config.space.S400, paddingTop: 0 }} direction="Column" gap="500">
|
||||
@@ -368,7 +367,7 @@ export function PowerChip({
|
||||
}
|
||||
before={
|
||||
cords ? (
|
||||
<Icon size="50" src={Icons.ChevronBottom} />
|
||||
profileIcon(CaretDown)
|
||||
) : (
|
||||
<>
|
||||
{!changing && <PowerColorBadge color={tag.color} />}
|
||||
|
||||
@@ -14,14 +14,22 @@ import {
|
||||
Text,
|
||||
Line,
|
||||
Chip,
|
||||
Icon,
|
||||
Icons,
|
||||
Spinner,
|
||||
toRem,
|
||||
Box,
|
||||
Scroll,
|
||||
Avatar,
|
||||
} from 'folds';
|
||||
import {
|
||||
CaretDown,
|
||||
Check,
|
||||
DotsThree,
|
||||
HardDrives,
|
||||
Link,
|
||||
PencilSimple,
|
||||
profileIcon,
|
||||
Prohibit,
|
||||
} from '$components/icons/phosphor';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { getMxIdServer } from '$utils/mxIdHelper';
|
||||
import { useCloseUserRoomProfile } from '$state/hooks/userRoomProfile';
|
||||
@@ -187,13 +195,7 @@ export function ServerChip({
|
||||
<Chip
|
||||
variant={cardColor ? undefined : myServer === server ? 'SurfaceVariant' : 'Warning'}
|
||||
radii="Pill"
|
||||
before={
|
||||
cords ? (
|
||||
<Icon size="50" src={Icons.ChevronBottom} />
|
||||
) : (
|
||||
<Icon size="50" src={copied ? Icons.Check : Icons.Server} />
|
||||
)
|
||||
}
|
||||
before={cords ? profileIcon(CaretDown) : profileIcon(copied ? Check : HardDrives)}
|
||||
onClick={open}
|
||||
aria-pressed={!!cords}
|
||||
className={cardColor ? css.UserHeroChipThemed : css.UserHeroBrightnessHover}
|
||||
@@ -307,13 +309,7 @@ export function ShareChip({
|
||||
<Chip
|
||||
variant={copied ? 'Success' : cardColor ? undefined : 'SurfaceVariant'}
|
||||
radii="Pill"
|
||||
before={
|
||||
cords ? (
|
||||
<Icon size="50" src={Icons.ChevronBottom} />
|
||||
) : (
|
||||
<Icon size="50" src={copied ? Icons.Check : Icons.Link} />
|
||||
)
|
||||
}
|
||||
before={cords ? profileIcon(CaretDown) : profileIcon(copied ? Check : Link)}
|
||||
onClick={open}
|
||||
aria-pressed={!!cords}
|
||||
className={!copied && cardColor ? css.UserHeroChipThemed : css.UserHeroBrightnessHover}
|
||||
@@ -730,7 +726,7 @@ export function OptionsChip({
|
||||
fill="None"
|
||||
size="300"
|
||||
radii="300"
|
||||
before={<Icon size="50" src={Icons.Pencil} />}
|
||||
before={profileIcon(PencilSimple)}
|
||||
onClick={() => setEditingNick(true)}
|
||||
className={css.UserHeroMenuItem}
|
||||
style={heroMenuItemStyle(
|
||||
@@ -756,11 +752,7 @@ export function OptionsChip({
|
||||
className={css.UserHeroMenuItem}
|
||||
style={heroMenuItemStyle({ backgroundColor: menuItemBg }, chipHoverBrightness)}
|
||||
before={
|
||||
ignoring ? (
|
||||
<Spinner variant="Critical" size="50" />
|
||||
) : (
|
||||
<Icon size="50" src={Icons.Prohibited} />
|
||||
)
|
||||
ignoring ? <Spinner variant="Critical" size="50" /> : profileIcon(Prohibit)
|
||||
}
|
||||
disabled={ignoring}
|
||||
>
|
||||
@@ -785,11 +777,7 @@ export function OptionsChip({
|
||||
chipHoverBrightness
|
||||
)}
|
||||
>
|
||||
{ignoring ? (
|
||||
<Spinner variant="Secondary" size="50" />
|
||||
) : (
|
||||
<Icon size="50" src={Icons.HorizontalDots} />
|
||||
)}
|
||||
{ignoring ? <Spinner variant="Secondary" size="50" /> : profileIcon(DotsThree)}
|
||||
</Chip>
|
||||
</PopOut>
|
||||
);
|
||||
|
||||
@@ -4,8 +4,6 @@ import {
|
||||
Avatar,
|
||||
Box,
|
||||
color as standardColors,
|
||||
Icon,
|
||||
Icons,
|
||||
Modal,
|
||||
Overlay,
|
||||
OverlayBackdrop,
|
||||
@@ -29,6 +27,7 @@ import { useBlobCache } from '$hooks/useBlobCache';
|
||||
import { ImageViewer } from '$components/image-viewer';
|
||||
import { AvatarPresence, PresenceBadge } from '$components/presence';
|
||||
import { UserAvatar } from '$components/user-avatar';
|
||||
import { CaretDown, CaretUp, profileIcon, userFallbackIcon } from '$components/icons/phosphor';
|
||||
import { ClientSideHoverFreeze } from '$components/ClientSideHoverFreeze';
|
||||
import { useUserProfile } from '$hooks/useUserProfile';
|
||||
import { shadeColor, areColorsTooSimilar } from '$utils/shadeColor';
|
||||
@@ -125,7 +124,7 @@ export function UserHero({ userId, avatarUrl, bannerUrl, presence, autoplayGifs
|
||||
userId={userId}
|
||||
src={avatarUrl}
|
||||
alt={userId}
|
||||
renderFallback={() => <Icon size="500" src={Icons.User} filled />}
|
||||
renderFallback={() => userFallbackIcon('hero')}
|
||||
/>
|
||||
</Avatar>
|
||||
</AvatarPresence>
|
||||
@@ -214,7 +213,7 @@ export function UserHero({ userId, avatarUrl, bannerUrl, presence, autoplayGifs
|
||||
alignSelf: isFullStatus ? 'flex-start' : 'center',
|
||||
}}
|
||||
>
|
||||
<Icon size="50" src={isFullStatus ? Icons.ChevronTop : Icons.ChevronBottom} />
|
||||
{profileIcon(isFullStatus ? CaretUp : CaretDown)}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Box, Button, color, config, Icon, Icons, Spinner, Text, Input } from 'folds';
|
||||
import { Box, Button, color, config, Spinner, Text, Input } from 'folds';
|
||||
import { ArrowLeft, ArrowRight, profileIcon, Prohibit } from '$components/icons/phosphor';
|
||||
import { useCallback, useRef } from 'react';
|
||||
import { useRoom } from '$hooks/useRoom';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
@@ -295,7 +296,7 @@ export function UserModeration({ userId, canKick, canBan, canInvite }: UserModer
|
||||
inviteState.status === AsyncStatus.Loading ? (
|
||||
<Spinner size="50" variant="Secondary" fill="Soft" />
|
||||
) : (
|
||||
<Icon size="50" src={Icons.ArrowRight} />
|
||||
profileIcon(ArrowRight)
|
||||
)
|
||||
}
|
||||
onClick={invite}
|
||||
@@ -315,7 +316,7 @@ export function UserModeration({ userId, canKick, canBan, canInvite }: UserModer
|
||||
kickState.status === AsyncStatus.Loading ? (
|
||||
<Spinner size="50" variant="Critical" fill="Soft" />
|
||||
) : (
|
||||
<Icon size="50" src={Icons.ArrowLeft} />
|
||||
profileIcon(ArrowLeft)
|
||||
)
|
||||
}
|
||||
onClick={kick}
|
||||
@@ -335,7 +336,7 @@ export function UserModeration({ userId, canKick, canBan, canInvite }: UserModer
|
||||
banState.status === AsyncStatus.Loading ? (
|
||||
<Spinner size="50" variant="Critical" fill="Solid" />
|
||||
) : (
|
||||
<Icon size="50" src={Icons.Prohibited} />
|
||||
profileIcon(Prohibit)
|
||||
)
|
||||
}
|
||||
onClick={ban}
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
color,
|
||||
config,
|
||||
Icon,
|
||||
Icons,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Scroll,
|
||||
Text,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { Box, Button, color, config, Menu, MenuItem, Scroll, Text, toRem } from 'folds';
|
||||
import type { CSSProperties, SyntheticEvent } from 'react';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import type { Opts as LinkifyOpts } from 'linkifyjs';
|
||||
import type { HTMLReactParserOptions } from 'html-react-parser';
|
||||
import {
|
||||
ArrowLeft,
|
||||
ArrowRight,
|
||||
CaretDown,
|
||||
CaretUp,
|
||||
ChatCircle,
|
||||
Clock,
|
||||
Heart,
|
||||
profileIcon,
|
||||
User,
|
||||
} from '$components/icons/phosphor';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
import { getMemberAvatarMxc, getMemberDisplayName } from '$utils/room';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
@@ -206,7 +205,7 @@ function UserExtendedSection({
|
||||
}}
|
||||
onClick={() => handleMiscSelector(-1)}
|
||||
>
|
||||
<Icon src={Icons.ChevronTop} size="50" />
|
||||
{profileIcon(CaretUp)}
|
||||
<Text>Show less</Text>
|
||||
</MenuItem>
|
||||
{unknownFields.map(([key], index) => (
|
||||
@@ -232,9 +231,7 @@ function UserExtendedSection({
|
||||
size="300"
|
||||
className={css.MiscDataToggleButton}
|
||||
onClick={() => setShowMisc(!showMisc)}
|
||||
after={
|
||||
<Icon size="50" src={miscDataIndex === -1 ? Icons.ChevronBottom : Icons.ChevronTop} />
|
||||
}
|
||||
after={profileIcon(miscDataIndex === -1 ? CaretDown : CaretUp)}
|
||||
style={{
|
||||
padding: '1rem',
|
||||
justifyContent: 'flex-start',
|
||||
@@ -260,7 +257,7 @@ function UserExtendedSection({
|
||||
<Box alignItems="Center" gap="300" wrap="Wrap">
|
||||
{pronouns && (
|
||||
<Box alignItems="Center" gap="100">
|
||||
<Icon size="50" src={Icons.User} style={{ opacity: 0.5 }} />
|
||||
{profileIcon(User, { style: { opacity: 0.5 } })}
|
||||
<Text size="T200" priority="400">
|
||||
{pronouns}
|
||||
</Text>
|
||||
@@ -268,7 +265,7 @@ function UserExtendedSection({
|
||||
)}
|
||||
{localTime && profile.timezone && (
|
||||
<Box alignItems="Center" gap="100">
|
||||
<Icon size="50" src={Icons.Clock} style={{ opacity: 0.5 }} />
|
||||
{profileIcon(Clock, { style: { opacity: 0.5 } })}
|
||||
<Text size="T200" priority="400">
|
||||
{localTime} ({profile.timezone.replaceAll(/^["']|["']$/g, '')})
|
||||
</Text>
|
||||
@@ -276,7 +273,7 @@ function UserExtendedSection({
|
||||
)}
|
||||
{catStatusText && (
|
||||
<Box alignItems="Center" gap="100">
|
||||
<Icon size="50" src={Icons.Heart} style={{ opacity: 0.5 }} />
|
||||
{profileIcon(Heart, { style: { opacity: 0.5 } })}
|
||||
<Text size="T200" priority="400">
|
||||
{catStatusText}
|
||||
</Text>
|
||||
@@ -345,7 +342,7 @@ function UserExtendedSection({
|
||||
}
|
||||
style={{ color: textColor }}
|
||||
>
|
||||
<Icon src={Icons.ArrowLeft} size="50" />
|
||||
{profileIcon(ArrowLeft)}
|
||||
</Button>
|
||||
)}
|
||||
{miscHeader}
|
||||
@@ -357,7 +354,7 @@ function UserExtendedSection({
|
||||
onClick={() => setMiscDataIndex((miscDataIndex + 1) % unknownFields.length)}
|
||||
style={{ color: textColor }}
|
||||
>
|
||||
<Icon src={Icons.ArrowRight} size="50" />
|
||||
{profileIcon(ArrowRight)}
|
||||
</Button>
|
||||
)}
|
||||
</Box>
|
||||
@@ -591,7 +588,7 @@ export function UserRoomProfile({ userId, initialProfile }: Readonly<UserRoomPro
|
||||
variant="Primary"
|
||||
fill="Solid"
|
||||
radii="300"
|
||||
before={<Icon size="50" src={Icons.Message} filled />}
|
||||
before={profileIcon(ChatCircle, { filled: true })}
|
||||
onClick={handleMessage}
|
||||
className={showCustomHeroCard ? css.UserHeroChipThemed : css.UserHeroChip}
|
||||
style={{
|
||||
|
||||
@@ -5,9 +5,7 @@ import {
|
||||
Button,
|
||||
config,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Input,
|
||||
Menu,
|
||||
MenuItem,
|
||||
@@ -19,6 +17,14 @@ import {
|
||||
Spinner,
|
||||
Text,
|
||||
} from 'folds';
|
||||
import {
|
||||
Check,
|
||||
MagnifyingGlass,
|
||||
X,
|
||||
composerIcon,
|
||||
sizedIcon,
|
||||
menuIcon,
|
||||
} from '$components/icons/phosphor';
|
||||
import type { ChangeEventHandler, MouseEventHandler } from 'react';
|
||||
import { useCallback, useMemo, useRef, useState } from 'react';
|
||||
import { useAtomValue } from 'jotai';
|
||||
@@ -220,7 +226,7 @@ export function AddExistingModal({ parentId, space, requestClose }: AddExistingM
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton size="300" radii="300" onClick={requestClose}>
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Box>
|
||||
</Header>
|
||||
@@ -241,7 +247,7 @@ export function AddExistingModal({ parentId, space, requestClose }: AddExistingM
|
||||
>
|
||||
<Input
|
||||
onChange={handleSearchChange}
|
||||
before={<Icon size="200" src={Icons.Search} />}
|
||||
before={menuIcon(MagnifyingGlass)}
|
||||
placeholder="Search"
|
||||
size="400"
|
||||
variant="Background"
|
||||
@@ -322,7 +328,7 @@ export function AddExistingModal({ parentId, space, requestClose }: AddExistingM
|
||||
)}
|
||||
</Avatar>
|
||||
}
|
||||
after={selectedItem && <Icon size="200" src={Icons.Check} />}
|
||||
after={selectedItem && sizedIcon(Check, '200')}
|
||||
>
|
||||
<Box grow="Yes">
|
||||
<Text truncate size="T400">
|
||||
|
||||
@@ -6,9 +6,7 @@ import {
|
||||
Chip,
|
||||
config,
|
||||
Header,
|
||||
Icon,
|
||||
IconButton,
|
||||
Icons,
|
||||
Input,
|
||||
Modal,
|
||||
Overlay,
|
||||
@@ -20,6 +18,7 @@ import {
|
||||
TextArea,
|
||||
Checkbox,
|
||||
} from 'folds';
|
||||
import { ArrowRight, X, chipIcon, composerIcon } from '$components/icons/phosphor';
|
||||
import * as Sentry from '@sentry/react';
|
||||
import { useCloseBugReportModal, useBugReportModalOpen } from '$state/hooks/bugReportModal';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
@@ -246,7 +245,7 @@ function BugReportModal() {
|
||||
<Text size="H4">Report an Issue</Text>
|
||||
</Box>
|
||||
<IconButton size="300" radii="300" onClick={close}>
|
||||
<Icon src={Icons.Cross} />
|
||||
{composerIcon(X)}
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Scroll size="300" hideTrack>
|
||||
@@ -501,7 +500,7 @@ function BugReportModal() {
|
||||
radii="400"
|
||||
disabled={!canSubmit}
|
||||
onClick={handleSubmit}
|
||||
after={<Icon src={Icons.ArrowRight} size="100" />}
|
||||
after={chipIcon(ArrowRight)}
|
||||
>
|
||||
<Text size="B400">
|
||||
{sentryEnabled && type === 'bug' ? 'Submit Report' : 'Open on GitHub'}
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
import { Box, Chip, Icon, IconButton, Icons, Spinner, Text, Tooltip, TooltipProvider } from 'folds';
|
||||
import { Box, Chip, IconButton, Spinner, Text, Tooltip, TooltipProvider } from 'folds';
|
||||
import {
|
||||
Headphones,
|
||||
sizedIcon,
|
||||
Microphone,
|
||||
MicrophoneSlash,
|
||||
PhoneDisconnect,
|
||||
ShareNetwork,
|
||||
SpeakerSlash,
|
||||
VideoCamera,
|
||||
VideoCameraSlash,
|
||||
} from '$components/icons/phosphor';
|
||||
import { useCallback } from 'react';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { StatusDivider } from './components';
|
||||
@@ -33,7 +44,7 @@ function MicrophoneButton({ enabled, onToggle, disabled }: MicrophoneButtonProps
|
||||
outlined
|
||||
disabled={disabled}
|
||||
>
|
||||
<Icon size="100" src={enabled ? Icons.Mic : Icons.MicMute} filled={!enabled} />
|
||||
{sizedIcon(enabled ? Microphone : MicrophoneSlash, '100', { filled: !enabled })}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -66,11 +77,7 @@ function SoundButton({ enabled, onToggle, disabled }: SoundButtonProps) {
|
||||
outlined
|
||||
disabled={disabled}
|
||||
>
|
||||
<Icon
|
||||
size="100"
|
||||
src={enabled ? Icons.Headphone : Icons.HeadphoneMute}
|
||||
filled={!enabled}
|
||||
/>
|
||||
{sizedIcon(enabled ? Headphones : SpeakerSlash, '100', { filled: !enabled })}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -103,11 +110,7 @@ function VideoButton({ enabled, onToggle, disabled }: VideoButtonProps) {
|
||||
outlined
|
||||
disabled={disabled}
|
||||
>
|
||||
<Icon
|
||||
size="100"
|
||||
src={enabled ? Icons.VideoCamera : Icons.VideoCameraMute}
|
||||
filled={enabled}
|
||||
/>
|
||||
{sizedIcon(enabled ? VideoCamera : VideoCameraSlash, '100', { filled: enabled })}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -140,7 +143,7 @@ function ScreenShareButton({ enabled, onToggle, disabled }: ScreenShareButtonPro
|
||||
outlined
|
||||
disabled={disabled}
|
||||
>
|
||||
<Icon size="100" src={Icons.ScreenShare} filled={enabled} />
|
||||
{sizedIcon(ShareNetwork, '100', { filled: enabled })}
|
||||
</IconButton>
|
||||
)}
|
||||
</TooltipProvider>
|
||||
@@ -209,7 +212,7 @@ export function CallControl({
|
||||
exiting ? (
|
||||
<Spinner variant="Critical" fill="Soft" size="50" />
|
||||
) : (
|
||||
<Icon size="50" src={Icons.PhoneDown} filled />
|
||||
sizedIcon(PhoneDisconnect, '50', { filled: true })
|
||||
)
|
||||
}
|
||||
disabled={exiting}
|
||||
|
||||
Loaded 100 of 245 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user