Skip to content

Commit 5ffbd6a

Browse files
fix: hide files icon on mobile and improve settings layout
1 parent a48be10 commit 5ffbd6a

3 files changed

Lines changed: 75 additions & 69 deletions

File tree

Lines changed: 71 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
import { useState } from 'react'
2-
import { Search, SlidersHorizontal, Trash2, X } from 'lucide-react'
3-
import { Button } from '@/components/ui/button'
4-
import { Input } from '@/components/ui/input'
1+
import { useState } from "react";
2+
import { Search, SlidersHorizontal, Trash2, X } from "lucide-react";
3+
import { Button } from "@/components/ui/button";
4+
import { Input } from "@/components/ui/input";
55
import {
66
DropdownMenu,
77
DropdownMenuContent,
88
DropdownMenuItem,
99
DropdownMenuTrigger,
1010
DropdownMenuCheckboxItem,
1111
DropdownMenuSeparator,
12-
} from '@/components/ui/dropdown-menu'
13-
import { useMobile } from '@/hooks/useMobile'
14-
import type { RepoFilterMode, RepoSortMode } from './repo-list-state'
12+
} from "@/components/ui/dropdown-menu";
13+
import { useMobile } from "@/hooks/useMobile";
14+
import type { RepoFilterMode, RepoSortMode } from "./repo-list-state";
1515

1616
interface RepoListControlsProps {
17-
searchQuery: string
18-
onSearchChange: (query: string) => void
19-
filterMode: RepoFilterMode
20-
onFilterModeChange: (mode: RepoFilterMode) => void
21-
sortMode: RepoSortMode
22-
onSortModeChange: (mode: RepoSortMode) => void
23-
filteredCount: number
24-
attentionCount: number
25-
selectedCount: number
26-
allVisibleSelected: boolean
27-
onSelectAll: () => void
28-
onClearSelection: () => void
29-
onDelete: () => void
30-
hasLocalRepos: boolean
31-
hasClonedRepos: boolean
32-
selectionMode: boolean
33-
onSelectionModeChange: (enabled: boolean) => void
17+
searchQuery: string;
18+
onSearchChange: (query: string) => void;
19+
filterMode: RepoFilterMode;
20+
onFilterModeChange: (mode: RepoFilterMode) => void;
21+
sortMode: RepoSortMode;
22+
onSortModeChange: (mode: RepoSortMode) => void;
23+
filteredCount: number;
24+
attentionCount: number;
25+
selectedCount: number;
26+
allVisibleSelected: boolean;
27+
onSelectAll: () => void;
28+
onClearSelection: () => void;
29+
onDelete: () => void;
30+
hasLocalRepos: boolean;
31+
hasClonedRepos: boolean;
32+
selectionMode: boolean;
33+
onSelectionModeChange: (enabled: boolean) => void;
3434
}
3535

3636
const FILTER_OPTIONS: { value: RepoFilterMode; label: string }[] = [
37-
{ value: 'all', label: 'All' },
38-
{ value: 'recent', label: 'Recent' },
39-
{ value: 'attention', label: 'Changes' },
40-
{ value: 'worktrees', label: 'Worktrees' },
41-
{ value: 'local', label: 'Local' },
42-
]
37+
{ value: "all", label: "All" },
38+
{ value: "recent", label: "Recent" },
39+
{ value: "attention", label: "Changes" },
40+
{ value: "worktrees", label: "Worktrees" },
41+
{ value: "local", label: "Local" },
42+
];
4343

4444
const SORT_OPTIONS: { value: RepoSortMode; label: string }[] = [
45-
{ value: 'recent', label: 'Recent' },
46-
{ value: 'manual', label: 'Manual' },
47-
{ value: 'name', label: 'Name' },
48-
]
45+
{ value: "recent", label: "Recent" },
46+
{ value: "manual", label: "Manual" },
47+
{ value: "name", label: "Name" },
48+
];
4949

