fix(lint): resolve eslint warnings, type errors and clean unused code

This commit is contained in:
mstfyldz
2026-08-23 01:51:51 +03:00
parent b312bc5593
commit 99951328ed
9 changed files with 31 additions and 81 deletions
+3 -66
View File
@@ -4,7 +4,7 @@ import { useState } from "react";
import Image from "next/image"; import Image from "next/image";
import { m, type Variants } from "framer-motion"; import { m, type Variants } from "framer-motion";
import Link from "next/link"; import Link from "next/link";
import { Utensils, Umbrella, Home, Wind, Hotel, Star, MapPin, ArrowRight } from "lucide-react"; import { MapPin, ArrowRight } from "lucide-react";
import { Button } from "@/app/components/ui/button"; import { Button } from "@/app/components/ui/button";
import { SectionHeader } from "@/app/components/ui/section-header"; import { SectionHeader } from "@/app/components/ui/section-header";
import { Marquee } from "@/app/components/ui/marquee"; import { Marquee } from "@/app/components/ui/marquee";
@@ -12,6 +12,7 @@ import { AnimatedNumber } from "@/app/components/ui/animated-number";
import { TextReveal } from "@/app/components/ui/text-reveal"; import { TextReveal } from "@/app/components/ui/text-reveal";
import { ShimmerButton } from "@/app/components/ui/shimmer-button"; import { ShimmerButton } from "@/app/components/ui/shimmer-button";
import { Badge } from "@/app/components/ui/badge"; import { Badge } from "@/app/components/ui/badge";
import type { Dictionary } from "@/types/dictionary";
const HERO_BG = const HERO_BG =
"https://images.unsplash.com/photo-1499793983690-e29da59ef1c2?auto=format&fit=crop&q=80&w=2070"; "https://images.unsplash.com/photo-1499793983690-e29da59ef1c2?auto=format&fit=crop&q=80&w=2070";
@@ -33,70 +34,6 @@ const STATS = [
{ value: 5, suffix: "", label: "Hizmet Kategorisi" }, { value: 5, suffix: "", label: "Hizmet Kategorisi" },
]; ];
const SERVICES = [
{
id: "restaurant",
title: "Restaurant",
icon: Utensils,
desc: "Ege'nin taze lezzetleri, yerel malzemeler ve şef imzalı tatlar.",
bg: "https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?auto=format&fit=crop&q=80&w=800",
},
{
id: "beach",
title: "Beach Bar",
icon: Umbrella,
desc: "Altın kumlar, masmavi deniz ve özenle seçilmiş içecekler.",
bg: "https://images.unsplash.com/photo-1507525428034-b723cf961d3e?auto=format&fit=crop&q=80&w=800",
},
{
id: "bungalow",
title: "Bungalov",
icon: Home,
desc: "Doğa ile iç içe, huzurlu ve modern konaklama deneyimi.",
bg: "https://images.unsplash.com/photo-1449844908441-8829872d2607?auto=format&fit=crop&q=80&w=800",
},
{
id: "kitesurf",
title: "Kite Surf",
icon: Wind,
desc: "Rüzgarın enerjisini hissedin; başlangıç ve ileri seviye dersler.",
bg: "https://images.unsplash.com/photo-1526685514088-290076a0d426?auto=format&fit=crop&q=80&w=800",
},
{
id: "hotel",
title: "Hotel",
icon: Hotel,
desc: "Premium konfor ve Ege'nin eşsiz manzarasıyla özel tatil.",
bg: "https://images.unsplash.com/photo-1566073771259-6a8506099945?auto=format&fit=crop&q=80&w=800",
},
];
const TESTIMONIALS = [
{
name: "Ayşe Y.",
origin: "İstanbul",
comment:
"Ege'de şimdiye kadar geçirdiğim en güzel tatildi. Hizmet kalitesi muazzamdı, her detay özenle düşünülmüş.",
rating: 5,
},
{
name: "John S.",
origin: "London",
comment:
"The kite surfing instructors were incredibly professional. The location is breathtaking — I'll be back next summer.",
rating: 5,
},
{
name: "Mehmet K.",
origin: "Ankara",
comment:
"Bungalovlar son derece huzurlu. Doğanın içindeyken şehrin konforundan hiç taviz vermiyorsunuz.",
rating: 5,
},
];
const fadeUp: Variants = { const fadeUp: Variants = {
hidden: { opacity: 0, y: 30 }, hidden: { opacity: 0, y: 30 },
visible: (i = 0) => ({ visible: (i = 0) => ({
@@ -106,7 +43,7 @@ const fadeUp: Variants = {
}), }),
}; };
export default function HomeClient({ lang, dict }: { lang: string; dict: any }) { export default function HomeClient({ lang, dict }: { lang: string; dict: Dictionary["home"] }) {
const [activeMap, setActiveMap] = useState(0); const [activeMap, setActiveMap] = useState(0);
const VENUES: { id: string; title: string; tag: string; desc: string; img: string; color: string; link: string }[] = dict.venuesList; const VENUES: { id: string; title: string; tag: string; desc: string; img: string; color: string; link: string }[] = dict.venuesList;
+2 -1
View File
@@ -5,8 +5,9 @@ import Image from "next/image";
import { m, AnimatePresence } from "framer-motion"; import { m, AnimatePresence } from "framer-motion";
import { X, ZoomIn } from "lucide-react"; import { X, ZoomIn } from "lucide-react";
import { Badge } from "@/app/components/ui/badge"; import { Badge } from "@/app/components/ui/badge";
import type { Dictionary } from "@/types/dictionary";
export default function GaleriClient({ lang, dict }: { lang: string; dict: any }) { export default function GaleriClient({ dict }: { lang?: string; dict: Dictionary }) {
const t = dict.gallery; const t = dict.gallery;
const CATEGORIES = [t.all, t.venues, "Beach", "Bungalov", "Kite Surf", "Hotel"] as const; const CATEGORIES = [t.all, t.venues, "Beach", "Bungalov", "Kite Surf", "Hotel"] as const;
+2 -2
View File
@@ -3,8 +3,8 @@
import { useState } from "react"; import { useState } from "react";
import { m, AnimatePresence } from "framer-motion"; import { m, AnimatePresence } from "framer-motion";
import { Plus, Minus } from "lucide-react"; import { Plus, Minus } from "lucide-react";
import { SectionHeader } from "@/app/components/ui/section-header";
import { Badge } from "@/app/components/ui/badge"; import { Badge } from "@/app/components/ui/badge";
import type { Dictionary } from "@/types/dictionary";
function FaqItem({ q, a }: { q: string; a: string }) { function FaqItem({ q, a }: { q: string; a: string }) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
@@ -41,7 +41,7 @@ function FaqItem({ q, a }: { q: string; a: string }) {
); );
} }
export default function SSSClient({ lang, dict }: { lang: string; dict: any }) { export default function SSSClient({ dict }: { lang?: string; dict: Dictionary }) {
const t = dict.faq; const t = dict.faq;
const FAQS = [ const FAQS = [
+3 -2
View File
@@ -1,9 +1,10 @@
import Link from "next/link"; import Link from "next/link";
import Image from "next/image"; import Image from "next/image";
import { MapPin, Phone, Mail } from "lucide-react"; import { MapPin } from "lucide-react";
import { Locale } from "../dictionaries"; import { Locale } from "../dictionaries";
import type { Dictionary } from "@/types/dictionary";
export default function Footer({ lang, dict }: { lang: Locale; dict: any }) { export default function Footer({ lang, dict }: { lang: Locale; dict: Dictionary["footer"] }) {
return ( return (
<footer className="bg-[var(--color-moy-dark)] text-white pt-16 pb-8 border-t border-gray-800"> <footer className="bg-[var(--color-moy-dark)] text-white pt-16 pb-8 border-t border-gray-800">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
+2 -1
View File
@@ -7,8 +7,9 @@ import { usePathname } from "next/navigation";
import { Menu, X, Globe } from "lucide-react"; import { Menu, X, Globe } from "lucide-react";
import { m, AnimatePresence } from "framer-motion"; import { m, AnimatePresence } from "framer-motion";
import { Locale } from "../dictionaries"; import { Locale } from "../dictionaries";
import type { Dictionary } from "@/types/dictionary";
export default function Navbar({ lang, dict }: { lang: Locale; dict: any }) { export default function Navbar({ lang, dict }: { lang: Locale; dict: Dictionary["navigation"] }) {
const [isScrolled, setIsScrolled] = useState(false); const [isScrolled, setIsScrolled] = useState(false);
const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const pathname = usePathname(); const pathname = usePathname();
+1
View File
@@ -12,6 +12,7 @@ const eslintConfig = defineConfig([
"out/**", "out/**",
"build/**", "build/**",
"next-env.d.ts", "next-env.d.ts",
"scripts/**",
]), ]),
]); ]);
+13 -7
View File
@@ -1,11 +1,16 @@
import { SignJWT, jwtVerify } from 'jose'; import { SignJWT, jwtVerify, type JWTPayload } from 'jose';
import { cookies } from 'next/headers'; import { cookies } from 'next/headers';
import { NextRequest, NextResponse } from 'next/server'; import { NextRequest, NextResponse } from 'next/server';
const secretKey = process.env.JWT_SECRET || 'super-secret-key-replace-me-in-production'; const secretKey = process.env.JWT_SECRET || 'super-secret-key-replace-me-in-production';
const key = new TextEncoder().encode(secretKey); const key = new TextEncoder().encode(secretKey);
export async function encrypt(payload: any) { export interface SessionPayload extends JWTPayload {
userId?: string;
expires?: Date;
}
export async function encrypt(payload: JWTPayload) {
return await new SignJWT(payload) return await new SignJWT(payload)
.setProtectedHeader({ alg: 'HS256' }) .setProtectedHeader({ alg: 'HS256' })
.setIssuedAt() .setIssuedAt()
@@ -13,13 +18,13 @@ export async function encrypt(payload: any) {
.sign(key); .sign(key);
} }
export async function decrypt(input: string): Promise<any> { export async function decrypt(input: string): Promise<JWTPayload | null> {
try { try {
const { payload } = await jwtVerify(input, key, { const { payload } = await jwtVerify(input, key, {
algorithms: ['HS256'], algorithms: ['HS256'],
}); });
return payload; return payload;
} catch (error) { } catch {
return null; return null;
} }
} }
@@ -53,16 +58,17 @@ export async function updateSession(request: NextRequest) {
const session = request.cookies.get('session')?.value; const session = request.cookies.get('session')?.value;
if (!session) return; if (!session) return;
const parsed = await decrypt(session); const parsed = (await decrypt(session)) as SessionPayload | null;
if (!parsed) return; if (!parsed) return;
parsed.expires = new Date(Date.now() + 24 * 60 * 60 * 1000); const expires = new Date(Date.now() + 24 * 60 * 60 * 1000);
parsed.expires = expires;
const res = NextResponse.next(); const res = NextResponse.next();
res.cookies.set({ res.cookies.set({
name: 'session', name: 'session',
value: await encrypt(parsed), value: await encrypt(parsed),
httpOnly: true, httpOnly: true,
expires: parsed.expires, expires: expires,
}); });
return res; return res;
} }
+2 -2
View File
@@ -2,7 +2,7 @@ import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server'; import type { NextRequest } from 'next/server';
import { i18n } from './app/dictionaries'; import { i18n } from './app/dictionaries';
function getLocale(request: NextRequest): string { function getLocale(): string {
// Always return default locale for now (can be improved to read headers) // Always return default locale for now (can be improved to read headers)
return i18n.defaultLocale; return i18n.defaultLocale;
} }
@@ -26,7 +26,7 @@ export function proxy(request: NextRequest) {
); );
if (pathnameIsMissingLocale) { if (pathnameIsMissingLocale) {
const locale = getLocale(request); const locale = getLocale();
return NextResponse.redirect( return NextResponse.redirect(
new URL(`/${locale}${pathname === '/' ? '' : pathname}`, request.url) new URL(`/${locale}${pathname === '/' ? '' : pathname}`, request.url)
); );
+3
View File
@@ -0,0 +1,3 @@
import type tr from '@/dictionaries/tr.json';
export type Dictionary = typeof tr;