37 Commits

Author SHA1 Message Date
214230b937 Add src/hooks/useAuth.ts 2026-06-09 15:45:56 +00:00
273e74a1b8 Update src/app/superadmin/page.tsx 2026-06-09 15:45:55 +00:00
a7ae5367f5 Update src/app/reports/page.tsx 2026-06-09 15:45:55 +00:00
7b109762fc Update src/app/recipes/page.tsx 2026-06-09 15:45:54 +00:00
24d1f2d208 Update src/app/production/page.tsx 2026-06-09 15:45:54 +00:00
d2d65b50b4 Update src/app/product-variations/page.tsx 2026-06-09 15:45:53 +00:00
63a7bcb8b5 Update src/app/page.tsx 2026-06-09 15:45:53 +00:00
bb1b3b9ec2 Update src/app/movements/page.tsx 2026-06-09 15:45:52 +00:00
327d77f3ff Update src/app/logs/page.tsx 2026-06-09 15:45:52 +00:00
d246763078 Update src/app/login/page.tsx 2026-06-09 15:45:51 +00:00
8f18881cdf Update src/app/dashboard/page.tsx 2026-06-09 15:45:50 +00:00
04ee63c157 Merge version_5 into main
Merge version_5 into main
2026-06-09 14:37:50 +00:00
f674d27f0d Update src/app/page.tsx 2026-06-09 14:37:47 +00:00
a6dd38e420 Update src/app/movements/page.tsx 2026-06-09 14:37:46 +00:00
a4e9ee617b Update src/app/logs/page.tsx 2026-06-09 14:37:46 +00:00
036da8d014 Update src/app/login/page.tsx 2026-06-09 14:37:45 +00:00
e619251ca9 Update src/app/dashboard/page.tsx 2026-06-09 14:37:45 +00:00
a4a765a673 Add src/app/AuthGuard.tsx 2026-06-09 14:37:44 +00:00
05477d34bc Merge version_4 into main
Merge version_4 into main
2026-06-09 14:30:10 +00:00
808a732b6d Add src/app/reports/page.tsx 2026-06-09 14:30:07 +00:00
c03eec7b77 Update src/app/page.tsx 2026-06-09 14:30:06 +00:00
513e6a962f Add src/app/movements/page.tsx 2026-06-09 14:30:06 +00:00
01083e4afc Add src/app/logs/page.tsx 2026-06-09 14:30:05 +00:00
4b5fc6dddd Add src/app/login/page.tsx 2026-06-09 14:30:05 +00:00
a6609a58e4 Add src/app/dashboard/page.tsx 2026-06-09 14:30:04 +00:00
e19e719bcc Merge version_3 into main
Merge version_3 into main
2026-06-09 11:11:25 +00:00
5ba808d291 Update src/app/page.tsx 2026-06-09 11:11:22 +00:00
9fe7ed4094 Merge version_2 into main
Merge version_2 into main
2026-06-09 11:07:04 +00:00
76fc0c7b11 Update src/app/recipes/page.tsx 2026-06-09 11:06:58 +00:00
9a1744e47b Update src/app/production/page.tsx 2026-06-09 11:06:57 +00:00
8402c67b3a Update src/app/product-variations/page.tsx 2026-06-09 11:06:57 +00:00
20ccdb0fb4 Merge version_2 into main
Merge version_2 into main
2026-06-09 11:06:21 +00:00
5efcb7508f Add src/app/superadmin/page.tsx 2026-06-09 11:06:18 +00:00
619f6cd9fa Add src/app/recipes/page.tsx 2026-06-09 11:06:18 +00:00
2ed8d5f960 Add src/app/production/page.tsx 2026-06-09 11:06:17 +00:00
94b0a75b39 Add src/app/product-variations/page.tsx 2026-06-09 11:06:17 +00:00
b025a1780c Update src/app/page.tsx 2026-06-09 11:06:16 +00:00
12 changed files with 453 additions and 42 deletions

39
src/app/AuthGuard.tsx Normal file
View File

