-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add star feature for tasks to prevent accidental deletion #6245
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
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 |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import React from "react" | ||
| import { cn } from "@/lib/utils" | ||
| import { StandardTooltip } from "@/components/ui" | ||
| import { useAppTranslation } from "@/i18n/TranslationContext" | ||
|
|
||
| interface StarButtonProps { | ||
| itemId: string | ||
| isStarred?: boolean | ||
| onToggleStar: (itemId: string) => void | ||
| className?: string | ||
| } | ||
|
|
||
| export const StarButton: React.FC<StarButtonProps> = ({ itemId, isStarred, onToggleStar, className }) => { | ||
| const { t } = useAppTranslation() | ||
|
|
||
| const handleClick = (e: React.MouseEvent) => { | ||
| e.stopPropagation() | ||
| onToggleStar(itemId) | ||
| } | ||
|
|
||
| return ( | ||
| <StandardTooltip content={isStarred ? t("history:unstarTask") : t("history:starTask")}> | ||
| <button | ||
| onClick={handleClick} | ||
| className={cn( | ||
| "p-1 rounded hover:bg-vscode-toolbar-hoverBackground transition-colors", | ||
| "focus:outline-none focus:ring-1 focus:ring-vscode-focusBorder", | ||
| className, | ||
| )} | ||
| aria-label={isStarred ? t("history:unstarTask") : t("history:starTask")}> | ||
| <span | ||
| className={cn("codicon", { | ||
| "codicon-star-full text-vscode-notificationsWarningIcon-foreground": isStarred, | ||
| "codicon-star-empty": !isStarred, | ||
| })} | ||
| /> | ||
| </button> | ||
| </StandardTooltip> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,11 @@ | |||||
| "exportTask": "Export Task", | ||||||
| "deleteTask": "Delete Task", | ||||||
| "deleteTaskMessage": "Are you sure you want to delete this task? This action cannot be undone.", | ||||||
| "deleteStarredTask": "Cannot Delete Starred Task", | ||||||
| "deleteStarredTaskMessage": "This task is starred and cannot be deleted. Please unstar it first if you want to delete it.", | ||||||
| "starTask": "Star task", | ||||||
| "unstarTask": "Unstar task", | ||||||
|
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. Typographical note: The label "Unstar task" has inconsistent capitalization compared to similar entries (e.g. "Export Task", "Delete Task"). Consider changing it to "Unstar Task" for consistency.
Suggested change
This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX. |
||||||
| "starredTasksExcluded": "{{count}} starred task(s) will not be deleted", | ||||||
| "cancel": "Cancel", | ||||||
| "delete": "Delete", | ||||||
| "exitSelection": "Exit Selection", | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typographical note: The label "Star task" has inconsistent capitalization compared to similar entries (e.g. "Export Task", "Delete Task"). Consider changing it to "Star Task" for consistency.
This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.