From e637f2bb27ad0a6069240ad1edf71f05a16a5e25 Mon Sep 17 00:00:00 2001 From: weishu Date: Tue, 23 Dec 2025 15:53:42 +0800 Subject: [PATCH] refactor(web): simplify NewSession component layout with divided sections Replace Card wrapper with a flex column layout using dividers for better visual separation and simpler structure. --- web/src/components/NewSession.tsx | 226 ++++++++++++++---------------- 1 file changed, 108 insertions(+), 118 deletions(-) diff --git a/web/src/components/NewSession.tsx b/web/src/components/NewSession.tsx index 64d8c288..847b33e3 100644 --- a/web/src/components/NewSession.tsx +++ b/web/src/components/NewSession.tsx @@ -2,7 +2,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react' import type { ApiClient } from '@/api/client' import type { Machine } from '@/types/api' import { Button } from '@/components/ui/button' -import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { usePlatform } from '@/hooks/usePlatform' import { useSpawnSession } from '@/hooks/mutations/useSpawnSession' import { useRecentPaths } from '@/hooks/useRecentPaths' @@ -105,127 +104,118 @@ export function NewSession(props: { const canCreate = machineId && directory.trim() && !isFormDisabled return ( -
- - - Create Session - - -
- {/* Machine Selector */} -
- - -
+
+ {/* Machine Selector */} +
+ + +
- {/* Directory Input */} -
- - setDirectory(e.target.value)} - disabled={isFormDisabled} - className="w-full rounded-md border border-[var(--app-border)] bg-[var(--app-bg)] p-2 text-sm focus:outline-none focus:ring-2 focus:ring-[var(--app-link)] disabled:opacity-50" - /> + {/* Directory Input */} +
+ + setDirectory(e.target.value)} + disabled={isFormDisabled} + className="w-full rounded-md border border-[var(--app-border)] bg-[var(--app-bg)] p-2 text-sm focus:outline-none focus:ring-2 focus:ring-[var(--app-link)] disabled:opacity-50" + /> - {/* Recent Paths */} - {recentPaths.length > 0 && ( -
- Recent: -
- {recentPaths.map((path) => ( - - ))} -
-
- )} -
- - {/* Agent Selector */} -
- -
- {(['claude', 'codex', 'gemini'] as const).map((agentType) => ( - - ))} -
-
- - {/* Error Message */} - {(error ?? spawnError) ? ( -
- {error ?? spawnError} -
- ) : null} - - {/* Action Buttons */} -
- - + {/* Recent Paths */} + {recentPaths.length > 0 && ( +
+ Recent: +
+ {recentPaths.map((path) => ( + + ))}
- - + )} +
+ + {/* Agent Selector */} +
+ +
+ {(['claude', 'codex', 'gemini'] as const).map((agentType) => ( + + ))} +
+
+ + {/* Error Message */} + {(error ?? spawnError) ? ( +
+ {error ?? spawnError} +
+ ) : null} + + {/* Action Buttons */} +
+ + +
) }