@@ -0,0 +1,39 @@
"use client";
import { useEffect } from 'react';
import { useRouter, usePathname } from 'next/navigation';
interface AuthGuardProps {
children: React.ReactNode;
}
export default function AuthGuard({ children }: AuthGuardProps) {
const router = useRouter();
const pathname = usePathname();
useEffect(() => {
const isAuthenticated = localStorage.getItem('isAuthenticated') === 'true';
// Allow access to login page regardless of authentication status
if (pathname === '/login') {
// If user is already authenticated and tries to go to login, redirect to dashboard
if (isAuthenticated) {
router.replace('/dashboard');
}
return;
}
// Protect all other pages except home (/) and login (/login)
if (pathname !== '/' && !isAuthenticated) {
router.replace('/login');
}
}, [pathname, router]);
// If on a protected route and not authenticated, we're redirecting, so don't render children yet.
// If on home page, or on login page, or on protected page AND authenticated, render children.
if (pathname !== '/' && pathname !== '/login' && localStorage.getItem('isAuthenticated') !== 'true') {
return null; // Don't render content until redirected
}
return <>{children}</>;
}

View File

@@ -0,0 +1,38 @@
"use client";
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/hooks/useAuth';
export default function DashboardPage() {
const { isAuthenticated, isLoading, logout } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.push('/login');
}
}, [isAuthenticated, isLoading, router]);
if (isLoading) {
return <div className="flex items-center justify-center min-h-screen text-xl">Yükleniyor...</div>;
}
if (!isAuthenticated) {
return null; // Or a loading spinner, as the redirect will happen soon
}
return (
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-background-accent text-foreground">
<h1 className="text-5xl font-extrabold mb-4">Gösterge Paneli</h1>
<p className="text-xl text-center mb-8">Hoş geldiniz! Burası size özel gösterge paneliniz.</p>
<button
onClick={logout}
className="px-6 py-3 bg-secondary-cta text-white rounded-full text-lg font-semibold shadow-lg hover:bg-opacity-90 transition-all duration-300"
>
Çıkış Yap
</button>
<p className="text-md text-gray-400 mt-4">Yalnızca yetkili kullanıcılar erişebilir.</p>
</div>
);
}

34
src/app/login/page.tsx Normal file
View File

@@ -0,0 +1,34 @@
"use client";
import { useAuth } from '@/hooks/useAuth';
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
export default function LoginPage() {
const { isAuthenticated, isLoading, login } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && isAuthenticated) {
router.push('/dashboard'); // Redirect if already authenticated
}
}, [isAuthenticated, isLoading, router]);
if (isLoading) {
return <div className="flex items-center justify-center min-h-screen text-xl">Yükleniyor...</div>;
}
return (
<div className="flex flex-col items-center justify-center min-h-screen p-4">
<h1 className="text-4xl font-bold mb-6">Giriş Yap</h1>
<p className="text-lg text-center mb-8">Panel sayfalarına erişmek için lütfen giriş yapın.</p>
<button
onClick={login}
className="px-8 py-4 bg-primary-cta text-white rounded-full text-lg font-semibold shadow-lg hover:bg-opacity-90 transition-all duration-300"
>
Giriş Yap (Demo)
</button>
<p className="mt-4 text-sm text-gray-500">Bu demo için basit bir giriş simülasyonudur.</p>
</div>
);
}

32
src/app/logs/page.tsx Normal file
View File

@@ -0,0 +1,32 @@
"use client";
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/hooks/useAuth';
export default function LogsPage() {
const { isAuthenticated, isLoading } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.push('/login');
}
}, [isAuthenticated, isLoading, router]);
if (isLoading) {
return <div className="flex items-center justify-center min-h-screen text-xl">Yükleniyor...</div>;
}
if (!isAuthenticated) {
return null; // Or a loading spinner, as the redirect will happen soon
}
return (
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-background-accent text-foreground">
<h1 className="text-5xl font-extrabold mb-4">Günlükler Paneli</h1>
<p className="text-xl text-center mb-8">Burada tüm sistem günlüklerini görüntüleyebilirsiniz.</p>
<p className="text-md text-gray-400">Yalnızca yetkili kullanıcılar erişebilir.</p>
</div>
);
}

View File

@@ -0,0 +1,32 @@
"use client";
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/hooks/useAuth';
export default function MovementsPage() {
const { isAuthenticated, isLoading } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.push('/login');
}
}, [isAuthenticated, isLoading, router]);
if (isLoading) {
return <div className="flex items-center justify-center min-h-screen text-xl">Yükleniyor...</div>;
}
if (!isAuthenticated) {
return null; // Or a loading spinner, as the redirect will happen soon
}
return (
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-background-accent text-foreground">
<h1 className="text-5xl font-extrabold mb-4">Hareketler Paneli</h1>
<p className="text-xl text-center mb-8">Ürünlerin tüm hareket geçmişini buradan takip edebilirsiniz.</p>
<p className="text-md text-gray-400">Yalnızca yetkili kullanıcılar erişebilir.</p>
</div>
);
}