5050
export function RepoListControls({
5151
searchQuery,
@@ -66,18 +66,19 @@ export function RepoListControls({
6666
selectionMode,
6767
onSelectionModeChange,
6868
}: RepoListControlsProps) {
69-
const isMobile = useMobile()
70-
const [showMenu, setShowMenu] = useState(false)
69+
const isMobile = useMobile();
70+
const [showMenu, setShowMenu] = useState(false);
7171

72-
const currentSortLabel = SORT_OPTIONS.find((s) => s.value === sortMode)?.label ?? 'Recent'
73-
const inSelectionMode = selectedCount > 0
72+
const currentSortLabel =
73+
SORT_OPTIONS.find((s) => s.value === sortMode)?.label ?? "Recent";
74+
const inSelectionMode = selectedCount > 0;
7475

7576
const getDeleteLabel = () => {
7677
if (hasLocalRepos && !hasClonedRepos) {
77-
return 'Unlink'
78+
return "Unlink";
7879
}
79-
return 'Delete'
80-
}
80+
return "Delete";
81+
};
8182

8283
if (inSelectionMode) {
8384
return (
@@ -92,7 +93,7 @@ export function RepoListControls({
9293
className="shrink-0 h-9 text-xs"
9394
size="sm"
9495
>
95-
{allVisibleSelected ? 'Unselect All' : 'Select All'}
96+
{allVisibleSelected ? "Unselect All" : "Select All"}
9697
</Button>
9798
<Button
9899
variant="ghost"
@@ -113,7 +114,7 @@ export function RepoListControls({
113114
</Button>
114115
</div>
115116
</div>
116-
)
117+
);
117118
}
118119

119120
return (
@@ -126,6 +127,7 @@ export function RepoListControls({
126127
onChange={(e) => onSearchChange(e.target.value)}
127128
placeholder="Search repositories..."
128129
className="pl-9 h-9"
130+
autoComplete="off"
129131
/>
130132
</div>
131133

@@ -139,27 +141,29 @@ export function RepoListControls({
139141
<DropdownMenuContent align="end" className="w-48">
140142
<DropdownMenuCheckboxItem
141143
checked={selectionMode}
142-
onCheckedChange={(checked) => onSelectionModeChange(checked === true)}
144+
onCheckedChange={(checked) =>
145+
onSelectionModeChange(checked === true)
146+
}
143147
>
144148
Select repositories
145149
</DropdownMenuCheckboxItem>
146150
<DropdownMenuSeparator />
147151
{FILTER_OPTIONS.map((option) => {
148152
const count =
149-
option.value === 'attention'
153+
option.value === "attention"
150154
? attentionCount
151-
: option.value === 'all'
155+
: option.value === "all"
152156
? filteredCount
153-
: undefined
157+
: undefined;
154158

155159
return (
156160
<DropdownMenuItem
157161
key={option.value}
158162
onClick={() => {
159-
onFilterModeChange(option.value)
160-
setShowMenu(false)
163+
onFilterModeChange(option.value);
164+
setShowMenu(false);
161165
}}
162-
className={filterMode === option.value ? 'bg-accent' : ''}
166+
className={filterMode === option.value ? "bg-accent" : ""}
163167
>
164168
{option.label}
165169
{count !== undefined && count > 0 && (
@@ -168,7 +172,7 @@ export function RepoListControls({
168172
</span>
169173
)}
170174
</DropdownMenuItem>
171-
)
175+
);
172176
})}
173177
</DropdownMenuContent>
174178
</DropdownMenu>
@@ -185,10 +189,10 @@ export function RepoListControls({
185189
<DropdownMenuItem
186190
key={option.value}
187191
onClick={() => {
188-
onSortModeChange(option.value)
189-
setShowMenu(false)
192+
onSortModeChange(option.value);
193+
setShowMenu(false);
190194
}}
191-
className={sortMode === option.value ? 'bg-accent' : ''}
195+
className={sortMode === option.value ? "bg-accent" : ""}
192196
>
193197
{option.label}
194198
</DropdownMenuItem>
@@ -202,47 +206,49 @@ export function RepoListControls({
202206
<div className="flex items-center gap-2 overflow-x-auto pb-1 -mb-1">
203207
{FILTER_OPTIONS.map((option) => {
204208
const count =
205-
option.value === 'attention'
209+
option.value === "attention"
206210
? attentionCount
207-
: option.value === 'all'
211+
: option.value === "all"
208212
? filteredCount
209-
: undefined
213+
: undefined;
210214

211215
return (
212216
<Button
213217
key={option.value}
214-
variant={filterMode === option.value ? 'default' : 'ghost'}
218+
variant={filterMode === option.value ? "default" : "ghost"}
215219
size="sm"
216220
onClick={() => onFilterModeChange(option.value)}
217221
className="shrink-0 gap-1.5"
218222
>
219223
{option.label}
220224
{count !== undefined && count > 0 && (
221225
<span
222-
className={`text-xs ${filterMode === option.value ? 'text-primary-foreground/80' : 'text-muted-foreground'}`}
226+
className={`text-xs ${filterMode === option.value ? "text-primary-foreground/80" : "text-muted-foreground"}`}
223227
>
224228
{count}
225229
</span>
226230
)}
227231
</Button>
228-
)
232+
);
229233
})}
230234
</div>
231235
)}
232236

233237
{!isMobile && (
234238
<div className="flex items-center justify-between text-sm text-muted-foreground">
235239
<span>
236-
{filteredCount} {filteredCount === 1 ? 'repo' : 'repos'}
240+
{filteredCount} {filteredCount === 1 ? "repo" : "repos"}
237241
{searchQuery && ` matching "${searchQuery}"`}
238242
</span>
239-
{attentionCount > 0 && filterMode !== 'attention' && (
243+
{attentionCount > 0 && filterMode !== "attention" && (
240244
<span>
241-
{attentionCount} {attentionCount === 1 ? 'needs attention' : 'need attention'}
245+
{attentionCount}{" "}
246+
{attentionCount === 1 ? "needs attention" : "need attention"}
242247
</span>
243248
)}
244249
</div>
245250
)}
246251
</div>
247-
)
248-
}
252+
);
253+
}
254+

frontend/src/components/settings/SettingsDialog.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ export function SettingsDialog() {
9595
return (
9696
<Dialog open={isOpen} modal={false} onOpenChange={(open) => !open && close()}>
9797
<DialogContent
98-
className="inset-0 w-full h-full max-w-none max-h-none p-0 rounded-none bg-gradient-to-br from-background via-background to-background border-border overflow-hidden !flex !flex-col"
98+
className="inset-0 w-full h-full max-w-none max-h-none p-0 rounded-none bg-gradient-to-br from-background via-background to-background border-border overflow-hidden !flex !flex-col !gap-0"
9999
fullscreen
100100
canSwipeBack={() => mobileView !== 'menu'}
101101
onSwipeBack={handleSettingsBack}
102102
>
103-
<div className="hidden sm:flex sm:flex-col sm:h-full">
103+
<div className="hidden sm:flex sm:flex-col sm:h-full sm:min-h-0">
104104
<div className="sticky top-0 z-10 bg-gradient-to-b from-background via-background to-transparent border-b border-border backdrop-blur-sm px-6 py-4 flex-shrink-0 flex items-center justify-between">
105105
<h2 className="text-2xl font-semibold bg-gradient-to-r from-foreground to-muted-foreground bg-clip-text text-transparent">
106106
Settings
@@ -164,7 +164,7 @@ export function SettingsDialog() {
164164
</Tabs>
165165
</div>
166166

167-
<div className="sm:hidden flex flex-col h-full min-h-0 pt-safe">
167+
<div className="sm:hidden flex flex-col h-full min-h-0">
168168
<div className="flex-shrink-0 bg-gradient-to-b from-background via-background to-transparent border-b border-border backdrop-blur-sm px-4 py-4 flex items-center justify-between">
169169
<div className="flex items-center gap-2 flex-1">
170170
{mobileView !== 'menu' && (

frontend/src/pages/Repos.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function Repos() {
3737
variant="ghost"
3838
size="icon"
3939
onClick={() => setFileBrowserOpen(true)}
40-
className="text-muted-foreground hover:text-foreground hover:bg-accent transition-all duration-200 h-8 w-8"
40+
className="hidden sm:flex text-muted-foreground hover:text-foreground hover:bg-accent transition-all duration-200 h-8 w-8"
4141
>
4242
<FolderOpen className="w-4 h-4" />
4343
</Button>

0 commit comments

Comments
 (0)