Build Kozmos QR menu site — full implementation
Next.js 16 App Router, TR/EN i18n via [lang] routing and proxy.ts, Tailwind v4, minimal list menu style, sticky bottom tab bar with Intersection Observer, PWA manifest, WhatsApp fixed button. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
f879d65cfc
commit
718e0a6228
@@ -0,0 +1,16 @@
|
||||
import 'server-only'
|
||||
|
||||
const dictionaries = {
|
||||
tr: () => import('../../dictionaries/tr.json').then((m) => m.default),
|
||||
en: () => import('../../dictionaries/en.json').then((m) => m.default),
|
||||
}
|
||||
|
||||
export type Locale = keyof typeof dictionaries
|
||||
|
||||
export function hasLocale(locale: string): locale is Locale {
|
||||
return locale in dictionaries
|
||||
}
|
||||
|
||||
export async function getDictionary(locale: Locale) {
|
||||
return dictionaries[locale]()
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { Metadata } from 'next'
|
||||
import { notFound } from 'next/navigation'
|
||||
import { getDictionary, hasLocale } from './dictionaries'
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return [{ lang: 'tr' }, { lang: 'en' }]
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ lang: string }>
|
||||
}): Promise<Metadata> {
|
||||
const { lang } = await params
|
||||
if (!hasLocale(lang)) return {}
|
||||
const dict = await getDictionary(lang)
|
||||
return {
|
||||
title: dict.meta.title,
|
||||
description: dict.meta.description,
|
||||
manifest: '/manifest.webmanifest',
|
||||
appleWebApp: {
|
||||
capable: true,
|
||||
statusBarStyle: 'black-translucent',
|
||||
title: 'Kozmos',
|
||||
},
|
||||
other: {
|
||||
'theme-color': '#3D2B1F',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default async function LangLayout({
|
||||
children,
|
||||
params,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
params: Promise<{ lang: string }>
|
||||
}) {
|
||||
const { lang } = await params
|
||||
if (!hasLocale(lang)) notFound()
|
||||
return <>{children}</>
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import { notFound } from 'next/navigation'
|
||||
import { getDictionary, hasLocale } from './dictionaries'
|
||||
import { categories } from '@/data/menu'
|
||||
import Header from '@/components/Header'
|
||||
import CategorySection from '@/components/CategorySection'
|
||||
import BottomTabBar from '@/components/BottomTabBar'
|
||||
import WhatsAppButton from '@/components/WhatsAppButton'
|
||||
|
||||
export default async function MenuPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ lang: string }>
|
||||
}) {
|
||||
const { lang } = await params
|
||||
if (!hasLocale(lang)) notFound()
|
||||
|
||||
const dict = await getDictionary(lang)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header dict={dict} />
|
||||
|
||||
<main
|
||||
className="bg-cream min-h-screen"
|
||||
style={{
|
||||
paddingTop: 'var(--header-h)',
|
||||
paddingBottom: 'calc(var(--tabbar-h) + 8px)',
|
||||
}}
|
||||
>
|
||||
{/* Subtle top fade from header */}
|
||||
<div
|
||||
className="h-4 bg-gradient-to-b from-beige/30 to-transparent"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
||||
{categories.map((category) => (
|
||||
<CategorySection
|
||||
key={category.id}
|
||||
category={category}
|
||||
lang={lang}
|
||||
currency={dict.currency}
|
||||
/>
|
||||
))}
|
||||
|
||||
{/* Bottom spacing */}
|
||||
<div className="h-6" aria-hidden="true" />
|
||||
</main>
|
||||
|
||||
<WhatsAppButton
|
||||
message={dict.whatsapp.message}
|
||||
label={dict.whatsapp.label}
|
||||
/>
|
||||
|
||||
<BottomTabBar categories={categories} lang={lang} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
+88
-14
@@ -1,26 +1,100 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
--cream: #F5F0E8;
|
||||
--beige: #E8DCC8;
|
||||
--beige-dark: #D4C8B0;
|
||||
--teal: #4AAFA8;
|
||||
--teal-dark: #3D9A94;
|
||||
--green: #5C8A5C;
|
||||
--coffee: #3D2B1F;
|
||||
--coffee-light: #5A3D2D;
|
||||
--muted: #8A7265;
|
||||
--header-h: 64px;
|
||||
--tabbar-h: 68px;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
--color-cream: var(--cream);
|
||||
--color-beige: var(--beige);
|
||||
--color-beige-dark: var(--beige-dark);
|
||||
--color-teal: var(--teal);
|
||||
--color-teal-dark: var(--teal-dark);
|
||||
--color-green: var(--green);
|
||||
--color-coffee: var(--coffee);
|
||||
--color-coffee-light: var(--coffee-light);
|
||||
--color-muted: var(--muted);
|
||||
--font-display: var(--font-playfair);
|
||||
--font-body: var(--font-inter);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--background: #0a0a0a;
|
||||
--foreground: #ededed;
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
/* Grain texture overlay */
|
||||
body::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 9998;
|
||||
opacity: 0.028;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
|
||||
background-repeat: repeat;
|
||||
background-size: 256px 256px;
|
||||
}
|
||||
|
||||
/* Category scroll offset for sticky header */
|
||||
.category-section {
|
||||
scroll-margin-top: calc(var(--header-h) + 12px);
|
||||
}
|
||||
|
||||
/* Menu item fade-up animation */
|
||||
@keyframes fadeUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
.menu-item-row {
|
||||
animation: fadeUp 0.35s ease both;
|
||||
animation-delay: calc(var(--item-index, 0) * 55ms);
|
||||
}
|
||||
|
||||
/* Tab bar active indicator */
|
||||
.tab-active-dot {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
border-radius: 50%;
|
||||
background: var(--teal);
|
||||
margin: 0 auto;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
/* Smooth tab color transition */
|
||||
.tab-item {
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
/* WhatsApp pulse ring */
|
||||
@keyframes pulse-ring {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.45);
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 12px rgba(37, 211, 102, 0);
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.wa-btn {
|
||||
animation: pulse-ring 2.5s ease-out infinite;
|
||||
}
|
||||
|
||||
+25
-21
@@ -1,33 +1,37 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import type { Metadata } from 'next'
|
||||
import { Playfair_Display, Inter } from 'next/font/google'
|
||||
import './globals.css'
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
const playfair = Playfair_Display({
|
||||
subsets: ['latin'],
|
||||
variable: '--font-playfair',
|
||||
display: 'swap',
|
||||
style: ['normal', 'italic'],
|
||||
weight: ['400', '500', '600', '700'],
|
||||
})
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
const inter = Inter({
|
||||
subsets: ['latin'],
|
||||
variable: '--font-inter',
|
||||
display: 'swap',
|
||||
})
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
};
|
||||
title: 'Kozmos Beach & More',
|
||||
description: 'Kozmos Beach & More dijital menüsü',
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
return (
|
||||
<html
|
||||
lang="en"
|
||||
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
||||
lang="tr"
|
||||
className={`${playfair.variable} ${inter.variable}`}
|
||||
>
|
||||
<body className="min-h-full flex flex-col">{children}</body>
|
||||
<body className="bg-cream font-body antialiased">{children}</body>
|
||||
</html>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { MetadataRoute } from 'next'
|
||||
|
||||
export default function manifest(): MetadataRoute.Manifest {
|
||||
return {
|
||||
name: 'Kozmos Beach & More',
|
||||
short_name: 'Kozmos',
|
||||
description: 'Kozmos Beach & More dijital menüsü',
|
||||
start_url: '/tr',
|
||||
display: 'standalone',
|
||||
orientation: 'portrait',
|
||||
background_color: '#F5F0E8',
|
||||
theme_color: '#3D2B1F',
|
||||
icons: [
|
||||
{
|
||||
src: '/icons/icon-192.png',
|
||||
sizes: '192x192',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
src: '/icons/icon-512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
+3
-63
@@ -1,65 +1,5 @@
|
||||
import Image from "next/image";
|
||||
import { redirect } from 'next/navigation'
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className="flex flex-col flex-1 items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
||||
<main className="flex flex-1 w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={100}
|
||||
height={20}
|
||||
priority
|
||||
/>
|
||||
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
||||
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
||||
To get started, edit the page.tsx file.
|
||||
</h1>
|
||||
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
||||
Looking for a starting point or more instructions? Head over to{" "}
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Templates
|
||||
</a>{" "}
|
||||
or the{" "}
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Learning
|
||||
</a>{" "}
|
||||
center.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Deploy Now
|
||||
</a>
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
export default function RootPage() {
|
||||
redirect('/tr')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user