View File

@@ -10,14 +10,16 @@ import TestimonialCardFifteen from "@/components/sections/testimonial/Testimonia
import PricingCardEight from "@/components/sections/pricing/PricingCardEight";
import FooterBaseReveal from "@/components/sections/footer/FooterBaseReveal";
import ContactCenter from "@/components/sections/contact/ContactCenter";
import { Zap, Layers, Package, TrendingUp, ShieldCheck, HelpCircle, DollarSign, Building, Clock, ShoppingCart, Warehouse, BarChart3 } from "lucide-react";
import { Zap, Layers, Package, TrendingUp, ShieldCheck, HelpCircle, DollarSign, Building, Clock, ShoppingCart, Warehouse, BarChart3, Mail } from "lucide-react";
import FeatureCardTwelve from '@/components/sections/feature/FeatureCardTwelve';
export default function SaasTemplatePage() {
const navItems = [
{ name: "Özellikler", id: "features" },
{ name: "Fiyatlandırma", id: "pricing" },
{ name: "İzlenebilirlik", id: "traceability" },
{ name: "Hakkımızda", id: "about" },
{ name: "İletişim", id: "contact" },
{ name: "İletişim", id: "contact" }
];
const avatars = [
@@ -29,18 +31,21 @@ export default function SaasTemplatePage() {
const features: FeatureCard[] = [
{
bentoComponent: "globe", title: "Kapsamlı Envanter Kontrolü", description: "Tüm ürünlerinizi, depo konumlarını ve stok seviyelerini tek bir yerden yönetin."},
bentoComponent: "globe", title: "Kapsamlı Envanter Kontrolü", description: "Tüm ürünlerinizi, depo konumlarını ve stok seviyelerini tek bir yerden yönetin."
},
{
bentoComponent: "marquee", variant: "text", centerIcon: Zap,
texts: ["Gerçek Zamanlı", "Doğru", "Hızlı", "Güvenli"],
title: "Hızlı ve Gerçek Zamanlı Takip", description: "Stok hareketlerini anlık olarak izleyin ve her zaman güncel bilgilere sahip olun."},
title: "Hızlı ve Gerçek Zamanlı Takip", description: "Stok hareketlerini anlık olarak izleyin ve her zaman güncel bilgilere sahip olun."
},
{
bentoComponent: "3d-stack-cards", items: [
{ icon: TrendingUp, title: "Talep Tahmini", subtitle: "Veriye Dayalı", detail: "Gelecek talebi öngörün" },
{ icon: Package, title: "Sipariş Otomasyonu", subtitle: "Verimli Akış", detail: "Siparişleri otomatikleştirin" },
{ icon: Warehouse, title: "Depo Optimizasyonu", subtitle: "Alan Kullanımı", detail: "Depo alanınızı en iyi şekilde kullanın" },
],
title: "Akıllı Stok Optimizasyonu", description: "Tedarik zincirinizi otomatikleştirin, talep tahminleri yapın ve aşırı stok maliyetlerinden kaçının."}
title: "Akıllı Stok Optimizasyonu", description: "Tedarik zincirinizi otomatikleştirin, talep tahminleri yapın ve aşırı stok maliyetlerinden kaçının."
}
];
return (
@@ -59,9 +64,11 @@ export default function SaasTemplatePage() {
description="Stokify ile envanterinizi zahmetsizce yönetin, operasyonel verimliliği artırın ve işinizi büyütün."
buttons={[
{
text: "Ücretsiz Deneyin", href: "#contact"},
text: "Ücretsiz Deneyin", href: "#contact"
},
{
text: "Detaylı Bilgi", href: "#features"},
text: "Detaylı Bilgi", href: "#features"
},
]}
marqueeItems={[
{ type: "text-icon", text: "Envanter Takibi", icon: Layers },
@@ -71,15 +78,17 @@ export default function SaasTemplatePage() {
{ type: "text-icon", text: "Otomatik Raporlama", icon: BarChart3 },
]}
/>
<FeatureBento
features={features}
animationType="none"
tag="Temel Özellikler"
title="Stok Yönetiminde İhtiyacınız Olan Her Şey"
description="Stokify, işletmenizin envanterini kolayca yönetmenizi ve operasyonel verimliliği artırmanızı sağlar."
textboxLayout="default"
useInvertedBackground={false}
/>
<div id="about" data-section="about">
<FeatureBento
features={features}
animationType="none"
tag="Temel Özellikler"
title="Stok Yönetiminde İhtiyacınız Olan Her Şey"
description="Stokify, işletmenizin envanterini kolayca yönetmenizi ve operasyonel verimliliği artırmanızı sağlar."
textboxLayout="default"
useInvertedBackground={false}
/>
</div>
<FeatureBorderGlow
tag="Neden Stokify?"
tagIcon={HelpCircle}
@@ -91,18 +100,56 @@ export default function SaasTemplatePage() {
features={[
{
icon: Package,
title: "Kapsamlı Ürün Yönetimi", description: "Ürünlerinizi barkod, kategori ve diğer detaylarla kolayca yönetin."},
title: "Kapsamlı Ürün Yönetimi", description: "Ürünlerinizi barkod, kategori ve diğer detaylarla kolayca yönetin."
},
{
icon: TrendingUp,
title: "Gelişmiş Raporlama", description: "Stok hareketleri, satış analizleri ve performans raporları ile akıllı kararlar alın."},
title: "Gelişmiş Raporlama", description: "Stok hareketleri, satış analizleri ve performans raporları ile akıllı kararlar alın."
},
{
icon: ShieldCheck,
title: "Güvenli Veri Saklama", description: "Tüm envanter verileriniz güvenli sunucularda saklanır ve yedeklenir."},
title: "Güvenli Veri Saklama", description: "Tüm envanter verileriniz güvenli sunucularda saklanır ve yedeklenir."
},
{
icon: Zap,
title: "Gerçek Zamanlı Envanter Takibi", description: "Stok seviyelerini anlık olarak izleyin ve olası sorunlara hızla müdahale edin."},
title: "Gerçek Zamanlı Envanter Takibi", description: "Stok seviyelerini anlık olarak izleyin ve olası sorunlara hızla müdahale edin."
},
]}
/>
<div id="traceability" data-section="traceability">
<FeatureCardTwelve
tag="İzlenebilirlik"
tagIcon={ShieldCheck}
title="Tam Kontrol ve Şeffaflık: Stoklarınızda Eksiksiz İzlenebilirlik"
description="İşletmenizin her aşamasında şeffaflığı ve hesap verebilirliği artıran kapsamlı izlenebilirlik sistemimizle tanışın."
animationType="slide-up"
textboxLayout="default"
useInvertedBackground={false}
features={[
{
id: "user-logging", label: "Kullanıcı Günlüğü", title: "Detaylı Kullanıcı Hareket Kayıtları", items: [
"Her kullanıcının sistemdeki tüm eylemlerini izleyin.", "Kim ne zaman ne yaptı, kolayca görün.", "Yetkisiz erişim ve hataları tespit edin."
]
},
{
id: "transaction-history", label: "İşlem Geçmişi", title: "Kapsamlı İşlem Takibi", items: [
"Her envanter hareketinin eksiksiz geçmişini görüntüleyin.", "Ürün girişlerinden çıkışlara, tüm detaylar.", "Hata ayıklama ve raporlama için kritik."
]
},
{
id: "audit-trails", label: "Denetim İzleri", title: "Güvenilir Denetim Mekanizmaları", items: [
"Değişikliklerin ne zaman, kim tarafından ve nasıl yapıldığını takip edin.", "Yasal uyumluluk ve iç denetimler için gerekli.", "Veri bütünlüğünü sağlayın."
]
},
{
id: "db-guarantees", label: "Veritabanı Garanti", title: "Veritabanı İşlem Garantileri", items: [
"Tüm veritabanı işlemlerinde ACID garantileri.", "Veri tutarlılığı ve güvenilirliği en üst düzeyde.", "Sistem kesintilerinde bile veri kaybını önler."
]
}
]}
buttons={[{ text: "Şimdi Keşfet", href: "#contact" }]}
/>
</div>
<TestimonialCardFifteen
testimonial="Stokify, envanter yönetimimizi baştan aşağı değiştirdi. Artık ürün kayıplarımız minimumda ve operasyonel verimliliğimiz zirvede. Kesinlikle tavsiye ederim!"
rating={5}
@@ -127,7 +174,8 @@ export default function SaasTemplatePage() {
{ text: "Hemen Başla", onClick: () => console.log("Starter clicked") },
],
features: [
"500 Ürüne Kadar", "Temel Stok Takibi", "Manuel Veri Girişi", "E-posta Desteği"],
"500 Ürüne Kadar", "Temel Stok Takibi", "Manuel Veri Girişi", "E-posta Desteği"
],
},
{
id: "pro", badge: "Profesyonel", badgeIcon: BarChart3,
@@ -135,7 +183,8 @@ export default function SaasTemplatePage() {
{ text: "Hemen Başla", onClick: () => console.log("Pro clicked") },
],
features: [
"Sınırsız Ürün", "Otomatik Envanter Güncelleme", "Barkod Entegrasyonu", "Gelişmiş Raporlama", "API Erişimi", "Öncelikli Destek"],
"Sınırsız Ürün", "Otomatik Envanter Güncelleme", "Barkod Entegrasyonu", "Gelişmiş Raporlama", "API Erişimi", "Öncelikli Destek"
],
},
{
id: "enterprise", badge: "Kurumsal", badgeIcon: Building,
@@ -143,7 +192,8 @@ export default function SaasTemplatePage() {
{ text: "Teklif Alın", onClick: () => console.log("Enterprise clicked") },
],
features: [
"Tüm Profesyonel Özellikler", "Özel Hesap Yöneticisi", "Kişiselleştirilmiş Entegrasyonlar", "Eğitim ve Yerinde Destek", "Gelişmiş Güvenlik"],
"Tüm Profesyonel Özellikler", "Özel Hesap Yöneticisi", "Kişiselleştirilmiş Entegrasyonlar", "Eğitim ve Yerinde Destek", "Gelişmiş Güvenlik"
],
},
]}
/>
@@ -163,34 +213,22 @@ export default function SaasTemplatePage() {
columns={[
{
title: "Ürün", items: [
{ label: "Özellikler", href: "#features" },
{ label: "Fiyatlandırma", href: "#pricing" },
{ label: "Entegrasyonlar", href: "#" },
{ label: "Referanslar", href: "#" },
{ label: "Özellikler", href: "/#features" },
{ label: "Fiyatlandırma", href: "/#pricing" },
{ label: "İzlenebilirlik", href: "/#traceability" }
],
},
{
title: "Şirket", items: [
{ label: "Hakkımızda", href: "#about" },
{ label: "Blog", href: "#" },
{ label: "Kariyer", href: "#" },
{ label: "İletişim", href: "#contact" },
{ label: "Hakkımızda", href: "/#about" },
{ label: "İletişim", href: "/#contact" }
],
},
{
title: "Kaynaklar", items: [
{ label: "Dokümantasyon", href: "#" },
{ label: "Yardım Merkezi", href: "#" },
{ label: "Topluluk", href: "#" },
{ label: "Destek", href: "#" },
],
title: "Kaynaklar", items: []
},
{
title: "Yasal", items: [
{ label: "Gizlilik Politikası", href: "#" },
{ label: "Kullanım Koşulları", href: "#" },
{ label: "Çerez Politikası", href: "#" },
],
title: "Yasal", items: []
},
]}
copyrightText="2024 Stokify. Tüm hakları saklıdır."

View File

@@ -0,0 +1,32 @@
"use client";
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/hooks/useAuth';
export default function ProductVariationsPage() {
const { isAuthenticated, isLoading } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.push('/login');
}
}, [isAuthenticated, isLoading, router]);
if (isLoading) {
return <div className="flex items-center justify-center min-h-screen text-xl">Yükleniyor...</div>;
}
if (!isAuthenticated) {
return null; // Or a loading spinner, as the redirect will happen soon
}
return (
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-background-accent text-foreground">
<h1 className="text-5xl font-extrabold mb-4">Varyasyonlar Paneli</h1>
<p className="text-xl text-center mb-8">Ürün varyasyonlarınızı buradan yönetin.</p>
<p className="text-md text-gray-400">Yalnızca yetkili kullanıcılar erişebilir.</p>
</div>
);
}

