Update src/app/page.tsx
This commit is contained in:
249
src/app/page.tsx
249
src/app/page.tsx
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||
import NavbarStyleFullscreen from "@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen";
|
||||
import HeroBillboardRotatedCarousel from "@/components/sections/hero/HeroBillboardRotatedCarousel";
|
||||
@@ -8,99 +7,20 @@ import MetricCardEleven from "@/components/sections/metrics/MetricCardEleven";
|
||||
import BlogCardTwo from "@/components/sections/blog/BlogCardTwo";
|
||||
import ContactText from "@/components/sections/contact/ContactText";
|
||||
import FooterLogoReveal from "@/components/sections/footer/FooterLogoReveal";
|
||||
import FaqDouble from "@/components/sections/faq/FaqDouble";
|
||||
import Link from "next/link";
|
||||
import { BookOpen, Star, TrendingUp, Users, Award, Filter, Search } from "lucide-react";
|
||||
import Image from "next/image";
|
||||
|
||||
interface SearchResult {
|
||||
id: string;
|
||||
name: string;
|
||||
category: string;
|
||||
rating: number;
|
||||
}
|
||||
import { BookOpen } from "lucide-react";
|
||||
|
||||
export default function HomePage() {
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
const [autocompleteResults, setAutocompleteResults] = useState<SearchResult[]>([]);
|
||||
const [showAutocomplete, setShowAutocomplete] = useState(false);
|
||||
const [activeFilters, setActiveFilters] = useState<string[]>([]);
|
||||
const [showCookieConsent, setShowCookieConsent] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const cookieConsent = localStorage.getItem("cookie-consent");
|
||||
if (!cookieConsent) {
|
||||
setShowCookieConsent(true);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleCookieConsent = (accepted: boolean) => {
|
||||
localStorage.setItem("cookie-consent", accepted ? "accepted" : "rejected");
|
||||
setShowCookieConsent(false);
|
||||
};
|
||||
|
||||
const handleSearch = (query: string) => {
|
||||
setSearchQuery(query);
|
||||
if (query.length > 0) {
|
||||
const mockResults: SearchResult[] = [
|
||||
{ id: "1", name: "Matematik Özel Ders", category: "Matematik", rating: 4.9 },
|
||||
{ id: "2", name: "İngilizce Konuşma", category: "İngilizce", rating: 4.8 },
|
||||
{ id: "3", name: "Kimya Deneyleri", category: "Kimya", rating: 4.7 },
|
||||
{ id: "4", name: "Tarih Dersleri", category: "Tarih", rating: 4.9 },
|
||||
].filter(
|
||||
(r) =>
|
||||
r.name.toLowerCase().includes(query.toLowerCase()) ||
|
||||
r.category.toLowerCase().includes(query.toLowerCase())
|
||||
);
|
||||
setAutocompleteResults(mockResults);
|
||||
setShowAutocomplete(true);
|
||||
} else {
|
||||
setAutocompleteResults([]);
|
||||
setShowAutocomplete(false);
|
||||
}
|
||||
};
|
||||
|
||||
const toggleFilter = (filter: string) => {
|
||||
setActiveFilters((prev) =>
|
||||
prev.includes(filter) ? prev.filter((f) => f !== filter) : [...prev, filter]
|
||||
);
|
||||
};
|
||||
|
||||
const formatTurkishCurrency = (amount: number): string => {
|
||||
return new Intl.NumberFormat("tr-TR", {
|
||||
style: "currency", currency: "TRY", minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 2,
|
||||
}).format(amount);
|
||||
};
|
||||
|
||||
const formatTurkishDate = (date: Date): string => {
|
||||
return new Intl.DateTimeFormat("tr-TR", {
|
||||
year: "numeric", month: "long", day: "numeric"}).format(date);
|
||||
};
|
||||
|
||||
const StarRating = ({ rating, count }: { rating: number; count?: number }) => (
|
||||
<div className="flex items-center gap-1">
|
||||
{[...Array(5)].map((_, i) => (
|
||||
<Star
|
||||
key={i}
|
||||
size={16}
|
||||
className={i < Math.floor(rating) ? "fill-yellow-400 text-yellow-400" : "text-gray-300"}
|
||||
/>
|
||||
))}
|
||||
{count && <span className="text-sm text-gray-600 ml-1">({count})</span>}
|
||||
<span className="text-sm font-semibold ml-1">{rating}</span>
|
||||
</div>
|
||||
);
|
||||
|
||||
const navItems = [
|
||||
{ name: "Ana Sayfa", id: "/" },
|
||||
{ name: "Öğretmenler", id: "/teachers" },
|
||||
{ name: "Etkinlikler", id: "/events" },
|
||||
{ name: "Çalışma Programı", id: "/schedule" },
|
||||
{ name: "Öğretmen Paneli", id: "/teacher-dashboard" },
|
||||
{ name: "Etkinlikler", id: "events" },
|
||||
{ name: "Çalışma Programı", id: "schedule" },
|
||||
];
|
||||
|
||||
const heroBtns = [
|
||||
{ text: "Hemen Başla", href: "/teachers" },
|
||||
{
|
||||
text: "Hemen Başla", href: "/teacher-dashboard"},
|
||||
];
|
||||
|
||||
const metricsData = [
|
||||
@@ -144,30 +64,11 @@ export default function HomePage() {
|
||||
title: "Osmanlı İmparatorluğu Hikayesi", excerpt: "Osmanlı tarihinin önemli dönemleri, simgesel olaylar ve kültürel etkilerin kapsamlı incelemesi.", imageSrc: "http://img.b2bpic.net/free-photo/view-ancient-paper-scroll-writing-documenting_23-2151751754.jpg", imageAlt: "history book ancient civilization artifacts", authorName: "İbrahim Çelik", authorAvatar: "http://img.b2bpic.net/free-photo/young-man-wearing-blue-outfit-looking-satisfied_1298-169.jpg", date: "31 Ocak 2025"},
|
||||
];
|
||||
|
||||
const faqData = [
|
||||
{
|
||||
id: "1", title: "Platformda nasıl başlarım?", content: "Kayıt olun, öğretmen kategorilerini seçin ve profilinizi tamamlayın. Ardından istediğiniz öğretmenleri görüntüleyin ve rezervasyon yapın."},
|
||||
{
|
||||
id: "2", title: "Ders fiyatları ne kadar?", content: `Fiyatlar öğretmene ve derse göre değişir. Ortalama fiyatlar:
|
||||
<ul>
|
||||
<li>Bireysel Dersler: ${formatTurkishCurrency(150)} - ${formatTurkishCurrency(300)}</li>
|
||||
<li>Grup Dersleri: ${formatTurkishCurrency(100)} - ${formatTurkishCurrency(200)}</li>
|
||||
<li>Paket Fiyatları: ${formatTurkishCurrency(1500)} - ${formatTurkishCurrency(5000)}</li>
|
||||
</ul>`,
|
||||
},
|
||||
{
|
||||
id: "3", title: "İptal politikası nedir?", content: "Dersler başlamadan 24 saat önce iptal edebilirsiniz. Geç iptal edilen dersler geri iade edilmez. Öğretmen kaynaklı iptal durumlarında tam geri iade yapılır."},
|
||||
{
|
||||
id: "4", title: "Öğretmen değiştirebilir miyim?", content: "Evet! İlk dersten sonra öğretmen değiştirebilirsiniz. Destek ekibimizle iletişime geçerek yeni bir öğretmen seçebilirsiniz."},
|
||||
{
|
||||
id: "5", title: "Sertifikat alınır mı?", content: "Evet, kursları tamamlayan öğrenciler resmi sertifika alırlar. Sertifika, tamamlanan kurs saatini ve başarı notunuzu içerir."},
|
||||
{
|
||||
id: "6", title: "24/7 destek var mı?", content: "Evet! Canlı sohbet, email ve telefon desteği 24/7 mevcuttur. Ortalama yanıt süresi 5 dakikadır."},
|
||||
];
|
||||
|
||||
const contactButtons = [
|
||||
{ text: "Bize Yazın", href: "/contact" },
|
||||
{ text: "Canlı Sohbet", href: "#" },
|
||||
{
|
||||
text: "Bize Yazın", href: "/contact"},
|
||||
{
|
||||
text: "Canlı Sohbet", href: "#"},
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -183,75 +84,6 @@ export default function HomePage() {
|
||||
secondaryButtonStyle="layered"
|
||||
headingFontWeight="light"
|
||||
>
|
||||
{/* Breadcrumb Navigation */}
|
||||
<nav className="hidden md:flex items-center gap-2 p-4 text-sm text-gray-600" aria-label="Breadcrumb">
|
||||
<Link href="/" className="hover:text-primary-cta">Ana Sayfa</Link>
|
||||
<span>/</span>
|
||||
<span className="text-gray-900 font-semibold">Eğitim Platformu</span>
|
||||
</nav>
|
||||
|
||||
{/* Search & Filter Bar */}
|
||||
<div className="sticky top-0 z-40 bg-background border-b border-card p-4">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<div className="flex flex-col gap-4 md:flex-row md:gap-2">
|
||||
{/* Search with Autocomplete */}
|
||||
<div className="relative flex-1">
|
||||
<div className="flex items-center border border-card rounded-lg px-3 py-2 bg-card">
|
||||
<Search size={18} className="text-gray-400" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Öğretmen, ders veya konuyu ara..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => handleSearch(e.target.value)}
|
||||
onFocus={() => searchQuery && setShowAutocomplete(true)}
|
||||
onBlur={() => setTimeout(() => setShowAutocomplete(false), 200)}
|
||||
className="w-full ml-2 bg-transparent outline-none text-foreground"
|
||||
aria-label="Arama"
|
||||
/>
|
||||
</div>
|
||||
{/* Autocomplete Dropdown */}
|
||||
{showAutocomplete && autocompleteResults.length > 0 && (
|
||||
<div className="absolute top-full left-0 right-0 mt-2 bg-card border border-card rounded-lg shadow-lg z-50">
|
||||
{autocompleteResults.map((result) => (
|
||||
<div
|
||||
key={result.id}
|
||||
className="px-4 py-3 border-b border-background last:border-0 hover:bg-background cursor-pointer flex justify-between items-center"
|
||||
>
|
||||
<div>
|
||||
<div className="font-semibold text-foreground">{result.name}</div>
|
||||
<div className="text-sm text-gray-500">{result.category}</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Star size={16} className="fill-yellow-400 text-yellow-400" />
|
||||
<span className="text-sm font-semibold">{result.rating}</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Filter Chips */}
|
||||
<div className="flex gap-2 overflow-x-auto pb-2 md:pb-0">
|
||||
{["Popüler", "En Yüksek Puan", "Yakında"].map((filter) => (
|
||||
<button
|
||||
key={filter}
|
||||
onClick={() => toggleFilter(filter)}
|
||||
className={`px-4 py-2 rounded-full text-sm whitespace-nowrap transition-colors ${
|
||||
activeFilters.includes(filter)
|
||||
? "bg-primary-cta text-white"
|
||||
: "bg-card text-foreground border border-card hover:bg-background"
|
||||
}`}
|
||||
aria-pressed={activeFilters.includes(filter)}
|
||||
>
|
||||
{filter}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarStyleFullscreen
|
||||
navItems={navItems}
|
||||
@@ -275,28 +107,6 @@ export default function HomePage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Trust Badges Section */}
|
||||
<div className="py-8 px-4 bg-card/50">
|
||||
<div className="max-w-7xl mx-auto flex flex-wrap justify-center gap-8 items-center">
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<Award size={20} className="text-primary-cta" />
|
||||
<span className="font-semibold">SSL Güvenli</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<Award size={20} className="text-primary-cta" />
|
||||
<span className="font-semibold">Doğrulanmış Öğretmenler</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<Award size={20} className="text-primary-cta" />
|
||||
<span className="font-semibold">Para İade Garantisi</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<Award size={20} className="text-primary-cta" />
|
||||
<span className="font-semibold">4.9/5 Yıldız Puan</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="metrics" data-section="metrics">
|
||||
<MetricCardEleven
|
||||
metrics={metricsData}
|
||||
@@ -320,18 +130,6 @@ export default function HomePage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* FAQ Section */}
|
||||
<div id="faq" data-section="faq" className="py-12 px-4">
|
||||
<FaqDouble
|
||||
faqs={faqData}
|
||||
title="Sıkça Sorulan Sorular"
|
||||
description="Platformumuz hakkında merak ettiklerinizi öğrenin"
|
||||
faqsAnimation="slide-up"
|
||||
textboxLayout="default"
|
||||
useInvertedBackground={false}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div id="contact" data-section="contact">
|
||||
<ContactText
|
||||
text="Halen sorularınız mı var? Bize ulaşın ve eğitim yolculuğunuza başlayın. Destek ekibimiz 24/7 sizin hizmetinizde."
|
||||
@@ -351,33 +149,6 @@ export default function HomePage() {
|
||||
text: "Kullanım Şartları", href: "#"}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Cookie Consent Banner */}
|
||||
{showCookieConsent && (
|
||||
<div className="fixed bottom-0 left-0 right-0 bg-card border-t border-border p-4 shadow-lg z-50">
|
||||
<div className="max-w-7xl mx-auto flex flex-col md:flex-row items-center justify-between gap-4">
|
||||
<p className="text-sm text-foreground">
|
||||
Bu web sitesi deneyimi geliştirmek için çerezleri kullanır. Kullanımına devam ederek kabulünüz olduğunu kabul edersiniz.
|
||||
</p>
|
||||
<div className="flex gap-3">
|
||||
<button
|
||||
onClick={() => handleCookieConsent(false)}
|
||||
className="px-4 py-2 text-sm border border-border rounded-lg hover:bg-background transition-colors"
|
||||
aria-label="Çerezleri reddet"
|
||||
>
|
||||
Reddet
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleCookieConsent(true)}
|
||||
className="px-4 py-2 text-sm bg-primary-cta text-white rounded-lg hover:opacity-90 transition-opacity"
|
||||
aria-label="Çerezleri kabul et"
|
||||
>
|
||||
Kabul Et
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user