Skip to content

Commit 9a945d2

Browse files
committed
refactor(components): migrate remaining components to ActionButton
Migrate TaskStepEditor and HistoryPanel to use ActionButton: - TaskStepEditor: 6 buttons (add step, import, move up/down, delete) - HistoryPanel: 1 danger button (clear history)
1 parent a9ce069 commit 9a945d2

2 files changed

Lines changed: 24 additions & 26 deletions

File tree

src/components/history/HistoryPanel.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from 'react';
2-
import { Button, Input, Drawer, Space, Popconfirm, App } from 'antd';
2+
import { Input, Drawer, Space, Popconfirm, App } from 'antd';
33
import { SearchOutlined, ClearOutlined } from '@ant-design/icons';
44
import { Task } from '@/models';
55
import { taskStorage } from '@/services/task-storage';
66
import { useTranslation } from 'react-i18next';
77
import { useHistoryData, HistoryItem } from './hooks/useHistoryData';
88
import { HistoryList } from './HistoryList';
9+
import { ActionButton } from '@/components/ui';
910

1011
const { Search } = Input;
1112

@@ -154,13 +155,12 @@ export const HistoryPanel: React.FC<HistoryPanelProps> = ({
154155
}
155156
}}
156157
>
157-
<Button
158-
danger
158+
<ActionButton
159+
variant="danger"
159160
icon={<ClearOutlined />}
160-
className="!bg-red-500/10 !border-red-500/30 hover:!bg-red-500/20 hover:!border-red-500/50 cursor-pointer transition-all duration-200"
161161
>
162162
{t('clear_history')}
163-
</Button>
163+
</ActionButton>
164164
</Popconfirm>
165165
</Space>
166166
}

src/components/scheduled-task/TaskStepEditor.tsx

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React, { useState, useEffect } from 'react';
2-
import { Button, Input, Modal, List, Space, Card } from 'antd';
2+
import { Input, Modal, List, Card } from 'antd';
33
import { DeleteOutlined, HolderOutlined, PlusOutlined } from '@ant-design/icons';
44
import { TaskStep, TaskTemplate } from '@/models';
55
import { useScheduledTaskStore } from '@/stores/scheduled-task-store';
66
import { useTranslation } from 'react-i18next';
7+
import { ActionButton } from '@/components/ui';
78

89
interface TaskStepEditorProps {
910
value?: TaskStep[];
@@ -105,20 +106,19 @@ export const TaskStepEditor: React.FC<TaskStepEditorProps> = ({ value = [], onCh
105106
<div className="task-step-editor">
106107
{/* Action buttons */}
107108
<div className="mb-4 flex gap-2">
108-
<Button
109-
type="primary"
109+
<ActionButton
110+
variant="primary"
110111
icon={<PlusOutlined />}
111112
onClick={handleAddStep}
112-
className="!bg-primary hover:!bg-primary-hover !border-none cursor-pointer transition-all duration-200"
113113
>
114114
{t('manual_add_step')}
115-
</Button>
116-
<Button
115+
</ActionButton>
116+
<ActionButton
117+
variant="secondary"
117118
onClick={() => setShowTemplateModal(true)}
118-
className="!bg-white dark:!bg-white/10 !border-gray-200 dark:!border-white/10 !text-gray-700 dark:!text-gray-300 hover:!bg-gray-100 dark:hover:!bg-white/20 hover:!border-primary/30 cursor-pointer transition-all duration-200"
119119
>
120120
{t('import_from_template')}
121-
</Button>
121+
</ActionButton>
122122
</div>
123123

124124
{/* Step list */}
@@ -166,28 +166,27 @@ export const TaskStepEditor: React.FC<TaskStepEditorProps> = ({ value = [], onCh
166166

167167
{/* Action buttons */}
168168
<div className="flex flex-col gap-1">
169-
<Button
169+
<ActionButton
170+
variant="secondary"
170171
size="small"
171172
onClick={() => handleMoveUp(index)}
172173
disabled={index === 0}
173-
className="!bg-white dark:!bg-white/10 !border-gray-200 dark:!border-white/10 !text-gray-700 dark:!text-gray-300 hover:!bg-gray-100 dark:hover:!bg-white/20 disabled:opacity-50 cursor-pointer transition-all duration-200"
174174
>
175175
176-
</Button>
177-
<Button
176+
</ActionButton>
177+
<ActionButton
178+
variant="secondary"
178179
size="small"
179180
onClick={() => handleMoveDown(index)}
180181
disabled={index === steps.length - 1}
181-
className="!bg-white dark:!bg-white/10 !border-gray-200 dark:!border-white/10 !text-gray-700 dark:!text-gray-300 hover:!bg-gray-100 dark:hover:!bg-white/20 disabled:opacity-50 cursor-pointer transition-all duration-200"
182182
>
183183
184-
</Button>
185-
<Button
184+
</ActionButton>
185+
<ActionButton
186+
variant="danger"
186187
size="small"
187-
danger
188188
icon={<DeleteOutlined />}
189189
onClick={() => handleRemoveStep(step.id)}
190-
className="!bg-red-500/10 !border-red-500/30 hover:!bg-red-500/20 hover:!border-red-500/50 cursor-pointer transition-all duration-200"
191190
/>
192191
</div>
193192
</div>
@@ -223,13 +222,12 @@ export const TaskStepEditor: React.FC<TaskStepEditorProps> = ({ value = [], onCh
223222
</div>
224223
}
225224
/>
226-
<Button
227-
type="primary"
225+
<ActionButton
226+
variant="primary"
228227
size="small"
229-
className="!bg-primary hover:!bg-primary-hover !border-none cursor-pointer transition-all duration-200"
230228
>
231229
{t('select')}
232-
</Button>
230+
</ActionButton>
233231
</List.Item>
234232
)}
235233
/>

0 commit comments

Comments
 (0)