View File

@@ -0,0 +1,32 @@
"use client";
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/hooks/useAuth';
export default function ProductionPage() {
const { isAuthenticated, isLoading } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.push('/login');
}
}, [isAuthenticated, isLoading, router]);
if (isLoading) {
return <div className="flex items-center justify-center min-h-screen text-xl">Yükleniyor...</div>;
}
if (!isAuthenticated) {
return null; // Or a loading spinner, as the redirect will happen soon
}
return (
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-background-accent text-foreground">
<h1 className="text-5xl font-extrabold mb-4">Üretim Paneli</h1>
<p className="text-xl text-center mb-8">Üretim süreçlerinizi ve operasyonlarınızı buradan yönetebilirsiniz.</p>
<p className="text-md text-gray-400">Yalnızca yetkili kullanıcılar erişebilir.</p>
</div>
);
}

32
src/app/recipes/page.tsx Normal file
View File

@@ -0,0 +1,32 @@
"use client";
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/hooks/useAuth';
export default function RecipesPage() {
const { isAuthenticated, isLoading } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.push('/login');
}
}, [isAuthenticated, isLoading, router]);
if (isLoading) {
return <div className="flex items-center justify-center min-h-screen text-xl">Yükleniyor...</div>;
}
if (!isAuthenticated) {
return null; // Or a loading spinner, as the redirect will happen soon
}
return (
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-background-accent text-foreground">
<h1 className="text-5xl font-extrabold mb-4">Reçeteler Paneli</h1>
<p className="text-xl text-center mb-8">Ürün reçetelerinizi ve içeriklerini buradan yönetin.</p>
<p className="text-md text-gray-400">Yalnızca yetkili kullanıcılar erişebilir.</p>
</div>
);
}

