-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(forum): Add delete dialog for forum in AdminCP
- Loading branch information
1 parent
a2f4f59
commit 0820a7b
Showing
4 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
frontend/admin/forum/views/forums/table/item/actions/delete/content.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useTranslations } from "next-intl"; | ||
|
||
import { | ||
AlertDialogHeader, | ||
AlertDialogTitle | ||
} from "@/components/ui/alert-dialog"; | ||
|
||
export const ContentDeleteActionForumAdmin = () => { | ||
// const t = useTranslations("admin_forum.forums.delete"); | ||
const tCore = useTranslations("core"); | ||
|
||
return ( | ||
<> | ||
<AlertDialogHeader> | ||
<AlertDialogTitle>{tCore("are_your_sure")}</AlertDialogTitle> | ||
</AlertDialogHeader> | ||
</> | ||
); | ||
}; |
37 changes: 37 additions & 0 deletions
37
frontend/admin/forum/views/forums/table/item/actions/delete/delete.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Trash2 } from "lucide-react"; | ||
import { useTranslations } from "next-intl"; | ||
import { Suspense, lazy } from "react"; | ||
|
||
import { Loader } from "@/components/loader"; | ||
import { | ||
AlertDialog, | ||
AlertDialogContent, | ||
AlertDialogTrigger | ||
} from "@/components/ui/alert-dialog"; | ||
import { Button } from "@/components/ui/button"; | ||
|
||
const Content = lazy(() => | ||
import("./content").then(module => ({ | ||
default: module.ContentDeleteActionForumAdmin | ||
})) | ||
); | ||
|
||
export const DeleteActionForumAdmin = () => { | ||
const t = useTranslations("core"); | ||
|
||
return ( | ||
<AlertDialog> | ||
<AlertDialogTrigger asChild> | ||
<Button variant="destructiveGhost" size="icon" tooltip={t("delete")}> | ||
<Trash2 /> | ||
</Button> | ||
</AlertDialogTrigger> | ||
|
||
<AlertDialogContent> | ||
<Suspense fallback={<Loader />}> | ||
<Content /> | ||
</Suspense> | ||
</AlertDialogContent> | ||
</AlertDialog> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters