fixed some ui, upgrade functionalitym added permission to operator
This commit is contained in:
1 parent
25c104ad8c
commit
5ed4c9a8ec
46 files changed
+1058
-1401
No files matched your search
@@ -1,11 +1,8 @@
|
||||
import { useState } from "react";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Pencil, Trash2, XCircle, CheckCircle2, UserRound, Link2 } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { XCircle, CheckCircle2, UserRound, Link2 } from "lucide-react";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { ConfirmDialog } from "@/components/confirmDialog";
|
||||
import { BentoGrid, BentoCard, InfoRow } from "@/components/viewPageComponents";
|
||||
import { BentoGrid, BentoCard, InfoRow, ViewActions } from "@/components/viewPageComponents";
|
||||
import { useUser, useDeleteUser } from "@/features/allUsers/hooks/useAllUsers";
|
||||
|
||||
// ─── ActiveIndicator ──────────────────────────────────────────────────────────
|
||||
@@ -25,8 +22,6 @@ export default function UserViewPage() {
|
||||
|
||||
const { data: user, isLoading, isError } = useUser(userId);
|
||||
|
||||
const [deleteOpen, setDeleteOpen] = useState(false);
|
||||
|
||||
// ── Loading ───────────────────────────────────────────────────────────────
|
||||
|
||||
if (isLoading) {
|
||||
@@ -63,22 +58,20 @@ export default function UserViewPage() {
|
||||
{t("users.viewTitle", "Ulanyjy giňişleýin")}: {user.name}
|
||||
</h1>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
className="h-8 w-8 text-muted-foreground hover:text-destructive"
|
||||
onClick={() => setDeleteOpen(true)}
|
||||
>
|
||||
<Trash2 size={15} />
|
||||
</Button>
|
||||
<Button
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
className="h-8 w-8 text-muted-foreground hover:text-foreground"
|
||||
onClick={() => navigate(`/all-users/${userId}/edit`)}
|
||||
>
|
||||
<Pencil size={15} />
|
||||
</Button>
|
||||
<ViewActions
|
||||
editTo={`/all-users/${userId}/edit`}
|
||||
onDelete={async () => {
|
||||
await deleteUser.mutateAsync(userId);
|
||||
navigate("/all-users");
|
||||
}}
|
||||
deleting={deleteUser.isPending}
|
||||
deleteTitle={t("users.deleteDialog.title", "Ulanyjyny öçürmek")}
|
||||
deleteDescription={t(
|
||||
"users.deleteDialog.description",
|
||||
'Siz "{name}" ulanyjysyny öçürjekmi? Bu amal yzyna gaýtarylyp bilinmez.',
|
||||
).replace("{name}", user.username)}
|
||||
deleteConfirmLabel={t("common.delete", "Öçür")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -140,22 +133,6 @@ export default function UserViewPage() {
|
||||
)}
|
||||
</BentoCard>
|
||||
</BentoGrid>
|
||||
|
||||
<ConfirmDialog
|
||||
open={deleteOpen}
|
||||
onOpenChange={setDeleteOpen}
|
||||
title={t("users.deleteDialog.title", "Ulanyjyny öçürmek")}
|
||||
description={t("users.deleteDialog.description", 'Siz "{name}" ulanyjysyny öçürjekmi? Bu amal yzyna gaýtarylyp bilinmez.').replace(
|
||||
"{name}",
|
||||
user.username,
|
||||
)}
|
||||
confirmLabel={t("common.delete", "Öçür")}
|
||||
onConfirm={async () => {
|
||||
await deleteUser.mutateAsync(userId);
|
||||
navigate("/all-users");
|
||||
}}
|
||||
isLoading={deleteUser.isPending}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user