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): avoid nested buttons in alert dialog footers

justin16481e3bb98f
diff --git a/apps/web/src/components/backlog-list-view/backlog-task-row.tsx b/apps/web/src/components/backlog-list-view/backlog-task-row.tsx
index 95de5bd80..b15616087 100644
--- a/apps/web/src/components/backlog-list-view/backlog-task-row.tsx
+++ b/apps/web/src/components/backlog-list-view/backlog-task-row.tsx
@@ -249,15 +249,19 @@ export default function BacklogTaskRow({ task }: BacklogTaskRowProps) {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose>
- <Button variant="outline" size="sm">
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose render={<Button variant="outline" size="sm" />}>
+ {t("common:actions.cancel")}
</AlertDialogClose>
- <AlertDialogClose onClick={handleDeleteTask}>
- <Button variant="destructive" size="sm">
- {t("tasks:delete.action")}
- </Button>
+ <AlertDialogClose
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={handleDeleteTask}
+ />
+ }
+ >
+ {t("tasks:delete.action")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
diff --git a/apps/web/src/components/kanban-board/task-card.tsx b/apps/web/src/components/kanban-board/task-card.tsx
index d21cd5c10..b2d18774e 100644
--- a/apps/web/src/components/kanban-board/task-card.tsx
+++ b/apps/web/src/components/kanban-board/task-card.tsx
@@ -415,15 +415,19 @@ function TaskCard({ task, disableDragDrop = false }: TaskCardProps) {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose>
- <Button variant="outline" size="sm">
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose render={<Button variant="outline" size="sm" />}>
+ {t("common:actions.cancel")}
</AlertDialogClose>
- <AlertDialogClose onClick={handleDeleteTask}>
- <Button variant="destructive" size="sm">
- {t("tasks:delete.action")}
- </Button>
+ <AlertDialogClose
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={handleDeleteTask}
+ />
+ }
+ >
+ {t("tasks:delete.action")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
diff --git a/apps/web/src/components/list-view/task-row.tsx b/apps/web/src/components/list-view/task-row.tsx
index 6ff49008d..7ea40f2a7 100644
--- a/apps/web/src/components/list-view/task-row.tsx
+++ b/apps/web/src/components/list-view/task-row.tsx
@@ -402,15 +402,19 @@ function TaskRow({ task, projectSlug }: TaskRowProps) {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose>
- <Button variant="outline" size="sm">
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose render={<Button variant="outline" size="sm" />}>
+ {t("common:actions.cancel")}
</AlertDialogClose>
- <AlertDialogClose onClick={handleDeleteTask}>
- <Button variant="destructive" size="sm">
- {t("tasks:delete.action")}
- </Button>
+ <AlertDialogClose
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={handleDeleteTask}
+ />
+ }
+ >
+ {t("tasks:delete.action")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
diff --git a/apps/web/src/components/nav-projects.tsx b/apps/web/src/components/nav-projects.tsx
index cc59759f7..7ba19d440 100644
--- a/apps/web/src/components/nav-projects.tsx
+++ b/apps/web/src/components/nav-projects.tsx
@@ -396,31 +396,33 @@ export function NavProjects() {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose>
- <Button variant="outline" size="sm">
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose render={<Button variant="outline" size="sm" />}>
+ {t("common:actions.cancel")}
</AlertDialogClose>
<AlertDialogClose
- onClick={async () => {
- await deleteProject({
- id: projectToDeleteId || "",
- });
- toast.success(t("navigation:projectList.deletedToast"));
- queryClient.invalidateQueries({
- queryKey: ["projects"],
- });
- navigate({
- to: "/dashboard/workspace/$workspaceId",
- params: {
- workspaceId: workspace?.id || "",
- },
- });
- }}
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={async () => {
+ await deleteProject({
+ id: projectToDeleteId || "",
+ });
+ toast.success(t("navigation:projectList.deletedToast"));
+ queryClient.invalidateQueries({
+ queryKey: ["projects"],
+ });
+ navigate({
+ to: "/dashboard/workspace/$workspaceId",
+ params: {
+ workspaceId: workspace?.id || "",
+ },
+ });
+ }}
+ />
+ }
>
- <Button variant="destructive" size="sm">
- {t("navigation:projectList.deleteProject")}
- </Button>
+ {t("navigation:projectList.deleteProject")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
diff --git a/apps/web/src/components/notification/notification-dropdown.tsx b/apps/web/src/components/notification/notification-dropdown.tsx
index dc6a2419b..3e894d02f 100644
--- a/apps/web/src/components/notification/notification-dropdown.tsx
+++ b/apps/web/src/components/notification/notification-dropdown.tsx
@@ -391,15 +391,19 @@ const NotificationDropdown = forwardRef<NotificationDropdownRef>(
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose>
- <Button variant="outline" size="sm">
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose render={<Button variant="outline" size="sm" />}>
+ {t("common:actions.cancel")}
</AlertDialogClose>
- <AlertDialogClose onClick={handleClearAll}>
- <Button variant="destructive" size="sm">
- {t("common:actions.clearAll")}
- </Button>
+ <AlertDialogClose
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={handleClearAll}
+ />
+ }
+ >
+ {t("common:actions.clearAll")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
diff --git a/apps/web/src/components/task/task-subtasks.tsx b/apps/web/src/components/task/task-subtasks.tsx
index cfce32550..07dbb38dd 100644
--- a/apps/web/src/components/task/task-subtasks.tsx
+++ b/apps/web/src/components/task/task-subtasks.tsx
@@ -460,15 +460,19 @@ export default function TaskSubtasks({
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose>
- <Button variant="outline" size="sm">
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose render={<Button variant="outline" size="sm" />}>
+ {t("common:actions.cancel")}
</AlertDialogClose>
- <AlertDialogClose onClick={handleDeleteTask}>
- <Button variant="destructive" size="sm">
- {t("tasks:subtasks.deleteAction")}
- </Button>
+ <AlertDialogClose
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ onClick={handleDeleteTask}
+ />
+ }
+ >
+ {t("tasks:subtasks.deleteAction")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
diff --git a/apps/web/src/components/team/members-table.tsx b/apps/web/src/components/team/members-table.tsx
index 547a15e6b..202b41f6a 100644
--- a/apps/web/src/components/team/members-table.tsx
+++ b/apps/web/src/components/team/members-table.tsx
@@ -434,19 +434,25 @@ function MembersTable({ workspaceId, invitations, users }: Props) {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose disabled={isDeleting}>
- <Button variant="outline" size="sm" disabled={isDeleting}>
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose
+ render={
+ <Button variant="outline" size="sm" disabled={isDeleting} />
+ }
+ >
+ {t("common:actions.cancel")}
</AlertDialogClose>
<AlertDialogClose
- onClick={handleDeleteMember}
- disabled={isDeleting}
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ disabled={isDeleting}
+ onClick={handleDeleteMember}
+ />
+ }
>
- <Button variant="destructive" size="sm" disabled={isDeleting}>
- <TrashIcon className="mr-2 size-4" />
- {t("team:membersTable.removeMember")}
- </Button>
+ <TrashIcon className="mr-2 size-4" />
+ {t("team:membersTable.removeMember")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
@@ -468,19 +474,25 @@ function MembersTable({ workspaceId, invitations, users }: Props) {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose disabled={isCancelling}>
- <Button variant="outline" size="sm" disabled={isCancelling}>
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose
+ render={
+ <Button variant="outline" size="sm" disabled={isCancelling} />
+ }
+ >
+ {t("common:actions.cancel")}
</AlertDialogClose>
<AlertDialogClose
- onClick={handleCancelInvitation}
- disabled={isCancelling}
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ disabled={isCancelling}
+ onClick={handleCancelInvitation}
+ />
+ }
>
- <Button variant="destructive" size="sm" disabled={isCancelling}>
- <TrashIcon className="mr-2 size-4" />
- {t("team:membersTable.cancelInvitation")}
- </Button>
+ <TrashIcon className="mr-2 size-4" />
+ {t("team:membersTable.cancelInvitation")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/general.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/general.tsx
index a7d05dc51..bed836552 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/general.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/general.tsx
@@ -605,20 +605,22 @@ function RouteComponent() {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose>
- <Button variant="outline" size="sm">
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose render={<Button variant="outline" size="sm" />}>
+ {t("common:actions.cancel")}
</AlertDialogClose>
<AlertDialogClose
- onClick={handleDeleteProject}
- disabled={isDeleting}
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ disabled={isDeleting}
+ onClick={handleDeleteProject}
+ />
+ }
>
- <Button variant="destructive" size="sm" disabled={isDeleting}>
- {isDeleting
- ? t("common:actions.deleting")
- : t("settings:projectGeneral.deleteModalConfirm")}
- </Button>
+ {isDeleting
+ ? t("common:actions.deleting")
+ : t("settings:projectGeneral.deleteModalConfirm")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/general.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/general.tsx
index 8bfb67213..08a5fc99f 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/general.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/general.tsx
@@ -556,25 +556,30 @@ function RouteComponent() {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose disabled={isTransferring}>
- <Button variant="outline" size="sm" disabled={isTransferring}>
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose
+ render={
+ <Button variant="outline" size="sm" disabled={isTransferring} />
+ }
+ >
+ {t("common:actions.cancel")}
</AlertDialogClose>
<AlertDialogClose
- onClick={handleTransferOwnership}
- disabled={isTransferring || !selectedMember}
+ render={
+ <Button
+ size="sm"
+ disabled={isTransferring}
+ onClick={handleTransferOwnership}
+ />
+ }
>
- <Button size="sm" disabled={isTransferring}>
- {isTransferring
- ? t(
- "settings:workspaceGeneral.transferOwnership.transferring",
- { defaultValue: "Transferring…" },
- )
- : t("settings:workspaceGeneral.transferOwnership.confirm", {
- defaultValue: "Transfer ownership",
- })}
- </Button>
+ {isTransferring
+ ? t(
+ "settings:workspaceGeneral.transferOwnership.transferring",
+ { defaultValue: "Transferring…" },
+ )
+ : t("settings:workspaceGeneral.transferOwnership.confirm", {
+ defaultValue: "Transfer ownership",
+ })}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
@@ -596,20 +601,22 @@ function RouteComponent() {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose>
- <Button variant="outline" size="sm">
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose render={<Button variant="outline" size="sm" />}>
+ {t("common:actions.cancel")}
</AlertDialogClose>
<AlertDialogClose
- onClick={handleDeleteWorkspace}
- disabled={isDeleting}
+ render={
+ <Button
+ variant="destructive"
+ size="sm"
+ disabled={isDeleting}
+ onClick={handleDeleteWorkspace}
+ />
+ }
>
- <Button variant="destructive" size="sm" disabled={isDeleting}>
- {isDeleting
- ? t("common:actions.deleting")
- : t("settings:workspaceGeneral.deleteModalConfirm")}
- </Button>
+ {isDeleting
+ ? t("common:actions.deleting")
+ : t("settings:workspaceGeneral.deleteModalConfirm")}
</AlertDialogClose>
</AlertDialogFooter>
</AlertDialogContent>
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/roles.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/roles.tsx
index 572d42054..5fd45978a 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/roles.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/roles.tsx
@@ -790,15 +790,17 @@ function DeleteRoleConfirm({
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogClose disabled={isPending}>
- <Button
- variant="outline"
- size="sm"
- disabled={isPending}
- onClick={onCancel}
- >
- {t("common:actions.cancel")}
- </Button>
+ <AlertDialogClose
+ render={
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={isPending}
+ onClick={onCancel}
+ />
+ }
+ >
+ {t("common:actions.cancel")}
</AlertDialogClose>
<Button
variant="destructive"