Skip to content

Commit 36bb59f

Browse files
author
Marvin Zhang
committed
refactor: simplify Dashboard and ProjectDetails pages by removing unused filters and stats, update DevlogList and ProjectDevlogListPage components for cleaner layout
1 parent 8221609 commit 36bb59f

File tree

7 files changed

+151
-254
lines changed

7 files changed

+151
-254
lines changed

packages/web/app/DashboardPage.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
'use client';
22

33
import React from 'react';
4-
import { Dashboard, PageLayout, OverviewStats } from '@/components';
4+
import { Dashboard, PageLayout } from '@/components';
55
import { useDevlogs } from '@/hooks/useDevlogs';
66
import { useStats } from '@/hooks/useStats';
77
import { useTimeSeriesStats } from '@/hooks/useTimeSeriesStats';
88
import { DevlogEntry } from '@codervisor/devlog-core';
99
import { useRouter } from 'next/navigation';
1010

1111
export function DashboardPage() {
12-
const { devlogs, filters, handleStatusFilter, loading: isLoadingDevlogs } = useDevlogs();
12+
const { devlogs, loading: isLoadingDevlogs } = useDevlogs();
1313
const { stats, loading: isLoadingStats } = useStats();
1414
const { timeSeriesData, loading: isLoadingTimeSeries } = useTimeSeriesStats();
1515
const router = useRouter();
@@ -18,18 +18,8 @@ export function DashboardPage() {
1818
router.push(`/devlogs/${devlog.id}`);
1919
};
2020

21-
const actions = (
22-
<OverviewStats
23-
stats={stats}
24-
loading={isLoadingStats}
25-
variant="detailed"
26-
currentFilters={filters}
27-
onFilterToggle={handleStatusFilter}
28-
/>
29-
);
30-
3121
return (
32-
<PageLayout actions={actions}>
22+
<PageLayout>
3323
<Dashboard
3424
stats={stats}
3525
timeSeriesData={timeSeriesData}

packages/web/app/components/features/devlogs/DevlogList.tsx

Lines changed: 81 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -320,86 +320,88 @@ export function DevlogList({
320320

321321
return (
322322
<div className="space-y-4">
323-
{/* Header with search and filters */}
324-
<Card>
325-
<CardHeader>
326-
<div className="flex items-center justify-between">
327-
<CardTitle>Devlogs ({devlogs.length})</CardTitle>
328-
<div className="flex items-center space-x-2">
329-
{/* Search */}
330-
<div className="relative">
331-
<Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
332-
<Input
333-
placeholder="Search devlogs..."
334-
value={searchText}
335-
onChange={(e) => handleSearch(e.target.value)}
336-
className="pl-8 w-64"
337-
/>
338-
</div>
339-
340-
{/* Status Filter */}
341-
<Select
342-
value={currentFilters?.status?.[0] || 'all'}
343-
onValueChange={(value) =>
344-
handleFilterChange('status', value === 'all' ? undefined : value)
345-
}
346-
>
347-
<SelectTrigger className="w-32">
348-
<SelectValue placeholder="Status" />
349-
</SelectTrigger>
350-
<SelectContent>
351-
<SelectItem value="all">All Status</SelectItem>
352-
{statusOptions.map((option) => (
353-
<SelectItem key={option.value} value={option.value}>
354-
{option.label}
355-
</SelectItem>
356-
))}
357-
</SelectContent>
358-
</Select>
359-
360-
{/* Priority Filter */}
361-
<Select
362-
value={currentFilters?.priority?.[0] || 'all'}
363-
onValueChange={(value) =>
364-
handleFilterChange('priority', value === 'all' ? undefined : value)
365-
}
366-
>
367-
<SelectTrigger className="w-32">
368-
<SelectValue placeholder="Priority" />
369-
</SelectTrigger>
370-
<SelectContent>
371-
<SelectItem value="all">All Priority</SelectItem>
372-
{priorityOptions.map((option) => (
373-
<SelectItem key={option.value} value={option.value}>
374-
{option.label}
375-
</SelectItem>
376-
))}
377-
</SelectContent>
378-
</Select>
323+
{/* Header with search and filters - Sticky */}
324+
<div className="sticky top-0 z-20 bg-background border-b pb-4">
325+
<Card>
326+
<CardHeader>
327+
<div className="flex items-center justify-between">
328+
<CardTitle>Devlogs ({devlogs.length})</CardTitle>
329+
<div className="flex items-center space-x-2">
330+
{/* Search */}
331+
<div className="relative">
332+
<Search className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
333+
<Input
334+
placeholder="Search devlogs..."
335+
value={searchText}
336+
onChange={(e) => handleSearch(e.target.value)}
337+
className="pl-8 w-64"
338+
/>
339+
</div>
379340

380-
{/* Type Filter */}
381-
<Select
382-
value={currentFilters?.type?.[0] || 'all'}
383-
onValueChange={(value) =>
384-
handleFilterChange('type', value === 'all' ? undefined : value)
385-
}
386-
>
387-
<SelectTrigger className="w-32">
388-
<SelectValue placeholder="Type" />
389-
</SelectTrigger>
390-
<SelectContent>
391-
<SelectItem value="all">All Types</SelectItem>
392-
{typeOptions.map((option) => (
393-
<SelectItem key={option.value} value={option.value}>
394-
{option.label}
395-
</SelectItem>
396-
))}
397-
</SelectContent>
398-
</Select>
341+
{/* Status Filter */}
342+
<Select
343+
value={currentFilters?.status?.[0] || 'all'}
344+
onValueChange={(value) =>
345+
handleFilterChange('status', value === 'all' ? undefined : value)
346+
}
347+
>
348+
<SelectTrigger className="w-32">
349+
<SelectValue placeholder="Status" />
350+
</SelectTrigger>
351+
<SelectContent>
352+
<SelectItem value="all">All Status</SelectItem>
353+
{statusOptions.map((option) => (
354+
<SelectItem key={option.value} value={option.value}>
355+
{option.label}
356+
</SelectItem>
357+
))}
358+
</SelectContent>
359+
</Select>
360+
361+
{/* Priority Filter */}
362+
<Select
363+
value={currentFilters?.priority?.[0] || 'all'}
364+
onValueChange={(value) =>
365+
handleFilterChange('priority', value === 'all' ? undefined : value)
366+
}
367+
>
368+
<SelectTrigger className="w-32">
369+
<SelectValue placeholder="Priority" />
370+
</SelectTrigger>
371+
<SelectContent>
372+
<SelectItem value="all">All Priority</SelectItem>
373+
{priorityOptions.map((option) => (
374+
<SelectItem key={option.value} value={option.value}>
375+
{option.label}
376+
</SelectItem>
377+
))}
378+
</SelectContent>
379+
</Select>
380+
381+
{/* Type Filter */}
382+
<Select
383+
value={currentFilters?.type?.[0] || 'all'}
384+
onValueChange={(value) =>
385+
handleFilterChange('type', value === 'all' ? undefined : value)
386+
}
387+
>
388+
<SelectTrigger className="w-32">
389+
<SelectValue placeholder="Type" />
390+
</SelectTrigger>
391+
<SelectContent>
392+
<SelectItem value="all">All Types</SelectItem>
393+
{typeOptions.map((option) => (
394+
<SelectItem key={option.value} value={option.value}>
395+
{option.label}
396+
</SelectItem>
397+
))}
398+
</SelectContent>
399+
</Select>
400+
</div>
399401
</div>
400-
</div>
401-
</CardHeader>
402-
</Card>
402+
</CardHeader>
403+
</Card>
404+
</div>
403405

404406
{/* Batch Operations */}
405407
{selectedRowKeys.length > 0 && (
@@ -464,7 +466,7 @@ export function DevlogList({
464466
</div>
465467
) : (
466468
<Table>
467-
<TableHeader>
469+
<TableHeader className="sticky top-[140px] z-10 bg-background">
468470
<TableRow>
469471
<TableHead className="w-12">
470472
<Checkbox

0 commit comments

Comments
 (0)