Skip to content

Commit f0355de

Browse files
committed
fix(servers): polish custom server panel header layout
Move Form/JSON toggle beside close, drop space subtitle, open Optional by default. Signed-off-by: crimsonsunset <jsangio1@gmail.com>
1 parent 3c7fccf commit f0355de

4 files changed

Lines changed: 25 additions & 35 deletions

File tree

apps/desktop/src/components/ConfigEditorModal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ export function ConfigEditorModal({
400400
{showCustomServerPanel && (
401401
<CustomServerPanel
402402
spaceId={spaceId}
403-
spaceName={spaceName}
404403
onClose={() => setShowCustomServerPanel(false)}
405404
onSaved={() => {
406405
void loadConfig();

apps/desktop/src/features/servers/CustomServerPanel.tsx

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ type PanelMode = 'form' | 'json';
2929

3030
interface CustomServerPanelProps {
3131
spaceId: string;
32-
spaceName: string;
3332
onClose: () => void;
3433
onSaved: () => void;
3534
}
@@ -435,7 +434,7 @@ function CustomServerFormBody({
435434
tone="purple"
436435
title={t('customServerPanel.form.optionalSection')}
437436
subtitle={t('customServerPanel.form.optionalSectionDesc')}
438-
defaultOpen={false}
437+
defaultOpen
439438
testId="custom-server-optional-section"
440439
>
441440
<div className="space-y-4">
@@ -621,7 +620,7 @@ function collectFormValidationErrors(
621620
/**
622621
* Slide-in panel for adding a custom server via guided form or JSON editor.
623622
*/
624-
export function CustomServerPanel({ spaceId, spaceName, onClose, onSaved }: CustomServerPanelProps) {
623+
export function CustomServerPanel({ spaceId, onClose, onSaved }: CustomServerPanelProps) {
625624
const { t } = useTranslation('servers');
626625
const { success, error: showError } = useToast();
627626

@@ -820,36 +819,31 @@ export function CustomServerPanel({ spaceId, spaceName, onClose, onSaved }: Cust
820819
data-testid="custom-server-panel"
821820
>
822821
<div className="flex-shrink-0 p-4 border-b border-[rgb(var(--border))] bg-[rgb(var(--surface-elevated))]">
823-
<div className="flex items-start justify-between gap-2">
824-
<div className="flex items-start gap-3 flex-1 min-w-0">
822+
<div className="flex items-center justify-between gap-2">
823+
<div className="flex items-center gap-3 flex-1 min-w-0">
825824
<div className="w-11 h-11 flex-shrink-0 flex items-center justify-center bg-[rgb(var(--background))] rounded-lg border border-[rgb(var(--border-subtle))]">
826825
<Plus className="h-5 w-5 text-[rgb(var(--primary))]" />
827826
</div>
828-
<div className="min-w-0">
829-
<h2 className="text-lg font-bold text-[rgb(var(--foreground))]">
830-
{t('customServerPanel.title')}
831-
</h2>
832-
<p className="text-xs text-[rgb(var(--muted))] mt-0.5">
833-
{t('customServerPanel.subtitle', { spaceName })}
834-
</p>
835-
</div>
827+
<h2 className="text-lg font-bold text-[rgb(var(--foreground))] truncate">
828+
{t('customServerPanel.title')}
829+
</h2>
830+
</div>
831+
<div className="flex items-center gap-2 flex-shrink-0">
832+
<ModeToggle
833+
mode={mode}
834+
onChange={setMode}
835+
formLabel={t('customServerPanel.modeForm')}
836+
jsonLabel={t('customServerPanel.modeJson')}
837+
/>
838+
<button
839+
type="button"
840+
onClick={onClose}
841+
className="p-1.5 rounded-lg hover:bg-[rgb(var(--surface-hover))] transition-colors"
842+
aria-label={t('customServerPanel.closeAria')}
843+
>
844+
<X className="h-5 w-5" />
845+
</button>
836846
</div>
837-
<button
838-
type="button"
839-
onClick={onClose}
840-
className="p-1.5 rounded-lg hover:bg-[rgb(var(--surface-hover))] transition-colors flex-shrink-0"
841-
aria-label={t('customServerPanel.closeAria')}
842-
>
843-
<X className="h-5 w-5" />
844-
</button>
845-
</div>
846-
<div className="mt-4">
847-
<ModeToggle
848-
mode={mode}
849-
onChange={setMode}
850-
formLabel={t('customServerPanel.modeForm')}
851-
jsonLabel={t('customServerPanel.modeJson')}
852-
/>
853847
</div>
854848
</div>
855849

apps/desktop/src/features/servers/ServersPage.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ export function ServersPage() {
398398
const [editConfigSpace, setEditConfigSpace] = useState<{ id: string; name: string } | null>(null);
399399
const [customServerPanelSpace, setCustomServerPanelSpace] = useState<{
400400
id: string;
401-
name: string;
402401
} | null>(null);
403402

404403
const viewSpace = useViewSpace();
@@ -1668,7 +1667,7 @@ export function ServersPage() {
16681667
<AddServerMenu
16691668
onDiscover={() => navigate('registry')}
16701669
onCustom={() =>
1671-
setCustomServerPanelSpace({ id: viewSpace.id, name: viewSpace.name })
1670+
setCustomServerPanelSpace({ id: viewSpace.id })
16721671
}
16731672
onViewManifest={() =>
16741673
setEditConfigSpace({ id: viewSpace.id, name: viewSpace.name })
@@ -1713,7 +1712,7 @@ export function ServersPage() {
17131712
<AddServerMenu
17141713
onDiscover={() => navigate('registry')}
17151714
onCustom={() =>
1716-
setCustomServerPanelSpace({ id: viewSpace.id, name: viewSpace.name })
1715+
setCustomServerPanelSpace({ id: viewSpace.id })
17171716
}
17181717
onViewManifest={() =>
17191718
setEditConfigSpace({ id: viewSpace.id, name: viewSpace.name })
@@ -2796,7 +2795,6 @@ export function ServersPage() {
27962795
{customServerPanelSpace && (
27972796
<CustomServerPanel
27982797
spaceId={customServerPanelSpace.id}
2799-
spaceName={customServerPanelSpace.name}
28002798
onClose={() => setCustomServerPanelSpace(null)}
28012799
onSaved={() => loadData()}
28022800
/>

apps/desktop/src/locales/en/servers.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@
281281
},
282282
"customServerPanel": {
283283
"title": "Add Custom Server",
284-
"subtitle": "{{spaceName}}",
285284
"closeAria": "Close panel",
286285
"modeForm": "Form",
287286
"modeJson": "JSON",

0 commit comments

Comments
 (0)