32
src/app/reports/page.tsx Normal file
View File

@@ -0,0 +1,32 @@
"use client";
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/hooks/useAuth';
export default function ReportsPage() {
const { isAuthenticated, isLoading } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.push('/login');
}
}, [isAuthenticated, isLoading, router]);
if (isLoading) {
return <div className="flex items-center justify-center min-h-screen text-xl">Yükleniyor...</div>;
}
if (!isAuthenticated) {
return null; // Or a loading spinner, as the redirect will happen soon
}
return (
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-background-accent text-foreground">
<h1 className="text-5xl font-extrabold mb-4">Raporlar Paneli</h1>
<p className="text-xl text-center mb-8">İşletmenize özel detaylı raporlara buradan ulaşabilirsiniz.</p>
<p className="text-md text-gray-400">Yalnızca yetkili kullanıcılar erişebilir.</p>
</div>
);
}

View File

@@ -0,0 +1,32 @@
"use client";
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/hooks/useAuth';
export default function SuperadminPage() {
const { isAuthenticated, isLoading } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.push('/login');
}
}, [isAuthenticated, isLoading, router]);
if (isLoading) {
return <div className="flex items-center justify-center min-h-screen text-xl">Yükleniyor...</div>;
}
if (!isAuthenticated) {
return null; // Or a loading spinner, as the redirect will happen soon
}
return (
<div className="flex flex-col items-center justify-center min-h-screen p-4 bg-background-accent text-foreground">
<h1 className="text-5xl font-extrabold mb-4">Yönetim Paneli</h1>
<p className="text-xl text-center mb-8">Tüm sistem ayarlarını ve kullanıcılarını buradan yönetin.</p>
<p className="text-md text-red-500 font-semibold">YALNIZCA SÜPER YÖNETİCİLER İÇİN</p>
</div>
);
}

38
src/hooks/useAuth.ts Normal file
View File

@@ -0,0 +1,38 @@
import { useState, useEffect } from 'react';
import { useRouter } from 'next/navigation';
// This is a placeholder for actual authentication logic.
// In a real application, this would interact with an authentication service,
// check tokens, manage sessions, etc.
export const useAuth = () => {
const [isAuthenticated, setIsAuthenticated] = useState(false);
const [isLoading, setIsLoading] = useState(true);
const router = useRouter();
useEffect(() => {
// Simulate checking for a token or session
const token = localStorage.getItem('authToken');
if (token === 'valid-token') {
setIsAuthenticated(true);
} else {
setIsAuthenticated(false);
}
setIsLoading(false);
}, []);
const login = () => {
// Simulate successful login
localStorage.setItem('authToken', 'valid-token');
setIsAuthenticated(true);
router.push('/dashboard'); // Redirect to dashboard after login
};
const logout = () => {
// Simulate logout
localStorage.removeItem('authToken');
setIsAuthenticated(false);
router.push('/login'); // Redirect to login page after logout
};
return { isAuthenticated, isLoading, login, logout };
};