first commit

This commit is contained in:
luoyangwei
2026-06-06 00:49:07 +08:00
commit 2b860d201e
134 changed files with 22773 additions and 0 deletions
@@ -0,0 +1,47 @@
import type { CSSProperties } from "react";
import { CollectionsManager } from "@/components/admin/collections/CollectionsManager";
import { AppSidebar } from "@/components/app-sidebar";
import {
SidebarInset,
SidebarProvider,
SidebarTrigger,
} from "@/components/ui/sidebar";
import {
listAdminPhotoCollections,
listPickedPhotosForCollections,
} from "@/server/admin/photo-collections";
export const dynamic = "force-dynamic";
export default async function CollectionsPage() {
const [collections, pickedPhotos] = await Promise.all([
listAdminPhotoCollections(),
listPickedPhotosForCollections(),
]);
return (
<SidebarProvider
style={
{
"--sidebar-width": "calc(var(--spacing) * 72)",
"--header-height": "calc(var(--spacing) * 12)",
} as CSSProperties
}
>
<AppSidebar variant="inset" />
<SidebarInset>
<header className="flex h-(--header-height) shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-(--header-height)">
<div className="flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6">
<SidebarTrigger className="-ml-1" />
<h1 className="text-base font-medium">Collections</h1>
</div>
</header>
<CollectionsManager
initialCollections={collections}
initialPickedPhotos={pickedPhotos}
/>
</SidebarInset>
</SidebarProvider>
);
}
@@ -0,0 +1,614 @@
[
{
"id": 1,
"header": "Cover page",
"type": "Cover page",
"status": "In Process",
"target": "18",
"limit": "5",
"reviewer": "Eddie Lake"
},
{
"id": 2,
"header": "Table of contents",
"type": "Table of contents",
"status": "Done",
"target": "29",
"limit": "24",
"reviewer": "Eddie Lake"
},
{
"id": 3,
"header": "Executive summary",
"type": "Narrative",
"status": "Done",
"target": "10",
"limit": "13",
"reviewer": "Eddie Lake"
},
{
"id": 4,
"header": "Technical approach",
"type": "Narrative",
"status": "Done",
"target": "27",
"limit": "23",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 5,
"header": "Design",
"type": "Narrative",
"status": "In Process",
"target": "2",
"limit": "16",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 6,
"header": "Capabilities",
"type": "Narrative",
"status": "In Process",
"target": "20",
"limit": "8",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 7,
"header": "Integration with existing systems",
"type": "Narrative",
"status": "In Process",
"target": "19",
"limit": "21",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 8,
"header": "Innovation and Advantages",
"type": "Narrative",
"status": "Done",
"target": "25",
"limit": "26",
"reviewer": "Assign reviewer"
},
{
"id": 9,
"header": "Overview of EMR's Innovative Solutions",
"type": "Technical content",
"status": "Done",
"target": "7",
"limit": "23",
"reviewer": "Assign reviewer"
},
{
"id": 10,
"header": "Advanced Algorithms and Machine Learning",
"type": "Narrative",
"status": "Done",
"target": "30",
"limit": "28",
"reviewer": "Assign reviewer"
},
{
"id": 11,
"header": "Adaptive Communication Protocols",
"type": "Narrative",
"status": "Done",
"target": "9",
"limit": "31",
"reviewer": "Assign reviewer"
},
{
"id": 12,
"header": "Advantages Over Current Technologies",
"type": "Narrative",
"status": "Done",
"target": "12",
"limit": "0",
"reviewer": "Assign reviewer"
},
{
"id": 13,
"header": "Past Performance",
"type": "Narrative",
"status": "Done",
"target": "22",
"limit": "33",
"reviewer": "Assign reviewer"
},
{
"id": 14,
"header": "Customer Feedback and Satisfaction Levels",
"type": "Narrative",
"status": "Done",
"target": "15",
"limit": "34",
"reviewer": "Assign reviewer"
},
{
"id": 15,
"header": "Implementation Challenges and Solutions",
"type": "Narrative",
"status": "Done",
"target": "3",
"limit": "35",
"reviewer": "Assign reviewer"
},
{
"id": 16,
"header": "Security Measures and Data Protection Policies",
"type": "Narrative",
"status": "In Process",
"target": "6",
"limit": "36",
"reviewer": "Assign reviewer"
},
{
"id": 17,
"header": "Scalability and Future Proofing",
"type": "Narrative",
"status": "Done",
"target": "4",
"limit": "37",
"reviewer": "Assign reviewer"
},
{
"id": 18,
"header": "Cost-Benefit Analysis",
"type": "Plain language",
"status": "Done",
"target": "14",
"limit": "38",
"reviewer": "Assign reviewer"
},
{
"id": 19,
"header": "User Training and Onboarding Experience",
"type": "Narrative",
"status": "Done",
"target": "17",
"limit": "39",
"reviewer": "Assign reviewer"
},
{
"id": 20,
"header": "Future Development Roadmap",
"type": "Narrative",
"status": "Done",
"target": "11",
"limit": "40",
"reviewer": "Assign reviewer"
},
{
"id": 21,
"header": "System Architecture Overview",
"type": "Technical content",
"status": "In Process",
"target": "24",
"limit": "18",
"reviewer": "Maya Johnson"
},
{
"id": 22,
"header": "Risk Management Plan",
"type": "Narrative",
"status": "Done",
"target": "15",
"limit": "22",
"reviewer": "Carlos Rodriguez"
},
{
"id": 23,
"header": "Compliance Documentation",
"type": "Legal",
"status": "In Process",
"target": "31",
"limit": "27",
"reviewer": "Sarah Chen"
},
{
"id": 24,
"header": "API Documentation",
"type": "Technical content",
"status": "Done",
"target": "8",
"limit": "12",
"reviewer": "Raj Patel"
},
{
"id": 25,
"header": "User Interface Mockups",
"type": "Visual",
"status": "In Process",
"target": "19",
"limit": "25",
"reviewer": "Leila Ahmadi"
},
{
"id": 26,
"header": "Database Schema",
"type": "Technical content",
"status": "Done",
"target": "22",
"limit": "20",
"reviewer": "Thomas Wilson"
},
{
"id": 27,
"header": "Testing Methodology",
"type": "Technical content",
"status": "In Process",
"target": "17",
"limit": "14",
"reviewer": "Assign reviewer"
},
{
"id": 28,
"header": "Deployment Strategy",
"type": "Narrative",
"status": "Done",
"target": "26",
"limit": "30",
"reviewer": "Eddie Lake"
},
{
"id": 29,
"header": "Budget Breakdown",
"type": "Financial",
"status": "In Process",
"target": "13",
"limit": "16",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 30,
"header": "Market Analysis",
"type": "Research",
"status": "Done",
"target": "29",
"limit": "32",
"reviewer": "Sophia Martinez"
},
{
"id": 31,
"header": "Competitor Comparison",
"type": "Research",
"status": "In Process",
"target": "21",
"limit": "19",
"reviewer": "Assign reviewer"
},
{
"id": 32,
"header": "Maintenance Plan",
"type": "Technical content",
"status": "Done",
"target": "16",
"limit": "23",
"reviewer": "Alex Thompson"
},
{
"id": 33,
"header": "User Personas",
"type": "Research",
"status": "In Process",
"target": "27",
"limit": "24",
"reviewer": "Nina Patel"
},
{
"id": 34,
"header": "Accessibility Compliance",
"type": "Legal",
"status": "Done",
"target": "18",
"limit": "21",
"reviewer": "Assign reviewer"
},
{
"id": 35,
"header": "Performance Metrics",
"type": "Technical content",
"status": "In Process",
"target": "23",
"limit": "26",
"reviewer": "David Kim"
},
{
"id": 36,
"header": "Disaster Recovery Plan",
"type": "Technical content",
"status": "Done",
"target": "14",
"limit": "17",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 37,
"header": "Third-party Integrations",
"type": "Technical content",
"status": "In Process",
"target": "25",
"limit": "28",
"reviewer": "Eddie Lake"
},
{
"id": 38,
"header": "User Feedback Summary",
"type": "Research",
"status": "Done",
"target": "20",
"limit": "15",
"reviewer": "Assign reviewer"
},
{
"id": 39,
"header": "Localization Strategy",
"type": "Narrative",
"status": "In Process",
"target": "12",
"limit": "19",
"reviewer": "Maria Garcia"
},
{
"id": 40,
"header": "Mobile Compatibility",
"type": "Technical content",
"status": "Done",
"target": "28",
"limit": "31",
"reviewer": "James Wilson"
},
{
"id": 41,
"header": "Data Migration Plan",
"type": "Technical content",
"status": "In Process",
"target": "19",
"limit": "22",
"reviewer": "Assign reviewer"
},
{
"id": 42,
"header": "Quality Assurance Protocols",
"type": "Technical content",
"status": "Done",
"target": "30",
"limit": "33",
"reviewer": "Priya Singh"
},
{
"id": 43,
"header": "Stakeholder Analysis",
"type": "Research",
"status": "In Process",
"target": "11",
"limit": "14",
"reviewer": "Eddie Lake"
},
{
"id": 44,
"header": "Environmental Impact Assessment",
"type": "Research",
"status": "Done",
"target": "24",
"limit": "27",
"reviewer": "Assign reviewer"
},
{
"id": 45,
"header": "Intellectual Property Rights",
"type": "Legal",
"status": "In Process",
"target": "17",
"limit": "20",
"reviewer": "Sarah Johnson"
},
{
"id": 46,
"header": "Customer Support Framework",
"type": "Narrative",
"status": "Done",
"target": "22",
"limit": "25",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 47,
"header": "Version Control Strategy",
"type": "Technical content",
"status": "In Process",
"target": "15",
"limit": "18",
"reviewer": "Assign reviewer"
},
{
"id": 48,
"header": "Continuous Integration Pipeline",
"type": "Technical content",
"status": "Done",
"target": "26",
"limit": "29",
"reviewer": "Michael Chen"
},
{
"id": 49,
"header": "Regulatory Compliance",
"type": "Legal",
"status": "In Process",
"target": "13",
"limit": "16",
"reviewer": "Assign reviewer"
},
{
"id": 50,
"header": "User Authentication System",
"type": "Technical content",
"status": "Done",
"target": "28",
"limit": "31",
"reviewer": "Eddie Lake"
},
{
"id": 51,
"header": "Data Analytics Framework",
"type": "Technical content",
"status": "In Process",
"target": "21",
"limit": "24",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 52,
"header": "Cloud Infrastructure",
"type": "Technical content",
"status": "Done",
"target": "16",
"limit": "19",
"reviewer": "Assign reviewer"
},
{
"id": 53,
"header": "Network Security Measures",
"type": "Technical content",
"status": "In Process",
"target": "29",
"limit": "32",
"reviewer": "Lisa Wong"
},
{
"id": 54,
"header": "Project Timeline",
"type": "Planning",
"status": "Done",
"target": "14",
"limit": "17",
"reviewer": "Eddie Lake"
},
{
"id": 55,
"header": "Resource Allocation",
"type": "Planning",
"status": "In Process",
"target": "27",
"limit": "30",
"reviewer": "Assign reviewer"
},
{
"id": 56,
"header": "Team Structure and Roles",
"type": "Planning",
"status": "Done",
"target": "20",
"limit": "23",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 57,
"header": "Communication Protocols",
"type": "Planning",
"status": "In Process",
"target": "15",
"limit": "18",
"reviewer": "Assign reviewer"
},
{
"id": 58,
"header": "Success Metrics",
"type": "Planning",
"status": "Done",
"target": "30",
"limit": "33",
"reviewer": "Eddie Lake"
},
{
"id": 59,
"header": "Internationalization Support",
"type": "Technical content",
"status": "In Process",
"target": "23",
"limit": "26",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 60,
"header": "Backup and Recovery Procedures",
"type": "Technical content",
"status": "Done",
"target": "18",
"limit": "21",
"reviewer": "Assign reviewer"
},
{
"id": 61,
"header": "Monitoring and Alerting System",
"type": "Technical content",
"status": "In Process",
"target": "25",
"limit": "28",
"reviewer": "Daniel Park"
},
{
"id": 62,
"header": "Code Review Guidelines",
"type": "Technical content",
"status": "Done",
"target": "12",
"limit": "15",
"reviewer": "Eddie Lake"
},
{
"id": 63,
"header": "Documentation Standards",
"type": "Technical content",
"status": "In Process",
"target": "27",
"limit": "30",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 64,
"header": "Release Management Process",
"type": "Planning",
"status": "Done",
"target": "22",
"limit": "25",
"reviewer": "Assign reviewer"
},
{
"id": 65,
"header": "Feature Prioritization Matrix",
"type": "Planning",
"status": "In Process",
"target": "19",
"limit": "22",
"reviewer": "Emma Davis"
},
{
"id": 66,
"header": "Technical Debt Assessment",
"type": "Technical content",
"status": "Done",
"target": "24",
"limit": "27",
"reviewer": "Eddie Lake"
},
{
"id": 67,
"header": "Capacity Planning",
"type": "Planning",
"status": "In Process",
"target": "21",
"limit": "24",
"reviewer": "Jamik Tashpulatov"
},
{
"id": 68,
"header": "Service Level Agreements",
"type": "Legal",
"status": "Done",
"target": "26",
"limit": "29",
"reviewer": "Assign reviewer"
}
]
@@ -0,0 +1,37 @@
import { AppSidebar } from "@/components/app-sidebar";
import { ChartAreaInteractive } from "@/components/chart-area-interactive";
import { DataTable } from "@/components/data-table";
import { SectionCards } from "@/components/section-cards";
import { SiteHeader } from "@/components/site-header";
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
import data from "./data.json";
export default function DashboardPage() {
return (
<SidebarProvider
style={
{
"--sidebar-width": "calc(var(--spacing) * 72)",
"--header-height": "calc(var(--spacing) * 12)",
} as React.CSSProperties
}
>
<AppSidebar variant="inset" />
<SidebarInset>
<SiteHeader />
<div className="flex flex-1 flex-col">
<div className="@container/main flex flex-1 flex-col gap-2">
<div className="flex flex-col gap-4 py-4 md:gap-6 md:py-6">
<SectionCards />
<div className="px-4 lg:px-6">
<ChartAreaInteractive />
</div>
<DataTable data={data} />
</div>
</div>
</div>
</SidebarInset>
</SidebarProvider>
);
}
@@ -0,0 +1,33 @@
"use client";
import { GalleryGrid } from "@/components/admin/gallery/GalleryGrid";
import { AppSidebar } from "@/components/app-sidebar";
import {
SidebarInset,
SidebarProvider,
SidebarTrigger,
} from "@/components/ui/sidebar";
export default function GalleryPage() {
return (
<SidebarProvider
style={
{
"--sidebar-width": "calc(var(--spacing) * 72)",
"--header-height": "calc(var(--spacing) * 12)",
} as React.CSSProperties
}
>
<AppSidebar variant="inset" />
<SidebarInset>
<header className="flex h-(--header-height) shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-(--header-height)">
<div className="flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6">
<SidebarTrigger className="-ml-1" />
<h1 className="text-base font-medium">Gallery</h1>
</div>
</header>
<GalleryGrid />
</SidebarInset>
</SidebarProvider>
);
}
+16
View File
@@ -0,0 +1,16 @@
import { auth } from "@/lib/auth";
import { redirect } from "next/navigation";
export default async function ProtectedAdminLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const session = await auth();
if (!session) {
redirect("/admin/login");
}
return children;
}
@@ -0,0 +1,38 @@
import type { CSSProperties } from "react";
import { UsersManager } from "@/components/admin/users/UsersManager";
import { AppSidebar } from "@/components/app-sidebar";
import {
SidebarInset,
SidebarProvider,
SidebarTrigger,
} from "@/components/ui/sidebar";
import { listAdminAppUsers } from "@/server/admin/app-users";
export const dynamic = "force-dynamic";
export default async function UsersPage() {
const users = await listAdminAppUsers();
return (
<SidebarProvider
style={
{
"--sidebar-width": "calc(var(--spacing) * 72)",
"--header-height": "calc(var(--spacing) * 12)",
} as CSSProperties
}
>
<AppSidebar variant="inset" />
<SidebarInset>
<header className="flex h-(--header-height) shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-(--header-height)">
<div className="flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6">
<SidebarTrigger className="-ml-1" />
<h1 className="text-base font-medium">Users</h1>
</div>
</header>
<UsersManager initialUsers={users} />
</SidebarInset>
</SidebarProvider>
);
}
+49
View File
@@ -0,0 +1,49 @@
import { LoginForm } from "@/components/login-form";
import { signIn } from "@/lib/auth";
import { GalleryVerticalEndIcon } from "lucide-react";
import { AuthError } from "next-auth";
import { redirect } from "next/navigation";
async function authenticate(formData: FormData) {
"use server";
try {
await signIn("credentials", {
email: formData.get("email"),
password: formData.get("password"),
redirectTo: "/admin/dashboard",
});
} catch (error) {
if (error instanceof AuthError) {
redirect("/admin/login?error=CredentialsSignin");
}
throw error;
}
}
export default async function LoginPage({
searchParams,
}: {
searchParams?: Promise<{ error?: string }>;
}) {
const params = await searchParams;
const error =
params?.error === "CredentialsSignin"
? "账号或密码错误,请重试。"
: undefined;
return (
<div className="bg-muted flex min-h-svh flex-col items-center justify-center gap-6 p-6 md:p-10">
<div className="flex w-full max-w-sm flex-col gap-6">
<div className="flex items-center gap-2 self-center font-medium">
<div className="bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md">
<GalleryVerticalEndIcon className="size-4" />
</div>
Wallora Admin
</div>
<LoginForm action={authenticate} error={error} />
</div>
</div>
);
}
+12
View File
@@ -0,0 +1,12 @@
import { auth } from "@/lib/auth";
import { redirect } from "next/navigation";
export default async function AdminPage() {
const session = await auth();
if (!session) {
redirect("/admin/login");
}
redirect("/admin/dashboard");
}
+66
View File
@@ -0,0 +1,66 @@
import Image from "next/image";
export default function Home() {
return (
<div className="flex flex-1 flex-col items-center justify-center bg-zinc-50 font-sans dark:bg-black">
<main className="flex w-full max-w-3xl flex-1 flex-col items-center justify-between bg-white px-16 py-32 sm:items-start dark:bg-black">
<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 leading-10 font-semibold 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="bg-foreground text-background flex h-12 w-full items-center justify-center gap-2 rounded-full px-5 transition-colors hover:bg-[#383838] md:w-39.5 dark:hover:bg-[#ccc]"
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/8 px-5 transition-colors hover:border-transparent hover:bg-black/4 md:w-39.5 dark:border-white/[.145] dark:hover:bg-[#1a1a1a]"
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>
);
}
+64
View File
@@ -0,0 +1,64 @@
import { auth } from "@/lib/auth";
import { updateAdminAppUserStatus } from "@/server/admin/app-users";
import { NextResponse } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const updateUserSchema = z.object({
status: z.enum(["active", "disabled"]),
});
async function requireAdminSession() {
const session = await auth();
if (!session) {
return null;
}
return session;
}
export async function PATCH(
request: Request,
{ params }: { params: Promise<{ id: string }> },
) {
try {
const session = await requireAdminSession();
if (!session) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const parsed = updateUserSchema.safeParse(await request.json());
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid request body." },
{ status: 400 },
);
}
const { id } = await params;
const data = await updateAdminAppUserStatus({
userId: id,
status: parsed.data.status,
});
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
+137
View File
@@ -0,0 +1,137 @@
import { auth } from "@/lib/auth";
import { createSupabaseServiceRoleClient } from "@/lib/supabase/service-role";
import { updateGalleryPhotoPickStatus } from "@/server/admin/gallery-pick";
import { NextResponse, type NextRequest } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const galleryPhotoSelect =
"id,unsplash_id,slug,description,alt_description,width,height,color,color_family,likes,urls,user_info,photo_created_at,is_picked,picked_at,picked_by,oss_url,oss_object_key,oss_synced_at,oss_sync_error";
const patchSchema = z.object({
unsplashId: z.string().min(1),
isPicked: z.boolean(),
});
async function requireAdminSession() {
const session = await auth();
if (!session) {
return null;
}
return session;
}
export async function GET(request: NextRequest) {
try {
const session = await requireAdminSession();
if (!session) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const { searchParams } = new URL(request.url);
const page = parseInt(searchParams.get("page") || "1", 10);
const perPage = parseInt(searchParams.get("per_page") || "24", 10);
const picked = searchParams.get("picked");
const colorFamily = searchParams.get("color_family");
if (page < 1 || perPage < 1 || perPage > 100) {
return NextResponse.json(
{ ok: false, error: "Invalid pagination parameters." },
{ status: 400 },
);
}
const supabase = createSupabaseServiceRoleClient();
let query = supabase
.from("wg_gallery_photos")
.select(galleryPhotoSelect, { count: "exact" });
if (picked === "true") {
query = query.eq("is_picked", true);
} else if (picked === "false") {
query = query.eq("is_picked", false);
}
if (colorFamily && colorFamily !== "all") {
query = query.eq("color_family", colorFamily);
}
const { data, error, count } = await query
.order("picked_at", { ascending: false, nullsFirst: false })
.order("photo_created_at", { ascending: false })
.range((page - 1) * perPage, page * perPage - 1);
if (error) {
throw error;
}
return NextResponse.json({
ok: true,
data: data ?? [],
pagination: {
page,
perPage,
total: count ?? 0,
hasMore: (count ?? 0) > page * perPage,
},
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
console.error("[api/admin/gallery-photos] PATCH failed", error);
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
export async function PATCH(request: NextRequest) {
try {
const session = await requireAdminSession();
if (!session) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const parsed = patchSchema.safeParse(await request.json());
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid request body." },
{ status: 400 },
);
}
const data = await updateGalleryPhotoPickStatus({
isPicked: parsed.data.isPicked,
pickedBy:
session.user?.email ?? session.user?.id ?? "wallora-admin",
unsplashId: parsed.data.unsplashId,
});
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
@@ -0,0 +1,138 @@
import { auth } from "@/lib/auth";
import {
deletePhotoCollection,
getAdminPhotoCollection,
updatePhotoCollection,
} from "@/server/admin/photo-collections";
import { NextResponse } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const collectionInputSchema = z.object({
title: z.string().min(1),
slug: z.string().optional().nullable(),
description: z.string().optional().nullable(),
coverPhotoId: z.string().uuid().optional().nullable(),
isPublished: z.boolean().default(false),
photoIds: z.array(z.string().uuid()).default([]),
});
async function requireAdminSession() {
const session = await auth();
if (!session) {
return null;
}
return session;
}
export async function GET(
_request: Request,
{ params }: { params: Promise<{ id: string }> },
) {
try {
const session = await requireAdminSession();
if (!session) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const { id } = await params;
const data = await getAdminPhotoCollection(id);
if (!data) {
return NextResponse.json(
{ ok: false, error: "Collection was not found." },
{ status: 404 },
);
}
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
export async function PATCH(
request: Request,
{ params }: { params: Promise<{ id: string }> },
) {
try {
const session = await requireAdminSession();
if (!session) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const parsed = collectionInputSchema.safeParse(await request.json());
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid request body." },
{ status: 400 },
);
}
const { id } = await params;
const data = await updatePhotoCollection(id, parsed.data);
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
export async function DELETE(
_request: Request,
{ params }: { params: Promise<{ id: string }> },
) {
try {
const session = await requireAdminSession();
if (!session) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const { id } = await params;
await deletePhotoCollection(id);
return NextResponse.json({
ok: true,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
+92
View File
@@ -0,0 +1,92 @@
import { auth } from "@/lib/auth";
import {
createPhotoCollection,
listAdminPhotoCollections,
} from "@/server/admin/photo-collections";
import { NextResponse } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const collectionInputSchema = z.object({
title: z.string().min(1),
slug: z.string().optional().nullable(),
description: z.string().optional().nullable(),
coverPhotoId: z.string().uuid().optional().nullable(),
isPublished: z.boolean().default(false),
photoIds: z.array(z.string().uuid()).default([]),
});
async function requireAdminSession() {
const session = await auth();
if (!session) {
return null;
}
return session;
}
export async function GET() {
try {
const session = await requireAdminSession();
if (!session) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const data = await listAdminPhotoCollections();
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
export async function POST(request: Request) {
try {
const session = await requireAdminSession();
if (!session) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const parsed = collectionInputSchema.safeParse(await request.json());
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid request body." },
{ status: 400 },
);
}
const data = await createPhotoCollection(parsed.data);
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
+3
View File
@@ -0,0 +1,3 @@
import { GET, POST } from "@/lib/auth";
export { GET, POST };
+52
View File
@@ -0,0 +1,52 @@
import { syncUnsplashWallpapersToGallery } from "@/server/admin/gallery-sync";
import { NextResponse, type NextRequest } from "next/server";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
function isAuthorized(request: NextRequest) {
const cronSecret = process.env.CRON_SECRET;
if (!cronSecret) {
return false;
}
return request.headers.get("authorization") === `Bearer ${cronSecret}`;
}
async function handleGalleryPhotosCron(request: NextRequest) {
if (!process.env.CRON_SECRET) {
return NextResponse.json(
{ ok: false, error: "CRON_SECRET is not configured." },
{ status: 500 },
);
}
if (!isAuthorized(request)) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
try {
const result = await syncUnsplashWallpapersToGallery();
return NextResponse.json({ ok: true, result });
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown cron error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
export async function GET(request: NextRequest) {
return handleGalleryPhotosCron(request);
}
export async function POST(request: NextRequest) {
return handleGalleryPhotosCron(request);
}
+44
View File
@@ -0,0 +1,44 @@
import {
getAppUserLoginContextFromRequest,
loginAppUser,
} from "@/server/app/app-auth";
import { NextResponse } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const loginSchema = z.object({
email: z.email(),
password: z.string().min(1),
});
export async function POST(request: Request) {
try {
const parsed = loginSchema.safeParse(await request.json());
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid request body." },
{ status: 400 },
);
}
const data = await loginAppUser({
...parsed.data,
context: getAppUserLoginContextFromRequest(request),
});
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 401 },
);
}
}
+39
View File
@@ -0,0 +1,39 @@
import { registerAppUser } from "@/server/app/app-auth";
import { NextResponse } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const registerSchema = z.object({
email: z.email(),
password: z.string().min(8),
displayName: z.string().optional().nullable(),
});
export async function POST(request: Request) {
try {
const parsed = registerSchema.safeParse(await request.json());
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid request body." },
{ status: 400 },
);
}
const data = await registerAppUser(parsed.data);
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 400 },
);
}
}
@@ -0,0 +1,67 @@
import { getOptionalAppUserFromRequest } from "@/server/app/app-auth";
import { getPublishedCollectionBySlug } from "@/server/site/photo-collections";
import { NextResponse, type NextRequest } from "next/server";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ slug: string }> },
) {
try {
const { searchParams } = new URL(request.url);
const { slug } = await params;
const page = parseInt(searchParams.get("page") || "1", 10);
const pageSize = parseInt(
searchParams.get("pageSize") ||
searchParams.get("page_size") ||
"24",
10,
);
if (page < 1 || pageSize < 1 || pageSize > 100) {
return NextResponse.json(
{ ok: false, error: "Invalid pagination parameters." },
{ status: 400 },
);
}
const user = await getOptionalAppUserFromRequest(request);
const result = await getPublishedCollectionBySlug({
slug,
page,
pageSize,
userId: user?.id ?? null,
});
if (!result) {
return NextResponse.json(
{ ok: false, error: "Collection was not found." },
{ status: 404 },
);
}
return NextResponse.json({
ok: true,
data: {
collection: result.collection,
photos: result.photos,
},
pagination: {
page,
pageSize,
total: result.total,
hasMore: result.total > page * pageSize,
nextPage: result.total > page * pageSize ? page + 1 : null,
},
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
+52
View File
@@ -0,0 +1,52 @@
import { getOptionalAppUserFromRequest } from "@/server/app/app-auth";
import { listPublishedCollections } from "@/server/site/photo-collections";
import { NextResponse, type NextRequest } from "next/server";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url);
const page = parseInt(searchParams.get("page") || "1", 10);
const pageSize = parseInt(
searchParams.get("pageSize") ||
searchParams.get("page_size") ||
"20",
10,
);
if (page < 1 || pageSize < 1 || pageSize > 50) {
return NextResponse.json(
{ ok: false, error: "Invalid pagination parameters." },
{ status: 400 },
);
}
const user = await getOptionalAppUserFromRequest(request);
const result = await listPublishedCollections({
page,
pageSize,
userId: user?.id ?? null,
});
return NextResponse.json({
ok: true,
data: result.data,
pagination: {
page,
pageSize,
total: result.total,
hasMore: result.total > page * pageSize,
nextPage: result.total > page * pageSize ? page + 1 : null,
},
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
+142
View File
@@ -0,0 +1,142 @@
import {
getAppUserFromRequest,
getOptionalAppUserFromRequest,
} from "@/server/app/app-auth";
import {
addUserFavorite,
removeUserFavorite,
} from "@/server/app/user-favorites";
import { getPickedGalleryPhotoById } from "@/server/site/gallery-photos";
import { NextResponse, type NextRequest } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const paramsSchema = z.object({
id: z.uuid(),
});
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> },
) {
try {
const parsed = paramsSchema.safeParse(await params);
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid photo id." },
{ status: 400 },
);
}
const user = await getOptionalAppUserFromRequest(request);
const data = await getPickedGalleryPhotoById({
id: parsed.data.id,
userId: user?.id ?? null,
});
if (!data) {
return NextResponse.json(
{ ok: false, error: "Photo was not found." },
{ status: 404 },
);
}
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
export async function POST(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> },
) {
try {
const user = await getAppUserFromRequest(request);
if (!user) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const parsed = paramsSchema.safeParse(await params);
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid photo id." },
{ status: 400 },
);
}
const data = await addUserFavorite({
userId: user.id,
photoId: parsed.data.id,
});
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
export async function DELETE(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> },
) {
try {
const user = await getAppUserFromRequest(request);
if (!user) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const parsed = paramsSchema.safeParse(await params);
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid photo id." },
{ status: 400 },
);
}
await removeUserFavorite({
userId: user.id,
photoId: parsed.data.id,
});
return NextResponse.json({
ok: true,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
+54
View File
@@ -0,0 +1,54 @@
import { getOptionalAppUserFromRequest } from "@/server/app/app-auth";
import { listPickedGalleryPhotos } from "@/server/site/gallery-photos";
import { NextResponse, type NextRequest } from "next/server";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url);
const page = parseInt(searchParams.get("page") || "1", 10);
const pageSize = parseInt(
searchParams.get("pageSize") ||
searchParams.get("page_size") ||
"24",
10,
);
const colorFamily = searchParams.get("colorFamily");
if (page < 1 || pageSize < 1 || pageSize > 100) {
return NextResponse.json(
{ ok: false, error: "Invalid pagination parameters." },
{ status: 400 },
);
}
const user = await getOptionalAppUserFromRequest(request);
const result = await listPickedGalleryPhotos({
colorFamily,
page,
pageSize,
userId: user?.id ?? null,
});
return NextResponse.json({
ok: true,
data: result.data,
pagination: {
page,
pageSize,
total: result.total,
hasMore: result.total > page * pageSize,
nextPage: result.total > page * pageSize ? page + 1 : null,
},
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
@@ -0,0 +1,52 @@
import { getAppUserFromRequest } from "@/server/app/app-auth";
import { removeUserFavorite } from "@/server/app/user-favorites";
import { NextResponse } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const paramsSchema = z.object({
photoId: z.uuid(),
});
export async function DELETE(
request: Request,
{ params }: { params: Promise<{ photoId: string }> },
) {
try {
const user = await getAppUserFromRequest(request);
if (!user) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const parsed = paramsSchema.safeParse(await params);
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid photo id." },
{ status: 400 },
);
}
await removeUserFavorite({
userId: user.id,
photoId: parsed.data.photoId,
});
return NextResponse.json({
ok: true,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
+107
View File
@@ -0,0 +1,107 @@
import { getAppUserFromRequest } from "@/server/app/app-auth";
import {
addUserFavorite,
listUserFavorites,
} from "@/server/app/user-favorites";
import { NextResponse, type NextRequest } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const favoriteSchema = z.object({
photoId: z.uuid(),
});
export async function GET(request: NextRequest) {
try {
const user = await getAppUserFromRequest(request);
if (!user) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const { searchParams } = new URL(request.url);
const page = parseInt(searchParams.get("page") || "1", 10);
const pageSize = parseInt(
searchParams.get("pageSize") ||
searchParams.get("page_size") ||
"24",
10,
);
if (page < 1 || pageSize < 1 || pageSize > 100) {
return NextResponse.json(
{ ok: false, error: "Invalid pagination parameters." },
{ status: 400 },
);
}
const result = await listUserFavorites({
userId: user.id,
page,
pageSize,
});
return NextResponse.json({
ok: true,
data: result.data,
pagination: {
page,
pageSize,
total: result.total,
hasMore: result.total > page * pageSize,
nextPage: result.total > page * pageSize ? page + 1 : null,
},
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
export async function POST(request: Request) {
try {
const user = await getAppUserFromRequest(request);
if (!user) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const parsed = favoriteSchema.safeParse(await request.json());
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid request body." },
{ status: 400 },
);
}
const data = await addUserFavorite({
userId: user.id,
photoId: parsed.data.photoId,
});
return NextResponse.json({
ok: true,
data,
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
+32
View File
@@ -0,0 +1,32 @@
import { getAppUserFromRequest } from "@/server/app/app-auth";
import { NextResponse } from "next/server";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export async function GET(request: Request) {
try {
const user = await getAppUserFromRequest(request);
if (!user) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
return NextResponse.json({
ok: true,
data: {
user,
},
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 401 },
);
}
}
+90
View File
@@ -0,0 +1,90 @@
import { getAppUserFromRequest } from "@/server/app/app-auth";
import {
getUserSettings,
updateUserSettings,
} from "@/server/app/user-preferences";
import { NextResponse } from "next/server";
import { z } from "zod";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const settingsSchema = z.object({
preferences: z.record(z.string(), z.unknown()).optional(),
downloadPreferences: z.record(z.string(), z.unknown()).optional(),
});
function mapSettings(settings: Awaited<ReturnType<typeof getUserSettings>>) {
return {
preferences: settings.preferences,
downloadPreferences: settings.download_preferences,
updatedAt: settings.updated_at,
};
}
export async function GET(request: Request) {
try {
const user = await getAppUserFromRequest(request);
if (!user) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const settings = await getUserSettings(user.id);
return NextResponse.json({
ok: true,
data: mapSettings(settings),
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
export async function PATCH(request: Request) {
try {
const user = await getAppUserFromRequest(request);
if (!user) {
return NextResponse.json(
{ ok: false, error: "Unauthorized." },
{ status: 401 },
);
}
const parsed = settingsSchema.safeParse(await request.json());
if (!parsed.success) {
return NextResponse.json(
{ ok: false, error: "Invalid request body." },
{ status: 400 },
);
}
const settings = await updateUserSettings({
userId: user.id,
preferences: parsed.data.preferences,
downloadPreferences: parsed.data.downloadPreferences,
});
return NextResponse.json({
ok: true,
data: mapSettings(settings),
});
} catch (error) {
const message =
error instanceof Error ? error.message : "Unknown error.";
return NextResponse.json(
{ ok: false, error: message },
{ status: 500 },
);
}
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+248
View File
@@ -0,0 +1,248 @@
@import "tailwindcss";
@custom-variant dark (&:is(.dark *));
:root {
--background: oklch(0.9551 0 0);
--foreground: oklch(0.3211 0 0);
--card: oklch(0.9702 0 0);
--card-foreground: oklch(0.3211 0 0);
--popover: oklch(0.9702 0 0);
--popover-foreground: oklch(0.3211 0 0);
--primary: oklch(0.4891 0 0);
--primary-foreground: oklch(1 0 0);
--secondary: oklch(0.9067 0 0);
--secondary-foreground: oklch(0.3211 0 0);
--muted: oklch(0.8853 0 0);
--muted-foreground: oklch(0.5103 0 0);
--accent: oklch(0.8078 0 0);
--accent-foreground: oklch(0.3211 0 0);
--destructive: oklch(0.5594 0.19 25.8625);
--destructive-foreground: oklch(1 0 0);
--border: oklch(0.8576 0 0);
--input: oklch(0.9067 0 0);
--ring: oklch(0.4891 0 0);
--chart-1: oklch(0.4891 0 0);
--chart-2: oklch(0.4863 0.0361 196.0278);
--chart-3: oklch(0.6534 0 0);
--chart-4: oklch(0.7316 0 0);
--chart-5: oklch(0.8078 0 0);
--sidebar: oklch(0.937 0 0);
--sidebar-foreground: oklch(0.3211 0 0);
--sidebar-primary: oklch(0.4891 0 0);
--sidebar-primary-foreground: oklch(1 0 0);
--sidebar-accent: oklch(0.8078 0 0);
--sidebar-accent-foreground: oklch(0.3211 0 0);
--sidebar-border: oklch(0.8576 0 0);
--sidebar-ring: oklch(0.4891 0 0);
--font-sans: Montserrat, sans-serif;
--font-serif: Georgia, serif;
--font-mono: Fira Code, monospace;
--radius: 0.35rem;
--shadow-x: 0px;
--shadow-y: 2px;
--shadow-blur: 0px;
--shadow-spread: 0px;
--shadow-opacity: 0.15;
--shadow-color: hsl(0 0% 20% / 0.1);
--shadow-2xs: 0px 2px 0px 0px hsl(0 0% 20% / 0.07);
--shadow-xs: 0px 2px 0px 0px hsl(0 0% 20% / 0.07);
--shadow-sm:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 1px 2px -1px hsl(0 0% 20% / 0.15);
--shadow:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 1px 2px -1px hsl(0 0% 20% / 0.15);
--shadow-md:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 2px 4px -1px hsl(0 0% 20% / 0.15);
--shadow-lg:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 4px 6px -1px hsl(0 0% 20% / 0.15);
--shadow-xl:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 8px 10px -1px hsl(0 0% 20% / 0.15);
--shadow-2xl: 0px 2px 0px 0px hsl(0 0% 20% / 0.38);
--tracking-normal: 0em;
--spacing: 0.25rem;
}
.dark {
--background: oklch(0.2178 0 0);
--foreground: oklch(0.8853 0 0);
--card: oklch(0.2435 0 0);
--card-foreground: oklch(0.8853 0 0);
--popover: oklch(0.2435 0 0);
--popover-foreground: oklch(0.8853 0 0);
--primary: oklch(0.7058 0 0);
--primary-foreground: oklch(0.2178 0 0);
--secondary: oklch(0.3092 0 0);
--secondary-foreground: oklch(0.8853 0 0);
--muted: oklch(0.285 0 0);
--muted-foreground: oklch(0.5999 0 0);
--accent: oklch(0.3715 0 0);
--accent-foreground: oklch(0.8853 0 0);
--destructive: oklch(0.6591 0.153 22.1703);
--destructive-foreground: oklch(1 0 0);
--border: oklch(0.329 0 0);
--input: oklch(0.3092 0 0);
--ring: oklch(0.7058 0 0);
--chart-1: oklch(0.7058 0 0);
--chart-2: oklch(0.6714 0.0339 206.3482);
--chart-3: oklch(0.5452 0 0);
--chart-4: oklch(0.4604 0 0);
--chart-5: oklch(0.3715 0 0);
--sidebar: oklch(0.2393 0 0);
--sidebar-foreground: oklch(0.8853 0 0);
--sidebar-primary: oklch(0.7058 0 0);
--sidebar-primary-foreground: oklch(0.2178 0 0);
--sidebar-accent: oklch(0.3715 0 0);
--sidebar-accent-foreground: oklch(0.8853 0 0);
--sidebar-border: oklch(0.329 0 0);
--sidebar-ring: oklch(0.7058 0 0);
--font-sans: Inter, sans-serif;
--font-serif: Georgia, serif;
--font-mono: Fira Code, monospace;
--radius: 0.35rem;
--shadow-x: 0px;
--shadow-y: 2px;
--shadow-blur: 0px;
--shadow-spread: 0px;
--shadow-opacity: 0.15;
--shadow-color: hsl(0 0% 20% / 0.1);
--shadow-2xs: 0px 2px 0px 0px hsl(0 0% 20% / 0.07);
--shadow-xs: 0px 2px 0px 0px hsl(0 0% 20% / 0.07);
--shadow-sm:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 1px 2px -1px hsl(0 0% 20% / 0.15);
--shadow:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 1px 2px -1px hsl(0 0% 20% / 0.15);
--shadow-md:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 2px 4px -1px hsl(0 0% 20% / 0.15);
--shadow-lg:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 4px 6px -1px hsl(0 0% 20% / 0.15);
--shadow-xl:
0px 2px 0px 0px hsl(0 0% 20% / 0.15),
0px 8px 10px -1px hsl(0 0% 20% / 0.15);
--shadow-2xl: 0px 2px 0px 0px hsl(0 0% 20% / 0.38);
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-chart-1: var(--chart-1);
--color-chart-2: var(--chart-2);
--color-chart-3: var(--chart-3);
--color-chart-4: var(--chart-4);
--color-chart-5: var(--chart-5);
--color-sidebar: var(--sidebar);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
--font-sans: var(--font-sans);
--font-mono: var(--font-mono);
--font-serif: var(--font-serif);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--shadow-2xs: var(--shadow-2xs);
--shadow-xs: var(--shadow-xs);
--shadow-sm: var(--shadow-sm);
--shadow: var(--shadow);
--shadow-md: var(--shadow-md);
--shadow-lg: var(--shadow-lg);
--shadow-xl: var(--shadow-xl);
--shadow-2xl: var(--shadow-2xl);
}
@layer base {
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-background text-foreground;
}
}
/* Animation Easings */
@theme inline {
--ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
--ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}
/* Gallery Photo Entrance Animation */
@keyframes photo-enter {
from {
opacity: 0;
transform: translateY(20px) scale(0.98);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes pulse-subtle {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}
.animate-photo-enter {
animation: photo-enter 0.5s var(--ease-out-quart) forwards;
}
.animate-pulse-subtle {
animation: pulse-subtle 2s ease-in-out infinite;
}
/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
.animate-photo-enter {
animation: none;
opacity: 1;
transform: none;
}
.animate-pulse-subtle {
animation: none;
}
* {
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}
+29
View File
@@ -0,0 +1,29 @@
import type { Metadata } from "next";
import { Toaster } from "@/components/ui/sonner";
import { TooltipProvider } from "@/components/ui/tooltip";
import { SessionProvider } from "next-auth/react";
import "./globals.css";
export const metadata: Metadata = {
title: "Wallora Searcher",
description: "Wallora Searcher Admin",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en" className="h-full antialiased">
<body className="flex min-h-full flex-col">
<SessionProvider>
<TooltipProvider>
{children}
<Toaster richColors closeButton />
</TooltipProvider>
</SessionProvider>
</body>
</html>
);
}