mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 17:41:25 -08:00
minor size adjustments for some icons
This commit is contained in:
1 parent
221c2e7c25
commit
cdf20c4586
12 files changed
+136
-130
No files matched your search
@@ -114,6 +114,7 @@ import {
|
||||
UserCircle,
|
||||
UserMinus,
|
||||
UserPlus,
|
||||
UsersThree,
|
||||
VideoCamera,
|
||||
VideoCameraSlash,
|
||||
Warning,
|
||||
@@ -179,6 +180,10 @@ export function chipIcon(Icon: PhosphorIcon, props?: IconProps): ReactNode {
|
||||
return <Icon size={PHOSPHOR_SIZE.inline} {...props} />;
|
||||
}
|
||||
|
||||
export function profileIcon(Icon: PhosphorIcon, props?: IconAtProps): ReactNode {
|
||||
return iconAt(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 ?? {};
|
||||
@@ -339,6 +344,7 @@ export {
|
||||
UserCircle,
|
||||
UserMinus,
|
||||
UserPlus,
|
||||
UsersThree,
|
||||
VideoCamera,
|
||||
VideoCameraSlash,
|
||||
Warning,
|
||||
|
||||
@@ -92,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}>
|
||||
{iconAt(ArrowLeft, '50')}
|
||||
{iconAt(ArrowLeft, '200')}
|
||||
</IconButton>
|
||||
<Text size="T300" truncate>
|
||||
{alt}
|
||||
@@ -125,7 +125,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
aria-label="View Original Size"
|
||||
title="View Original Size"
|
||||
>
|
||||
{iconAt(Image, '50')}
|
||||
{iconAt(Image, '200')}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
variant="Surface"
|
||||
@@ -146,7 +146,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
||||
aria-label="Reset Zoom"
|
||||
title="Zoom to Fill Container"
|
||||
>
|
||||
{iconAt(ArrowsClockwise, '50')}
|
||||
{iconAt(ArrowsClockwise, '200')}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
variant={transforms.zoom < 1 ? 'Success' : 'SurfaceVariant'}
|
||||
|
||||
@@ -1,73 +1,73 @@
|
||||
import { style, styleVariants } from '@vanilla-extract/css';
|
||||
import { color, config } from 'folds';
|
||||
import { style, styleVariants } from "@vanilla-extract/css";
|
||||
import { color, config } from "folds";
|
||||
|
||||
export const RoomAvatar = style({
|
||||
backgroundColor: color.Secondary.Container,
|
||||
color: color.Secondary.OnContainer,
|
||||
textTransform: 'capitalize',
|
||||
textTransform: "capitalize",
|
||||
|
||||
selectors: {
|
||||
'&[data-image-loaded="true"]': {
|
||||
backgroundColor: 'transparent',
|
||||
backgroundColor: "transparent",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const RoomIconRoot = style({
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
lineHeight: 0,
|
||||
overflow: 'visible',
|
||||
overflow: "visible",
|
||||
});
|
||||
|
||||
export const RoomIconComposite = style({
|
||||
position: 'relative',
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
position: "relative",
|
||||
display: "inline-flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
lineHeight: 0,
|
||||
flexShrink: 0,
|
||||
overflow: 'visible',
|
||||
overflow: "visible",
|
||||
});
|
||||
|
||||
export const RoomIconBadge = style({
|
||||
position: 'absolute',
|
||||
top: '-4%',
|
||||
right: '-4%',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
aspectRatio: '1',
|
||||
boxSizing: 'border-box',
|
||||
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',
|
||||
overflow: "visible",
|
||||
pointerEvents: "none",
|
||||
});
|
||||
|
||||
export const RoomIconBadgeShape = styleVariants({
|
||||
globe: {
|
||||
width: '62%',
|
||||
width: "62%",
|
||||
padding: 0,
|
||||
borderRadius: '50%',
|
||||
borderRadius: "50%",
|
||||
},
|
||||
lock: {
|
||||
width: '64%',
|
||||
width: "64%",
|
||||
padding: 0,
|
||||
borderTopLeftRadius: config.radii.R300,
|
||||
borderTopRightRadius: config.radii.R300,
|
||||
borderBottomLeftRadius: '20%',
|
||||
borderBottomRightRadius: '20%',
|
||||
borderBottomLeftRadius: "20%",
|
||||
borderBottomRightRadius: "20%",
|
||||
},
|
||||
});
|
||||
|
||||
export const RoomIconBadgeIcon = style({
|
||||
display: 'flex',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
display: "flex",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
flexShrink: 0,
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { RectCords } from 'folds';
|
||||
import { Chip, config, Menu, MenuItem, PopOut, Text } from 'folds';
|
||||
import { CaretDown, iconAt } from '$components/icons/phosphor';
|
||||
import { CaretDown, profileIcon } from '$components/icons/phosphor';
|
||||
import type { CSSProperties } from 'react';
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useState } from 'react';
|
||||
@@ -107,7 +107,7 @@ export function CreatorChip({
|
||||
variant={cardColor ? undefined : 'Success'}
|
||||
outlined={!cardColor}
|
||||
radii="Pill"
|
||||
before={cords ? iconAt(CaretDown, '50') : <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}
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
Text,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import { CaretDown, iconAt, menuIcon, X } from '$components/icons/phosphor';
|
||||
import { CaretDown, menuIcon, profileIcon, X } from '$components/icons/phosphor';
|
||||
import type { CSSProperties } from 'react';
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
@@ -367,7 +367,7 @@ export function PowerChip({
|
||||
}
|
||||
before={
|
||||
cords ? (
|
||||
iconAt(CaretDown, '50')
|
||||
profileIcon(CaretDown)
|
||||
) : (
|
||||
<>
|
||||
{!changing && <PowerColorBadge color={tag.color} />}
|
||||
|
||||
@@ -25,9 +25,9 @@ import {
|
||||
Check,
|
||||
DotsThree,
|
||||
HardDrives,
|
||||
iconAt,
|
||||
Link,
|
||||
PencilSimple,
|
||||
profileIcon,
|
||||
Prohibit,
|
||||
} from '$components/icons/phosphor';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
@@ -195,7 +195,7 @@ export function ServerChip({
|
||||
<Chip
|
||||
variant={cardColor ? undefined : myServer === server ? 'SurfaceVariant' : 'Warning'}
|
||||
radii="Pill"
|
||||
before={cords ? iconAt(CaretDown, '50') : iconAt(copied ? Check : HardDrives, '50')}
|
||||
before={cords ? profileIcon(CaretDown) : profileIcon(copied ? Check : HardDrives)}
|
||||
onClick={open}
|
||||
aria-pressed={!!cords}
|
||||
className={cardColor ? css.UserHeroChipThemed : css.UserHeroBrightnessHover}
|
||||
@@ -309,7 +309,7 @@ export function ShareChip({
|
||||
<Chip
|
||||
variant={copied ? 'Success' : cardColor ? undefined : 'SurfaceVariant'}
|
||||
radii="Pill"
|
||||
before={cords ? iconAt(CaretDown, '50') : iconAt(copied ? Check : Link, '50')}
|
||||
before={cords ? profileIcon(CaretDown) : profileIcon(copied ? Check : Link)}
|
||||
onClick={open}
|
||||
aria-pressed={!!cords}
|
||||
className={!copied && cardColor ? css.UserHeroChipThemed : css.UserHeroBrightnessHover}
|
||||
@@ -726,7 +726,7 @@ export function OptionsChip({
|
||||
fill="None"
|
||||
size="300"
|
||||
radii="300"
|
||||
before={iconAt(PencilSimple, '50')}
|
||||
before={profileIcon(PencilSimple)}
|
||||
onClick={() => setEditingNick(true)}
|
||||
className={css.UserHeroMenuItem}
|
||||
style={heroMenuItemStyle(
|
||||
@@ -752,7 +752,7 @@ export function OptionsChip({
|
||||
className={css.UserHeroMenuItem}
|
||||
style={heroMenuItemStyle({ backgroundColor: menuItemBg }, chipHoverBrightness)}
|
||||
before={
|
||||
ignoring ? <Spinner variant="Critical" size="50" /> : iconAt(Prohibit, '50')
|
||||
ignoring ? <Spinner variant="Critical" size="50" /> : profileIcon(Prohibit)
|
||||
}
|
||||
disabled={ignoring}
|
||||
>
|
||||
@@ -777,7 +777,7 @@ export function OptionsChip({
|
||||
chipHoverBrightness
|
||||
)}
|
||||
>
|
||||
{ignoring ? <Spinner variant="Secondary" size="50" /> : iconAt(DotsThree, '50')}
|
||||
{ignoring ? <Spinner variant="Secondary" size="50" /> : profileIcon(DotsThree)}
|
||||
</Chip>
|
||||
</PopOut>
|
||||
);
|
||||
|
||||
@@ -27,7 +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, iconAt, userFallbackIcon } from '$components/icons/phosphor';
|
||||
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';
|
||||
@@ -213,7 +213,7 @@ export function UserHero({ userId, avatarUrl, bannerUrl, presence, autoplayGifs
|
||||
alignSelf: isFullStatus ? 'flex-start' : 'center',
|
||||
}}
|
||||
>
|
||||
{iconAt(isFullStatus ? CaretUp : CaretDown, '50')}
|
||||
{profileIcon(isFullStatus ? CaretUp : CaretDown)}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Box, Button, color, config, Spinner, Text, Input } from 'folds';
|
||||
import { ArrowLeft, ArrowRight, iconAt, Prohibit } from '$components/icons/phosphor';
|
||||
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';
|
||||
@@ -296,7 +296,7 @@ export function UserModeration({ userId, canKick, canBan, canInvite }: UserModer
|
||||
inviteState.status === AsyncStatus.Loading ? (
|
||||
<Spinner size="50" variant="Secondary" fill="Soft" />
|
||||
) : (
|
||||
iconAt(ArrowRight, '50')
|
||||
profileIcon(ArrowRight)
|
||||
)
|
||||
}
|
||||
onClick={invite}
|
||||
@@ -316,7 +316,7 @@ export function UserModeration({ userId, canKick, canBan, canInvite }: UserModer
|
||||
kickState.status === AsyncStatus.Loading ? (
|
||||
<Spinner size="50" variant="Critical" fill="Soft" />
|
||||
) : (
|
||||
iconAt(ArrowLeft, '50')
|
||||
profileIcon(ArrowLeft)
|
||||
)
|
||||
}
|
||||
onClick={kick}
|
||||
@@ -336,7 +336,7 @@ export function UserModeration({ userId, canKick, canBan, canInvite }: UserModer
|
||||
banState.status === AsyncStatus.Loading ? (
|
||||
<Spinner size="50" variant="Critical" fill="Solid" />
|
||||
) : (
|
||||
iconAt(Prohibit, '50')
|
||||
profileIcon(Prohibit)
|
||||
)
|
||||
}
|
||||
onClick={ban}
|
||||
|
||||
@@ -11,10 +11,9 @@ import {
|
||||
CaretDown,
|
||||
CaretUp,
|
||||
ChatCircle,
|
||||
chipIcon,
|
||||
Clock,
|
||||
Heart,
|
||||
iconAt,
|
||||
profileIcon,
|
||||
User,
|
||||
} from '$components/icons/phosphor';
|
||||
import { mxcUrlToHttp } from '$utils/matrix';
|
||||
@@ -206,7 +205,7 @@ function UserExtendedSection({
|
||||
}}
|
||||
onClick={() => handleMiscSelector(-1)}
|
||||
>
|
||||
{iconAt(CaretUp, '50')}
|
||||
{profileIcon(CaretUp)}
|
||||
<Text>Show less</Text>
|
||||
</MenuItem>
|
||||
{unknownFields.map(([key], index) => (
|
||||
@@ -232,7 +231,7 @@ function UserExtendedSection({
|
||||
size="300"
|
||||
className={css.MiscDataToggleButton}
|
||||
onClick={() => setShowMisc(!showMisc)}
|
||||
after={iconAt(miscDataIndex === -1 ? CaretDown : CaretUp, '50')}
|
||||
after={profileIcon(miscDataIndex === -1 ? CaretDown : CaretUp)}
|
||||
style={{
|
||||
padding: '1rem',
|
||||
justifyContent: 'flex-start',
|
||||
@@ -258,7 +257,7 @@ function UserExtendedSection({
|
||||
<Box alignItems="Center" gap="300" wrap="Wrap">
|
||||
{pronouns && (
|
||||
<Box alignItems="Center" gap="100">
|
||||
{chipIcon(User, { style: { opacity: 0.5 } })}
|
||||
{profileIcon(User, { style: { opacity: 0.5 } })}
|
||||
<Text size="T200" priority="400">
|
||||
{pronouns}
|
||||
</Text>
|
||||
@@ -266,7 +265,7 @@ function UserExtendedSection({
|
||||
)}
|
||||
{localTime && profile.timezone && (
|
||||
<Box alignItems="Center" gap="100">
|
||||
{iconAt(Clock, '50', { style: { opacity: 0.5 } })}
|
||||
{profileIcon(Clock, { style: { opacity: 0.5 } })}
|
||||
<Text size="T200" priority="400">
|
||||
{localTime} ({profile.timezone.replaceAll(/^["']|["']$/g, '')})
|
||||
</Text>
|
||||
@@ -274,7 +273,7 @@ function UserExtendedSection({
|
||||
)}
|
||||
{catStatusText && (
|
||||
<Box alignItems="Center" gap="100">
|
||||
{iconAt(Heart, '50', { style: { opacity: 0.5 } })}
|
||||
{profileIcon(Heart, { style: { opacity: 0.5 } })}
|
||||
<Text size="T200" priority="400">
|
||||
{catStatusText}
|
||||
</Text>
|
||||
@@ -343,7 +342,7 @@ function UserExtendedSection({
|
||||
}
|
||||
style={{ color: textColor }}
|
||||
>
|
||||
{iconAt(ArrowLeft, '50')}
|
||||
{profileIcon(ArrowLeft)}
|
||||
</Button>
|
||||
)}
|
||||
{miscHeader}
|
||||
@@ -355,7 +354,7 @@ function UserExtendedSection({
|
||||
onClick={() => setMiscDataIndex((miscDataIndex + 1) % unknownFields.length)}
|
||||
style={{ color: textColor }}
|
||||
>
|
||||
{iconAt(ArrowRight, '50')}
|
||||
{profileIcon(ArrowRight)}
|
||||
</Button>
|
||||
)}
|
||||
</Box>
|
||||
@@ -589,7 +588,7 @@ export function UserRoomProfile({ userId, initialProfile }: Readonly<UserRoomPro
|
||||
variant="Primary"
|
||||
fill="Solid"
|
||||
radii="300"
|
||||
before={iconAt(ChatCircle, '50', { filled: true })}
|
||||
before={profileIcon(ChatCircle, { filled: true })}
|
||||
onClick={handleMessage}
|
||||
className={showCustomHeroCard ? css.UserHeroChipThemed : css.UserHeroChip}
|
||||
style={{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import type { RectCords } from 'folds';
|
||||
import type { MouseEventHandler } from "react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import type { RectCords } from "folds";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -12,23 +12,23 @@ import {
|
||||
Spinner,
|
||||
Text,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
} from "folds";
|
||||
import {
|
||||
composerIcon,
|
||||
DotsThreeOutlineVerticalIcon,
|
||||
iconAt,
|
||||
PhoneDisconnect,
|
||||
} from '$components/icons/phosphor';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
import type { CallEmbed } from '$plugins/call';
|
||||
import { useCallControlState } from '$plugins/call';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useRoom } from '$hooks/useRoom';
|
||||
import { ScreenSize, useScreenSizeContext } from '$hooks/useScreenSize';
|
||||
import { useCallPreferences } from '$state/hooks/callPreferences';
|
||||
import * as css from './styles.css';
|
||||
} from "$components/icons/phosphor";
|
||||
import FocusTrap from "focus-trap-react";
|
||||
import { SequenceCard } from "$components/sequence-card";
|
||||
import type { CallEmbed } from "$plugins/call";
|
||||
import { useCallControlState } from "$plugins/call";
|
||||
import { stopPropagation } from "$utils/keyboard";
|
||||
import { AsyncStatus, useAsyncCallback } from "$hooks/useAsyncCallback";
|
||||
import { useRoom } from "$hooks/useRoom";
|
||||
import { ScreenSize, useScreenSizeContext } from "$hooks/useScreenSize";
|
||||
import { useCallPreferences } from "$state/hooks/callPreferences";
|
||||
import * as css from "./styles.css";
|
||||
import {
|
||||
ChatButton,
|
||||
ControlDivider,
|
||||
@@ -36,7 +36,7 @@ import {
|
||||
ScreenShareButton,
|
||||
SoundButton,
|
||||
VideoButton,
|
||||
} from './Controls';
|
||||
} from "./Controls";
|
||||
|
||||
type CallControlsProps = {
|
||||
callEmbed: CallEmbed;
|
||||
@@ -49,7 +49,7 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
const compact = screenSize === ScreenSize.Mobile;
|
||||
|
||||
const { microphone, video, sound, screenshare, spotlight } = useCallControlState(
|
||||
callEmbed.control
|
||||
callEmbed.control,
|
||||
);
|
||||
|
||||
const { setPreferences } = useCallPreferences();
|
||||
@@ -80,7 +80,7 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
};
|
||||
|
||||
const [hangupState, hangup] = useAsyncCallback(
|
||||
useCallback(() => callEmbed.hangup(), [callEmbed])
|
||||
useCallback(() => callEmbed.hangup(), [callEmbed]),
|
||||
);
|
||||
const exiting =
|
||||
hangupState.status === AsyncStatus.Loading || hangupState.status === AsyncStatus.Success;
|
||||
@@ -92,15 +92,15 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
justifyContent="Center"
|
||||
alignItems="Center"
|
||||
style={{
|
||||
maxWidth: '100%',
|
||||
maxWidth: "100%",
|
||||
padding: compact ? `0 ${toRem(8)}` : undefined,
|
||||
overflowX: 'auto',
|
||||
overflowX: "auto",
|
||||
}}
|
||||
>
|
||||
<SequenceCard
|
||||
className={css.ControlCard}
|
||||
variant="SurfaceVariant"
|
||||
gap={compact ? '100' : '200'}
|
||||
gap={compact ? "100" : "200"}
|
||||
radii="500"
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
@@ -110,7 +110,7 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
shrink="No"
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
gap={compact ? '100' : '200'}
|
||||
gap={compact ? "100" : "200"}
|
||||
direction="Row"
|
||||
>
|
||||
<MicrophoneButton
|
||||
@@ -126,7 +126,7 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
shrink="No"
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
gap={compact ? '100' : '200'}
|
||||
gap={compact ? "100" : "200"}
|
||||
direction="Row"
|
||||
>
|
||||
<VideoButton enabled={video} onToggle={() => callEmbed.control.toggleVideo()} />
|
||||
@@ -140,7 +140,7 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
shrink="No"
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
gap={compact ? '100' : '200'}
|
||||
gap={compact ? "100" : "200"}
|
||||
direction="Row"
|
||||
>
|
||||
{room?.isCallRoom() && <ChatButton />}
|
||||
@@ -155,8 +155,8 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
initialFocus: false,
|
||||
onDeactivate: () => setCords(undefined),
|
||||
clickOutsideDeactivates: true,
|
||||
isKeyForward: (evt: KeyboardEvent) => evt.key === 'ArrowDown',
|
||||
isKeyBackward: (evt: KeyboardEvent) => evt.key === 'ArrowUp',
|
||||
isKeyForward: (evt: KeyboardEvent) => evt.key === "ArrowDown",
|
||||
isKeyBackward: (evt: KeyboardEvent) => evt.key === "ArrowUp",
|
||||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
>
|
||||
@@ -169,7 +169,7 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
onClick={handleSpotlightClick}
|
||||
>
|
||||
<Text size="B300" truncate>
|
||||
{spotlight ? 'Grid View' : 'Spotlight View'}
|
||||
{spotlight ? "Grid View" : "Spotlight View"}
|
||||
</Text>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
@@ -207,7 +207,7 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
aria-pressed={!!cords}
|
||||
>
|
||||
{composerIcon(DotsThreeOutlineVerticalIcon, {
|
||||
weight: cords ? 'fill' : 'regular',
|
||||
weight: cords ? "fill" : "regular",
|
||||
})}
|
||||
</IconButton>
|
||||
</PopOut>
|
||||
@@ -224,7 +224,7 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
exiting ? (
|
||||
<Spinner variant="Critical" fill="Solid" size="200" />
|
||||
) : (
|
||||
iconAt(PhoneDisconnect, '200', { filled: true })
|
||||
iconAt(PhoneDisconnect, "200", { filled: true })
|
||||
)
|
||||
}
|
||||
disabled={exiting}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import type { ReactNode, FormEventHandler } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import type { Room } from '$types/matrix-sdk';
|
||||
import { MatrixError, JoinRule, RoomType } from '$types/matrix-sdk';
|
||||
import { Box, Button, Chip, color, config, Input, Spinner, Switch, Text, TextArea } from 'folds';
|
||||
import { SettingTile } from '$components/setting-tile';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { millisecondsToMinutes, replaceSpaceWithDash } from '$utils/common';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useCapabilities } from '$hooks/useCapabilities';
|
||||
import { useAlive } from '$hooks/useAlive';
|
||||
import type { CreateRoomData } from '$components/create-room';
|
||||
import type { ReactNode, FormEventHandler } from "react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import type { Room } from "$types/matrix-sdk";
|
||||
import { MatrixError, JoinRule, RoomType } from "$types/matrix-sdk";
|
||||
import { Box, Button, Chip, color, config, Input, Spinner, Switch, Text, TextArea } from "folds";
|
||||
import { SettingTile } from "$components/setting-tile";
|
||||
import { SequenceCard } from "$components/sequence-card";
|
||||
import { useMatrixClient } from "$hooks/useMatrixClient";
|
||||
import { millisecondsToMinutes, replaceSpaceWithDash } from "$utils/common";
|
||||
import { AsyncStatus, useAsyncCallback } from "$hooks/useAsyncCallback";
|
||||
import { useCapabilities } from "$hooks/useCapabilities";
|
||||
import { useAlive } from "$hooks/useAlive";
|
||||
import type { CreateRoomData } from "$components/create-room";
|
||||
import {
|
||||
AdditionalCreatorInput,
|
||||
createRoom,
|
||||
@@ -20,10 +20,10 @@ import {
|
||||
RoomVersionSelector,
|
||||
useAdditionalCreators,
|
||||
CreateRoomType,
|
||||
} from '$components/create-room';
|
||||
} from "$components/create-room";
|
||||
|
||||
import { CreateRoomTypeSelector } from '$components/create-room/CreateRoomTypeSelector';
|
||||
import { getRoomIconComponent } from '$components/icons/roomIcons';
|
||||
import { CreateRoomTypeSelector } from "$components/create-room/CreateRoomTypeSelector";
|
||||
import { getRoomStandaloneIconComponent } from "$components/icons/roomIcons";
|
||||
import {
|
||||
CaretDown,
|
||||
CaretUp,
|
||||
@@ -32,22 +32,22 @@ import {
|
||||
SpeakerHigh,
|
||||
Warning,
|
||||
type IconSizeToken,
|
||||
} from '$components/icons/phosphor';
|
||||
import { createDebugLogger } from '$utils/debugLogger';
|
||||
} from "$components/icons/phosphor";
|
||||
import { createDebugLogger } from "$utils/debugLogger";
|
||||
import {
|
||||
restrictedSupported,
|
||||
creatorsSupported,
|
||||
knockSupported,
|
||||
knockRestrictedSupported,
|
||||
} from '$utils/roomSupport';
|
||||
import { ErrorCode } from '../../cs-errorcode';
|
||||
} from "$utils/roomSupport";
|
||||
import { ErrorCode } from "../../cs-errorcode";
|
||||
|
||||
const debugLog = createDebugLogger('CreateRoom');
|
||||
const debugLog = createDebugLogger("CreateRoom");
|
||||
|
||||
const getCreateRoomAccessToIcon = (
|
||||
access: CreateRoomAccess,
|
||||
type?: CreateRoomType,
|
||||
size: IconSizeToken = '400'
|
||||
size: IconSizeToken = "400",
|
||||
): ReactNode => {
|
||||
const isVoiceRoom = type === CreateRoomType.VoiceRoom;
|
||||
|
||||
@@ -56,14 +56,14 @@ const getCreateRoomAccessToIcon = (
|
||||
if (access === CreateRoomAccess.Private) joinRule = JoinRule.Knock;
|
||||
|
||||
return iconAt(
|
||||
getRoomIconComponent(isVoiceRoom ? RoomType.UnstableCall : undefined, joinRule),
|
||||
size
|
||||
getRoomStandaloneIconComponent(isVoiceRoom ? RoomType.UnstableCall : undefined, joinRule),
|
||||
size,
|
||||
);
|
||||
};
|
||||
|
||||
const getCreateRoomTypeToIcon = (type: CreateRoomType): ReactNode => {
|
||||
if (type === CreateRoomType.VoiceRoom) return iconAt(SpeakerHigh, '400');
|
||||
return iconAt(Hash, '400');
|
||||
if (type === CreateRoomType.VoiceRoom) return iconAt(SpeakerHigh, "400");
|
||||
return iconAt(Hash, "400");
|
||||
};
|
||||
|
||||
type CreateRoomFormProps = {
|
||||
@@ -82,18 +82,18 @@ export function CreateRoomForm({
|
||||
const alive = useAlive();
|
||||
|
||||
const capabilities = useCapabilities();
|
||||
const roomVersions = capabilities['m.room_versions'];
|
||||
const [selectedRoomVersion, selectRoomVersion] = useState(roomVersions?.default ?? '1');
|
||||
const roomVersions = capabilities["m.room_versions"];
|
||||
const [selectedRoomVersion, selectRoomVersion] = useState(roomVersions?.default ?? "1");
|
||||
useEffect(() => {
|
||||
// capabilities load async
|
||||
selectRoomVersion(roomVersions?.default ?? '1');
|
||||
selectRoomVersion(roomVersions?.default ?? "1");
|
||||
}, [roomVersions?.default]);
|
||||
|
||||
const allowRestricted = space && restrictedSupported(selectedRoomVersion);
|
||||
|
||||
const [type, setType] = useState(defaultType ?? CreateRoomType.TextRoom);
|
||||
const [access, setAccess] = useState(
|
||||
defaultAccess ?? (allowRestricted ? CreateRoomAccess.Restricted : CreateRoomAccess.Private)
|
||||
defaultAccess ?? (allowRestricted ? CreateRoomAccess.Restricted : CreateRoomAccess.Private),
|
||||
);
|
||||
const allowAdditionalCreators = creatorsSupported(selectedRoomVersion);
|
||||
const { additionalCreators, addAdditionalCreator, removeAdditionalCreator } =
|
||||
@@ -115,7 +115,7 @@ export function CreateRoomForm({
|
||||
};
|
||||
|
||||
const [createState, create] = useAsyncCallback<string, Error | MatrixError, [CreateRoomData]>(
|
||||
useCallback((data) => createRoom(mx, data), [mx])
|
||||
useCallback((data) => createRoom(mx, data), [mx]),
|
||||
);
|
||||
const loading = createState.status === AsyncStatus.Loading;
|
||||
const error = createState.status === AsyncStatus.Error ? createState.error : undefined;
|
||||
@@ -147,7 +147,7 @@ export function CreateRoomForm({
|
||||
let roomType: RoomType | undefined;
|
||||
if (type === CreateRoomType.VoiceRoom) roomType = RoomType.UnstableCall;
|
||||
|
||||
debugLog.info('ui', 'Create room button clicked', {
|
||||
debugLog.info("ui", "Create room button clicked", {
|
||||
roomName,
|
||||
access,
|
||||
type,
|
||||
@@ -170,7 +170,7 @@ export function CreateRoomForm({
|
||||
allowFederation: federation,
|
||||
additionalCreators: allowAdditionalCreators ? additionalCreators : undefined,
|
||||
}).then((roomId) => {
|
||||
debugLog.info('ui', 'Room created successfully', {
|
||||
debugLog.info("ui", "Room created successfully", {
|
||||
roomId,
|
||||
roomName,
|
||||
access,
|
||||
@@ -209,7 +209,7 @@ export function CreateRoomForm({
|
||||
<Text size="L400">Name</Text>
|
||||
<Input
|
||||
required
|
||||
before={getCreateRoomAccessToIcon(access, type, '100')}
|
||||
before={getCreateRoomAccessToIcon(access, type, "100")}
|
||||
name="nameInput"
|
||||
autoFocus
|
||||
size="500"
|
||||
@@ -238,7 +238,7 @@ export function CreateRoomForm({
|
||||
<Box grow="Yes" justifyContent="End">
|
||||
<Chip
|
||||
radii="Pill"
|
||||
before={iconAt(advance ? CaretUp : CaretDown, '50')}
|
||||
before={iconAt(advance ? CaretUp : CaretDown, "50")}
|
||||
onClick={() => setAdvance(!advance)}
|
||||
type="button"
|
||||
>
|
||||
@@ -326,7 +326,7 @@ export function CreateRoomForm({
|
||||
</SequenceCard>
|
||||
{advance && (
|
||||
<RoomVersionSelector
|
||||
versions={roomVersions?.available ? Object.keys(roomVersions.available) : ['1']}
|
||||
versions={roomVersions?.available ? Object.keys(roomVersions.available) : ["1"]}
|
||||
value={selectedRoomVersion}
|
||||
onChange={handleRoomVersionChange}
|
||||
disabled={disabled}
|
||||
@@ -336,12 +336,12 @@ export function CreateRoomForm({
|
||||
|
||||
{error && (
|
||||
<Box style={{ color: color.Critical.Main }} alignItems="Center" gap="200">
|
||||
{iconAt(Warning, '100', { filled: true })}
|
||||
{iconAt(Warning, "100", { filled: true })}
|
||||
<Text size="T300" style={{ color: color.Critical.Main }}>
|
||||
<b>
|
||||
{error instanceof MatrixError && error.name === (ErrorCode.M_LIMIT_EXCEEDED as string)
|
||||
? `Server rate-limited your request for ${millisecondsToMinutes(
|
||||
(error.data.retry_after_ms as number | undefined) ?? 0
|
||||
(error.data.retry_after_ms as number | undefined) ?? 0,
|
||||
)} minutes!`
|
||||
: error.message}
|
||||
</b>
|
||||
|
||||
@@ -42,6 +42,7 @@ import {
|
||||
Smiley,
|
||||
Terminal,
|
||||
User,
|
||||
UsersThree,
|
||||
X,
|
||||
} from '$components/icons/phosphor';
|
||||
import { About } from './about';
|
||||
@@ -90,7 +91,7 @@ const settingsMenuIcons: Record<
|
||||
> = {
|
||||
general: { icon: GearSix },
|
||||
account: { icon: User },
|
||||
persona: { icon: User },
|
||||
persona: { icon: UsersThree },
|
||||
appearance: { icon: Palette },
|
||||
notifications: { icon: Bell },
|
||||
devices: { icon: DevicesIcon },
|
||||
|
||||
Reference in new issue
Block a user