Skip to content

Commit a0e21c9

Browse files
author
Marvin Zhang
committed
refactor: Remove redundant interface definitions and update imports for Devlog types
1 parent 9bdda08 commit a0e21c9

File tree

5 files changed

+17
-72
lines changed

5 files changed

+17
-72
lines changed

packages/web/src/client/src/components/Dashboard.tsx

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,10 @@ import {
1010
WarningOutlined,
1111
MinusCircleOutlined
1212
} from '@ant-design/icons';
13+
import { DevlogEntry, DevlogStats } from '@devlog/types';
1314

1415
const { Title, Paragraph, Text } = Typography;
1516

16-
interface DevlogEntry {
17-
id: string;
18-
title: string;
19-
type: string;
20-
status: string;
21-
priority: string;
22-
description: string;
23-
createdAt: string;
24-
updatedAt: string;
25-
}
26-
27-
interface DevlogStats {
28-
total: number;
29-
byStatus: Record<string, number>;
30-
byType: Record<string, number>;
31-
byPriority: Record<string, number>;
32-
}
33-
3417
interface DashboardProps {
3518
stats: DevlogStats | null;
3619
recentDevlogs: DevlogEntry[];
@@ -94,7 +77,7 @@ export function Dashboard({ stats, recentDevlogs, onViewDevlog }: DashboardProps
9477
<Card>
9578
<Statistic
9679
title="Total Devlogs"
97-
value={stats.total}
80+
value={stats.totalEntries}
9881
prefix={<FileTextOutlined style={{ color: '#1890ff' }} />}
9982
valueStyle={{ color: '#1890ff' }}
10083
/>
@@ -123,10 +106,10 @@ export function Dashboard({ stats, recentDevlogs, onViewDevlog }: DashboardProps
123106
<Col xs={24} sm={12} lg={6}>
124107
<Card>
125108
<Statistic
126-
title="Blocked"
127-
value={stats.byStatus['blocked'] || 0}
128-
prefix={<StopOutlined style={{ color: '#ff4d4f' }} />}
129-
valueStyle={{ color: '#ff4d4f' }}
109+
title="Todo"
110+
value={stats.byStatus['todo'] || 0}
111+
prefix={<ClockCircleOutlined style={{ color: '#8c8c8c' }} />}
112+
valueStyle={{ color: '#8c8c8c' }}
130113
/>
131114
</Card>
132115
</Col>

packages/web/src/client/src/components/DevlogDetails.tsx

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,12 @@ import {
3333
ToolOutlined,
3434
BookOutlined
3535
} from '@ant-design/icons';
36+
import { DevlogEntry } from '@devlog/types';
3637

3738
const { Title, Text, Paragraph } = Typography;
3839
const { TextArea } = Input;
3940
const { Option } = Select;
4041

41-
interface DevlogEntry {
42-
id: string;
43-
title: string;
44-
type: string;
45-
status: string;
46-
priority: string;
47-
description: string;
48-
businessContext?: string;
49-
technicalContext?: string;
50-
createdAt: string;
51-
updatedAt: string;
52-
notes?: Array<{
53-
id: string;
54-
note: string;
55-
category: string;
56-
timestamp: string;
57-
}>;
58-
}
59-
6042
interface DevlogDetailsProps {
6143
devlog: DevlogEntry;
6244
onUpdate: (data: any) => void;
@@ -174,8 +156,8 @@ export function DevlogDetails({ devlog, onUpdate, onDelete, onBack }: DevlogDeta
174156
status: devlog.status,
175157
priority: devlog.priority,
176158
description: devlog.description,
177-
businessContext: devlog.businessContext || '',
178-
technicalContext: devlog.technicalContext || ''
159+
businessContext: devlog.context?.businessContext || '',
160+
technicalContext: devlog.context?.technicalContext || ''
179161
}}
180162
>
181163
<Row gutter={[16, 0]}>
@@ -324,11 +306,11 @@ export function DevlogDetails({ devlog, onUpdate, onDelete, onBack }: DevlogDeta
324306
</Paragraph>
325307
</div>
326308

327-
{devlog.businessContext && (
309+
{devlog.context?.businessContext && (
328310
<div style={{ marginBottom: '24px' }}>
329311
<Title level={4}>Business Context</Title>
330312
<Alert
331-
message={devlog.businessContext}
313+
message={devlog.context.businessContext}
332314
type="info"
333315
showIcon
334316
icon={<InfoCircleOutlined />}
@@ -337,11 +319,11 @@ export function DevlogDetails({ devlog, onUpdate, onDelete, onBack }: DevlogDeta
337319
</div>
338320
)}
339321

340-
{devlog.technicalContext && (
322+
{devlog.context?.technicalContext && (
341323
<div style={{ marginBottom: '24px' }}>
342324
<Title level={4}>Technical Context</Title>
343325
<Alert
344-
message={devlog.technicalContext}
326+
message={devlog.context.technicalContext}
345327
type="warning"
346328
showIcon
347329
icon={<ToolOutlined />}
@@ -357,7 +339,7 @@ export function DevlogDetails({ devlog, onUpdate, onDelete, onBack }: DevlogDeta
357339
{devlog.notes.map((note) => (
358340
<Timeline.Item key={note.id}>
359341
<div style={{ marginBottom: '8px' }}>
360-
<Text>{note.note}</Text>
342+
<Text>{note.content}</Text>
361343
</div>
362344
<Text type="secondary" style={{ fontSize: '12px' }}>
363345
{note.category}{new Date(note.timestamp).toLocaleString()}

packages/web/src/client/src/components/DevlogList.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,10 @@ import {
1212
WarningOutlined
1313
} from '@ant-design/icons';
1414
import type { ColumnsType } from 'antd/es/table';
15+
import { DevlogEntry } from '@devlog/types';
1516

1617
const { Title, Text } = Typography;
1718

18-
interface DevlogEntry {
19-
id: string;
20-
title: string;
21-
type: string;
22-
status: string;
23-
priority: string;
24-
description: string;
25-
createdAt: string;
26-
updatedAt: string;
27-
}
28-
2919
interface DevlogListProps {
3020
devlogs: DevlogEntry[];
3121
loading: boolean;

packages/web/src/client/src/hooks/useDevlogs.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
import { useState, useEffect } from 'react';
2-
3-
interface DevlogEntry {
4-
id: string;
5-
title: string;
6-
type: string;
7-
status: string;
8-
priority: string;
9-
description: string;
10-
createdAt: string;
11-
updatedAt: string;
12-
}
2+
import { DevlogEntry } from '@devlog/types';
133

144
export function useDevlogs() {
155
const [devlogs, setDevlogs] = useState<DevlogEntry[]>([]);

packages/web/src/client/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import ReactDOM from 'react-dom/client'
3-
import App from './App.tsx'
3+
import App from './App'
44
import './index.css'
55
import 'antd/dist/reset.css'
66

0 commit comments

Comments
 (0)