feat: fixing set banner and pop up (minor)

This commit is contained in:
hanif salafi 2025-06-24 09:43:08 +07:00
parent 4ef9d5b513
commit 89375f00b1
5 changed files with 7 additions and 29 deletions

View File

@ -58,16 +58,6 @@ const columns: ColumnDef<any>[] = [
<span>{formatDateToIndonesian(row.getValue("createdAt"))}</span> <span>{formatDateToIndonesian(row.getValue("createdAt"))}</span>
), ),
}, },
{
accessorKey: "isStaticBanner",
header: "Static Banner",
cell: ({ row }) => (
<StaticToogle
id={row.original.id}
initChecked={row.original.isStaticBanner}
/>
),
},
{ {
accessorKey: "statusName", accessorKey: "statusName",
header: "Status Banner", header: "Status Banner",
@ -75,7 +65,6 @@ const columns: ColumnDef<any>[] = [
<StatusToogle id={row.original.id} initChecked={row.original.isBanner} /> <StatusToogle id={row.original.id} initChecked={row.original.isBanner} />
), ),
}, },
{ {
id: "actions", id: "actions",
accessorKey: "action", accessorKey: "action",

View File

@ -28,7 +28,7 @@ export default function AdminBanner() {
: "bg-white text-black " : "bg-white text-black "
}`} }`}
> >
Kontent Konten
</Button> </Button>
<Button <Button
rounded="md" rounded="md"

View File

@ -58,24 +58,13 @@ const columns: ColumnDef<any>[] = [
<span>{formatDateToIndonesian(row.getValue("createdAt"))}</span> <span>{formatDateToIndonesian(row.getValue("createdAt"))}</span>
), ),
}, },
{
accessorKey: "isStaticBanner",
header: "Static Banner",
cell: ({ row }) => (
<StaticToogle
id={row.original.id}
initChecked={row.original.isStaticBanner}
/>
),
},
{ {
accessorKey: "statusName", accessorKey: "statusName",
header: "Status Banner", header: "Status Pop Up",
cell: ({ row }) => ( cell: ({ row }) => (
<StatusToogle id={row.original.id} initChecked={row.original.isBanner} /> <StatusToogle id={row.original.id} initChecked={row.original.isInterstitial} />
), ),
}, },
{ {
id: "actions", id: "actions",
accessorKey: "action", accessorKey: "action",

View File

@ -1,7 +1,7 @@
import { Switch } from "@/components/ui/switch"; import { Switch } from "@/components/ui/switch";
import { useToast } from "@/components/ui/use-toast"; import { useToast } from "@/components/ui/use-toast";
import { useRouter } from "@/i18n/routing"; import { useRouter } from "@/i18n/routing";
import { setBanner } from "@/service/settings/settings"; import { setBanner, setPopUp } from "@/service/settings/settings";
export default function StatusToogle(props: { export default function StatusToogle(props: {
id: number; id: number;
@ -12,7 +12,7 @@ export default function StatusToogle(props: {
const router = useRouter(); const router = useRouter();
const disableBanner = async () => { const disableBanner = async () => {
const response = await setBanner(id, false); const response = await setPopUp(id, false);
if (response?.error) { if (response?.error) {
toast({ toast({
@ -25,7 +25,7 @@ export default function StatusToogle(props: {
toast({ toast({
title: "Success ", title: "Success ",
}); });
router.push("/admin/settings/banner?dataChange=true"); router.push("/admin/settings/popup?dataChange=true");
}; };
return ( return (
<Switch <Switch

View File

@ -28,7 +28,7 @@ export default function AdminPopup() {
: "bg-white text-black " : "bg-white text-black "
}`} }`}
> >
Kontent Konten
</Button> </Button>
<Button <Button
rounded="md" rounded="md"