Skip to content

Commit bb1e7ef

Browse files
committed
Enhance ConsoleLayout and ListView styles; add padding and background color for improved layout, and update ViewSwitcher class for better visual consistency
1 parent 83c40bd commit bb1e7ef

3 files changed

Lines changed: 66 additions & 42 deletions

File tree

apps/console/src/components/ConsoleLayout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export function ConsoleLayout({
3232
objects={objects}
3333
/>
3434
}
35+
className="p-0 overflow-hidden bg-muted/5"
3536
>
3637
{children}
3738
</AppShell>

packages/plugin-list/src/ListView.tsx

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ export const ListView: React.FC<ListViewProps> = ({
141141
fields: schema.fields,
142142
filters: schema.filters,
143143
sort: [{ field: sortField, order: sortOrder }],
144+
className: "h-full w-full",
145+
// Disable internal controls that clash with ListView toolbar
146+
showSearch: false,
144147
};
145148

146149
switch (currentView) {
@@ -249,55 +252,72 @@ export const ListView: React.FC<ListViewProps> = ({
249252
}, [schema.options, schema.viewType]);
250253

251254
return (
252-
<div className={cn('flex flex-col gap-4', className)}>
253-
{/* Toolbar */}
254-
<div className="flex flex-wrap items-center gap-4 justify-between">
255-
<div className="flex items-center gap-2 flex-1 min-w-0">
256-
<div className="relative flex-1 max-w-md">
257-
<Search className="absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
258-
<Input
259-
placeholder={`Search ${schema.objectName}...`}
260-
value={searchTerm}
261-
onChange={(e) => handleSearchChange(e.target.value)}
262-
className="pl-8 pr-8"
255+
<div className={cn('flex flex-col h-full bg-background', className)}>
256+
{/* Airtable-style Toolbar */}
257+
<div className="border-b px-4 py-2 flex items-center justify-between gap-4 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
258+
<div className="flex items-center gap-2 flex-1 overflow-hidden">
259+
{/* View Switcher on the Left */}
260+
<div className="flex items-center pr-2 border-r mr-2">
261+
<ViewSwitcher
262+
currentView={currentView}
263+
availableViews={availableViews}
264+
onViewChange={handleViewChange}
263265
/>
264-
{searchTerm && (
265-
<Button
266-
variant="ghost"
266+
</div>
267+
268+
{/* Action Tools */}
269+
<div className="flex items-center gap-1">
270+
<Button
271+
variant={showFilters ? "secondary" : "ghost"}
267272
size="sm"
268-
className="absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6 p-0"
269-
onClick={() => handleSearchChange('')}
273+
onClick={() => setShowFilters(!showFilters)}
274+
className="h-8 px-2 lg:px-3 text-muted-foreground hover:text-primary"
270275
>
271-
<X className="h-3 w-3" />
276+
<SlidersHorizontal className="h-4 w-4 mr-2" />
277+
<span className="hidden lg:inline">Filter</span>
278+
</Button>
279+
280+
{sortField && (
281+
<Button
282+
variant="ghost"
283+
size="sm"
284+
onClick={handleSortChange}
285+
className="h-8 px-2 lg:px-3 text-muted-foreground hover:text-primary"
286+
>
287+
<ArrowUpDown className="h-4 w-4 mr-2" />
288+
<span className="hidden lg:inline">Sort</span>
272289
</Button>
273290
)}
291+
292+
{/* Future: Group, Color, Height */}
274293
</div>
275-
276-
<Button
277-
variant="outline"
278-
size="sm"
279-
onClick={() => setShowFilters(!showFilters)}
280-
className={cn(showFilters && 'bg-muted')}
281-
>
282-
<SlidersHorizontal className="h-4 w-4 mr-2" />
283-
Filters
284-
</Button>
285-
286-
{sortField && (
287-
<Button variant="outline" size="sm" onClick={handleSortChange}>
288-
<ArrowUpDown className="h-4 w-4 mr-2" />
289-
{sortOrder === 'asc' ? 'A-Z' : 'Z-A'}
290-
</Button>
291-
)}
292294
</div>
293295

294-
<ViewSwitcher
295-
currentView={currentView}
296-
availableViews={availableViews}
297-
onViewChange={handleViewChange}
298-
/>
296+
{/* Right Actions: Search + New */}
297+
<div className="flex items-center gap-2">
298+
<div className="relative w-40 lg:w-64 transition-all">
299+
<Search className="absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
300+
<Input
301+
placeholder="Find..."
302+
value={searchTerm}
303+
onChange={(e) => handleSearchChange(e.target.value)}
304+
className="pl-8 h-8 text-sm bg-muted/50 border-transparent hover:bg-muted focus:bg-background focus:border-input transition-colors"
305+
/>
306+
{searchTerm && (
307+
<Button
308+
variant="ghost"
309+
size="sm"
310+
className="absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6 p-0 hover:bg-muted-foreground/20"
311+
onClick={() => handleSearchChange('')}
312+
>
313+
<X className="h-3 w-3" />
314+
</Button>
315+
)}
316+
</div>
317+
</div>
299318
</div>
300319

320+
301321
{/* Filters Panel */}
302322
{showFilters && (
303323
<div className="p-4 border rounded-lg bg-muted/30">
@@ -309,7 +329,7 @@ export const ListView: React.FC<ListViewProps> = ({
309329
)}
310330

311331
{/* View Content */}
312-
<div className="flex-1">
332+
<div className="flex-1 min-h-0 bg-background relative overflow-hidden">
313333
<SchemaRenderer
314334
schema={viewComponentSchema}
315335
{...props}

packages/plugin-list/src/ViewSwitcher.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,20 @@ export const ViewSwitcher: React.FC<ViewSwitcherProps> = ({
6565
type="single"
6666
value={currentView}
6767
onValueChange={(value) => value && onViewChange(value as ViewType)}
68-
className={cn("inline-flex", className)}
68+
className={cn("bg-transparent gap-1", className)}
6969
>
7070
{availableViews.map((view) => (
7171
<ToggleGroupItem
7272
key={view}
7373
value={view}
7474
aria-label={VIEW_LABELS[view]}
7575
title={VIEW_LABELS[view]}
76-
className="px-3"
76+
className="gap-2 px-3 data-[state=on]:bg-background data-[state=on]:shadow-sm border-transparent border data-[state=on]:border-border/50"
7777
>
7878
{VIEW_ICONS[view]}
79+
<span className="hidden sm:inline-block text-xs font-medium">
80+
{VIEW_LABELS[view]}
81+
</span>
7982
</ToggleGroupItem>
8083
))}
8184
</ToggleGroup>

0 commit comments

Comments
 (0)