import { defaultErrorHandler, trpc } from '@/api/trpc';
import { CommonHeader } from '@/components/CommonHeader';
import { CommonWrapper } from '@/components/CommonWrapper';
import { ServerList } from '@/components/server/ServerList';
import {
AlertDialog,
AlertDialogAction,
AlertDialogContent,
AlertDialogFooter,
AlertDialogTrigger,
} from '@/components/ui/alert-dialog';
import { Button } from '@/components/ui/button';
import { Separator } from '@/components/ui/separator';
import { Switch } from '@/components/ui/switch';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { useEventWithLoading } from '@/hooks/useEvent';
import { LayoutV2 } from '@/pages/LayoutV2';
import { AddServerStep, InstallScript } from '@/pages/Servers';
import { useCurrentWorkspaceId } from '@/store/user';
import { routeAuthBeforeLoad } from '@/utils/route';
import { useTranslation } from '@i18next-toolkit/react';
import { createFileRoute } from '@tanstack/react-router';
import { Popconfirm } from 'antd';
import React from 'react';
import { useState } from 'react';
import { LuPlus } from 'react-icons/lu';
export const Route = createFileRoute('/server')({
beforeLoad: routeAuthBeforeLoad,
component: ServerComponent,
});
function ServerComponent() {
return (
);
}
export const ServerContent: React.FC = React.memo(() => {
const [hideOfflineServer, setHideOfflineServer] = useState(false);
const { t } = useTranslation();
const workspaceId = useCurrentWorkspaceId();
const clearOfflineNodeMutation =
trpc.serverStatus.clearOfflineServerStatus.useMutation({
onError: defaultErrorHandler,
});
const [handleClearOfflineNode, loading] = useEventWithLoading(async (e) => {
await clearOfflineNodeMutation.mutateAsync({
workspaceId,
});
});
return (
{t('Hide Offline')}
{t('Auto')}
{t('Manual')}
{t('Continue')}
}
/>
}
>
);
});
ServerContent.displayName = 'ServerContent';