Add next-intl to internationalize our project
This commit is contained in:
7
app/[locale]/(backend)/admin/page.tsx
Normal file
7
app/[locale]/(backend)/admin/page.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
export default function AdminPage() {
|
||||
return (
|
||||
<section className="container">
|
||||
<h1>Admin Page</h1>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
58
app/[locale]/(backend)/layout.tsx
Normal file
58
app/[locale]/(backend)/layout.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
"use client";
|
||||
|
||||
import Header from "@/components/Header/index";
|
||||
import Sidebar from "@/components/Sidebar";
|
||||
import React, { useState } from "react";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
interface LayoutProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const Layout: React.FC<LayoutProps> = ({ children }) => {
|
||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||
const pathname = usePathname();
|
||||
|
||||
const getPageTitle = (path: string) => {
|
||||
if (path === "/") return "Overview";
|
||||
|
||||
const titles: Record<string, string> = {
|
||||
"/users": "Users",
|
||||
"/settings": "Settings",
|
||||
"/profile": "Profile",
|
||||
"/songs": "Songs Database",
|
||||
"/events": "Worship & Events",
|
||||
};
|
||||
|
||||
return titles[path] || "Dashboard";
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="dashboard">
|
||||
<Sidebar open={sidebarOpen} close={() => setSidebarOpen(false)} />
|
||||
|
||||
{/* Mobile Sidebar Overlay */}
|
||||
{sidebarOpen && (
|
||||
<div
|
||||
className="fixed inset-0 z-40 bg-black/50 md:hidden"
|
||||
onClick={() => setSidebarOpen(false)}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div
|
||||
className={`flex min-h-screen flex-col transition-all duration-300 md:pl-64`}
|
||||
>
|
||||
<Header
|
||||
onMenuClick={() => setSidebarOpen(!sidebarOpen)}
|
||||
pageTitle={getPageTitle(pathname)}
|
||||
/>
|
||||
|
||||
<main className="animate-in fade-in flex-1 p-4 duration-500 md:p-8">
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Layout;
|
||||
245
app/[locale]/(backend)/page.tsx
Normal file
245
app/[locale]/(backend)/page.tsx
Normal file
@@ -0,0 +1,245 @@
|
||||
"use client";
|
||||
|
||||
import ModuleCard from "@/components/ModuleCard";
|
||||
import StatCard from "@/components/StatCard";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ModuleCategory } from "@/lib/types/dashboard";
|
||||
import {
|
||||
BookOpen,
|
||||
Building2,
|
||||
Calendar,
|
||||
FileText,
|
||||
History,
|
||||
Languages,
|
||||
Layout,
|
||||
List,
|
||||
MapPin,
|
||||
Mic2,
|
||||
Music,
|
||||
Sparkles,
|
||||
Tag,
|
||||
UserCircle,
|
||||
Users,
|
||||
} from "lucide-react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import Link from "next/link";
|
||||
import React from "react";
|
||||
|
||||
const Dashboard: React.FC = () => {
|
||||
const t = useTranslations("dashboard");
|
||||
const categories: ModuleCategory[] = [
|
||||
{
|
||||
title: "People & Community",
|
||||
items: [
|
||||
{
|
||||
id: "users",
|
||||
title: "Users",
|
||||
description: "Manage registered users, permissions, and roles.",
|
||||
icon: Users,
|
||||
path: "/users",
|
||||
},
|
||||
{
|
||||
id: "profiles",
|
||||
title: "Profiles",
|
||||
description: "Create, edit, or remove detailed user profiles.",
|
||||
icon: UserCircle,
|
||||
path: "/profiles",
|
||||
},
|
||||
{
|
||||
id: "communities",
|
||||
title: "Communities",
|
||||
description: "Manage different community groups and branches.",
|
||||
icon: Building2,
|
||||
path: "/communities",
|
||||
},
|
||||
{
|
||||
id: "addresses",
|
||||
title: "Addresses",
|
||||
description:
|
||||
"Database of addresses for registered users and locations.",
|
||||
icon: MapPin,
|
||||
path: "/addresses",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Worship & Events",
|
||||
items: [
|
||||
{
|
||||
id: "services",
|
||||
title: "Services & Lectures",
|
||||
description:
|
||||
"Schedule and manage church services and lecture events.",
|
||||
icon: Calendar,
|
||||
path: "/services",
|
||||
},
|
||||
{
|
||||
id: "lectures_list",
|
||||
title: "Lectures List",
|
||||
description:
|
||||
"Browse the complete archive of lectures from all communities.",
|
||||
icon: Mic2,
|
||||
path: "/lectures",
|
||||
},
|
||||
{
|
||||
id: "holidays",
|
||||
title: "Feast Days",
|
||||
description: "Configure upcoming holidays and special feast days.",
|
||||
icon: Sparkles,
|
||||
path: "/holidays",
|
||||
},
|
||||
{
|
||||
id: "services_list",
|
||||
title: "Services List",
|
||||
description: "View only the scheduled services overview.",
|
||||
icon: List,
|
||||
path: "/services-list",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Music & Content",
|
||||
items: [
|
||||
{
|
||||
id: "songbooks",
|
||||
title: "Songbooks",
|
||||
description: "Manage digital songbook collections and versions.",
|
||||
icon: BookOpen,
|
||||
path: "/songbooks",
|
||||
},
|
||||
{
|
||||
id: "songs",
|
||||
title: "Songs & Poems",
|
||||
description: "Create and edit lyrics, poems, and musical content.",
|
||||
icon: Music,
|
||||
path: "/songs",
|
||||
},
|
||||
{
|
||||
id: "themes",
|
||||
title: "Themes",
|
||||
description: "Organize songs and poems into thematic categories.",
|
||||
icon: Tag,
|
||||
path: "/themes",
|
||||
},
|
||||
{
|
||||
id: "titles",
|
||||
title: "Titles",
|
||||
description: "Index of all titles for lectures, songs, and poems.",
|
||||
icon: Layout,
|
||||
path: "/titles",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "System & Config",
|
||||
items: [
|
||||
{
|
||||
id: "changes",
|
||||
title: "Change Log",
|
||||
description: "Track database modifications and user activities.",
|
||||
icon: History,
|
||||
path: "/changes",
|
||||
},
|
||||
{
|
||||
id: "types",
|
||||
title: "Lecture Types",
|
||||
description:
|
||||
"Define and categorize different types of presentations.",
|
||||
icon: Tag,
|
||||
path: "/types",
|
||||
},
|
||||
{
|
||||
id: "contributions",
|
||||
title: "Contributions",
|
||||
description: "Manage community posts and member contributions.",
|
||||
icon: FileText,
|
||||
path: "/contributions",
|
||||
},
|
||||
{
|
||||
id: "languages",
|
||||
title: "Languages",
|
||||
description: "Configure supported languages and translations.",
|
||||
icon: Languages,
|
||||
path: "/languages",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-7xl space-y-8">
|
||||
{/* Welcome Section */}
|
||||
<div className="flex flex-col justify-between gap-4 md:flex-row md:items-center">
|
||||
<div>
|
||||
<h1 className="text-foreground text-3xl font-bold tracking-tight">
|
||||
{t("title")}
|
||||
</h1>
|
||||
<p className="text-muted-foreground mt-1">{t("welcome")}</p>
|
||||
</div>
|
||||
<div className="flex space-x-3">
|
||||
<Badge variant="secondary" className="px-2.5 py-0.5 text-sm">
|
||||
v2.4.0 Live
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Quick Stats */}
|
||||
<div className="grid grid-cols-1 gap-6 md:grid-cols-3">
|
||||
<StatCard
|
||||
label="Total Members"
|
||||
value="2,845"
|
||||
icon={Users}
|
||||
trend="up"
|
||||
change="12% this month"
|
||||
/>
|
||||
<StatCard
|
||||
label="Upcoming Services"
|
||||
value="24"
|
||||
icon={Calendar}
|
||||
trend="neutral"
|
||||
change="Next 7 days"
|
||||
/>
|
||||
<StatCard
|
||||
label="Songs Database"
|
||||
value="1,430"
|
||||
icon={Music}
|
||||
trend="up"
|
||||
change="5 new added"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Categories */}
|
||||
<div className="space-y-10">
|
||||
{categories.map((category) => (
|
||||
<div
|
||||
key={category.title}
|
||||
className="animate-in fade-in slide-in-from-bottom-4 duration-700"
|
||||
>
|
||||
<div className="mb-6 flex items-center space-x-2">
|
||||
<h2 className="text-foreground border-primary border-l-4 pl-3 text-xl font-semibold">
|
||||
{category.title}
|
||||
</h2>
|
||||
<div className="bg-border ml-4 h-px flex-1 opacity-50"></div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-4">
|
||||
{category.items.map((item) => (
|
||||
<Link key={item.id} href={item.path} className="block">
|
||||
<ModuleCard
|
||||
key={item.id}
|
||||
title={item.title}
|
||||
description={item.description}
|
||||
icon={item.icon}
|
||||
//onClick={() => console.log(`Navigating to ${item.path}`)}
|
||||
/>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Dashboard;
|
||||
136
app/[locale]/(backend)/users/components/UserForm/index.tsx
Normal file
136
app/[locale]/(backend)/users/components/UserForm/index.tsx
Normal file
@@ -0,0 +1,136 @@
|
||||
'use client';
|
||||
|
||||
import { z } from "zod"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
|
||||
// Shadcn UI components
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage
|
||||
} from "@/components/ui/form"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue
|
||||
} from "@/components/ui/select"
|
||||
import { Switch } from "@/components/ui/switch"
|
||||
|
||||
// 1. Schema definition
|
||||
const formSchema = z.object({
|
||||
email: z.string().email("Invalid email address."),
|
||||
role: z.string().min(1, "Please select a role."), // Rollenbezeichnung
|
||||
status: z.boolean().default(true), // Status (Active/Inactive)
|
||||
password: z.string().min(8, "Password must be at least 8 characters."),
|
||||
})
|
||||
|
||||
export type FormValues = z.infer<typeof formSchema>
|
||||
|
||||
export default function UserForm() {
|
||||
// 2. Initialize the form
|
||||
const form = useForm({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
email: "",
|
||||
role: "user",
|
||||
status: true,
|
||||
password: "",
|
||||
},
|
||||
})
|
||||
|
||||
// 3. Define the submit handler
|
||||
function onSubmit(values: FormValues) {
|
||||
// All comments in code must be in English
|
||||
// Later we will connect this to a Server Action
|
||||
console.log("Form values:", values)
|
||||
}
|
||||
|
||||
return (
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6 py-4">
|
||||
{/* Email Field */}
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="email"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Email</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="example@mail.com" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* Role Select Field */}
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="role"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Role (Rollenbezeichnung)</FormLabel>
|
||||
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
||||
<FormControl>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select a role" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value="admin">Admin</SelectItem>
|
||||
<SelectItem value="editor">Editor</SelectItem>
|
||||
<SelectItem value="user">User</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* Status Switch Field */}
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="status"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm">
|
||||
<div className="space-y-0.5">
|
||||
<FormLabel>Active Status</FormLabel>
|
||||
</div>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={field.value}
|
||||
onCheckedChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* Password Field */}
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="password"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Password</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="password" placeholder="••••••••" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Button type="submit" className="w-full">Save User</Button>
|
||||
</form>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
73
app/[locale]/(backend)/users/components/UserFormWrapper.tsx
Normal file
73
app/[locale]/(backend)/users/components/UserFormWrapper.tsx
Normal file
@@ -0,0 +1,73 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { Plus } from "lucide-react"
|
||||
import { useMediaQuery } from "@/hooks/use-media-query"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog"
|
||||
import {
|
||||
Drawer,
|
||||
DrawerClose,
|
||||
DrawerContent,
|
||||
DrawerFooter,
|
||||
DrawerHeader,
|
||||
DrawerTitle,
|
||||
DrawerTrigger,
|
||||
} from "@/components/ui/drawer"
|
||||
import UserForm from "./UserForm"
|
||||
|
||||
export function UserFormWrapper() {
|
||||
const [open, setOpen] = React.useState(false)
|
||||
const isDesktop = useMediaQuery("(min-width: 768px)")
|
||||
|
||||
// Common button content
|
||||
const TriggerButton = (
|
||||
<Button
|
||||
variant="default"
|
||||
className="bg-secondary hover:bg-secondary/90 border border-border rounded-lg cursor-pointer h-10"
|
||||
>
|
||||
<Plus className="text-muted-foreground size-5 md:mr-2" />
|
||||
<span className="hidden md:inline text-sm text-muted-foreground">
|
||||
Add New User
|
||||
</span>
|
||||
</Button>
|
||||
)
|
||||
|
||||
if (isDesktop) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
{TriggerButton}
|
||||
</DialogTrigger>
|
||||
<DialogContent className="sm:max-w-106.25 bg-card text-white border-border">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Add New User</DialogTitle>
|
||||
</DialogHeader>
|
||||
<UserForm />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Drawer open={open} onOpenChange={setOpen}>
|
||||
<DrawerTrigger asChild>
|
||||
{TriggerButton}
|
||||
</DrawerTrigger>
|
||||
<DrawerContent className="bg-card border-border text-white max-h-[96dvh]">
|
||||
<DrawerHeader className="text-left">
|
||||
<DrawerTitle>Add New User</DrawerTitle>
|
||||
</DrawerHeader>
|
||||
<div className="px-4 overflow-y-auto pb-4">
|
||||
<UserForm />
|
||||
</div>
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
'use client';
|
||||
|
||||
import { MoreVertical, Mail, Shield, Calendar } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
interface UserMobileCardProps {
|
||||
name: string;
|
||||
email: string;
|
||||
role: string;
|
||||
joinedAt?: string;
|
||||
status: 'active' | 'inactive';
|
||||
}
|
||||
|
||||
export const UserMobileCard: React.FC<UserMobileCardProps> = ({ name, email, role, joinedAt, status }) => {
|
||||
|
||||
return (
|
||||
<div className="bg-card border border-border rounded-xl p-4 shadow-sm md:hidden active:scale-[0.99] transition-all">
|
||||
{/* Header section */}
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
{/* Avatar will be here */}
|
||||
<div className="size-11 rounded-full bg-primary/10 flex items-center justify-center border border-primary/20">
|
||||
<span className="text-primary font-bold text-sm">
|
||||
{name.split(" ").map(n => n[0]).join("")}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex flex-col">
|
||||
<span className="font-semibold text-foreground leading-none">{name}</span>
|
||||
<span className="text-xs text-muted-foreground mt-1 flex items-center gap-1">
|
||||
<Mail className="size-3" />
|
||||
{email}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Badge
|
||||
variant={status === "active" ? "default" : "secondary"}
|
||||
className="text-[10px] px-2 py-0 h-5"
|
||||
>
|
||||
{status}
|
||||
</Badge>
|
||||
</div>
|
||||
|
||||
{/* Footer section: role and options */}
|
||||
<div className="flex items-center justify-between mt-5 pt-3 border-t border-border/50">
|
||||
<div className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<Shield className="size-3 text-primary/70" />
|
||||
<span>Role: <b className="text-foreground font-medium">{role}</b></span>
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5 text-[10px] text-muted-foreground/80">
|
||||
<Calendar className="size-3" />
|
||||
<span>Joined: {joinedAt}</span>
|
||||
</div>
|
||||
<Button variant="ghost" size="icon-xs" className="text-muted-foreground">
|
||||
<MoreVertical className="size-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
185
app/[locale]/(backend)/users/page.tsx
Normal file
185
app/[locale]/(backend)/users/page.tsx
Normal file
@@ -0,0 +1,185 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Filter, MoreVertical, Search } from "lucide-react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { UserFormWrapper } from "./components/UserFormWrapper";
|
||||
import { UserMobileCard } from "./components/UserMobileCard";
|
||||
|
||||
// Temporary user data for demonstration
|
||||
const tempUsers = [
|
||||
{
|
||||
id: 1,
|
||||
name: "John Doe",
|
||||
email: "john@example.com",
|
||||
role: "Admin",
|
||||
joinedAt: "2023-01-01",
|
||||
status: "active",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "Alice Smith",
|
||||
email: "alice@test.com",
|
||||
role: "Editor",
|
||||
joinedAt: "2023-02-15",
|
||||
status: "active",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Bob Johnson",
|
||||
email: "bob@community.com",
|
||||
role: "Member",
|
||||
joinedAt: "2023-03-10",
|
||||
status: "inactive",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Charlie Brown",
|
||||
email: "charlie@community.com",
|
||||
role: "Member",
|
||||
joinedAt: "2023-04-20",
|
||||
status: "active",
|
||||
},
|
||||
];
|
||||
|
||||
export default function UsersPage() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const t = useTranslations("users");
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex flex-col gap-6 p-0 md:gap-10">
|
||||
{/* Header: Title + Button for Desktop only */}
|
||||
<div className="hidden items-center justify-between md:flex">
|
||||
<div className="space-y-1">
|
||||
<h1 className="text-4xl font-bold tracking-tight text-white">
|
||||
{t("title")}
|
||||
</h1>
|
||||
<p className="text-muted-foreground mt-3 hidden max-w-2xl text-lg md:block">
|
||||
{t("welcome")}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Button: Add New User for Desktop only */}
|
||||
<UserFormWrapper />
|
||||
</div>
|
||||
|
||||
{/* Search + Filter */}
|
||||
<div className="flex gap-3 md:gap-4">
|
||||
<div className="group relative w-full">
|
||||
<Search className="text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2" />
|
||||
<Input
|
||||
className="bg-card border-border h-10 w-full rounded-lg border py-1 pr-12 pl-10 focus:outline-1"
|
||||
placeholder="Search users..."
|
||||
/>
|
||||
<div className="absolute top-1/2 right-2 -translate-y-1/2">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="hover:bg-muted text-muted-foreground size-8 transition-colors hover:text-white md:size-10"
|
||||
>
|
||||
<Filter className="size-4 md:size-5" />
|
||||
<span className="sr-only">Filters</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/* Button: Add New User for Mobile only */}
|
||||
<div className="md:hidden">
|
||||
<UserFormWrapper />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* --- For Mobile Phones --- */}
|
||||
<div className="flex flex-col gap-4 md:hidden">
|
||||
{tempUsers.map((user) => (
|
||||
<UserMobileCard
|
||||
key={user.id}
|
||||
name={user.name}
|
||||
email={user.email}
|
||||
role={user.role}
|
||||
joinedAt={user.joinedAt}
|
||||
status={user.status as "active" | "inactive"}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Users List / Table */}
|
||||
<div className="bg-card border-border hidden overflow-hidden rounded-xl border shadow-sm md:block">
|
||||
<table className="w-full text-left">
|
||||
<thead className="bg-muted/50 border-border border-b">
|
||||
<tr>
|
||||
<th className="text-muted-foreground px-6 py-3 text-xs font-semibold tracking-wider uppercase">
|
||||
User
|
||||
</th>
|
||||
<th className="text-muted-foreground px-6 py-3 text-xs font-semibold tracking-wider uppercase">
|
||||
Role
|
||||
</th>
|
||||
<th className="text-muted-foreground px-6 py-3 text-xs font-semibold tracking-wider uppercase">
|
||||
Status
|
||||
</th>
|
||||
<th className="text-muted-foreground px-6 py-3 text-xs font-semibold tracking-wider uppercase">
|
||||
Joined
|
||||
</th>
|
||||
<th className="px-6 py-3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-border divide-y">
|
||||
{/* Example Row */}
|
||||
{tempUsers.map((user) => (
|
||||
<tr
|
||||
key={user.id}
|
||||
className="hover:bg-muted/20 cursor-pointer transition-colors"
|
||||
>
|
||||
<td className="px-6 py-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="bg-primary/20 text-primary flex h-10 w-10 items-center justify-center rounded-full font-bold">
|
||||
{user.name.charAt(0)}
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-foreground text-sm font-medium">
|
||||
{user.name}
|
||||
</div>
|
||||
<div className="text-muted-foreground text-xs">
|
||||
{user.email}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-6 py-4">
|
||||
<span className="text-muted-foreground text-sm">
|
||||
{user.role}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-6 py-4">
|
||||
<span
|
||||
className={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${
|
||||
user.status === "active"
|
||||
? "bg-green-500/10 text-green-500"
|
||||
: "bg-red-500/10 text-red-500"
|
||||
}`}
|
||||
>
|
||||
{user.status}
|
||||
</span>
|
||||
</td>
|
||||
<td className="text-muted-foreground px-6 py-4 text-sm">
|
||||
{user.joinedAt}
|
||||
</td>
|
||||
<td className="px-6 py-4 text-right">
|
||||
<button
|
||||
title="More options"
|
||||
className="hover:bg-muted rounded-full p-2 transition-colors"
|
||||
>
|
||||
<MoreVertical className="text-muted-foreground h-4 w-4" />
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
45
app/[locale]/layout.tsx
Normal file
45
app/[locale]/layout.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import { routing } from "@/i18n/routing";
|
||||
import type { Metadata } from "next";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { ThemeProvider } from "next-themes";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "../globals.css";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "CGR App",
|
||||
description: "Manager for CGR Data",
|
||||
};
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
params,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
params: { locale?: string };
|
||||
}>) {
|
||||
const { locale } = await params;
|
||||
|
||||
return (
|
||||
<html lang={locale || routing.defaultLocale} suppressHydrationWarning>
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
>
|
||||
<ThemeProvider attribute="class" enableSystem>
|
||||
<NextIntlClientProvider locale={locale || routing.defaultLocale}>
|
||||
{children}
|
||||
</NextIntlClientProvider>
|
||||
</ThemeProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user