This commit is contained in:
Flatlogic Bot 2026-01-24 21:04:09 +00:00
parent 1ba7b9d821
commit 9ccd76f13b
3 changed files with 239 additions and 578 deletions

View File

@ -8,8 +8,8 @@ export const localStorageStyleKey = 'style'
export const containerMaxW = 'xl:max-w-full xl:mx-auto 2xl:mx-20'
export const appTitle = 'created by Flatlogic generator!'
export const appTitle = 'L\'Escale Marocaine'
export const getPageTitle = (currentPageTitle: string) => `${currentPageTitle}${appTitle}`
export const tinyKey = process.env.NEXT_PUBLIC_TINY_KEY || ''
export const tinyKey = process.env.NEXT_PUBLIC_TINY_KEY || ''

View File

@ -7,7 +7,7 @@ import LayoutAuthenticated from '../layouts/Authenticated'
import SectionMain from '../components/SectionMain'
import SectionTitleLineWithButton from '../components/SectionTitleLineWithButton'
import BaseIcon from "../components/BaseIcon";
import { getPageTitle } from '../config'
import { getPageTitle, appTitle } from '../config'
import Link from "next/link";
import { hasPermission } from "../helpers/userPermissions";
@ -16,15 +16,15 @@ import { WidgetCreator } from '../components/WidgetCreator/WidgetCreator';
import { SmartWidget } from '../components/SmartWidget/SmartWidget';
import { useAppDispatch, useAppSelector } from '../stores/hooks';
const Dashboard = () => {
const dispatch = useAppDispatch();
const iconsColor = useAppSelector((state) => state.style.iconsColor);
const corners = useAppSelector((state) => state.style.corners);
const cardsStyle = useAppSelector((state) => state.style.cardsStyle);
const loadingMessage = 'Loading...';
const loadingMessage = '...';
const [users, setUsers] = React.useState(loadingMessage);
const [roles, setRoles] = React.useState(loadingMessage);
const [permissions, setPermissions] = React.useState(loadingMessage);
@ -39,29 +39,24 @@ const Dashboard = () => {
const [suppliers, setSuppliers] = React.useState(loadingMessage);
const [ingredients, setIngredients] = React.useState(loadingMessage);
const [widgetsRole, setWidgetsRole] = React.useState({
role: { value: '', label: '' },
});
const { currentUser } = useAppSelector((state) => state.auth);
const { isFetchingQuery } = useAppSelector((state) => state.openAi);
const { rolesWidgets, loading } = useAppSelector((state) => state.roles);
async function loadData() {
const entities = ['users','roles','permissions','restaurants','categories','dishes','menus','orders','tables','reservations','reviews','suppliers','ingredients',];
const fns = [setUsers,setRoles,setPermissions,setRestaurants,setCategories,setDishes,setMenus,setOrders,setTables,setReservations,setReviews,setSuppliers,setIngredients,];
const entities = ['users','roles','permissions','restaurants','categories','dishes','menus','orders','tables','reservations','reviews','suppliers','ingredients'];
const fns = [setUsers,setRoles,setPermissions,setRestaurants,setCategories,setDishes,setMenus,setOrders,setTables,setReservations,setReviews,setSuppliers,setIngredients];
const requests = entities.map((entity, index) => {
if(hasPermission(currentUser, `READ_${entity.toUpperCase()}`)) {
return axios.get(`/${entity.toLowerCase()}/count`);
} else {
fns[index](null);
return Promise.resolve({data: {count: null}});
}
});
Promise.allSettled(requests).then((results) => {
@ -74,10 +69,11 @@ const Dashboard = () => {
});
});
}
async function getWidgets(roleId) {
async function getWidgets(roleId: string) {
await dispatch(fetchWidgets(roleId));
}
React.useEffect(() => {
if (!currentUser) return;
loadData().then();
@ -88,439 +84,138 @@ const Dashboard = () => {
if (!currentUser || !widgetsRole?.role?.value) return;
getWidgets(widgetsRole?.role?.value || '').then();
}, [widgetsRole?.role?.value]);
return (
<>
<Head>
<title>
{getPageTitle('Overview')}
</title>
</Head>
<SectionMain>
<SectionTitleLineWithButton
icon={icon.mdiChartTimelineVariant}
title='Overview'
main>
{''}
</SectionTitleLineWithButton>
{hasPermission(currentUser, 'CREATE_ROLES') && <WidgetCreator
currentUser={currentUser}
isFetchingQuery={isFetchingQuery}
setWidgetsRole={setWidgetsRole}
widgetsRole={widgetsRole}
/>}
{!!rolesWidgets.length &&
hasPermission(currentUser, 'CREATE_ROLES') && (
<p className=' text-gray-500 dark:text-gray-400 mb-4'>
{`${widgetsRole?.role?.label || 'Users'}'s widgets`}
</p>
)}
<div className='grid grid-cols-1 gap-6 lg:grid-cols-4 mb-6 grid-flow-dense'>
{(isFetchingQuery || loading) && (
<div className={` ${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 text-lg leading-tight text-gray-500 flex items-center ${cardsStyle} dark:border-dark-700 p-6`}>
<BaseIcon
className={`${iconsColor} animate-spin mr-5`}
w='w-16'
h='h-16'
size={48}
path={icon.mdiLoading}
/>{' '}
Loading widgets...
return (
<>
<Head>
<title>{getPageTitle('Dashboard')}</title>
</Head>
<SectionMain>
<SectionTitleLineWithButton
icon={icon.mdiViewDashboard}
title={`${appTitle} Management`}
main
>
{''}
</SectionTitleLineWithButton>
<div className="mb-6 p-6 bg-indigo-50 dark:bg-dark-800 rounded-2xl border border-indigo-100 dark:border-dark-700">
<h2 className="text-2xl font-bold text-indigo-900 dark:text-white mb-2">
Welcome back, {currentUser?.firstName || 'Manager'}!
</h2>
<p className="text-indigo-600 dark:text-indigo-400">
Here is what&apos;s happening at L&apos;Escale Marocaine today.
</p>
</div>
)}
{ rolesWidgets &&
rolesWidgets.map((widget) => (
<SmartWidget
key={widget.id}
userId={currentUser?.id}
widget={widget}
roleId={widgetsRole?.role?.value || ''}
admin={hasPermission(currentUser, 'CREATE_ROLES')}
{hasPermission(currentUser, 'CREATE_ROLES') && (
<WidgetCreator
currentUser={currentUser}
isFetchingQuery={isFetchingQuery}
setWidgetsRole={setWidgetsRole}
widgetsRole={widgetsRole}
/>
))}
</div>
)}
{!!rolesWidgets.length && <hr className='my-6 text-pastelBrownTheme-mainBG ' />}
<div id="dashboard" className='grid grid-cols-1 gap-6 lg:grid-cols-3 mb-6'>
{hasPermission(currentUser, 'READ_USERS') && <Link href={'/users/users-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Users
</div>
<div className="text-3xl leading-tight font-semibold">
{users}
</div>
</div>
<div>
<div className='grid grid-cols-1 gap-6 lg:grid-cols-4 mb-6 grid-flow-dense'>
{(isFetchingQuery || loading) && (
<div className={`${corners !== 'rounded-full' ? corners : 'rounded-3xl'} dark:bg-dark-900 text-lg leading-tight text-gray-500 flex items-center ${cardsStyle} dark:border-dark-700 p-6`}>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
className={`${iconsColor} animate-spin mr-5`}
w='w-16'
h='h-16'
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={icon.mdiAccountGroup || icon.mdiTable}
path={icon.mdiLoading}
/>
Loading metrics...
</div>
</div>
)}
{rolesWidgets && rolesWidgets.map((widget) => (
<SmartWidget
key={widget.id}
userId={currentUser?.id}
widget={widget}
roleId={widgetsRole?.role?.value || ''}
admin={hasPermission(currentUser, 'CREATE_ROLES')}
/>
))}
</div>
</Link>}
{hasPermission(currentUser, 'READ_ROLES') && <Link href={'/roles/roles-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Roles
<div id="dashboard" className='grid grid-cols-1 gap-6 lg:grid-cols-3 mb-6'>
{hasPermission(currentUser, 'READ_RESERVATIONS') && (
<Link href={'/reservations/reservations-list'}>
<div className={`${corners !== 'rounded-full' ? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6 hover:shadow-lg transition-shadow bg-white`}>
<div className="flex justify-between items-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">Reservations</div>
<div className="text-3xl leading-tight font-semibold">{reservations}</div>
</div>
<BaseIcon className="text-orange-500" w="w-16" h="h-16" size={48} path={icon.mdiCalendarAccount} />
</div>
</div>
<div className="text-3xl leading-tight font-semibold">
{roles}
</Link>
)}
{hasPermission(currentUser, 'READ_ORDERS') && (
<Link href={'/orders/orders-list'}>
<div className={`${corners !== 'rounded-full' ? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6 hover:shadow-lg transition-shadow bg-white`}>
<div className="flex justify-between items-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">Active Orders</div>
<div className="text-3xl leading-tight font-semibold">{orders}</div>
</div>
<BaseIcon className="text-green-500" w="w-16" h="h-16" size={48} path={icon.mdiFoodForkDrink} />
</div>
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={icon.mdiShieldAccountVariantOutline || icon.mdiTable}
/>
</div>
</div>
</Link>
)}
{hasPermission(currentUser, 'READ_DISHES') && (
<Link href={'/dishes/dishes-list'}>
<div className={`${corners !== 'rounded-full' ? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6 hover:shadow-lg transition-shadow bg-white`}>
<div className="flex justify-between items-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">Menu Items</div>
<div className="text-3xl leading-tight font-semibold">{dishes}</div>
</div>
<BaseIcon className="text-indigo-500" w="w-16" h="h-16" size={48} path={icon.mdiChefHat} />
</div>
</div>
</Link>
)}
</div>
</Link>}
{hasPermission(currentUser, 'READ_PERMISSIONS') && <Link href={'/permissions/permissions-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Permissions
</div>
<div className="text-3xl leading-tight font-semibold">
{permissions}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={icon.mdiShieldAccountOutline || icon.mdiTable}
/>
</div>
</div>
<div className="grid grid-cols-1 gap-6 lg:grid-cols-4 mb-6">
{/* Secondary Metrics */}
{[
{ label: 'Restaurants', val: restaurants, path: '/restaurants/restaurants-list', icon: icon.mdiStorefront, color: 'text-blue-500', perm: 'READ_RESTAURANTS' },
{ label: 'Categories', val: categories, path: '/categories/categories-list', icon: icon.mdiShape, color: 'text-purple-500', perm: 'READ_CATEGORIES' },
{ label: 'Tables', val: tables, path: '/tables/tables-list', icon: icon.mdiTableLarge, color: 'text-yellow-600', perm: 'READ_TABLES' },
{ label: 'Reviews', val: reviews, path: '/reviews/reviews-list', icon: icon.mdiStar, color: 'text-red-400', perm: 'READ_REVIEWS' },
].map((item, idx) => (
hasPermission(currentUser, item.perm) && (
<Link href={item.path} key={idx}>
<div className={`${corners !== 'rounded-full' ? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-4 hover:bg-gray-50 dark:hover:bg-dark-800 transition-colors bg-white`}>
<div className="flex items-center gap-4">
<BaseIcon className={item.color} w="w-10" h="h-10" size={24} path={item.icon} />
<div>
<div className="text-sm text-gray-500">{item.label}</div>
<div className="text-xl font-bold">{item.val}</div>
</div>
</div>
</div>
</Link>
)
))}
</div>
</Link>}
{hasPermission(currentUser, 'READ_RESTAURANTS') && <Link href={'/restaurants/restaurants-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Restaurants
</div>
<div className="text-3xl leading-tight font-semibold">
{restaurants}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiStorefront' in icon ? icon['mdiStorefront' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_CATEGORIES') && <Link href={'/categories/categories-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Categories
</div>
<div className="text-3xl leading-tight font-semibold">
{categories}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiShape' in icon ? icon['mdiShape' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_DISHES') && <Link href={'/dishes/dishes-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Dishes
</div>
<div className="text-3xl leading-tight font-semibold">
{dishes}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiFood' in icon ? icon['mdiFood' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_MENUS') && <Link href={'/menus/menus-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Menus
</div>
<div className="text-3xl leading-tight font-semibold">
{menus}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiMenu' in icon ? icon['mdiMenu' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_ORDERS') && <Link href={'/orders/orders-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Orders
</div>
<div className="text-3xl leading-tight font-semibold">
{orders}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiClipboardList' in icon ? icon['mdiClipboardList' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_TABLES') && <Link href={'/tables/tables-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Tables
</div>
<div className="text-3xl leading-tight font-semibold">
{tables}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiTableLarge' in icon ? icon['mdiTableLarge' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_RESERVATIONS') && <Link href={'/reservations/reservations-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Reservations
</div>
<div className="text-3xl leading-tight font-semibold">
{reservations}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiCalendar' in icon ? icon['mdiCalendar' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_REVIEWS') && <Link href={'/reviews/reviews-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Reviews
</div>
<div className="text-3xl leading-tight font-semibold">
{reviews}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiStar' in icon ? icon['mdiStar' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_SUPPLIERS') && <Link href={'/suppliers/suppliers-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Suppliers
</div>
<div className="text-3xl leading-tight font-semibold">
{suppliers}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiTruck' in icon ? icon['mdiTruck' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_INGREDIENTS') && <Link href={'/ingredients/ingredients-list'}>
<div
className={`${corners !== 'rounded-full'? corners : 'rounded-3xl'} dark:bg-dark-900 ${cardsStyle} dark:border-dark-700 p-6`}
>
<div className="flex justify-between align-center">
<div>
<div className="text-lg leading-tight text-gray-500 dark:text-gray-400">
Ingredients
</div>
<div className="text-3xl leading-tight font-semibold">
{ingredients}
</div>
</div>
<div>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={'mdiLeaf' in icon ? icon['mdiLeaf' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
</div>
</SectionMain>
</>
)
</SectionMain>
</>
)
}
Dashboard.getLayout = function getLayout(page: ReactElement) {
return <LayoutAuthenticated>{page}</LayoutAuthenticated>
return <LayoutAuthenticated>{page}</LayoutAuthenticated>
}
export default Dashboard
export default Dashboard

View File

@ -1,166 +1,132 @@
import React, { useEffect, useState } from 'react';
import type { ReactElement } from 'react';
import Head from 'next/head';
import Link from 'next/link';
import BaseButton from '../components/BaseButton';
import CardBox from '../components/CardBox';
import SectionFullScreen from '../components/SectionFullScreen';
import LayoutGuest from '../layouts/Guest';
import BaseDivider from '../components/BaseDivider';
import BaseButtons from '../components/BaseButtons';
import { getPageTitle } from '../config';
import { useAppSelector } from '../stores/hooks';
import CardBoxComponentTitle from "../components/CardBoxComponentTitle";
import { getPexelsImage, getPexelsVideo } from '../helpers/pexels';
import { getPageTitle, appTitle } from '../config';
import { getPexelsImage } from '../helpers/pexels';
import { mdiFood, mdiSilverwareVariant, mdiTimelineClockOutline } from '@mdi/js';
import BaseIcon from '../components/BaseIcon';
export default function LandingPage() {
const [heroImage, setHeroImage] = useState(null)
export default function Starter() {
const [illustrationImage, setIllustrationImage] = useState({
src: undefined,
photographer: undefined,
photographer_url: undefined,
})
const [illustrationVideo, setIllustrationVideo] = useState({video_files: []})
const [contentType, setContentType] = useState('image');
const [contentPosition, setContentPosition] = useState('left');
const textColor = useAppSelector((state) => state.style.linkColor);
const title = 'AI App Draft'
// Fetch Pexels image/video
useEffect(() => {
async function fetchData() {
const image = await getPexelsImage();
const video = await getPexelsVideo();
setIllustrationImage(image);
setIllustrationVideo(video);
// We search for Moroccan food specifically to match the theme
const image = await getPexelsImage('Moroccan Food');
setHeroImage(image);
}
fetchData();
}, []);
const imageBlock = (image) => (
<div
className='hidden md:flex flex-col justify-end relative flex-grow-0 flex-shrink-0 w-1/3'
style={{
backgroundImage: `${
image
? `url(${image?.src?.original})`
: 'linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5))'
}`,
backgroundSize: 'cover',
backgroundPosition: 'left center',
backgroundRepeat: 'no-repeat',
}}
>
<div className='flex justify-center w-full bg-blue-300/20'>
<a
className='text-[8px]'
href={image?.photographer_url}
target='_blank'
rel='noreferrer'
>
Photo by {image?.photographer} on Pexels
</a>
const features = [
{
title: 'Authentic Flavors',
description: 'Experience the rich heritage of Moroccan spices and traditional cooking techniques.',
icon: mdiFood,
},
{
title: 'Elegant Dining',
description: 'A refined atmosphere inspired by the beautiful Riads of Marrakech.',
icon: mdiSilverwareVariant,
},
{
title: 'Easy Reservations',
description: 'Book your table in seconds and manage your dining experience online.',
icon: mdiTimelineClockOutline,
}
]
return (
<div className="bg-white text-gray-900">
<Head>
<title>{getPageTitle('Authentic Moroccan Cuisine')}</title>
</Head>
{/* Hero Section */}
<SectionFullScreen bg="violet">
<div className="relative w-full min-h-screen flex items-center justify-center overflow-hidden">
{/* Background Overlay */}
<div
className="absolute inset-0 z-0 transition-opacity duration-1000"
style={{
backgroundImage: heroImage ? `url(${heroImage.src?.large2x})` : 'linear-gradient(to right, #1a237e, #4a148c)',
backgroundSize: 'cover',
backgroundPosition: 'center',
}}
>
<div className="absolute inset-0 bg-black opacity-50"></div>
</div>
{/* Content */}
<div className="relative z-10 container mx-auto px-6 text-center text-white">
<h1 className="text-5xl md:text-7xl font-serif mb-6 animate-fade-in">
{appTitle}
</h1>
<p className="text-xl md:text-2xl mb-10 max-w-2xl mx-auto font-light">
A journey through the vibrant colors and exquisite tastes of Morocco.
</p>
<div className="flex flex-col md:flex-row items-center justify-center gap-4">
<BaseButton
href="/login"
label="Reserve a Table"
color="info"
className="px-10 py-4 text-lg rounded-full"
/>
<Link href="/login" className="text-white hover:text-orange-400 transition-colors duration-200 underline underline-offset-8">
Admin Portal
</Link>
</div>
</div>
</div>
</SectionFullScreen>
{/* Features / Story */}
<div className="py-24 bg-gray-50">
<div className="container mx-auto px-6">
<div className="text-center mb-16">
<h2 className="text-4xl font-serif mb-4 text-indigo-900">Tradition in Every Bite</h2>
<div className="w-24 h-1 bg-orange-500 mx-auto"></div>
</div>
<div className="grid grid-cols-1 md:grid-cols-3 gap-12">
{features.map((feature, index) => (
<div key={index} className="text-center p-8 bg-white rounded-2xl shadow-sm hover:shadow-md transition-shadow">
<div className="inline-flex items-center justify-center w-16 h-16 rounded-full bg-orange-100 text-orange-600 mb-6">
<BaseIcon path={feature.icon} size={32} />
</div>
<h3 className="text-xl font-bold mb-4">{feature.title}</h3>
<p className="text-gray-600 leading-relaxed">
{feature.description}
</p>
</div>
))}
</div>
</div>
</div>
{/* Footer */}
<footer className="bg-indigo-950 text-white py-12">
<div className="container mx-auto px-6 text-center">
<h3 className="text-2xl font-serif mb-6">{appTitle}</h3>
<p className="text-indigo-300 mb-8">Authentic Moroccan Dining Experience</p>
<div className="flex justify-center gap-6 mb-8 text-sm text-indigo-200">
<Link href="/login">Menu</Link>
<Link href="/login">Gallery</Link>
<Link href="/login">Contact</Link>
</div>
<p className="text-indigo-400 text-xs">
© 2026 {appTitle}. Crafted for an authentic experience.
</p>
</div>
</footer>
</div>
);
const videoBlock = (video) => {
if (video?.video_files?.length > 0) {
return (
<div className='hidden md:flex flex-col justify-end relative flex-grow-0 flex-shrink-0 w-1/3'>
<video
className='absolute top-0 left-0 w-full h-full object-cover'
autoPlay
loop
muted
>
<source src={video?.video_files[0]?.link} type='video/mp4'/>
Your browser does not support the video tag.
</video>
<div className='flex justify-center w-full bg-blue-300/20 z-10'>
<a
className='text-[8px]'
href={video?.user?.url}
target='_blank'
rel='noreferrer'
>
Video by {video.user.name} on Pexels
</a>
</div>
</div>)
}
};
return (
<div
style={
contentPosition === 'background'
? {
backgroundImage: `${
illustrationImage
? `url(${illustrationImage.src?.original})`
: 'linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5))'
}`,
backgroundSize: 'cover',
backgroundPosition: 'left center',
backgroundRepeat: 'no-repeat',
}
: {}
}
>
<Head>
<title>{getPageTitle('Starter Page')}</title>
</Head>
<SectionFullScreen bg='violet'>
<div
className={`flex ${
contentPosition === 'right' ? 'flex-row-reverse' : 'flex-row'
} min-h-screen w-full`}
>
{contentType === 'image' && contentPosition !== 'background'
? imageBlock(illustrationImage)
: null}
{contentType === 'video' && contentPosition !== 'background'
? videoBlock(illustrationVideo)
: null}
<div className='flex items-center justify-center flex-col space-y-4 w-full lg:w-full'>
<CardBox className='w-full md:w-3/5 lg:w-2/3'>
<CardBoxComponentTitle title="Welcome to your AI App Draft app!"/>
<div className="space-y-3">
<p className='text-center text-gray-500'>This is a React.js/Node.js app generated by the <a className={`${textColor}`} href="https://flatlogic.com/generator">Flatlogic Web App Generator</a></p>
<p className='text-center text-gray-500'>For guides and documentation please check
your local README.md and the <a className={`${textColor}`} href="https://flatlogic.com/documentation">Flatlogic documentation</a></p>
</div>
<BaseButtons>
<BaseButton
href='/login'
label='Login'
color='info'
className='w-full'
/>
</BaseButtons>
</CardBox>
</div>
</div>
</SectionFullScreen>
<div className='bg-black text-white flex flex-col text-center justify-center md:flex-row'>
<p className='py-6 text-sm'>© 2026 <span>{title}</span>. All rights reserved</p>
<Link className='py-6 ml-4 text-sm' href='/privacy-policy/'>
Privacy Policy
</Link>
</div>
</div>
);
}
Starter.getLayout = function getLayout(page: ReactElement) {
return <LayoutGuest>{page}</LayoutGuest>;
};
LandingPage.getLayout = function getLayout(page: ReactElement) {
return <LayoutGuest>{page}</LayoutGuest>;
};