Merge branch 'dev' into void/phone-hit-editor
All checks were successful
Build pull request / Build pull request (pull_request) Successful in 3m57s
All checks were successful
Build pull request / Build pull request (pull_request) Successful in 3m57s
This commit is contained in:
commit
9153ee945d
72 changed files with 584 additions and 72 deletions
|
|
@ -16,6 +16,7 @@ import {
|
|||
} from 'folds';
|
||||
import { MatrixError } from 'matrix-js-sdk';
|
||||
import { Cursor } from '../plugins/text-area';
|
||||
import { PhoneHit } from '../styles/PhoneHit.css';
|
||||
import { syntaxErrorPosition } from '../utils/dom';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { Page, PageHeader } from './page';
|
||||
|
|
@ -294,7 +295,7 @@ export function AccountDataEditor({
|
|||
</Chip>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton onClick={requestClose} variant="Surface" className={PhoneHit}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import {
|
|||
} from '../hooks/useKeyBackup';
|
||||
import { stopPropagation } from '../utils/keyboard';
|
||||
import { useRestoreBackupOnVerification } from '../hooks/useRestoreBackupOnVerification';
|
||||
import { PhoneHit } from '../styles/PhoneHit.css';
|
||||
|
||||
type BackupStatusProps = {
|
||||
enabled: boolean;
|
||||
|
|
@ -177,6 +178,7 @@ export function BackupRestoreTile({ crypto }: BackupRestoreTileProps) {
|
|||
<BackupSyncing count={remainingSession} />
|
||||
)}
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
aria-pressed={!!menuCords}
|
||||
size="300"
|
||||
variant="Surface"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import {
|
|||
} from '../hooks/useVerificationRequest';
|
||||
import { AsyncStatus, useAsyncCallback } from '../hooks/useAsyncCallback';
|
||||
import { ContainerColor } from '../styles/ContainerColor.css';
|
||||
import { PhoneHit } from '../styles/PhoneHit.css';
|
||||
|
||||
const DialogHeaderStyles: CSSProperties = {
|
||||
padding: `0 ${config.space.S200} 0 ${config.space.S400}`,
|
||||
|
|
@ -261,7 +262,7 @@ export function DeviceVerification({ request, onExit }: DeviceVerificationProps)
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Device Verification</Text>
|
||||
</Box>
|
||||
<IconButton size="300" radii="300" onClick={handleCancel}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={handleCancel}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import { ActionUIA, ActionUIAFlowsLoader } from './ActionUIA';
|
|||
import { useMatrixClient } from '../hooks/useMatrixClient';
|
||||
import { useAlive } from '../hooks/useAlive';
|
||||
import { UseStateProvider } from './UseStateProvider';
|
||||
import { PhoneHit } from '../styles/PhoneHit.css';
|
||||
|
||||
type UIACallback<T> = (
|
||||
authDict: AuthDict | null
|
||||
|
|
@ -301,7 +302,7 @@ export const DeviceVerificationSetup = forwardRef<HTMLDivElement, DeviceVerifica
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Setup Device Verification</Text>
|
||||
</Box>
|
||||
<IconButton size="300" radii="300" onClick={onCancel}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={onCancel}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
@ -336,7 +337,7 @@ export const DeviceVerificationReset = forwardRef<HTMLDivElement, DeviceVerifica
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Reset Device Verification</Text>
|
||||
</Box>
|
||||
<IconButton size="300" radii="300" onClick={onCancel}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={onCancel}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import { AsyncStatus } from '../../hooks/useAsyncCallback';
|
|||
import { useZoom } from '../../hooks/useZoom';
|
||||
import { createPage, usePdfDocumentLoader, usePdfJSLoader } from '../../plugins/pdfjs-dist';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import { PhoneHit, PhoneHitSpread24 } from '../../styles/PhoneHit.css';
|
||||
|
||||
export type PdfViewerProps = {
|
||||
name: string;
|
||||
|
|
@ -108,7 +109,7 @@ export const PdfViewer = as<'div', PdfViewerProps>(
|
|||
<Box className={classNames(css.PdfViewer, className)} direction="Column" {...props} ref={ref}>
|
||||
<Header className={css.PdfViewerHeader} size="400">
|
||||
<Box grow="Yes" alignItems="Center" gap="200">
|
||||
<IconButton size="300" radii="300" onClick={requestClose}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={requestClose}>
|
||||
<Icon size="50" src={Icons.ArrowLeft} />
|
||||
</IconButton>
|
||||
<Text size="T300" truncate>
|
||||
|
|
@ -117,6 +118,7 @@ export const PdfViewer = as<'div', PdfViewerProps>(
|
|||
</Box>
|
||||
<Box shrink="No" alignItems="Center" gap="200">
|
||||
<IconButton
|
||||
className={PhoneHitSpread24}
|
||||
variant={zoom < 1 ? 'Success' : 'SurfaceVariant'}
|
||||
outlined={zoom < 1}
|
||||
size="300"
|
||||
|
|
@ -130,6 +132,7 @@ export const PdfViewer = as<'div', PdfViewerProps>(
|
|||
<Text size="B300">{Math.round(zoom * 100)}%</Text>
|
||||
</Chip>
|
||||
<IconButton
|
||||
className={PhoneHitSpread24}
|
||||
variant={zoom > 1 ? 'Success' : 'SurfaceVariant'}
|
||||
outlined={zoom > 1}
|
||||
size="300"
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
IconButton,
|
||||
} from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { PhoneHit } from '../styles/PhoneHit.css';
|
||||
|
||||
export type UIAFlowOverlayProps = {
|
||||
currentStep: number;
|
||||
|
|
@ -53,6 +54,7 @@ export function UIAFlowOverlay({
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
ref={anchorRef}
|
||||
variant="Critical"
|
||||
size="300"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { useMediaAuthentication } from '../../hooks/useMediaAuthentication';
|
|||
import { useOpenUserRoomProfile } from '../../state/hooks/userRoomProfile';
|
||||
import { useSpaceOptionally } from '../../hooks/useSpace';
|
||||
import { getMouseEventCords } from '../../utils/dom';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
export type EventReadersProps = {
|
||||
room: Room;
|
||||
|
|
@ -52,7 +53,7 @@ export const EventReaders = as<'div', EventReadersProps>(
|
|||
<Box grow="Yes">
|
||||
<Text size="H3">Seen by</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={requestClose}>
|
||||
<IconButton className={PhoneHit} size="300" onClick={requestClose}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import React from 'react';
|
|||
import classNames from 'classnames';
|
||||
import { Box, Chip, Header, Icon, IconButton, Icons, Text, as } from 'folds';
|
||||
import * as css from './ImageEditor.css';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
export type ImageEditorProps = {
|
||||
name: string;
|
||||
|
|
@ -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}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={requestClose}>
|
||||
<Icon size="50" src={Icons.ArrowLeft} />
|
||||
</IconButton>
|
||||
<Text size="T300" truncate>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React from 'react';
|
||||
import { Box, IconButton, Text, Icon, Icons, Scroll, Chip } from 'folds';
|
||||
import { PackAddress } from '../../plugins/custom-emoji';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
import { Page, PageHeader, PageContent } from '../page';
|
||||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||
import { RoomImagePack } from './RoomImagePack';
|
||||
|
|
@ -29,7 +30,7 @@ export function ImagePackView({ address, requestClose }: ImagePackViewProps) {
|
|||
</Chip>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton onClick={requestClose} variant="Surface" className={PhoneHit}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import * as css from './ImageViewer.css';
|
|||
import { useZoom } from '../../hooks/useZoom';
|
||||
import { usePan } from '../../hooks/usePan';
|
||||
import { downloadMedia } from '../../utils/matrix';
|
||||
import { PhoneHit, PhoneHitSpread24 } from '../../styles/PhoneHit.css';
|
||||
|
||||
export type ImageViewerProps = {
|
||||
alt: string;
|
||||
|
|
@ -33,7 +34,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}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={requestClose}>
|
||||
<Icon size="50" src={Icons.ArrowLeft} />
|
||||
</IconButton>
|
||||
<Text size="T300" truncate>
|
||||
|
|
@ -42,6 +43,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
|||
</Box>
|
||||
<Box shrink="No" alignItems="Center" gap="200">
|
||||
<IconButton
|
||||
className={PhoneHitSpread24}
|
||||
variant={zoom < 1 ? 'Success' : 'SurfaceVariant'}
|
||||
outlined={zoom < 1}
|
||||
size="300"
|
||||
|
|
@ -55,6 +57,7 @@ export const ImageViewer = as<'div', ImageViewerProps>(
|
|||
<Text size="B300">{Math.round(zoom * 100)}%</Text>
|
||||
</Chip>
|
||||
<IconButton
|
||||
className={PhoneHitSpread24}
|
||||
variant={zoom > 1 ? 'Success' : 'SurfaceVariant'}
|
||||
outlined={zoom > 1}
|
||||
size="300"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
|||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||
import { BreakWord } from '../../styles/Text.css';
|
||||
import { useAlive } from '../../hooks/useAlive';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
const SEARCH_OPTIONS: UseAsyncSearchOptions = {
|
||||
limit: 1000,
|
||||
|
|
@ -173,7 +174,7 @@ export function InviteUserPrompt({ room, requestClose }: InviteUserProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton size="300" radii="300" onClick={requestClose}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={requestClose}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import { stopPropagation } from '../../utils/keyboard';
|
|||
import { isRoomAlias, isRoomId } from '../../utils/matrix';
|
||||
import { parseMatrixToRoom, parseMatrixToRoomEvent, testMatrixTo } from '../../plugins/matrix-to';
|
||||
import { tryDecodeURIComponent } from '../../utils/dom';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
type JoinAddressProps = {
|
||||
onOpen: (roomIdOrAlias: string, via?: string[], eventId?: string) => void;
|
||||
|
|
@ -82,7 +83,7 @@ export function JoinAddressPrompt({ onOpen, onCancel }: JoinAddressProps) {
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Join with Address</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<IconButton className={PhoneHit} size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import { MatrixError } from 'matrix-js-sdk';
|
|||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
type LeaveRoomPromptProps = {
|
||||
roomId: string;
|
||||
|
|
@ -68,7 +69,7 @@ export function LeaveRoomPrompt({ roomId, onDone, onCancel }: LeaveRoomPromptPro
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Leave Room</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<IconButton className={PhoneHit} size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import { MatrixError } from 'matrix-js-sdk';
|
|||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
type LeaveSpacePromptProps = {
|
||||
roomId: string;
|
||||
|
|
@ -68,7 +69,7 @@ export function LeaveSpacePrompt({ roomId, onDone, onCancel }: LeaveSpacePromptP
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Leave Space</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<IconButton className={PhoneHit} size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { Badge, Box, Icon, IconButton, Icons, Spinner, Text, as, toRem } from 'f
|
|||
import React, { ReactNode, useCallback } from 'react';
|
||||
import { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
|
||||
import FileSaver from 'file-saver';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
import { mimeTypeToExt } from '../../utils/mimeTypes';
|
||||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||
import { useMediaAuthentication } from '../../hooks/useMediaAuthentication';
|
||||
|
|
@ -48,6 +49,7 @@ export function FileDownloadButton({ filename, url, mimeType, encInfo }: FileDow
|
|||
variant={hasError ? 'Critical' : 'SurfaceVariant'}
|
||||
size="300"
|
||||
radii="300"
|
||||
className={PhoneHit}
|
||||
>
|
||||
{downloading ? (
|
||||
<Spinner size="100" variant={hasError ? 'Critical' : 'Secondary'} />
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import React, { ReactNode, useCallback, useRef, useState } from 'react';
|
|||
import { Badge, Chip, Icon, IconButton, Icons, ProgressBar, Spinner, Text, toRem } from 'folds';
|
||||
import { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
|
||||
import { Range } from 'react-range';
|
||||
import { PhoneHitSpread24 } from '../../../styles/PhoneHit.css';
|
||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
||||
import { IAudioInfo } from '../../../../types/matrix/common';
|
||||
|
|
@ -159,6 +160,7 @@ export function AudioContent({
|
|||
variant="SurfaceVariant"
|
||||
size="300"
|
||||
radii="Pill"
|
||||
className={PhoneHitSpread24}
|
||||
onClick={() => setMute(!mute)}
|
||||
aria-pressed={mute}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import classNames from 'classnames';
|
|||
import Linkify from 'linkify-react';
|
||||
import * as css from './style.css';
|
||||
import { LINKIFY_OPTS, scaleSystemEmoji } from '../../plugins/react-custom-html-parser';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
export const RoomTopicViewer = as<
|
||||
'div',
|
||||
|
|
@ -26,7 +27,7 @@ export const RoomTopicViewer = as<
|
|||
{name}
|
||||
</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={requestClose} radii="300">
|
||||
<IconButton className={PhoneHit} size="300" onClick={requestClose} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { Box, Chip, Header, Icon, IconButton, Icons, Scroll, Text, as } from 'fo
|
|||
import { ErrorBoundary } from 'react-error-boundary';
|
||||
import * as css from './TextViewer.css';
|
||||
import { copyToClipboard } from '../../utils/dom';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
const ReactPrism = lazy(() => import('../../plugins/react-prism/ReactPrism'));
|
||||
|
||||
|
|
@ -53,7 +54,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}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={requestClose}>
|
||||
<Icon size="50" src={Icons.ArrowLeft} />
|
||||
</IconButton>
|
||||
<Text size="T300" truncate>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { AuthType } from 'matrix-js-sdk';
|
|||
import { StageComponentProps } from './types';
|
||||
import { ErrorCode } from '../../cs-errorcode';
|
||||
import { PasswordInput } from '../password-input';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
export function PasswordStage({
|
||||
stageData,
|
||||
|
|
@ -45,7 +46,7 @@ export function PasswordStage({
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Account Password</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<IconButton className={PhoneHit} size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Box, Button, color, config, Dialog, Header, Icon, IconButton, Icons, Text } from 'folds';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { StageComponentProps } from './types';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
export function SSOStage({
|
||||
ssoRedirectURL,
|
||||
|
|
@ -56,7 +57,7 @@ export function SSOStage({
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">SSO Login</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<IconButton className={PhoneHit} size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import { getPowerTagIconSrc, useGetMemberPowerTag } from '../../hooks/useMemberP
|
|||
import { useRoomCreators } from '../../hooks/useRoomCreators';
|
||||
import { useRoomPermissions } from '../../hooks/useRoomPermissions';
|
||||
import { useMemberPowerCompare } from '../../hooks/useMemberPowerCompare';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
type SelfDemoteAlertProps = {
|
||||
power: number;
|
||||
|
|
@ -70,7 +71,7 @@ function SelfDemoteAlert({ power, onCancel, onChange }: SelfDemoteAlertProps) {
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Self Demotion</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<IconButton className={PhoneHit} size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
@ -120,7 +121,7 @@ function SharedPowerAlert({ power, onCancel, onChange }: SharedPowerAlertProps)
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Shared Power</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={onCancel} radii="300">
|
||||
<IconButton className={PhoneHit} size="300" onClick={onCancel} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ import { StateEvent } from '../../../types/matrix/room';
|
|||
import { getViaServers } from '../../plugins/via-servers';
|
||||
import { rateLimitedActions } from '../../utils/matrix';
|
||||
import { useAlive } from '../../hooks/useAlive';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
const SEARCH_OPTS: UseAsyncSearchOptions = {
|
||||
limit: 500,
|
||||
|
|
@ -201,7 +202,7 @@ export function AddExistingModal({ parentId, space, requestClose }: AddExistingM
|
|||
<Text size="H4">Add Existing</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton size="300" radii="300" onClick={requestClose}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={requestClose}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { StatusDivider } from './components';
|
|||
import { CallEmbed, useCallControlState } from '../../plugins/call';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
||||
import { callEmbedAtom } from '../../state/callEmbed';
|
||||
import { PhoneHitSpread26 } from '../../styles/PhoneHit.css';
|
||||
|
||||
type MicrophoneButtonProps = {
|
||||
enabled: boolean;
|
||||
|
|
@ -26,6 +27,7 @@ function MicrophoneButton({ enabled, onToggle, disabled }: MicrophoneButtonProps
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHitSpread26}
|
||||
ref={anchorRef}
|
||||
variant={enabled ? 'Surface' : 'Warning'}
|
||||
fill="Soft"
|
||||
|
|
@ -59,6 +61,7 @@ function SoundButton({ enabled, onToggle, disabled }: SoundButtonProps) {
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHitSpread26}
|
||||
ref={anchorRef}
|
||||
variant={enabled ? 'Surface' : 'Warning'}
|
||||
fill="Soft"
|
||||
|
|
@ -99,6 +102,7 @@ function VideoButton({ enabled, onToggle, disabled }: VideoButtonProps) {
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHitSpread26}
|
||||
ref={anchorRef}
|
||||
variant={enabled ? 'Success' : 'Surface'}
|
||||
fill="Soft"
|
||||
|
|
@ -136,6 +140,7 @@ function ScreenShareButton({ enabled, onToggle, disabled }: ScreenShareButtonPro
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHitSpread26}
|
||||
ref={anchorRef}
|
||||
variant={enabled ? 'Success' : 'Surface'}
|
||||
fill="Soft"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import {
|
|||
SoundButton,
|
||||
VideoButton,
|
||||
} from './Controls';
|
||||
import { PhoneHitSpread40 } from '../../styles/PhoneHit.css';
|
||||
import { CallEmbed, useCallControlState } from '../../plugins/call';
|
||||
import { useResizeObserver } from '../../hooks/useResizeObserver';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
|
|
@ -169,6 +170,7 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
|||
}
|
||||
>
|
||||
<IconButton
|
||||
className={PhoneHitSpread40}
|
||||
variant="Surface"
|
||||
fill="Soft"
|
||||
radii="400"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { useAtom } from 'jotai';
|
|||
import * as css from './styles.css';
|
||||
import { callChatAtom } from '../../state/callEmbed';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
||||
import { PhoneHitSpread40 } from '../../styles/PhoneHit.css';
|
||||
|
||||
export function ControlDivider() {
|
||||
return (
|
||||
|
|
@ -31,6 +32,7 @@ export function MicrophoneButton({ enabled, onToggle }: MicrophoneButtonProps) {
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHitSpread40}
|
||||
ref={anchorRef}
|
||||
variant={enabled ? 'Surface' : 'Warning'}
|
||||
fill="Soft"
|
||||
|
|
@ -64,6 +66,7 @@ export function SoundButton({ enabled, onToggle }: SoundButtonProps) {
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHitSpread40}
|
||||
ref={anchorRef}
|
||||
variant={enabled ? 'Surface' : 'Warning'}
|
||||
fill="Soft"
|
||||
|
|
@ -103,6 +106,7 @@ export function VideoButton({ enabled, onToggle }: VideoButtonProps) {
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHitSpread40}
|
||||
ref={anchorRef}
|
||||
variant={enabled ? 'Success' : 'Surface'}
|
||||
fill="Soft"
|
||||
|
|
@ -140,6 +144,7 @@ export function ScreenShareButton({ enabled, onToggle }: ScreenShareButtonProps)
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHitSpread40}
|
||||
ref={anchorRef}
|
||||
variant={enabled ? 'Success' : 'Surface'}
|
||||
fill="Soft"
|
||||
|
|
@ -170,6 +175,7 @@ export function ChatButton() {
|
|||
>
|
||||
{(anchorRef) => (
|
||||
<IconButton
|
||||
className={PhoneHitSpread40}
|
||||
ref={anchorRef}
|
||||
variant={chat ? 'Success' : 'Surface'}
|
||||
fill="Soft"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import {
|
|||
AccountDataSubmitCallback,
|
||||
} from '../../../components/AccountDataEditor';
|
||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type DeveloperToolsProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -92,7 +93,7 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import { useTextAreaCodeEditor } from '../../../hooks/useTextAreaCodeEditor';
|
|||
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
||||
import { syntaxErrorPosition } from '../../../utils/dom';
|
||||
import { Cursor } from '../../../plugins/text-area';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
const EDITOR_INTENT_SPACE_COUNT = 2;
|
||||
|
||||
|
|
@ -118,7 +119,7 @@ export function SendRoomEvent({ type, stateKey, requestClose }: SendRoomEventPro
|
|||
</Chip>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import { usePowerLevels } from '../../../hooks/usePowerLevels';
|
|||
import { useTextAreaCodeEditor } from '../../../hooks/useTextAreaCodeEditor';
|
||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
const EDITOR_INTENT_SPACE_COUNT = 2;
|
||||
|
||||
|
|
@ -275,7 +276,7 @@ export function StateEventEditor({ type, stateKey, requestClose }: StateEventEdi
|
|||
</Chip>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { Page, PageContent, PageHeader } from '../../../components/page';
|
|||
import { ImagePack } from '../../../plugins/custom-emoji';
|
||||
import { ImagePackView } from '../../../components/image-pack-view';
|
||||
import { RoomPacks } from './RoomPacks';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type EmojisStickersProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -29,7 +30,7 @@ export function EmojisStickers({ requestClose }: EmojisStickersProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
|||
import { useAlive } from '../../../hooks/useAlive';
|
||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type CreatePackTileProps = {
|
||||
packs: ImagePack[];
|
||||
|
|
@ -215,6 +216,7 @@ export function RoomPacks({ onViewPack }: RoomPacksProps) {
|
|||
{canEdit &&
|
||||
(removed ? (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
size="300"
|
||||
radii="Pill"
|
||||
variant="Critical"
|
||||
|
|
@ -225,6 +227,7 @@ export function RoomPacks({ onViewPack }: RoomPacksProps) {
|
|||
</IconButton>
|
||||
) : (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
size="300"
|
||||
radii="Pill"
|
||||
variant="Secondary"
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import { useRoom } from '../../../hooks/useRoom';
|
|||
import { useStateEvent } from '../../../hooks/useStateEvent';
|
||||
import { stopPropagation } from '../../../utils/keyboard';
|
||||
import { RoomPermissionsAPI } from '../../../hooks/useRoomPermissions';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
const ROOM_ENC_ALGO = 'm.megolm.v1.aes-sha2';
|
||||
|
||||
|
|
@ -123,7 +124,12 @@ export function RoomEncryption({ permissions }: RoomEncryptionProps) {
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Enable Encryption</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={() => setPrompt(false)} radii="300">
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
size="300"
|
||||
onClick={() => setPrompt(false)}
|
||||
radii="300"
|
||||
>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import { useAlive } from '../../../hooks/useAlive';
|
|||
import { creatorsSupported } from '../../../utils/matrix';
|
||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||
import { BreakWord } from '../../../styles/Text.css';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
function RoomUpgradeDialog({ requestClose }: { requestClose: () => void }) {
|
||||
const mx = useMatrixClient();
|
||||
|
|
@ -105,7 +106,7 @@ function RoomUpgradeDialog({ requestClose }: { requestClose: () => void }) {
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">{room.isSpaceRoom() ? 'Space Upgrade' : 'Room Upgrade'}</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={requestClose} radii="300">
|
||||
<IconButton className={PhoneHit} size="300" onClick={requestClose} radii="300">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ import { useSpaceOptionally } from '../../../hooks/useSpace';
|
|||
import { useFlattenPowerTagMembers, useGetMemberPowerTag } from '../../../hooks/useMemberPowerTag';
|
||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||
import { getMouseEventCords } from '../../../utils/dom';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
const SEARCH_OPTIONS: UseAsyncSearchOptions = {
|
||||
limit: 1000,
|
||||
|
|
@ -161,7 +162,7 @@ export function Members({ requestClose }: MembersProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
@ -277,6 +278,7 @@ export function Members({ requestClose }: MembersProps) {
|
|||
anchorRef={scrollTopAnchorRef}
|
||||
>
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
onClick={() => virtualizer.scrollToOffset(0)}
|
||||
variant="Surface"
|
||||
radii="Pill"
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import { useAlive } from '../../../hooks/useAlive';
|
|||
import { BetaNoticeBadge } from '../../../components/BetaNoticeBadge';
|
||||
import { getPowerTagIconSrc } from '../../../hooks/useMemberPowerTag';
|
||||
import { creatorsSupported } from '../../../utils/matrix';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type EditPowerProps = {
|
||||
maxPower: number;
|
||||
|
|
@ -369,7 +370,7 @@ export function PowersEditor({ powerLevels, requestClose }: PowersEditorProps) {
|
|||
</Chip>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {
|
|||
import { CreateRoomModalState } from '../../state/createRoomModal';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import { CreateRoomType } from '../../components/create-room/types';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
type CreateRoomModalProps = {
|
||||
state: CreateRoomModalState;
|
||||
|
|
@ -63,7 +64,7 @@ function CreateRoomModal({ state }: CreateRoomModalProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton size="300" radii="300" onClick={closeDialog}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={closeDialog}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import {
|
|||
} from '../../state/hooks/createSpaceModal';
|
||||
import { CreateSpaceModalState } from '../../state/createSpaceModal';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
type CreateSpaceModalProps = {
|
||||
state: CreateSpaceModalState;
|
||||
|
|
@ -61,7 +62,7 @@ function CreateSpaceModal({ state }: CreateSpaceModalProps) {
|
|||
<Text size="H4">New Space</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton size="300" radii="300" onClick={closeDialog}>
|
||||
<IconButton className={PhoneHit} size="300" radii="300" onClick={closeDialog}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import { IPowerLevels } from '../../hooks/usePowerLevels';
|
|||
import { getRoomCreatorsForRoomId } from '../../hooks/useRoomCreators';
|
||||
import { getRoomPermissionsAPI } from '../../hooks/useRoomPermissions';
|
||||
import { InviteUserPrompt } from '../../components/invite-user-prompt';
|
||||
import { PhoneHitSpread24 } from '../../styles/PhoneHit.css';
|
||||
|
||||
type HierarchyItemWithParent = HierarchyItem & {
|
||||
parentId: string;
|
||||
|
|
@ -231,6 +232,7 @@ export function HierarchyItemMenu({
|
|||
return (
|
||||
<Box gap="200" alignItems="Center" shrink="No">
|
||||
<IconButton
|
||||
className={PhoneHitSpread24}
|
||||
onClick={handleOpenMenu}
|
||||
size="300"
|
||||
variant="SurfaceVariant"
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import { useGetRoom } from '../../hooks/useGetRoom';
|
|||
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
||||
import { getRoomPermissionsAPI } from '../../hooks/useRoomPermissions';
|
||||
import { getRoomCreatorsForRoomId } from '../../hooks/useRoomCreators';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
const useCanDropLobbyItem = (
|
||||
space: Room,
|
||||
|
|
@ -413,6 +414,7 @@ export function Lobby() {
|
|||
onVisibilityChange={setOnTop}
|
||||
>
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
onClick={() => virtualizer.scrollToOffset(0)}
|
||||
variant="SurfaceVariant"
|
||||
radii="Pill"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import { SearchResultGroup } from './SearchResultGroup';
|
|||
import { SearchInput } from './SearchInput';
|
||||
import { SearchFilters } from './SearchFilters';
|
||||
import { VirtualTile } from '../../components/virtualizer';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
const useSearchPathSearchParams = (searchParams: URLSearchParams): _SearchPathSearchParams =>
|
||||
useMemo(
|
||||
|
|
@ -193,6 +194,7 @@ export function MessageSearch({
|
|||
<Box direction="Column" gap="700">
|
||||
<ScrollTopContainer scrollRef={scrollRef} anchorRef={scrollTopAnchorRef}>
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
onClick={() => virtualizer.scrollToOffset(0)}
|
||||
variant="SurfaceVariant"
|
||||
radii="Pill"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import { Permissions } from './permissions';
|
|||
import { RoomSettingsPage } from '../../state/roomSettings';
|
||||
import { useRoom } from '../../hooks/useRoom';
|
||||
import { DeveloperTools } from '../common-settings/developer-tools';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
type RoomSettingsMenuItem = {
|
||||
page: RoomSettingsPage;
|
||||
|
|
@ -117,7 +118,7 @@ export function RoomSettings({ initialPage, requestClose }: RoomSettingsProps) {
|
|||
</Box>
|
||||
<Box shrink="No">
|
||||
{screenSize === ScreenSize.Mobile && (
|
||||
<IconButton onClick={requestClose} variant="Background">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Background">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import {
|
|||
} from '../../common-settings/general';
|
||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type GeneralProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -35,7 +36,7 @@ export function General({ requestClose }: GeneralProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { usePermissionGroups } from './usePermissionItems';
|
|||
import { PermissionGroups, Powers, PowersEditor } from '../../common-settings/permissions';
|
||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type PermissionsProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -45,7 +46,7 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import { About } from './about';
|
|||
import { UseStateProvider } from '../../components/UseStateProvider';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import { LogoutDialog } from '../../components/LogoutDialog';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
export enum SettingsPages {
|
||||
GeneralPage,
|
||||
|
|
@ -141,7 +142,7 @@ export function Settings({ initialPage, requestClose }: SettingsProps) {
|
|||
</Box>
|
||||
<Box shrink="No">
|
||||
{screenSize === ScreenSize.Mobile && (
|
||||
<IconButton onClick={requestClose} variant="Background">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Background">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { LogoMark } from '../../../components/logo/logoMark.css';
|
|||
import RatatoskrSVG from '../../../../../public/res/svg/ratatoskr.svg';
|
||||
import { clearCacheAndReload } from '../../../../client/initMatrix';
|
||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type AboutProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -25,7 +26,7 @@ export function About({ requestClose }: AboutProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { MatrixId } from './MatrixId';
|
|||
import { Profile } from './Profile';
|
||||
import { ContactInformation } from './ContactInfo';
|
||||
import { IgnoredUserList } from './IgnoredUserList';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type AccountProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -20,7 +21,7 @@ export function Account({ requestClose }: AccountProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
|||
import { isUserId } from '../../../utils/matrix';
|
||||
import { useIgnoredUsers } from '../../../hooks/useIgnoredUsers';
|
||||
import { useAlive } from '../../../hooks/useAlive';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
function IgnoreUserInput({ userList }: { userList: string[] }) {
|
||||
const mx = useMatrixClient();
|
||||
|
|
@ -67,6 +68,7 @@ function IgnoreUserInput({ userList }: { userList: string[] }) {
|
|||
userId &&
|
||||
!ignoring && (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
type="reset"
|
||||
onClick={handleReset}
|
||||
size="300"
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import { ModalWide } from '../../../styles/Modal.css';
|
|||
import { createUploadAtom, UploadSuccess } from '../../../state/upload';
|
||||
import { CompactUploadCardRenderer } from '../../../components/upload-card';
|
||||
import { useCapabilities } from '../../../hooks/useCapabilities';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type ProfileProps = {
|
||||
profile: UserProfile;
|
||||
|
|
@ -185,7 +186,12 @@ function ProfileAvatar({ profile, userId }: ProfileProps) {
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Remove Avatar</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={() => setAlertRemove(false)} radii="300">
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
size="300"
|
||||
onClick={() => setAlertRemove(false)}
|
||||
radii="300"
|
||||
>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
@ -273,6 +279,7 @@ function ProfileDisplayName({ profile, userId }: ProfileProps) {
|
|||
hasChanges &&
|
||||
!changingDisplayName && (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
type="reset"
|
||||
onClick={handleReset}
|
||||
size="300"
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
} from '../../../components/AccountDataEditor';
|
||||
import { copyToClipboard } from '../../../utils/dom';
|
||||
import { AccountData } from './AccountData';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type DeveloperToolsProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -51,7 +52,7 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import { LogoutDialog } from '../../../components/LogoutDialog';
|
|||
import { stopPropagation } from '../../../utils/keyboard';
|
||||
import { useSetting } from '../../../state/hooks/settings';
|
||||
import { settingsAtom } from '../../../state/settings';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
export function DeviceTilePlaceholder() {
|
||||
return (
|
||||
|
|
@ -288,6 +289,7 @@ export function DeviceTile({
|
|||
<SettingTile
|
||||
before={
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
variant={deleted ? 'Critical' : 'Secondary'}
|
||||
outlined={deleted}
|
||||
radii="300"
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import {
|
|||
} from '../../../hooks/useSecretStorage';
|
||||
import { useCrossSigningActive } from '../../../hooks/useCrossSigning';
|
||||
import { BackupRestoreTile } from '../../../components/BackupRestore';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
function DevicesPlaceholder() {
|
||||
return (
|
||||
|
|
@ -74,7 +75,7 @@ export function Devices({ requestClose }: DevicesProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import { stopPropagation } from '../../../utils/keyboard';
|
|||
import { useAuthMetadata } from '../../../hooks/useAuthMetadata';
|
||||
import { withSearchParam } from '../../../pages/pathUtils';
|
||||
import { useAccountManagementActions } from '../../../hooks/useAccountManagement';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type VerificationStatusBadgeProps = {
|
||||
verificationStatus: VerificationStatus;
|
||||
|
|
@ -288,6 +289,7 @@ export function DeviceVerificationOptions() {
|
|||
return (
|
||||
<>
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
aria-pressed={!!menuCords}
|
||||
variant="SurfaceVariant"
|
||||
size="300"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { GlobalPacks } from './GlobalPacks';
|
|||
import { UserPack } from './UserPack';
|
||||
import { ImagePack } from '../../../plugins/custom-emoji';
|
||||
import { ImagePackView } from '../../../components/image-pack-view';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type EmojisStickersProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -30,7 +31,7 @@ export function EmojisStickers({ requestClose }: EmojisStickersProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import { allRoomsAtom } from '../../../state/room-list/roomList';
|
|||
import { AccountDataEvent } from '../../../../types/matrix/accountData';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
||||
import { stopPropagation } from '../../../utils/keyboard';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
function GlobalPackSelector({
|
||||
packs,
|
||||
|
|
@ -368,6 +369,7 @@ export function GlobalPacks({ onViewPack }: GlobalPacksProps) {
|
|||
<Box alignItems="Center" gap="300">
|
||||
{removed ? (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
size="300"
|
||||
radii="Pill"
|
||||
variant="Critical"
|
||||
|
|
@ -378,6 +380,7 @@ export function GlobalPacks({ onViewPack }: GlobalPacksProps) {
|
|||
</IconButton>
|
||||
) : (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
size="300"
|
||||
radii="Pill"
|
||||
variant="Secondary"
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import { useMessageLayoutItems } from '../../../hooks/useMessageLayout';
|
|||
import { useMessageSpacingItems } from '../../../hooks/useMessageSpacing';
|
||||
import { useDateFormatItems } from '../../../hooks/useDateFormat';
|
||||
import { SequenceCardStyle } from '../styles.css';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type ThemeSelectorProps = {
|
||||
themeNames: Record<string, string>;
|
||||
|
|
@ -497,6 +498,7 @@ function DateHint({ hasChanges, handleReset }: DateHintProps) {
|
|||
>
|
||||
{hasChanges ? (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
tabIndex={-1}
|
||||
onClick={handleReset}
|
||||
type="reset"
|
||||
|
|
@ -508,6 +510,7 @@ function DateHint({ hasChanges, handleReset }: DateHintProps) {
|
|||
</IconButton>
|
||||
) : (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
tabIndex={-1}
|
||||
onClick={handleOpenMenu}
|
||||
type="button"
|
||||
|
|
@ -1015,7 +1018,7 @@ export function General({ requestClose }: GeneralProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import {
|
|||
} from '../../../hooks/useNotificationMode';
|
||||
import { NotificationModeSwitcher } from './NotificationModeSwitcher';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
const NOTIFY_MODE_OPS: NotificationModeOptions = {
|
||||
highlight: true,
|
||||
|
|
@ -75,6 +76,7 @@ function KeywordInput() {
|
|||
keyword &&
|
||||
!addingKeyword && (
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
type="reset"
|
||||
onClick={handleReset}
|
||||
size="300"
|
||||
|
|
@ -118,7 +120,14 @@ function KeywordCross({ pushRule }: PushRulesProps) {
|
|||
|
||||
const removing = removeState.status === AsyncStatus.Loading;
|
||||
return (
|
||||
<IconButton onClick={remove} size="300" radii="Pill" variant="Secondary" disabled={removing}>
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
onClick={remove}
|
||||
size="300"
|
||||
radii="Pill"
|
||||
variant="Secondary"
|
||||
disabled={removing}
|
||||
>
|
||||
{removing ? <Spinner size="100" /> : <Icon src={Icons.Cross} size="100" />}
|
||||
</IconButton>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { KeywordMessagesNotifications } from './KeywordMessages';
|
|||
import { SequenceCard } from '../../../components/sequence-card';
|
||||
import { SequenceCardStyle } from '../styles.css';
|
||||
import { SettingTile } from '../../../components/setting-tile';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type NotificationsProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -23,7 +24,7 @@ export function Notifications({ requestClose }: NotificationsProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import { Members } from '../common-settings/members';
|
|||
import { DeveloperTools } from '../common-settings/developer-tools';
|
||||
import { General } from './general';
|
||||
import { Permissions } from './permissions';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
type SpaceSettingsMenuItem = {
|
||||
page: SpaceSettingsPage;
|
||||
|
|
@ -117,7 +118,7 @@ export function SpaceSettings({ initialPage, requestClose }: SpaceSettingsProps)
|
|||
</Box>
|
||||
<Box shrink="No">
|
||||
{screenSize === ScreenSize.Mobile && (
|
||||
<IconButton onClick={requestClose} variant="Background">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Background">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
} from '../../common-settings/general';
|
||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type GeneralProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -33,7 +34,7 @@ export function General({ requestClose }: GeneralProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { usePermissionGroups } from './usePermissionItems';
|
|||
import { PermissionGroups, Powers, PowersEditor } from '../../common-settings/permissions';
|
||||
import { useRoomCreators } from '../../../hooks/useRoomCreators';
|
||||
import { useRoomPermissions } from '../../../hooks/useRoomPermissions';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
type PermissionsProps = {
|
||||
requestClose: () => void;
|
||||
|
|
@ -45,7 +46,7 @@ export function Permissions({ requestClose }: PermissionsProps) {
|
|||
</Text>
|
||||
</Box>
|
||||
<Box shrink="No">
|
||||
<IconButton onClick={requestClose} variant="Surface">
|
||||
<IconButton className={PhoneHit} onClick={requestClose} variant="Surface">
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import FocusTrap from 'focus-trap-react';
|
|||
|
||||
import { useDebounce } from '../../hooks/useDebounce';
|
||||
import { stopPropagation } from '../../utils/keyboard';
|
||||
import { PhoneHit } from '../../styles/PhoneHit.css';
|
||||
|
||||
export function ServerPicker({
|
||||
server,
|
||||
|
|
@ -129,6 +130,7 @@ export function ServerPicker({
|
|||
}
|
||||
>
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
onClick={handleOpenServerMenu}
|
||||
variant={allowCustomServer ? 'Background' : 'Surface'}
|
||||
size="300"
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
|||
import { useNavToActivePathMapper } from '../../../hooks/useNavToActivePathMapper';
|
||||
import { PageNav, PageNavContent, PageNavHeader } from '../../../components/page';
|
||||
import { stopPropagation } from '../../../utils/keyboard';
|
||||
import { PhoneHit } from '../../../styles/PhoneHit.css';
|
||||
|
||||
export function AddServer() {
|
||||
const mx = useMatrixClient();
|
||||
|
|
@ -96,7 +97,12 @@ export function AddServer() {
|
|||
<Box grow="Yes">
|
||||
<Text size="H4">Add Server</Text>
|
||||
</Box>
|
||||
<IconButton size="300" onClick={() => setDialog(false)} radii="300">
|
||||
<IconButton
|
||||
className={PhoneHit}
|
||||
size="300"
|
||||
onClick={() => setDialog(false)}
|
||||
radii="300"
|
||||
>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
|
|
|
|||
15
src/app/phoneHit.call.test.ts
Normal file
15
src/app/phoneHit.call.test.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { describe, it } from 'vitest';
|
||||
import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
|
||||
|
||||
// Every IconButton of the call bars carries the phone hit-area variant of its drawn size, in source order
|
||||
// (mic, sound, video, share, chat; the menu button; the call-status mic, sound, video, share).
|
||||
describe('icon buttons in the call controls', () => {
|
||||
it.each([
|
||||
['features/call/Controls.tsx', Array(5).fill('PhoneHitSpread40')],
|
||||
['features/call/CallControls.tsx', ['PhoneHitSpread40']],
|
||||
['features/call-status/CallControl.tsx', Array(4).fill('PhoneHitSpread26')],
|
||||
])('%s', (file, want) => {
|
||||
expectPhoneHitClasses(file as string, want as string[]);
|
||||
expectSizeTie(file as string);
|
||||
});
|
||||
});
|
||||
26
src/app/phoneHit.commonSettings.test.ts
Normal file
26
src/app/phoneHit.commonSettings.test.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { describe, it } from 'vitest';
|
||||
import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
|
||||
|
||||
// Every IconButton under features/common-settings, in source order. Header close buttons are alone at the
|
||||
// header end (the title beside them is text), the dialog close buttons are alone in their Header, the
|
||||
// scroll-to-top button floats alone, and the RoomPacks pair is a ternary (only one renders): all PhoneHit.
|
||||
const files: [string, string[]][] = [
|
||||
['features/common-settings/members/Members.tsx', ['PhoneHit', 'PhoneHit']],
|
||||
['features/common-settings/developer-tools/SendRoomEvent.tsx', ['PhoneHit']],
|
||||
['features/common-settings/developer-tools/StateEventEditor.tsx', ['PhoneHit']],
|
||||
['features/common-settings/developer-tools/DevelopTools.tsx', ['PhoneHit']],
|
||||
['features/common-settings/permissions/PowersEditor.tsx', ['PhoneHit']],
|
||||
['features/common-settings/emojis-stickers/EmojisStickers.tsx', ['PhoneHit']],
|
||||
['features/common-settings/emojis-stickers/RoomPacks.tsx', ['PhoneHit', 'PhoneHit']],
|
||||
['features/common-settings/general/RoomEncryption.tsx', ['PhoneHit']],
|
||||
['features/common-settings/general/RoomUpgrade.tsx', ['PhoneHit']],
|
||||
];
|
||||
|
||||
describe.each(files)('phone hit area: %s', (file, want) => {
|
||||
it('carries the variant its drawn size and neighbours call for', () => {
|
||||
expectPhoneHitClasses(file, want);
|
||||
});
|
||||
it('names a size that matches what it draws', () => {
|
||||
expectSizeTie(file);
|
||||
});
|
||||
});
|
||||
26
src/app/phoneHit.content.test.ts
Normal file
26
src/app/phoneHit.content.test.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { describe, it } from 'vitest';
|
||||
import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
|
||||
|
||||
describe('icon buttons in message content and data editors', () => {
|
||||
// The class each IconButton must carry, in source order.
|
||||
const expected: Record<string, string[]> = {
|
||||
// mute toggle, 16 px icon + 8 padding = 24 px, 8 px from the volume slider (tappable)
|
||||
'components/message/content/AudioContent.tsx': ['PhoneHitSpread24'],
|
||||
// download, alone at the end of the header row (26 px)
|
||||
'components/message/FileHeader.tsx': ['PhoneHit'],
|
||||
// code block expand/collapse, 24 px, 8 px from the Copy chip
|
||||
'plugins/react-custom-html-parser.tsx': ['PhoneHitSpread24'],
|
||||
// close at the header end, alone
|
||||
'components/AccountDataEditor.tsx': ['PhoneHit'],
|
||||
'components/image-pack-view/ImagePackView.tsx': ['PhoneHit'],
|
||||
};
|
||||
|
||||
it.each(Object.entries(expected))(
|
||||
'%s: each IconButton carries its own PhoneHit class',
|
||||
(file, want) => expectPhoneHitClasses(file, want)
|
||||
);
|
||||
|
||||
it.each(Object.keys(expected))('%s: a sized variant matches the drawn size', (file) =>
|
||||
expectSizeTie(file)
|
||||
);
|
||||
});
|
||||
28
src/app/phoneHit.dialogs.test.ts
Normal file
28
src/app/phoneHit.dialogs.test.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { describe, it } from 'vitest';
|
||||
import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
|
||||
|
||||
// Dialog and prompt close buttons: each is a 32 px button (24 px Icon + 8 px padding) alone at the end of a
|
||||
// header whose title is not tappable, so the plain PhoneHit; no neighbour to spread from, no clipping container.
|
||||
describe('icon buttons in dialogs and prompts', () => {
|
||||
const expected: Record<string, string[]> = {
|
||||
'features/create-space/CreateSpaceModal.tsx': ['PhoneHit'],
|
||||
'features/create-room/CreateRoomModal.tsx': ['PhoneHit'],
|
||||
'features/add-existing/AddExisting.tsx': ['PhoneHit'],
|
||||
'components/room-topic-viewer/RoomTopicViewer.tsx': ['PhoneHit'],
|
||||
'components/leave-room-prompt/LeaveRoomPrompt.tsx': ['PhoneHit'],
|
||||
'components/leave-space-prompt/LeaveSpacePrompt.tsx': ['PhoneHit'],
|
||||
'components/event-readers/EventReaders.tsx': ['PhoneHit'],
|
||||
'components/invite-user-prompt/InviteUserPrompt.tsx': ['PhoneHit'],
|
||||
'components/join-address-prompt/JoinAddressPrompt.tsx': ['PhoneHit'], // join cancel
|
||||
'components/user-profile/PowerChip.tsx': ['PhoneHit', 'PhoneHit'], // self demotion, shared power
|
||||
};
|
||||
|
||||
it.each(Object.entries(expected))(
|
||||
'%s: each IconButton carries its own PhoneHit class',
|
||||
(file, want) => expectPhoneHitClasses(file, want)
|
||||
);
|
||||
|
||||
it.each(Object.keys(expected))('%s: a sized variant matches the drawn size', (file) =>
|
||||
expectSizeTie(file)
|
||||
);
|
||||
});
|
||||
28
src/app/phoneHit.roomSpace.test.ts
Normal file
28
src/app/phoneHit.roomSpace.test.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { describe, it } from 'vitest';
|
||||
import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
|
||||
|
||||
describe('icon buttons in room settings, space settings, lobby, search and explore', () => {
|
||||
// The class each IconButton must carry, in source order. Vertical stacks and lone buttons: the plain PhoneHit.
|
||||
const expected: Record<string, string[]> = {
|
||||
'features/room-settings/RoomSettings.tsx': ['PhoneHit'], // close, phone only, alone at the header end
|
||||
'features/room-settings/general/General.tsx': ['PhoneHit'], // close, 40 px
|
||||
'features/room-settings/permissions/Permissions.tsx': ['PhoneHit'],
|
||||
'features/space-settings/SpaceSettings.tsx': ['PhoneHit'],
|
||||
'features/space-settings/general/General.tsx': ['PhoneHit'],
|
||||
'features/space-settings/permissions/Permissions.tsx': ['PhoneHit'],
|
||||
// 16 px icon + 8 padding = 24 px, 8-12 px from the Open / Add chips beside it in a hierarchy card
|
||||
'features/lobby/HierarchyItemMenu.tsx': ['PhoneHitSpread24'],
|
||||
'features/lobby/Lobby.tsx': ['PhoneHit'], // floating scroll-to-top, alone
|
||||
'features/message-search/MessageSearch.tsx': ['PhoneHit'], // floating scroll-to-top, alone
|
||||
'pages/client/explore/Explore.tsx': ['PhoneHit'], // Add Server dialog close
|
||||
};
|
||||
|
||||
it.each(Object.entries(expected))(
|
||||
'%s: each IconButton carries its own PhoneHit class',
|
||||
(file, want) => expectPhoneHitClasses(file, want)
|
||||
);
|
||||
|
||||
it.each(Object.keys(expected))('%s: a sized variant matches the drawn size', (file) =>
|
||||
expectSizeTie(file)
|
||||
);
|
||||
});
|
||||
29
src/app/phoneHit.settingsA.test.ts
Normal file
29
src/app/phoneHit.settingsA.test.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { describe, it } from 'vitest';
|
||||
import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
|
||||
|
||||
describe('icon buttons in settings A', () => {
|
||||
// The class each IconButton must carry, in source order. Every one is alone in its row (a header close next to
|
||||
// non-tappable title text, an input slot, or a list tile beside a non-tappable Avatar), so the plain PhoneHit.
|
||||
const expected: Record<string, string[]> = {
|
||||
'features/settings/developer-tools/DevelopTools.tsx': ['PhoneHit'], // header close, 40 px
|
||||
'features/settings/notifications/Notifications.tsx': ['PhoneHit'], // header close, 40 px
|
||||
'features/settings/notifications/KeywordMessages.tsx': ['PhoneHit', 'PhoneHit'], // input reset, remove: 26 px, alone
|
||||
'features/settings/emojis-stickers/EmojisStickers.tsx': ['PhoneHit'], // header close, 40 px
|
||||
'features/settings/emojis-stickers/GlobalPacks.tsx': ['PhoneHit', 'PhoneHit'], // undo / remove, a ternary pair, 26 px
|
||||
'features/settings/Settings.tsx': ['PhoneHit'], // mobile-only header close, 40 px
|
||||
'features/settings/about/About.tsx': ['PhoneHit'], // header close, 40 px
|
||||
'features/settings/general/General.tsx': ['PhoneHit', 'PhoneHit', 'PhoneHit'], // reset / info (ternary), header close
|
||||
'features/settings/account/Account.tsx': ['PhoneHit'], // header close, 40 px
|
||||
'features/settings/devices/Devices.tsx': ['PhoneHit'], // header close, 40 px
|
||||
};
|
||||
|
||||
it.each(Object.entries(expected))('%s carries the right hit-area class', (file, want) => {
|
||||
expectPhoneHitClasses(file, want);
|
||||
});
|
||||
|
||||
// Plain PhoneHit has no size to tie, so nothing is allow-listed; the check still fails an allow-list entry
|
||||
// or a sized variant that disagrees with the drawn size if one is added later.
|
||||
it.each(Object.keys(expected))('%s ties a sized variant to the drawn size', (file) => {
|
||||
expectSizeTie(file);
|
||||
});
|
||||
});
|
||||
21
src/app/phoneHit.settingsB.test.ts
Normal file
21
src/app/phoneHit.settingsB.test.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { describe, it } from 'vitest';
|
||||
import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
|
||||
|
||||
// Each IconButton here is alone in its slot (a dialog header's close, an input's clear button, a tile's lone
|
||||
// menu or chevron button, its neighbours being text or a badge), so each takes PhoneHit. Every size is derivable
|
||||
// from the source, so nothing is allow-listed; plain PhoneHit has no number to tie.
|
||||
const files: [string, string[]][] = [
|
||||
['features/settings/account/Profile.tsx', ['PhoneHit', 'PhoneHit']],
|
||||
['features/settings/account/IgnoredUserList.tsx', ['PhoneHit']],
|
||||
['features/settings/devices/Verification.tsx', ['PhoneHit']],
|
||||
['features/settings/devices/DeviceTile.tsx', ['PhoneHit']],
|
||||
['pages/auth/ServerPicker.tsx', ['PhoneHit']],
|
||||
['components/BackupRestore.tsx', ['PhoneHit']],
|
||||
['components/DeviceVerification.tsx', ['PhoneHit']],
|
||||
['components/DeviceVerificationSetup.tsx', ['PhoneHit', 'PhoneHit']],
|
||||
];
|
||||
|
||||
describe.each(files)('phone hit area: %s', (file, want) => {
|
||||
it('gives each icon button its variant', () => expectPhoneHitClasses(file, want));
|
||||
it('ties each sized variant to the size it draws', () => expectSizeTie(file));
|
||||
});
|
||||
27
src/app/phoneHit.viewers.test.ts
Normal file
27
src/app/phoneHit.viewers.test.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { describe, it } from 'vitest';
|
||||
import { expectPhoneHitClasses, expectSizeTie } from './phoneHitTestKit';
|
||||
|
||||
// Viewer headers and the UIA stages. The back/close button sits beside a title that is not tappable, so it is a
|
||||
// plain PhoneHit; the zoom out/in buttons sit either side of a tappable zoom Chip, so they spread at their drawn
|
||||
// 24 px (IconButton size 300 around a 16 px Icon).
|
||||
// Not covered: the two scroll arrows of components/url-preview/UrlPreviewCard.tsx. They are position: absolute and
|
||||
// PhoneHit sets position: relative on phones, which would pull them into the flow; they need a variant that keeps
|
||||
// the position, which PhoneHit.css.ts does not have yet.
|
||||
const files: [string, string[]][] = [
|
||||
['components/uia-stages/PasswordStage.tsx', ['PhoneHit']],
|
||||
['components/uia-stages/SSOStage.tsx', ['PhoneHit']],
|
||||
['components/UIAFlowOverlay.tsx', ['PhoneHit']],
|
||||
['components/text-viewer/TextViewer.tsx', ['PhoneHit']],
|
||||
['components/image-editor/ImageEditor.tsx', ['PhoneHit']],
|
||||
['components/image-viewer/ImageViewer.tsx', ['PhoneHit', 'PhoneHitSpread24', 'PhoneHitSpread24']],
|
||||
['components/Pdf-viewer/PdfViewer.tsx', ['PhoneHit', 'PhoneHitSpread24', 'PhoneHitSpread24']],
|
||||
];
|
||||
|
||||
describe.each(files)('phone hit area: %s', (file, want) => {
|
||||
it('gives each icon button the variant of its surroundings', () => {
|
||||
expectPhoneHitClasses(file, want);
|
||||
});
|
||||
it('ties each sized variant to the size the button draws', () => {
|
||||
expectSizeTie(file);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import { drawnPx, expectSizeTie, iconButtons } from './phoneHitTestKit';
|
||||
import { mkdtempSync, rmSync, writeFileSync } from 'fs';
|
||||
import { tmpdir } from 'os';
|
||||
import { relative } from 'path';
|
||||
import {
|
||||
drawnPx,
|
||||
expectPhoneHitClasses,
|
||||
expectSizeTie,
|
||||
iconButtons,
|
||||
phoneHitOf,
|
||||
} from './phoneHitTestKit';
|
||||
|
||||
describe('phone hit test kit', () => {
|
||||
it('reads <IconButton only, not a longer component name', () => {
|
||||
|
|
@ -38,4 +47,108 @@ describe('phone hit test kit', () => {
|
|||
it('fails a file with no IconButton, which would otherwise pass vacuously', () => {
|
||||
expect(() => expectSizeTie('styles/PhoneHit.css.ts')).toThrow(/no IconButton/);
|
||||
});
|
||||
|
||||
describe('phoneHitOf reads the imported class off the AST, applied unconditionally', () => {
|
||||
const tag = (expr: string) => `<IconButton size="300" className={${expr}}>`;
|
||||
const ok = (expr: string, name: string) => expect(phoneHitOf(tag(expr))).toBe(name);
|
||||
const no = (expr: string) => expect(phoneHitOf(tag(expr))).toBeNull();
|
||||
|
||||
it('accepts the bare identifier and merges that always include it', () => {
|
||||
ok('PhoneHitSpread26', 'PhoneHitSpread26');
|
||||
ok('classNames(PhoneHitRoom36, css.other)', 'PhoneHitRoom36');
|
||||
ok('clsx(css.a, { [css.b]: on }, PhoneHit)', 'PhoneHit');
|
||||
ok('cx(PhoneHit)', 'PhoneHit');
|
||||
ok('`${PhoneHit} ${css.other}`', 'PhoneHit');
|
||||
ok('classNames(/* PhoneHit */ PhoneHit)', 'PhoneHit');
|
||||
});
|
||||
|
||||
it('rejects the name as a string, a concatenation or a comment', () => {
|
||||
no("'PhoneHitSpread26'");
|
||||
no('`PhoneHitSpread26`');
|
||||
no('"PhoneHitSpread26" + "x"');
|
||||
no("'PhoneHit' + 'Spread26'");
|
||||
no('/* PhoneHit */ undefined');
|
||||
no('css.a // PhoneHit');
|
||||
});
|
||||
|
||||
it('rejects a conditionally applied name', () => {
|
||||
no('cond ? PhoneHitSpread26 : undefined');
|
||||
no('cond && PhoneHitSpread26');
|
||||
no('cond || PhoneHitSpread26');
|
||||
no('maybe ?? PhoneHitSpread26');
|
||||
no("classNames(cond ? PhoneHit : '', css.a)");
|
||||
no('classNames(PhoneHit, cond && PhoneHit)');
|
||||
});
|
||||
|
||||
it('rejects every other expression shape the name can hide in', () => {
|
||||
no('classNames({ PhoneHit: on })');
|
||||
no('clsx({ [PhoneHit]: on })');
|
||||
no('`${`${PhoneHit}`}`');
|
||||
no('typeof PhoneHit');
|
||||
no("(PhoneHit = 'x')");
|
||||
no('(PhoneHit, css.a)');
|
||||
no('(PhoneHit)');
|
||||
no('() => PhoneHit');
|
||||
no('PhoneHit.foo');
|
||||
no('other.PhoneHit');
|
||||
no('classNames(css.a, [PhoneHit])');
|
||||
no('wrap(PhoneHit)');
|
||||
no('PhoneHitSpread26é');
|
||||
no('`${css.a}`');
|
||||
});
|
||||
|
||||
it('rejects a tag without className, with two, or with a non-expression one', () => {
|
||||
expect(phoneHitOf('<IconButton size="300">')).toBeNull();
|
||||
expect(phoneHitOf('<IconButton className={PhoneHit} className={css.a}>')).toBeNull();
|
||||
expect(phoneHitOf('<IconButton className="PhoneHit">')).toBeNull();
|
||||
expect(phoneHitOf('<IconButton className={PhoneHit} />')).toBe('PhoneHit');
|
||||
});
|
||||
|
||||
it('rejects a spread after className, which can override it, and accepts one before', () => {
|
||||
expect(phoneHitOf('<IconButton className={PhoneHit} {...props}>')).toBeNull();
|
||||
expect(phoneHitOf('<IconButton className={PhoneHit} size="300" {...props} />')).toBeNull();
|
||||
expect(phoneHitOf('<IconButton {...props} className={PhoneHit}>')).toBe('PhoneHit');
|
||||
});
|
||||
|
||||
it('reads a className past braces inside strings', () => {
|
||||
ok("classNames('{', PhoneHit)", 'PhoneHit');
|
||||
});
|
||||
});
|
||||
|
||||
describe('expectPhoneHitClasses', () => {
|
||||
const check = (src: string, want: (string | null)[]) => {
|
||||
const dir = mkdtempSync(`${tmpdir()}/phone-hit-kit-`);
|
||||
try {
|
||||
writeFileSync(`${dir}/Probe.tsx`, src);
|
||||
expectPhoneHitClasses(relative(`${process.cwd()}/src/app`, `${dir}/Probe.tsx`), want);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true });
|
||||
}
|
||||
};
|
||||
const imp = "import { PhoneHit, PhoneHitSpread26 } from '../../styles/PhoneHit.css';\n";
|
||||
const src =
|
||||
imp +
|
||||
'const A = () => (<><IconButton className={PhoneHit} /><IconButton className={classNames(PhoneHitSpread26, a)} /><IconButton /></>);';
|
||||
|
||||
it('pins each button in order, null meaning no class', () => {
|
||||
check(src, ['PhoneHit', 'PhoneHitSpread26', null]);
|
||||
expect(() => check(src, ['PhoneHit', 'PhoneHit', null])).toThrow();
|
||||
expect(() => check(src, ['PhoneHit', 'PhoneHitSpread26', 'PhoneHit'])).toThrow();
|
||||
expect(() => check(src, ['PhoneHit', 'PhoneHitSpread26'])).toThrow();
|
||||
});
|
||||
|
||||
it('fails a name that is not read from PhoneHit.css or is applied conditionally', () => {
|
||||
const local = "const PhoneHit = 'x';\n<IconButton className={PhoneHit} />";
|
||||
expect(() => check(local, ['PhoneHit'])).toThrow();
|
||||
expect(() => check(local, [null])).not.toThrow();
|
||||
const cond = imp + '<IconButton className={on ? PhoneHit : undefined} />';
|
||||
expect(() => check(cond, ['PhoneHit'])).toThrow();
|
||||
const aliased =
|
||||
"import { Other as PhoneHit } from '../../styles/PhoneHit.css';\n<IconButton className={PhoneHit} />";
|
||||
expect(() => check(aliased, ['PhoneHit'])).toThrow();
|
||||
const wrongModule =
|
||||
"import { PhoneHit } from './other';\n<IconButton className={PhoneHit} />";
|
||||
expect(() => check(wrongModule, ['PhoneHit'])).toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// group of IconButtons). Not a test file: it registers nothing, the test files call it.
|
||||
import { readFileSync } from 'fs';
|
||||
import { expect } from 'vitest';
|
||||
import ts from 'typescript';
|
||||
import zlib from 'zlib';
|
||||
import { compile, processVanillaFile } from '@vanilla-extract/integration';
|
||||
|
||||
|
|
@ -72,36 +73,113 @@ const tagEnd = (src: string, from: number) => {
|
|||
return j;
|
||||
};
|
||||
|
||||
/** Every <IconButton (not <IconButtonX): its opening tag, read to its closing > outside any {} expression, and
|
||||
* what it wraps (empty when self-closing). */
|
||||
const tsx = (src: string) =>
|
||||
ts.createSourceFile('source.tsx', src, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
||||
|
||||
type Opening = ts.JsxOpeningElement | ts.JsxSelfClosingElement;
|
||||
|
||||
/** Every IconButton element (not IconButtonX) of a parsed source, in source order. */
|
||||
const elements = (sf: ts.SourceFile) => {
|
||||
const found: Opening[] = [];
|
||||
const walk = (n: ts.Node) => {
|
||||
if (
|
||||
(ts.isJsxOpeningElement(n) || ts.isJsxSelfClosingElement(n)) &&
|
||||
ts.isIdentifier(n.tagName) &&
|
||||
n.tagName.text === 'IconButton'
|
||||
)
|
||||
found.push(n);
|
||||
ts.forEachChild(n, walk);
|
||||
};
|
||||
walk(sf);
|
||||
return found;
|
||||
};
|
||||
|
||||
const bodyOf = (el: Opening) =>
|
||||
ts.isJsxOpeningElement(el) && ts.isJsxElement(el.parent)
|
||||
? el.getSourceFile().text.slice(el.end, el.parent.closingElement.getStart())
|
||||
: '';
|
||||
|
||||
/** Every <IconButton (not <IconButtonX): its opening tag and what it wraps (empty when self-closing). */
|
||||
export const iconButtons = (src: string) =>
|
||||
[...src.matchAll(/<IconButton(?=[\s>/])/g)].map((m) => {
|
||||
const start = m.index ?? 0;
|
||||
const end = tagEnd(src, start);
|
||||
const tag = src.slice(start, end + 1);
|
||||
const close = src.indexOf('</IconButton>', end);
|
||||
return { tag, body: tag.endsWith('/>') || close === -1 ? '' : src.slice(end + 1, close) };
|
||||
});
|
||||
elements(tsx(src)).map((el) => ({ tag: el.getText(), body: bodyOf(el) }));
|
||||
|
||||
export const iconButtonTags = (src: string) => iconButtons(src).map((b) => b.tag);
|
||||
|
||||
const phoneHitOf = (tag: string) => tag.match(/className=\{[^}]*?\b(PhoneHit\w*)\b/)?.[1] ?? null;
|
||||
|
||||
/** The class each IconButton must carry, in source order: the variant is chosen by the button's drawn size and
|
||||
* whether a clipping container or neighbours surround it, so a swapped variant is a wrong hit area. Also checks
|
||||
* the name is the one PhoneHit.css.ts exports, not a local of the same name. */
|
||||
export const expectPhoneHitClasses = (file: string, want: string[]) => {
|
||||
const src = readSource(file);
|
||||
expect(iconButtonTags(src).map(phoneHitOf)).toEqual(want);
|
||||
[...new Set(want)].forEach((name) =>
|
||||
expect(src).toMatch(
|
||||
new RegExp(
|
||||
`import \\{(?:[^}]*,)?\\s*${name}\\s*(?:,[^}]*)?\\} from '(\\.\\./)+styles/PhoneHit\\.css'`
|
||||
)
|
||||
)
|
||||
/** Local names the source imports from the PhoneHit.css module (as written, not aliased). */
|
||||
const importedHits = (sf: ts.SourceFile) =>
|
||||
new Set(
|
||||
sf.statements.flatMap((st) => {
|
||||
const nb = ts.isImportDeclaration(st) ? st.importClause?.namedBindings : undefined;
|
||||
return nb &&
|
||||
ts.isNamedImports(nb) &&
|
||||
ts.isStringLiteral((st as ts.ImportDeclaration).moduleSpecifier) &&
|
||||
/^(\.\.\/)+styles\/PhoneHit\.css$/.test(
|
||||
((st as ts.ImportDeclaration).moduleSpecifier as ts.StringLiteral).text
|
||||
)
|
||||
? nb.elements.filter((e) => !e.propertyName).map((e) => e.name.text)
|
||||
: [];
|
||||
})
|
||||
);
|
||||
|
||||
const MERGERS = new Set(['classNames', 'clsx', 'cx']);
|
||||
|
||||
/** The PhoneHit* class an IconButton carries, or null. className must appear exactly once, with no props spread
|
||||
* after it (a spread can override it at runtime), and its expression must be: the bare identifier; a classNames /
|
||||
* clsx / cx call with it as a direct argument; or a template with it as a direct span. The identifier must occur
|
||||
* nowhere else in the expression, so a key, a member, a closure, a conditional or a comma can never carry it. When
|
||||
* `imported` is given, the identifier must also be a binding imported from the PhoneHit.css module. */
|
||||
const hitOf = (el: Opening, imported?: Set<string>): string | null => {
|
||||
const props = el.attributes.properties;
|
||||
const at = props.flatMap((p, i) =>
|
||||
ts.isJsxAttribute(p) && ts.isIdentifier(p.name) && p.name.text === 'className' ? [i] : []
|
||||
);
|
||||
if (at.length !== 1 || props.slice(at[0] + 1).some(ts.isJsxSpreadAttribute)) return null;
|
||||
const attr = props[at[0]] as ts.JsxAttribute;
|
||||
const expr =
|
||||
attr.initializer && ts.isJsxExpression(attr.initializer) && attr.initializer.expression;
|
||||
if (!expr) return null;
|
||||
const isHit = (n: ts.Node): n is ts.Identifier =>
|
||||
ts.isIdentifier(n) && /^PhoneHit\w*$/.test(n.text) && (!imported || imported.has(n.text));
|
||||
let direct: ts.Node[] = [];
|
||||
if (ts.isIdentifier(expr)) direct = [expr];
|
||||
else if (
|
||||
ts.isCallExpression(expr) &&
|
||||
ts.isIdentifier(expr.expression) &&
|
||||
MERGERS.has(expr.expression.text)
|
||||
)
|
||||
direct = [...expr.arguments];
|
||||
else if (ts.isTemplateExpression(expr)) direct = expr.templateSpans.map((sp) => sp.expression);
|
||||
const hits = direct.filter(isHit);
|
||||
if (hits.length !== 1) return null;
|
||||
let occurrences = 0;
|
||||
const count = (n: ts.Node) => {
|
||||
if (ts.isIdentifier(n) && n.text === hits[0].text) occurrences += 1;
|
||||
ts.forEachChild(n, count);
|
||||
};
|
||||
count(expr);
|
||||
return occurrences === 1 ? hits[0].text : null;
|
||||
};
|
||||
|
||||
/** The PhoneHit* class of one tag's text (see hitOf), without the import-binding check. */
|
||||
export const phoneHitOf = (tag: string) => {
|
||||
const els = elements(tsx(tag.endsWith('/>') ? tag : `${tag}</IconButton>`));
|
||||
return els.length === 1 ? hitOf(els[0]) : null;
|
||||
};
|
||||
|
||||
/** The PhoneHit* class of each IconButton of a source, in source order; null when it has none or the name is not
|
||||
* the one imported from PhoneHit.css. */
|
||||
const phoneHitClasses = (src: string) => {
|
||||
const sf = tsx(src);
|
||||
const imported = importedHits(sf);
|
||||
return elements(sf).map((el) => hitOf(el, imported));
|
||||
};
|
||||
|
||||
/** The class each IconButton must carry, in source order (null = must carry none): the variant is chosen by the
|
||||
* button's drawn size and whether a clipping container or neighbours surround it, so a swapped variant is a wrong
|
||||
* hit area. The name must also be the one PhoneHit.css exports, not a local of the same name. */
|
||||
export const expectPhoneHitClasses = (file: string, want: (string | null)[]) =>
|
||||
expect(phoneHitClasses(readSource(file))).toEqual(want);
|
||||
|
||||
// IconButton `size` -> padding on each side, Icon `size` -> px (folds 2.7.2). Both default to 400.
|
||||
const BUTTON_PAD: Record<string, number> = { '300': 4, '400': 8, '500': 12, '600': 16 };
|
||||
const ICON_PX: Record<string, number> = {
|
||||
|
|
@ -147,10 +225,12 @@ export type SizeAllow = Record<string, Record<number, string>>;
|
|||
export const expectSizeTie = (file: string, allow: SizeAllow = {}) => {
|
||||
const allowed = allow[file] ?? {};
|
||||
const seen = new Set<number>();
|
||||
const buttons = iconButtons(readSource(file));
|
||||
const src = readSource(file);
|
||||
const buttons = iconButtons(src);
|
||||
const classes = phoneHitClasses(src);
|
||||
expect(buttons.length, `${file} has no IconButton`).toBeGreaterThan(0);
|
||||
buttons.forEach(({ tag, body }, i) => {
|
||||
const variant = phoneHitOf(tag)?.match(/^PhoneHit(?:Spread|Room)(\d+)$/);
|
||||
const variant = classes[i]?.match(/^PhoneHit(?:Spread|Room)(\d+)$/);
|
||||
if (!variant) {
|
||||
expect(allowed[i], `${file} #${i} is allow-listed but has no sized variant`).toBeUndefined();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import Linkify from 'linkify-react';
|
|||
import { ErrorBoundary } from 'react-error-boundary';
|
||||
import { ChildNode } from 'domhandler';
|
||||
import * as css from '../styles/CustomHtml.css';
|
||||
import { PhoneHitSpread24 } from '../styles/PhoneHit.css';
|
||||
import {
|
||||
getMxIdLocalPart,
|
||||
getCanonicalAliasRoomId,
|
||||
|
|
@ -282,6 +283,7 @@ export function CodeBlock({
|
|||
variant="SurfaceVariant"
|
||||
outlined
|
||||
radii="300"
|
||||
className={PhoneHitSpread24}
|
||||
onClick={toggleExpand}
|
||||
aria-label={expanded ? 'Collapse' : 'Expand'}
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in a new issue