-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: add unarchive support for archived tasks #1894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { useState, useEffect, useRef, memo, useMemo } from 'react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import { Play, Square, Clock, Zap, Target, Shield, Gauge, Palette, FileCode, Bug, Wrench, Loader2, AlertTriangle, RotateCcw, Archive, GitPullRequest, MoreVertical } from 'lucide-react'; | ||
| import { Play, Square, Clock, Zap, Target, Shield, Gauge, Palette, FileCode, Bug, Wrench, Loader2, AlertTriangle, RotateCcw, Archive, ArchiveRestore, GitPullRequest, MoreVertical } from 'lucide-react'; | ||
| import { Card, CardContent } from './ui/card'; | ||
| import { Badge } from './ui/badge'; | ||
| import { Button } from './ui/button'; | ||
|
|
@@ -31,7 +31,7 @@ import { | |
| JSON_ERROR_PREFIX, | ||
| JSON_ERROR_TITLE_SUFFIX | ||
| } from '../../shared/constants'; | ||
| import { stopTask, checkTaskRunning, recoverStuckTask, isIncompleteHumanReview, archiveTasks, hasRecentActivity, startTaskOrQueue } from '../stores/task-store'; | ||
| import { stopTask, checkTaskRunning, recoverStuckTask, isIncompleteHumanReview, archiveTasks, unarchiveTasks, hasRecentActivity, startTaskOrQueue } from '../stores/task-store'; | ||
| import { useToast } from '../hooks/use-toast'; | ||
| import type { Task, TaskCategory, ReviewReason, TaskStatus } from '../../shared/types'; | ||
|
|
||
|
|
@@ -265,6 +265,18 @@ export const TaskCard = memo(function TaskCard({ | |
| } | ||
| }; | ||
|
|
||
| const handleUnarchive = async (e: React.MouseEvent) => { | ||
| e.stopPropagation(); | ||
| const result = await unarchiveTasks(task.projectId, [task.id]); | ||
| if (!result.success) { | ||
| toast({ | ||
| title: t('tasks:actions.unarchive'), | ||
| description: result.error, | ||
| variant: 'destructive', | ||
| }); | ||
| } | ||
ahmed-hassan19 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
|
Comment on lines
+268
to
+278
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Toast title on failure uses the action label instead of an error message.
♻️ Suggested fix if (!result.success) {
toast({
- title: t('tasks:actions.unarchive'),
+ title: t('common:errors.operationFailed'),
description: result.error,
variant: 'destructive',
});
}🤖 Prompt for AI Agents |
||
|
|
||
| const handleViewPR = (e: React.MouseEvent) => { | ||
| e.stopPropagation(); | ||
| if (task.metadata?.prUrl && window.electronAPI?.openExternal) { | ||
|
|
@@ -571,7 +583,17 @@ export const TaskCard = memo(function TaskCard({ | |
| <GitPullRequest className="h-3 w-3" /> | ||
| </Button> | ||
| )} | ||
| {!task.metadata?.archivedAt && ( | ||
| {task.metadata?.archivedAt ? ( | ||
| <Button | ||
| variant="ghost" | ||
| size="sm" | ||
| className="h-7 px-2 cursor-pointer" | ||
| onClick={handleUnarchive} | ||
| title={t('tooltips.unarchiveTask')} | ||
| > | ||
| <ArchiveRestore className="h-3 w-3" /> | ||
| </Button> | ||
| ) : ( | ||
| <Button | ||
| variant="ghost" | ||
| size="sm" | ||
|
|
@@ -583,6 +605,17 @@ export const TaskCard = memo(function TaskCard({ | |
| </Button> | ||
| )} | ||
| </div> | ||
| ) : task.status === 'done' && task.metadata?.archivedAt ? ( | ||
| <Button | ||
| variant="ghost" | ||
| size="sm" | ||
| className="h-7 px-2.5 hover:bg-muted-foreground/10" | ||
| onClick={handleUnarchive} | ||
| title={t('tooltips.unarchiveTask')} | ||
| > | ||
| <ArchiveRestore className="mr-1.5 h-3 w-3" /> | ||
| {t('actions.unarchive')} | ||
| </Button> | ||
| ) : task.status === 'done' && !task.metadata?.archivedAt ? ( | ||
| <Button | ||
| variant="ghost" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.