perf: improve mobile display for tianji

This commit is contained in:
moonrailgun 2024-06-13 21:03:35 +08:00
parent cae0c1d6c0
commit e9a1b61a7f
4 changed files with 29 additions and 27 deletions

View File

@ -112,7 +112,7 @@ export function DataTable<TData>({
)} )}
{row.getVisibleCells().map((cell, i) => ( {row.getVisibleCells().map((cell, i) => (
<TableCell key={cell.id}> <TableCell key={cell.id} className="text-nowrap">
{flexRender( {flexRender(
cell.column.columnDef.cell, cell.column.columnDef.cell,
cell.getContext() cell.getContext()

View File

@ -5,6 +5,7 @@ import { Button } from '@/components/ui/button';
import { ScrollArea } from '@/components/ui/scroll-area'; import { ScrollArea } from '@/components/ui/scroll-area';
import { useRouterState } from '@tanstack/react-router'; import { useRouterState } from '@tanstack/react-router';
import { useWatch } from '@/hooks/useWatch'; import { useWatch } from '@/hooks/useWatch';
import { cn } from '@/utils/style';
export const MobileLayoutMenu: React.FC<{ export const MobileLayoutMenu: React.FC<{
list?: React.ReactNode; list?: React.ReactNode;
@ -16,11 +17,8 @@ export const MobileLayoutMenu: React.FC<{
setOpen(false); setOpen(false);
}); });
if (!props.list) {
return <div />;
}
return ( return (
<div className={cn(props.list ? 'opacity-100' : 'opacity-0')}>
<Sheet open={open} onOpenChange={setOpen}> <Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger> <SheetTrigger>
<Button variant="outline" size="icon"> <Button variant="outline" size="icon">
@ -31,6 +29,7 @@ export const MobileLayoutMenu: React.FC<{
<ScrollArea className="h-full">{props.list}</ScrollArea> <ScrollArea className="h-full">{props.list}</ScrollArea>
</SheetContent> </SheetContent>
</Sheet> </Sheet>
</div>
); );
}); });
MobileLayoutMenu.displayName = 'MobileLayoutMenu'; MobileLayoutMenu.displayName = 'MobileLayoutMenu';

View File

@ -106,7 +106,7 @@ export const MonitorStatusPage: React.FC<MonitorStatusPageProps> = React.memo(
<div <div
className={clsx( className={clsx(
'mx-auto overflow-auto px-4 py-8', 'mx-auto overflow-auto px-4 py-8',
!editMode ? 'w-4/5' : 'w-2/3' !editMode ? 'w-4/5 sm:w-full' : 'w-2/3'
)} )}
> >
<div className="flex"> <div className="flex">

View File

@ -10,6 +10,7 @@ import {
MonitorStatusPageEditForm, MonitorStatusPageEditForm,
MonitorStatusPageEditFormValues, MonitorStatusPageEditFormValues,
} from '@/components/monitor/StatusPage/EditForm'; } from '@/components/monitor/StatusPage/EditForm';
import { ScrollArea } from '@/components/ui/scroll-area';
export const Route = createFileRoute('/page/add')({ export const Route = createFileRoute('/page/add')({
beforeLoad: routeAuthBeforeLoad, beforeLoad: routeAuthBeforeLoad,
@ -47,6 +48,7 @@ function PageAddComponent() {
<CommonWrapper <CommonWrapper
header={<h1 className="text-xl font-bold">{t('Add Page')}</h1>} header={<h1 className="text-xl font-bold">{t('Add Page')}</h1>}
> >
<ScrollArea className="h-full">
<div className="p-4"> <div className="p-4">
<Card> <Card>
<CardContent className="pt-4"> <CardContent className="pt-4">
@ -58,6 +60,7 @@ function PageAddComponent() {
</CardContent> </CardContent>
</Card> </Card>
</div> </div>
</ScrollArea>
</CommonWrapper> </CommonWrapper>
); );
} }