fix: show navbar again

This commit is contained in:
Sabda Yagra 2025-10-12 11:15:40 +07:00
parent ecb878fc7a
commit e8f49bdad4
6 changed files with 28 additions and 54 deletions

View File

@ -13,7 +13,7 @@ import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { format } from "date-fns"; import { format } from "date-fns";
import withReactContent from "sweetalert2-react-content"; import withReactContent from "sweetalert2-react-content";
import { deleteMedia } from "@/service/content/content"; import { deleteArticle, deleteMedia } from "@/service/content/content";
import { error } from "@/lib/swal"; import { error } from "@/lib/swal";
import Swal from "sweetalert2"; import Swal from "sweetalert2";
import Link from "next/link"; import Link from "next/link";
@ -55,12 +55,10 @@ const useTableColumns = () => {
const categoryName = row.getValue("categoryName"); const categoryName = row.getValue("categoryName");
const categories = row.original.categories; const categories = row.original.categories;
// Handle new API structure with categories array // Handle new API structure with categories array
const displayName = categoryName || (categories && categories.length > 0 ? categories[0].title : "-"); const displayName =
return ( categoryName ||
<span className="whitespace-nowrap"> (categories && categories.length > 0 ? categories[0].title : "-");
{displayName} return <span className="whitespace-nowrap">{displayName}</span>;
</span>
);
}, },
}, },
{ {
@ -190,13 +188,8 @@ const useTableColumns = () => {
const MySwal = withReactContent(Swal); const MySwal = withReactContent(Swal);
async function doDelete(id: any) { async function doDelete(id: any) {
// loading(); const data = { id };
const data = { const response = await deleteArticle(id);
id,
};
const response = await deleteMedia(data);
if (response?.error) { if (response?.error) {
error(response.message); error(response.message);
return false; return false;
@ -220,7 +213,6 @@ const useTableColumns = () => {
const handleDeleteMedia = (id: any) => { const handleDeleteMedia = (id: any) => {
MySwal.fire({ MySwal.fire({
title: "Hapus Data", title: "Hapus Data",
text: "",
icon: "warning", icon: "warning",
showCancelButton: true, showCancelButton: true,
cancelButtonColor: "#3085d6", cancelButtonColor: "#3085d6",
@ -232,7 +224,6 @@ const useTableColumns = () => {
} }
}); });
}; };
const [isMabesApprover, setIsMabesApprover] = React.useState(false); const [isMabesApprover, setIsMabesApprover] = React.useState(false);
const userId = getCookiesDecrypt("uie"); const userId = getCookiesDecrypt("uie");
const userLevelId = getCookiesDecrypt("ulie"); const userLevelId = getCookiesDecrypt("ulie");

View File

@ -3,7 +3,7 @@ import FormAudio from "@/components/form/content/audio/audio-form";
const AudioCreatePage = async () => { const AudioCreatePage = async () => {
return ( return (
<div> <div>
<div className="space-y-4"> <div className="space-y-4 bg-slate-100">
<FormAudio /> <FormAudio />
</div> </div>
</div> </div>

View File

@ -13,7 +13,7 @@ import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { format } from "date-fns"; import { format } from "date-fns";
import { error } from "@/lib/swal"; import { error } from "@/lib/swal";
import { deleteMedia } from "@/service/content/content"; import { deleteArticle, deleteMedia } from "@/service/content/content";
import withReactContent from "sweetalert2-react-content"; import withReactContent from "sweetalert2-react-content";
import Swal from "sweetalert2"; import Swal from "sweetalert2";
import Link from "next/link"; import Link from "next/link";
@ -55,12 +55,10 @@ const useTableColumns = () => {
const categoryName = row.getValue("categoryName"); const categoryName = row.getValue("categoryName");
const categories = row.original.categories; const categories = row.original.categories;
// Handle new API structure with categories array // Handle new API structure with categories array
const displayName = categoryName || (categories && categories.length > 0 ? categories[0].title : "-"); const displayName =
return ( categoryName ||
<span className="whitespace-nowrap"> (categories && categories.length > 0 ? categories[0].title : "-");
{displayName} return <span className="whitespace-nowrap">{displayName}</span>;
</span>
);
}, },
}, },
{ {
@ -191,13 +189,8 @@ const useTableColumns = () => {
const MySwal = withReactContent(Swal); const MySwal = withReactContent(Swal);
async function doDelete(id: any) { async function doDelete(id: any) {
// loading(); const data = { id };
const data = { const response = await deleteArticle(id);
id,
};
const response = await deleteMedia(data);
if (response?.error) { if (response?.error) {
error(response.message); error(response.message);
return false; return false;
@ -221,7 +214,6 @@ const useTableColumns = () => {
const handleDeleteMedia = (id: any) => { const handleDeleteMedia = (id: any) => {
MySwal.fire({ MySwal.fire({
title: "Hapus Data", title: "Hapus Data",
text: "",
icon: "warning", icon: "warning",
showCancelButton: true, showCancelButton: true,
cancelButtonColor: "#3085d6", cancelButtonColor: "#3085d6",
@ -233,7 +225,6 @@ const useTableColumns = () => {
} }
}); });
}; };
const [isMabesApprover, setIsMabesApprover] = React.useState(false); const [isMabesApprover, setIsMabesApprover] = React.useState(false);
const userId = getCookiesDecrypt("uie"); const userId = getCookiesDecrypt("uie");
const userLevelId = getCookiesDecrypt("ulie"); const userLevelId = getCookiesDecrypt("ulie");
@ -267,9 +258,7 @@ const useTableColumns = () => {
</Link> </Link>
{(Number(row.original.uploadedById) === Number(userId) || {(Number(row.original.uploadedById) === Number(userId) ||
isMabesApprover) && ( isMabesApprover) && (
<Link <Link href={`/admin/content/text/update/${row.original.id}`}>
href={`/admin/content/text/update/${row.original.id}`}
>
<DropdownMenuItem className="p-2 border-b text-default-700 group rounded-none"> <DropdownMenuItem className="p-2 border-b text-default-700 group rounded-none">
<SquarePen className="w-4 h-4 me-1.5" /> <SquarePen className="w-4 h-4 me-1.5" />
Edit Edit

View File

@ -215,7 +215,6 @@ const useTableColumns = () => {
const handleDeleteMedia = (id: any) => { const handleDeleteMedia = (id: any) => {
MySwal.fire({ MySwal.fire({
title: "Hapus Data", title: "Hapus Data",
text: "",
icon: "warning", icon: "warning",
showCancelButton: true, showCancelButton: true,
cancelButtonColor: "#3085d6", cancelButtonColor: "#3085d6",
@ -227,7 +226,6 @@ const useTableColumns = () => {
} }
}); });
}; };
const [isMabesApprover, setIsMabesApprover] = React.useState(false); const [isMabesApprover, setIsMabesApprover] = React.useState(false);
const userId = getCookiesDecrypt("uie"); const userId = getCookiesDecrypt("uie");
const userLevelId = getCookiesDecrypt("ulie"); const userLevelId = getCookiesDecrypt("ulie");
@ -253,9 +251,7 @@ const useTableColumns = () => {
</Button> </Button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent className="p-0" align="end"> <DropdownMenuContent className="p-0" align="end">
<Link <Link href={`/admin/content/video/detail/${row.original.id}`}>
href={`/admin/content/video/detail/${row.original.id}`}
>
<DropdownMenuItem className="p-2 border-b text-default-700 group rounded-none"> <DropdownMenuItem className="p-2 border-b text-default-700 group rounded-none">
<Eye className="w-4 h-4 me-1.5" /> <Eye className="w-4 h-4 me-1.5" />
View View
@ -271,14 +267,12 @@ const useTableColumns = () => {
</Link> */} </Link> */}
{/* {(Number(row.original.uploadedById) === Number(userId) || {/* {(Number(row.original.uploadedById) === Number(userId) ||
isMabesApprover) && ( */} isMabesApprover) && ( */}
<Link <Link href={`/admin/content/video/update/${row.original.id}`}>
href={`/admin/content/video/update/${row.original.id}`} <DropdownMenuItem className="p-2 border-b text-default-700 group rounded-none">
> <SquarePen className="w-4 h-4 me-1.5" />
<DropdownMenuItem className="p-2 border-b text-default-700 group rounded-none"> Edit
<SquarePen className="w-4 h-4 me-1.5" /> </DropdownMenuItem>
Edit </Link>
</DropdownMenuItem>
</Link>
{/* )} */} {/* )} */}
<DropdownMenuItem <DropdownMenuItem
onClick={() => handleDeleteMedia(row.original.id)} onClick={() => handleDeleteMedia(row.original.id)}

View File

@ -8,7 +8,7 @@ export default function Home() {
return ( return (
<div className="relative min-h-screen font-[family-name:var(--font-geist-sans)]"> <div className="relative min-h-screen font-[family-name:var(--font-geist-sans)]">
<div className="relative z-10 bg-white w-full mx-auto"> <div className="relative z-10 bg-white w-full mx-auto">
{/* <Navbar /> */} <Navbar />
<div className="flex-1"> <div className="flex-1">
<Header /> <Header />
</div> </div>

View File

@ -783,7 +783,6 @@ export default function FormAudio() {
const resCsrf = await getCsrfToken(); const resCsrf = await getCsrfToken();
const csrfToken = resCsrf?.data?.token; const csrfToken = resCsrf?.data?.token;
console.log("CSRF TOKEN : ", csrfToken);
const headers = { const headers = {
"X-XSRF-TOKEN": csrfToken, "X-XSRF-TOKEN": csrfToken,
}; };
@ -986,8 +985,8 @@ export default function FormAudio() {
return ( return (
<form onSubmit={handleSubmit(onSubmit)}> <form onSubmit={handleSubmit(onSubmit)}>
<div className="flex flex-col lg:flex-row gap-10"> <div className="flex flex-col lg:flex-row gap-10 border rounded-lg">
<Card className="w-full lg:w-8/12"> <Card className="w-full lg:w-8/12 m-2">
<div className="px-6 py-6"> <div className="px-6 py-6">
<p className="text-lg font-semibold mb-3">Form Audio</p> <p className="text-lg font-semibold mb-3">Form Audio</p>
<div className="gap-5 mb-5"> <div className="gap-5 mb-5">
@ -1464,7 +1463,7 @@ export default function FormAudio() {
</div> </div>
</div> </div>
</Card> </Card>
<div className="w-full lg:w-4/12"> <div className="w-full lg:w-4/12 m-2">
<Card className="pb-3"> <Card className="pb-3">
<div className="px-3 py-3"> <div className="px-3 py-3">
<div className="space-y-2"> <div className="space-y-2">
@ -1597,6 +1596,7 @@ export default function FormAudio() {
id={option.id} id={option.id}
checked={isChecked} checked={isChecked}
onCheckedChange={handleChange} onCheckedChange={handleChange}
className="border"
/> />
<Label htmlFor={option.id}>{option.label}</Label> <Label htmlFor={option.id}>{option.label}</Label>
</div> </div>