mediahub-fe/components/page-title.tsx

78 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-11-28 17:23:53 +00:00
"use client";
2024-12-12 18:38:15 +00:00
import React, { useEffect } from "react";
2024-11-28 17:23:53 +00:00
import DateRangePicker from "@/components/date-range-picker";
import { usePathname } from "@/components/navigation";
2024-12-12 18:38:15 +00:00
import { cn, getCookiesDecrypt } from "@/lib/utils";
2025-03-05 16:37:57 +00:00
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "./ui/dialog";
import { Button } from "./ui/button";
import { Label } from "./ui/label";
import { Input } from "./ui/input";
2024-11-26 03:09:48 +00:00
2024-11-28 17:23:53 +00:00
const PageTitle = ({
title,
className,
}: {
title?: string;
className?: string;
}) => {
const pathname = usePathname();
const name = pathname?.split("/").slice(1).join(" ");
2024-12-12 18:38:15 +00:00
const roleId = getCookiesDecrypt("urie");
2024-11-26 03:09:48 +00:00
2024-12-12 18:38:15 +00:00
useEffect(() => {
console.log("role", roleId);
}, [roleId]);
return Number(roleId) == 2 || Number(roleId) == 11 || Number(roleId) == 12 ? (
""
) : (
2024-11-28 17:23:53 +00:00
<div
className={cn(
"flex flex-wrap gap-4 items-center justify-between",
className
)}
>
<div className="text-2xl font-medium text-default-800 capitalize">
Dashboard
</div>
2025-03-05 16:37:57 +00:00
<Dialog>
<DialogTrigger asChild>
<Button variant="outline">Download Report</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>Download Report</DialogTitle>
</DialogHeader>
<div className="grid gap-4 py-4">
<div className="w-full">
<Label>Date</Label>
<Input
type="date"
// value={dateFilter}
// onChange={(e) => setDateFilter(e.target.value)}
className="w-full"
/>
</div>
</div>
<DialogFooter>
<Button
type="submit"
// onClick={downloadReport}
>
Download
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
2024-11-28 17:23:53 +00:00
</div>
);
};
2024-11-26 03:09:48 +00:00
2024-11-28 17:23:53 +00:00
export default PageTitle;