mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-01-29 01:28:29 +00:00
add device placeholder tile
This commit is contained in:
parent
a50b6efd46
commit
5716b75711
|
@ -1,11 +1,37 @@
|
||||||
import React, { FormEventHandler, useCallback, useEffect, useState } from 'react';
|
import React, { FormEventHandler, useCallback, useEffect, useState } from 'react';
|
||||||
import { Box, Text, IconButton, Icon, Icons, Chip, Input, Button, color, Spinner } from 'folds';
|
import {
|
||||||
|
Box,
|
||||||
|
Text,
|
||||||
|
IconButton,
|
||||||
|
Icon,
|
||||||
|
Icons,
|
||||||
|
Chip,
|
||||||
|
Input,
|
||||||
|
Button,
|
||||||
|
color,
|
||||||
|
Spinner,
|
||||||
|
toRem,
|
||||||
|
} from 'folds';
|
||||||
import { IMyDevice, MatrixError } from 'matrix-js-sdk';
|
import { IMyDevice, MatrixError } from 'matrix-js-sdk';
|
||||||
import { SettingTile } from '../../../components/setting-tile';
|
import { SettingTile } from '../../../components/setting-tile';
|
||||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||||
import { timeDayMonYear, timeHourMinute, today, yesterday } from '../../../utils/time';
|
import { timeDayMonYear, timeHourMinute, today, yesterday } from '../../../utils/time';
|
||||||
import { BreakWord } from '../../../styles/Text.css';
|
import { BreakWord } from '../../../styles/Text.css';
|
||||||
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
||||||
|
import { SequenceCard } from '../../../components/sequence-card';
|
||||||
|
import { SequenceCardStyle } from '../styles.css';
|
||||||
|
|
||||||
|
export function DeviceTilePlaceholder() {
|
||||||
|
return (
|
||||||
|
<SequenceCard
|
||||||
|
className={SequenceCardStyle}
|
||||||
|
style={{ height: toRem(66) }}
|
||||||
|
variant="SurfaceVariant"
|
||||||
|
direction="Column"
|
||||||
|
gap="400"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function DeviceActiveTime({ ts }: { ts: number }) {
|
function DeviceActiveTime({ ts }: { ts: number }) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
import React, { useCallback, useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
import {
|
import { Box, Text, IconButton, Icon, Icons, Scroll, Button, Spinner, Menu, config } from 'folds';
|
||||||
Box,
|
|
||||||
Text,
|
|
||||||
IconButton,
|
|
||||||
Icon,
|
|
||||||
Icons,
|
|
||||||
Scroll,
|
|
||||||
Button,
|
|
||||||
Spinner,
|
|
||||||
toRem,
|
|
||||||
Menu,
|
|
||||||
config,
|
|
||||||
} from 'folds';
|
|
||||||
import { AuthDict, MatrixError } from 'matrix-js-sdk';
|
import { AuthDict, MatrixError } from 'matrix-js-sdk';
|
||||||
import { Page, PageContent, PageHeader } from '../../../components/page';
|
import { Page, PageContent, PageHeader } from '../../../components/page';
|
||||||
import { SequenceCard } from '../../../components/sequence-card';
|
import { SequenceCard } from '../../../components/sequence-card';
|
||||||
|
@ -23,46 +11,13 @@ import { AsyncState, AsyncStatus, useAsync } from '../../../hooks/useAsyncCallba
|
||||||
import { ActionUIA, ActionUIAFlowsLoader } from '../../../components/ActionUIA';
|
import { ActionUIA, ActionUIAFlowsLoader } from '../../../components/ActionUIA';
|
||||||
import { useUIAMatrixError } from '../../../hooks/useUIAFlows';
|
import { useUIAMatrixError } from '../../../hooks/useUIAFlows';
|
||||||
import { LocalBackup } from './LocalBackup';
|
import { LocalBackup } from './LocalBackup';
|
||||||
import { DeviceTile } from './DeviceTile';
|
import { DeviceTile, DeviceTilePlaceholder } from './DeviceTile';
|
||||||
|
|
||||||
function DevicesPlaceholder() {
|
function DevicesPlaceholder() {
|
||||||
return (
|
return (
|
||||||
<Box direction="Column" gap="100">
|
<Box direction="Column" gap="100">
|
||||||
<SequenceCard
|
<DeviceTilePlaceholder />
|
||||||
className={SequenceCardStyle}
|
<DeviceTilePlaceholder />
|
||||||
style={{ height: toRem(64) }}
|
|
||||||
variant="SurfaceVariant"
|
|
||||||
direction="Column"
|
|
||||||
gap="400"
|
|
||||||
/>
|
|
||||||
<SequenceCard
|
|
||||||
className={SequenceCardStyle}
|
|
||||||
style={{ height: toRem(64) }}
|
|
||||||
variant="SurfaceVariant"
|
|
||||||
direction="Column"
|
|
||||||
gap="400"
|
|
||||||
/>
|
|
||||||
<SequenceCard
|
|
||||||
className={SequenceCardStyle}
|
|
||||||
style={{ height: toRem(64) }}
|
|
||||||
variant="SurfaceVariant"
|
|
||||||
direction="Column"
|
|
||||||
gap="400"
|
|
||||||
/>
|
|
||||||
<SequenceCard
|
|
||||||
className={SequenceCardStyle}
|
|
||||||
style={{ height: toRem(64) }}
|
|
||||||
variant="SurfaceVariant"
|
|
||||||
direction="Column"
|
|
||||||
gap="400"
|
|
||||||
/>
|
|
||||||
<SequenceCard
|
|
||||||
className={SequenceCardStyle}
|
|
||||||
style={{ height: toRem(64) }}
|
|
||||||
variant="SurfaceVariant"
|
|
||||||
direction="Column"
|
|
||||||
gap="400"
|
|
||||||
/>
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -236,10 +191,9 @@ export function Devices({ requestClose }: DevicesProps) {
|
||||||
/>
|
/>
|
||||||
</SequenceCard>
|
</SequenceCard>
|
||||||
</Box>
|
</Box>
|
||||||
{devices === null && <DevicesPlaceholder />}
|
<Box direction="Column" gap="100">
|
||||||
{currentDevice && (
|
<Text size="L400">Current</Text>
|
||||||
<Box direction="Column" gap="100">
|
{currentDevice ? (
|
||||||
<Text size="L400">Current</Text>
|
|
||||||
<SequenceCard
|
<SequenceCard
|
||||||
className={SequenceCardStyle}
|
className={SequenceCardStyle}
|
||||||
variant={deleted.has(currentDevice.device_id) ? 'Critical' : 'SurfaceVariant'}
|
variant={deleted.has(currentDevice.device_id) ? 'Critical' : 'SurfaceVariant'}
|
||||||
|
@ -254,8 +208,11 @@ export function Devices({ requestClose }: DevicesProps) {
|
||||||
disabled={deleting}
|
disabled={deleting}
|
||||||
/>
|
/>
|
||||||
</SequenceCard>
|
</SequenceCard>
|
||||||
</Box>
|
) : (
|
||||||
)}
|
<DeviceTilePlaceholder />
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
{devices === null && <DevicesPlaceholder />}
|
||||||
{otherDevices && otherDevices.length > 0 && (
|
{otherDevices && otherDevices.length > 0 && (
|
||||||
<Box direction="Column" gap="100">
|
<Box direction="Column" gap="100">
|
||||||
<Text size="L400">Others</Text>
|
<Text size="L400">Others</Text>
|
||||||
|
|
Loading…
Reference in a new issue