Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): show the priority mark in the bulk toast

Andrej4c89504dc4da
diff --git a/apps/web/src/components/bulk-selection/use-bulk-actions.ts b/apps/web/src/components/bulk-selection/use-bulk-actions.ts
index 41da94b78..7b03737f6 100644
--- a/apps/web/src/components/bulk-selection/use-bulk-actions.ts
+++ b/apps/web/src/components/bulk-selection/use-bulk-actions.ts
@@ -2,22 +2,21 @@ import {
ArchiveIcon,
CalendarDaysIcon,
CircleDotIcon,
- type LucideIcon,
- SignalHighIcon,
SquareKanbanIcon,
SquircleDashedIcon,
TagIcon,
Trash2Icon,
UserRoundIcon,
} from "lucide-react";
-import { useMemo, useState } from "react";
+import { createElement, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useBulkOperations } from "@/hooks/mutations/task/use-bulk-operations";
import useGetLabelsByWorkspace from "@/hooks/queries/label/use-get-labels-by-workspace";
import useActiveWorkspace from "@/hooks/queries/workspace/use-active-workspace";
import useGetProjectMembers from "@/hooks/queries/workspace-users/use-get-project-members";
import { useWorkspacePermission } from "@/hooks/use-workspace-permission";
-import { toast } from "@/lib/toast";
+import { PriorityGlyph } from "@/components/task-chips/priority-glyph";
+import { type ToastIcon, toast } from "@/lib/toast";
import useProjectStore from "@/store/project";
export function useBulkActions(
@@ -57,7 +56,7 @@ export function useBulkActions(
const run = async (
action: () => Promise<unknown>,
success: string,
- icon: LucideIcon,
+ icon: ToastIcon,
error: string,
) => {
try {
@@ -91,7 +90,8 @@ export function useBulkActions(
run(
() => operations.bulkPriority({ taskIds: taskIds(), priority }),
t("tasks:bulk.updateSuccess", { count }),
- SignalHighIcon,
+ ({ className }) =>
+ createElement(PriorityGlyph, { priority, className }),
t("tasks:bulk.updatePriorityError"),
),
assign: (userId: string) =>
diff --git a/apps/web/src/components/ui/toast.tsx b/apps/web/src/components/ui/toast.tsx
index 9c0a5b547..28207065d 100644
--- a/apps/web/src/components/ui/toast.tsx
+++ b/apps/web/src/components/ui/toast.tsx
@@ -6,12 +6,12 @@ import {
CircleCheckIcon,
InfoIcon,
LoaderCircleIcon,
- type LucideIcon,
TriangleAlertIcon,
} from "lucide-react";
import { buttonVariants } from "@/components/ui/button";
import { ToastShakeRoot } from "@/components/ui/toast-shake-root";
import { cn } from "@/lib/cn";
+import type { ToastIcon } from "@/lib/toast";
const toastManager = Toast.createToastManager();
const anchoredToastManager = Toast.createToastManager();
@@ -71,7 +71,7 @@ function Toasts({ position = "bottom-right" }: { position: ToastPosition }) {
>
{toasts.map((toast) => {
const data = toast.data as
- | { icon?: LucideIcon; repeat?: number }
+ | { icon?: ToastIcon; repeat?: number }
| undefined;
const Icon =
data?.icon ??
diff --git a/apps/web/src/lib/toast.ts b/apps/web/src/lib/toast.ts
index db8eb054f..d3276d18a 100644
--- a/apps/web/src/lib/toast.ts
+++ b/apps/web/src/lib/toast.ts
@@ -1,6 +1,8 @@
-import type { LucideIcon } from "lucide-react";
+import type { ComponentType } from "react";
import { toastManager } from "@/components/ui/toast";
+export type ToastIcon = ComponentType<{ className?: string }>;
+
type ToastVariant = "success" | "error" | "info" | "warning";
type ToastAction = {
@@ -10,7 +12,7 @@ type ToastAction = {
type ToastOptions = {
description?: string;
- icon?: LucideIcon;
+ icon?: ToastIcon;
action?: ToastAction;
cancel?: ToastAction;
};