Skip to content

Commit 123afd0

Browse files
committed
refactor: migrated from antd to shadcn/ui
1 parent 67383ab commit 123afd0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+4539
-1877
lines changed

packages/web/app/AppLayout.tsx

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
'use client';
22

33
import React, { useEffect, useState } from 'react';
4-
import { Alert, Layout } from 'antd';
54
import { NavigationSidebar, ErrorBoundary, AppLayoutSkeleton, TopNavbar } from '@/components';
65
import { useDevlogContext } from './contexts/DevlogContext';
76
import { useStats } from '@/hooks/useStats';
8-
9-
const { Content } = Layout;
7+
import { Alert, AlertDescription } from '@/components/ui/alert';
8+
import { AlertTriangle } from 'lucide-react';
9+
import { cn } from '@/lib/utils';
1010

1111
interface AppLayoutProps {
1212
children: React.ReactNode;
@@ -31,35 +31,31 @@ export function AppLayout({ children }: AppLayoutProps) {
3131

3232
return (
3333
<ErrorBoundary>
34-
<Layout className="app-layout">
34+
<div className="min-h-screen bg-background">
3535
<TopNavbar />
36-
<Layout style={{ flex: 1 }}>
36+
<div className="flex flex-1">
3737
<NavigationSidebar
3838
stats={stats}
3939
statsLoading={isLoadingStats}
4040
collapsed={sidebarCollapsed}
4141
connected={connected}
4242
onToggle={() => setSidebarCollapsed(!sidebarCollapsed)}
4343
/>
44-
<Layout>
45-
<Content className="app-content">
46-
<div className="app-content-wrapper">
44+
<div className="flex-1 flex flex-col">
45+
<main className="flex-1 p-6">
46+
<div className="max-w-full">
4747
{error && (
48-
<Alert
49-
message="Error"
50-
description={error}
51-
type="error"
52-
showIcon
53-
closable
54-
className="app-error-alert"
55-
/>
48+
<Alert className="mb-4">
49+
<AlertTriangle className="h-4 w-4" />
50+
<AlertDescription>{error}</AlertDescription>
51+
</Alert>
5652
)}
5753
{children}
5854
</div>
59-
</Content>
60-
</Layout>
61-
</Layout>
62-
</Layout>
55+
</main>
56+
</div>
57+
</div>
58+
</div>
6359
</ErrorBoundary>
6460
);
6561
}

packages/web/app/components/common/Pagination.tsx

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

33
import React from 'react';
4-
import { Button, Select, Space, Typography } from 'antd';
5-
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
4+
import { Button } from '@/components/ui/button';
5+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
6+
import { ChevronLeft, ChevronRight } from 'lucide-react';
67
import { PaginationMeta } from '@codervisor/devlog-core';
78

8-
const { Text } = Typography;
9-
const { Option } = Select;
10-
119
interface PaginationProps {
1210
pagination: PaginationMeta;
1311
onPageChange: (page: number) => void;
@@ -65,73 +63,75 @@ export function Pagination({
6563
return (
6664
<div className={`flex items-center justify-between gap-4 ${className || ''}`}>
6765
{/* Results info */}
68-
<Text type="secondary" className="text-sm">
66+
<p className="text-sm text-muted-foreground">
6967
Showing {startItem}-{endItem} of {total} results
70-
</Text>
68+
</p>
7169

72-
<Space size="middle" className="flex items-center">
70+
<div className="flex items-center gap-4">
7371
{/* Page size selector */}
7472
{showSizeChanger && (
75-
<Space size="small">
76-
<Text type="secondary" className="text-sm">
77-
Show
78-
</Text>
79-
<Select value={limit} onChange={onPageSizeChange} size="small" style={{ width: 70 }}>
80-
{pageSizeOptions.map((size) => (
81-
<Option key={size} value={size}>
82-
{size}
83-
</Option>
84-
))}
73+
<div className="flex items-center gap-2">
74+
<span className="text-sm text-muted-foreground">Show</span>
75+
<Select value={limit.toString()} onValueChange={(value) => onPageSizeChange(parseInt(value))}>
76+
<SelectTrigger className="w-16">
77+
<SelectValue />
78+
</SelectTrigger>
79+
<SelectContent>
80+
{pageSizeOptions.map((size) => (
81+
<SelectItem key={size} value={size.toString()}>
82+
{size}
83+
</SelectItem>
84+
))}
85+
</SelectContent>
8586
</Select>
86-
<Text type="secondary" className="text-sm">
87-
per page
88-
</Text>
89-
</Space>
87+
<span className="text-sm text-muted-foreground">per page</span>
88+
</div>
9089
)}
9190

9291
{/* Page navigation */}
93-
<Space size="small">
92+
<div className="flex items-center gap-1">
9493
<Button
95-
icon={<LeftOutlined />}
94+
variant="outline"
95+
size="sm"
9696
disabled={!hasPreviousPage}
9797
onClick={() => onPageChange(page - 1)}
98-
size="small"
9998
>
99+
<ChevronLeft className="h-4 w-4 mr-1" />
100100
Previous
101101
</Button>
102102

103103
{/* Page numbers */}
104-
<Space size={4}>
104+
<div className="flex items-center gap-1">
105105
{getVisiblePages().map((pageNum, index) =>
106106
pageNum === '...' ? (
107-
<span key={`dots-${index}`} className="px-2 text-gray-400">
107+
<span key={`dots-${index}`} className="px-2 text-muted-foreground">
108108
...
109109
</span>
110110
) : (
111111
<Button
112112
key={pageNum}
113-
type={pageNum === page ? 'primary' : 'default'}
113+
variant={pageNum === page ? 'default' : 'outline'}
114+
size="sm"
114115
onClick={() => onPageChange(pageNum as number)}
115-
size="small"
116116
className="min-w-8"
117117
>
118118
{pageNum}
119119
</Button>
120120
),
121121
)}
122-
</Space>
122+
</div>
123123

124124
<Button
125-
iconPosition="end"
126-
icon={<RightOutlined />}
125+
variant="outline"
126+
size="sm"
127127
disabled={!hasNextPage}
128128
onClick={() => onPageChange(page + 1)}
129-
size="small"
130129
>
131130
Next
131+
<ChevronRight className="h-4 w-4 ml-1" />
132132
</Button>
133-
</Space>
134-
</Space>
133+
</div>
134+
</div>
135135
</div>
136136
);
137137
}

0 commit comments

Comments
 (0)