Initial commit

This commit is contained in:
payacom
2026-07-09 15:26:46 +03:30
parent ff2009c402
commit edb094e323
65 changed files with 4083 additions and 803 deletions

View File

@@ -2,14 +2,13 @@
import Link from "next/link";
import { useEffect, useState } from "react";
import toast from "react-hot-toast";
import BoldIcon from "@/components/ui/BoldIcon";
import { cn } from "@/lib/utils";
const tabs = [
{ href: "/", icon: "home-2", label: "خانه" },
{ href: "/academy", icon: "teacher", label: "آموزشگاه" },
{ href: "/new-post", icon: "add-square", label: "پست ها" },
{ href: "/projects", icon: "briefcase", label: "پروژه‌ها" },
{ href: "/billboards", icon: "flash-circle", label: "بیلبورد" },
{ href: "/settings", icon: "setting", label: "تنظیمات" },
] as const;
@@ -19,24 +18,11 @@ type TabNavigationProps = {
};
export default function TabNavigation({ currentPage }: TabNavigationProps) {
const [createTab, setCreateTab] = useState("/new-post");
const [userTypeS, setUserTypeS] = useState<string | null>(null);
const [mounted, setMounted] = useState(false);
const [isDark, setIsDark] = useState(false);
useEffect(() => {
setMounted(true);
if (typeof window !== "undefined") {
const userType = localStorage.getItem("usertype");
setUserTypeS(userType);
setCreateTab(
userType === "user"
? "/new-post"
: userType === "employer"
? "/new-project"
: "/new-post"
);
}
}, []);
useEffect(() => {
@@ -59,27 +45,24 @@ export default function TabNavigation({ currentPage }: TabNavigationProps) {
return (
<nav className="fixed bottom-2 left-1/2 z-50 w-full max-w-xl -translate-x-1/2 px-4 pb-2">
<div className="glass-panel gentle-transition flex justify-evenly rounded-full border border-white/40 p-2.5 shadow-lg dark:border-white/10">
{tabs.map((tab, index) => {
const href = index === 2 ? createTab : tab.href;
{tabs.map((tab) => {
const isActive =
currentPage === href ||
(href === "/settings" && currentPage.startsWith("/settings"));
currentPage === tab.href ||
(tab.href === "/settings" && currentPage.startsWith("/settings")) ||
(tab.href === "/projects" &&
(currentPage.startsWith("/projects") ||
currentPage === "/new-project")) ||
(tab.href === "/academy" && currentPage.startsWith("/academy"));
return (
<Link
key={tab.href}
href={href}
href={tab.href}
className={cn(
"gentle-transition flex flex-col items-center gap-0.5 rounded-2xl px-2 py-1",
"hover:bg-black/5 active:scale-95 dark:hover:bg-white/10",
isActive && "tab-active-glass scale-105"
)}
onClick={(e) => {
if (index === 2 && !userTypeS) {
e.preventDefault();
toast.error("لطفا ابتدا در سایت وارد شوید یا ثبت نام کنید.");
}
}}
>
<BoldIcon
name={tab.icon}