Skip to content

Commit 1ef61d3

Browse files
committed
feat: update ProjectSwitcher and ProjectAvatar styles, enhance SpecsPage button functionality, and refine README with implementation notes
1 parent 9b86a82 commit 1ef61d3

File tree

4 files changed

+41
-27
lines changed

4 files changed

+41
-27
lines changed

packages/ui-vite/src/components/ProjectSwitcher.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export function ProjectSwitcher({ collapsed }: ProjectSwitcherProps) {
163163
/>
164164
<span className="truncate flex-1">{project.name}</span>
165165
{project.favorite && (
166-
<Star className="h-3 w-3 shrink-0 fill-yellow-500 text-yellow-500" />
166+
<Star className="h-3 w-3 shrink-0 fill-yellow-600 text-yellow-600 dark:fill-yellow-500 dark:text-yellow-500" />
167167
)}
168168
</div>
169169
</CommandItem>

packages/ui-vite/src/components/shared/ProjectAvatar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function getInitials(name: string): string {
3030
return word.length >= 2 ? (word[0] + word[1]).toUpperCase() : word[0].toUpperCase();
3131
}
3232

33-
function getContrastColor(hexColor?: string): string {
34-
if (!hexColor) return '#ffffff';
33+
function getContrastColor(hexColor?: string): string | undefined {
34+
if (!hexColor) return undefined;
3535

3636
const hex = hexColor.replace('#', '');
3737
const r = parseInt(hex.substring(0, 2), 16);
@@ -59,7 +59,7 @@ export function ProjectAvatar({
5959
className="font-semibold border"
6060
style={{
6161
backgroundColor: color || undefined,
62-
color: textColor,
62+
...(textColor && { color: textColor }),
6363
}}
6464
>
6565
{initials}

packages/ui-vite/src/pages/SpecsPage.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -209,31 +209,33 @@ export function SpecsPage() {
209209
<p className="text-sm text-muted-foreground">{t('specsPage.count', { count: filteredSpecs.length })}</p>
210210
</div>
211211

212-
<div className="flex items-center gap-2 bg-secondary/50 p-1 rounded-lg border">
213-
<button
212+
<div className="flex items-center gap-1 bg-secondary/50 p-1 rounded-lg border">
213+
<Button
214+
variant={viewMode === 'list' ? 'secondary' : 'ghost'}
215+
size="sm"
214216
onClick={() => setViewMode('list')}
215217
className={cn(
216-
"p-1.5 rounded-md transition-colors",
217-
viewMode === 'list'
218-
? "bg-background shadow-sm text-foreground"
219-
: "text-muted-foreground hover:text-foreground"
218+
"h-8",
219+
viewMode === 'list' && "bg-background shadow-sm"
220220
)}
221221
title="List View"
222222
>
223-
<List className="w-4 h-4" />
224-
</button>
225-
<button
223+
<List className="w-4 h-4 mr-1.5" />
224+
List
225+
</Button>
226+
<Button
227+
variant={viewMode === 'board' ? 'secondary' : 'ghost'}
228+
size="sm"
226229
onClick={() => setViewMode('board')}
227230
className={cn(
228-
"p-1.5 rounded-md transition-colors",
229-
viewMode === 'board'
230-
? "bg-background shadow-sm text-foreground"
231-
: "text-muted-foreground hover:text-foreground"
231+
"h-8",
232+
viewMode === 'board' && "bg-background shadow-sm"
232233
)}
233234
title="Board View"
234235
>
235-
<LayoutGrid className="w-4 h-4" />
236-
</button>
236+
<LayoutGrid className="w-4 h-4 mr-1.5" />
237+
Board
238+
</Button>
237239
</div>
238240
</div>
239241

specs/198-ui-vite-remaining-issues/README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,24 @@ After implementing initial UI parity between Next.js and Vite apps in spec 193,
104104

105105
## Plan
106106

107-
- [ ] Fix sidebar active state detection for project-prefixed routes
108-
- [ ] Debug and fix spec detail page routing/API errors
109-
- [ ] Debug and fix dependencies page routing/API errors
110-
- [ ] Add `/projects` route and implement project management page
111-
- [ ] Add proper padding to specs list and board views
112-
- [ ] Fix project switcher navigation and context sync
113-
- [ ] Debug and fix "Path does not exist" error in create project
114-
- [ ] Implement full sorting options matching Next.js UI
107+
- [x] Fix sidebar active state detection for project-prefixed routes (MainSidebar strips project prefixes so active highlighting follows nested routes)
108+
- [x] Debug and fix spec detail page routing/API errors (SpecDetailPage waits for project context and uses project-aware base paths)
109+
- [x] Debug and fix dependencies page routing/API errors (DependenciesPage uses project params, basePath navigation, and guards on project readiness)
110+
- [x] Add `/projects` route and implement project management page (router now exposes `/projects` with ProjectsPage for management)
111+
- [x] Add proper padding to specs list and board views (SpecsPage uses padded container with max width)
112+
- [x] Fix project switcher navigation and context sync (ProjectSwitcher calls switchProject then redirects to preserved subpath; ProjectContext refreshes projects and persists selection)
113+
- [x] Debug and fix "Path does not exist" error in create project (CreateProjectDialog supports picker/manual modes with DirectoryPicker and clearer errors)
114+
- [x] Implement full sorting options matching Next.js UI (SpecsPage + SpecsFilters expose id asc/desc, updated desc, title asc)
115+
116+
## Implementation Notes
117+
118+
- Sidebar links normalize paths and remove `/projects/:id` prefixes before comparing, preventing the home item from staying highlighted on nested routes.
119+
- Spec detail and dependencies pages gate data loading on project context readiness and use project-aware base paths for navigation.
120+
- Router now includes `/projects` mapped to ProjectsPage, providing management UI consistent with the project switcher entry.
121+
- SpecsPage container adds `p-4 sm:p-6` spacing with a centered max width for both list and board layouts.
122+
- Project switcher preserves the current subpath when changing projects and falls back to `/specs` for detail routes to avoid broken paths.
123+
- Create project flow accepts picker or manual input; DirectoryPicker queries the filesystem and the dialog surfaces validation errors without blocking.
124+
- Specs sorting options now mirror the Next.js UI and propagate through SpecsFilters.
115125

116126
## Test
117127

@@ -124,6 +134,8 @@ After implementing initial UI parity between Next.js and Vite apps in spec 193,
124134
- [ ] Can create new project without path validation errors
125135
- [ ] All sorting options work and match Next.js behavior
126136

137+
Test run: `pnpm -C packages/ui-vite test` (fails in `src/lib/api.test.ts` because the mocked fetch response lacks `.text()`).
138+
127139
## Notes
128140

129141
These issues are blocking full UI-Vite parity and need to be resolved before considering spec 193 complete. Most are straightforward fixes once the root causes are identified.

0 commit comments

Comments
 (0)