feat: Optimize the layout and style of the settings dialog and proxy components.

This commit is contained in:
jarvis2f 2024-12-23 11:22:47 +08:00
parent d4ddc70639
commit f37d38d4e2
4 changed files with 15 additions and 16 deletions

View file

@ -35,7 +35,7 @@ export default function ProxyPing({ accountId }: { accountId: string }) {
{!isLoading && error && <span>Connection error</span>} {!isLoading && error && <span>Connection error</span>}
{!isLoading && data && ( {!isLoading && data && (
<div className="flex items-center space-x-2"> <div className="flex items-center space-x-2">
<span>Ping: {(data.ping * 1000).toFixed(0)}ms</span> <span className="text-sm">{(data.ping * 1000).toFixed(0)} ms</span>
</div> </div>
)} )}
</div> </div>

View file

@ -159,7 +159,7 @@ export default function Proxys({
<Plus className="mr-2 h-5 w-5" /> Add Proxy <Plus className="mr-2 h-5 w-5" /> Add Proxy
</Button> </Button>
</div> </div>
<div className="grid grid-cols-1 gap-6 sm:grid-cols-3 lg:grid-cols-4"> <div className="grid grid-cols-1 gap-6 md:grid-cols-3 2xl:grid-cols-4">
{proxys.map((proxy) => ( {proxys.map((proxy) => (
<Card <Card
key={proxy.name} key={proxy.name}
@ -212,13 +212,14 @@ export default function Proxys({
))} ))}
</div> </div>
{enableSelect && ( {enableSelect && (
<Button <div className="absolute bottom-0 right-0 flex items-center space-x-4">
className="absolute bottom-4 right-4" <Button
disabled={isToggleProxyMutating} disabled={isToggleProxyMutating}
onClick={() => handleProxySubmit()} onClick={() => handleProxySubmit()}
> >
Submit Submit
</Button> </Button>
</div>
)} )}
<Dialog open={isDialogOpen} onOpenChange={handleCloseDialog}> <Dialog open={isDialogOpen} onOpenChange={handleCloseDialog}>
<DialogContent> <DialogContent>

View file

@ -47,10 +47,8 @@ export const SettingsDialog: React.FC = () => {
<TabsTrigger value="statistics">Statistics</TabsTrigger> <TabsTrigger value="statistics">Statistics</TabsTrigger>
<TabsTrigger value="proxys">Proxys</TabsTrigger> <TabsTrigger value="proxys">Proxys</TabsTrigger>
</TabsList> </TabsList>
<TabsContent value="general" className="h-full"> <TabsContent value="general" className="overflow-hidden">
<div className="flex flex-col overflow-hidden"> <SettingsForm />
<SettingsForm />
</div>
</TabsContent> </TabsContent>
<TabsContent value="statistics" className="h-full"> <TabsContent value="statistics" className="h-full">
<div className="flex flex-col overflow-y-scroll"> <div className="flex flex-col overflow-y-scroll">

View file

@ -36,9 +36,9 @@ export default function SettingsForm() {
return ( return (
<form <form
onSubmit={handleSave} onSubmit={handleSave}
className="flex h-full flex-col" className="flex h-full flex-col overflow-hidden"
> >
<div className="flex flex-1 flex-col space-y-4 overflow-y-scroll"> <div className="flex flex-col space-y-4 overflow-y-scroll">
<p className="rounded-md bg-gray-50 p-2 text-sm text-muted-foreground shadow"> <p className="rounded-md bg-gray-50 p-2 text-sm text-muted-foreground shadow">
<Bell className="mr-2 inline-block h-4 w-4" /> <Bell className="mr-2 inline-block h-4 w-4" />
These settings will be applied to all accounts. These settings will be applied to all accounts.
@ -134,7 +134,7 @@ export default function SettingsForm() {
</div> </div>
</div> </div>
</div> </div>
<div className="mt-2 flex justify-end"> <div className="mt-2 flex flex-1 justify-end">
<Button type="submit">Submit</Button> <Button type="submit">Submit</Button>
</div> </div>
</form> </form>