Compare commits

..

No commits in common. "ai-dev" and "master" have entirely different histories.

10 changed files with 555 additions and 304 deletions

View File

@ -17,7 +17,6 @@ const searchRoutes = require('./routes/search');
const pexelsRoutes = require('./routes/pexels'); const pexelsRoutes = require('./routes/pexels');
const openaiRoutes = require('./routes/openai'); const openaiRoutes = require('./routes/openai');
const publicEventsRoutes = require('./routes/publicEvents');
@ -96,7 +95,6 @@ app.use(bodyParser.json());
app.use('/api/auth', authRoutes); app.use('/api/auth', authRoutes);
app.use('/api/file', fileRoutes); app.use('/api/file', fileRoutes);
app.use('/api/pexels', pexelsRoutes); app.use('/api/pexels', pexelsRoutes);
app.use('/api/public/events', publicEventsRoutes);
app.enable('trust proxy'); app.enable('trust proxy');

View File

@ -1,13 +0,0 @@
const express = require('express');
const EventsDBApi = require('../db/api/events');
const wrapAsync = require('../helpers').wrapAsync;
const router = express.Router();
router.get('/', wrapAsync(async (req, res) => {
const payload = await EventsDBApi.findAll(req.query);
res.status(200).send(payload);
}));
module.exports = router;

View File

@ -1,3 +0,0 @@
# Ignore generated files
build/*
next-env.d.ts

View File

@ -6,9 +6,5 @@ module.exports = {
], ],
rules: { rules: {
'react/no-children-prop': 'off', 'react/no-children-prop': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off', // Turned off to reduce noise
'@typescript-eslint/ban-types': 'off',
'react-hooks/exhaustive-deps': 'off', // Turned off to reduce noise
}, },
}; };

View File

@ -4,7 +4,7 @@
"dev": "cross-env PORT=${FRONT_PORT:-3000} next dev --turbopack", "dev": "cross-env PORT=${FRONT_PORT:-3000} next dev --turbopack",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "eslint . --ext .ts,.tsx", "lint": "next lint",
"format": "prettier '{components,pages,src,interfaces,hooks}/**/*.{tsx,ts,js}' --write" "format": "prettier '{components,pages,src,interfaces,hooks}/**/*.{tsx,ts,js}' --write"
}, },
"dependencies": { "dependencies": {

View File

@ -1,89 +0,0 @@
import React, { useEffect, useState } from 'react';
import ImageField from '../ImageField';
import { useAppSelector } from '../../stores/hooks';
import dataFormatter from '../../helpers/dataFormatter';
import LoadingSpinner from '../LoadingSpinner';
import Link from 'next/link';
import { getMultiplePexelsImages } from '../../helpers/pexels';
type Props = {
events: any[];
loading: boolean;
};
const LandingEventCards = ({ events, loading }: Props) => {
const { corners } = useAppSelector((state) => state.style);
const [imageUrls, setImageUrls] = useState([]);
useEffect(() => {
if (events.length > 0) {
const fetchImages = async () => {
const queries = events.map((event) => event.title);
const images = await getMultiplePexelsImages(queries);
setImageUrls(images.map((image) => image?.src.original));
};
fetchImages();
}
}, [events]);
const cardClass = `group relative overflow-hidden transition-all duration-300 ease-in-out transform hover:scale-[1.03] hover:shadow-2xl dark:hover:shadow-black/50 ${
corners !== 'rounded-full' ? corners : 'rounded-3xl'
} bg-white dark:bg-dark-800 shadow-lg`;
return (
<div className="p-4 md:p-6">
{loading && <LoadingSpinner />}
<ul
role="list"
className="grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4"
>
{!loading &&
events.map((item, index) => (
<li key={item.id} className={cardClass}>
<Link href={`/events/events-view/?id=${item.id}`} className="block">
<div className="relative h-64 w-full overflow-hidden">
<ImageField
url={imageUrls[index]}
alt={item.title}
className="h-full w-full object-cover transition-transform duration-500 group-hover:scale-110"
/>
<div className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent" />
<div className="absolute top-0 right-0 mt-3 mr-3 px-3 py-1.5 text-xs font-semibold tracking-wider text-white uppercase bg-black/50 rounded-full">
{dataFormatter.dateFormatter(item.start_datetime)}
</div>
<div className="absolute bottom-0 left-0 p-4 w-full">
<h3 className="text-2xl font-bold text-white leading-tight tracking-tight line-clamp-2 mb-2">
{item.title}
</h3>
<div className="text-sm text-white/80 line-clamp-1">
{dataFormatter.venuesOneListFormatter(item.venue)}
</div>
</div>
</div>
<div className="p-5">
<p className="text-sm text-gray-600 dark:text-gray-400 line-clamp-3">
{item.description}
</p>
</div>
</Link>
</li>
))}
{!loading && events.length === 0 && (
<div className="col-span-full flex items-center justify-center h-48">
<p className="text-gray-500 dark:text-gray-400">
No upcoming events at the moment.
</p>
</div>
)}
</ul>
</div>
);
};
export default LandingEventCards;

View File

@ -1,102 +1,432 @@
import * as icon from '@mdi/js' import * as icon from '@mdi/js';
import Head from 'next/head' import Head from 'next/head'
import React, { useEffect } from 'react' import React from 'react'
import axios from 'axios';
import type { ReactElement } from 'react' import type { ReactElement } from 'react'
import LayoutAuthenticated from '../layouts/Authenticated' import LayoutAuthenticated from '../layouts/Authenticated'
import SectionMain from '../components/SectionMain' import SectionMain from '../components/SectionMain'
import SectionTitleLineWithButton from '../components/SectionTitleLineWithButton' import SectionTitleLineWithButton from '../components/SectionTitleLineWithButton'
import BaseIcon from "../components/BaseIcon";
import { getPageTitle } from '../config' import { getPageTitle } from '../config'
import Link from 'next/link' import Link from "next/link";
import { useAppDispatch, useAppSelector } from '../stores/hooks'
import { fetch } from '../stores/events/eventsSlice'
import { hasPermission } from '../helpers/userPermissions'
import CardBox from '../components/CardBox'
import BaseButton from '../components/BaseButton'
import BaseButtons from '../components/BaseButtons'
import LoadingSpinner from '../components/LoadingSpinner'
import CardBoxComponentEmpty from '../components/CardBoxComponentEmpty'
import { hasPermission } from "../helpers/userPermissions";
import { fetchWidgets } from '../stores/roles/rolesSlice';
import { WidgetCreator } from '../components/WidgetCreator/WidgetCreator';
import { SmartWidget } from '../components/SmartWidget/SmartWidget';
import { useAppDispatch, useAppSelector } from '../stores/hooks';
const Dashboard = () => { const Dashboard = () => {
const dispatch = useAppDispatch() 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 { currentUser } = useAppSelector((state) => state.auth) const loadingMessage = 'Loading...';
const { events, loading } = useAppSelector((state) => state.events)
useEffect(() => {
if (currentUser) { const [users, setUsers] = React.useState(loadingMessage);
dispatch(fetch({})) const [roles, setRoles] = React.useState(loadingMessage);
const [permissions, setPermissions] = React.useState(loadingMessage);
const [events, setEvents] = React.useState(loadingMessage);
const [venues, setVenues] = React.useState(loadingMessage);
const [vendors, setVendors] = React.useState(loadingMessage);
const [guests, setGuests] = React.useState(loadingMessage);
const [budgets, setBudgets] = React.useState(loadingMessage);
const [tasks, setTasks] = React.useState(loadingMessage);
const [schedules, setSchedules] = 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','events','venues','vendors','guests','budgets','tasks','schedules',];
const fns = [setUsers,setRoles,setPermissions,setEvents,setVenues,setVendors,setGuests,setBudgets,setTasks,setSchedules,];
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) => {
results.forEach((result, i) => {
if (result.status === 'fulfilled') {
fns[i](result.value.data.count);
} else {
fns[i](result.reason.message);
}
});
});
} }
}, [dispatch, currentUser])
async function getWidgets(roleId) {
const canCreateEvents = hasPermission(currentUser, 'CREATE_EVENTS') await dispatch(fetchWidgets(roleId));
}
React.useEffect(() => {
if (!currentUser) return;
loadData().then();
setWidgetsRole({ role: { value: currentUser?.app_role?.id, label: currentUser?.app_role?.name } });
}, [currentUser]);
React.useEffect(() => {
if (!currentUser || !widgetsRole?.role?.value) return;
getWidgets(widgetsRole?.role?.value || '').then();
}, [widgetsRole?.role?.value]);
return ( return (
<> <>
<Head> <Head>
<title>{getPageTitle('Dashboard')}</title> <title>
{getPageTitle('Overview')}
</title>
</Head> </Head>
<SectionMain> <SectionMain>
<SectionTitleLineWithButton icon={icon.mdiChartTimelineVariant} title="Upcoming Events" main> <SectionTitleLineWithButton
{canCreateEvents && ( icon={icon.mdiChartTimelineVariant}
<Link href="/events/new" passHref> title='Overview'
<BaseButton icon={icon.mdiPlus} label="Add Event" color="primary" roundedFull /> main>
</Link> {''}
)}
</SectionTitleLineWithButton> </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>
)}
{loading && <LoadingSpinner />} <div className='grid grid-cols-1 gap-6 lg:grid-cols-4 mb-6 grid-flow-dense'>
{(isFetchingQuery || loading) && (
{!loading && events.length === 0 && ( <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`}>
<CardBox> <BaseIcon
<CardBoxComponentEmpty> className={`${iconsColor} animate-spin mr-5`}
<p>No upcoming events found.</p> w='w-16'
{canCreateEvents && ( h='h-16'
<div className="mt-4"> size={48}
<Link href="/events/new" passHref> path={icon.mdiLoading}
<BaseButton label="Create your first event" color="primary" /> />{' '}
</Link> Loading widgets...
</div> </div>
)} )}
</CardBoxComponentEmpty>
</CardBox>
)}
{!loading && events.length > 0 && ( { rolesWidgets &&
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3 mb-6"> rolesWidgets.map((widget) => (
{events.map((event) => ( <SmartWidget
<CardBox key={event.id}> key={widget.id}
<div className="p-6"> userId={currentUser?.id}
<div className="mb-4"> widget={widget}
<h3 className="text-xl font-bold">{event.name || 'Unnamed Event'}</h3> roleId={widgetsRole?.role?.value || ''}
<p className="text-gray-500 dark:text-gray-400"> admin={hasPermission(currentUser, 'CREATE_ROLES')}
{event.date />
? new Date(event.date).toLocaleDateString()
: 'No date set'}
</p>
</div>
<div className="flex items-center justify-between">
<span
className={`px-2 py-1 text-sm font-semibold rounded-full ${
event.status === 'upcoming'
? 'bg-blue-100 text-blue-800'
: event.status === 'ongoing'
? 'bg-green-100 text-green-800'
: 'bg-gray-100 text-gray-800'
}`}
>
{event.status || 'No status'}
</span>
<BaseButtons>
<Link href={`/events/${event.id}`} passHref>
<BaseButton label="Details" color="lightDark" small />
</Link>
</BaseButtons>
</div>
</div>
</CardBox>
))} ))}
</div> </div>
)}
{!!rolesWidgets.length && <hr className='my-6 ' />}
<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>
<BaseIcon
className={`${iconsColor}`}
w="w-16"
h="h-16"
size={48}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
path={icon.mdiAccountGroup || icon.mdiTable}
/>
</div>
</div>
</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>
<div className="text-3xl leading-tight font-semibold">
{roles}
</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>
</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>
</Link>}
{hasPermission(currentUser, 'READ_EVENTS') && <Link href={'/events/events-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">
Events
</div>
<div className="text-3xl leading-tight font-semibold">
{events}
</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_VENUES') && <Link href={'/venues/venues-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">
Venues
</div>
<div className="text-3xl leading-tight font-semibold">
{venues}
</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={'mdiMapMarker' in icon ? icon['mdiMapMarker' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_VENDORS') && <Link href={'/vendors/vendors-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">
Vendors
</div>
<div className="text-3xl leading-tight font-semibold">
{vendors}
</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={'mdiStore' in icon ? icon['mdiStore' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_GUESTS') && <Link href={'/guests/guests-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">
Guests
</div>
<div className="text-3xl leading-tight font-semibold">
{guests}
</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={'mdiAccountMultiple' in icon ? icon['mdiAccountMultiple' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_BUDGETS') && <Link href={'/budgets/budgets-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">
Budgets
</div>
<div className="text-3xl leading-tight font-semibold">
{budgets}
</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={'mdiCurrencyUsd' in icon ? icon['mdiCurrencyUsd' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_TASKS') && <Link href={'/tasks/tasks-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">
Tasks
</div>
<div className="text-3xl leading-tight font-semibold">
{tasks}
</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={'mdiCheckboxMarkedCircle' in icon ? icon['mdiCheckboxMarkedCircle' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
{hasPermission(currentUser, 'READ_SCHEDULES') && <Link href={'/schedules/schedules-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">
Schedules
</div>
<div className="text-3xl leading-tight font-semibold">
{schedules}
</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={'mdiClockOutline' in icon ? icon['mdiClockOutline' as keyof typeof icon] : icon.mdiTable || icon.mdiTable}
/>
</div>
</div>
</div>
</Link>}
</div>
</SectionMain> </SectionMain>
</> </>
) )

View File

@ -1,3 +1,4 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import type { ReactElement } from 'react'; import type { ReactElement } from 'react';
import Head from 'next/head'; import Head from 'next/head';
@ -6,106 +7,167 @@ import BaseButton from '../components/BaseButton';
import CardBox from '../components/CardBox'; import CardBox from '../components/CardBox';
import SectionFullScreen from '../components/SectionFullScreen'; import SectionFullScreen from '../components/SectionFullScreen';
import LayoutGuest from '../layouts/Guest'; import LayoutGuest from '../layouts/Guest';
import BaseDivider from '../components/BaseDivider';
import BaseButtons from '../components/BaseButtons';
import { getPageTitle } from '../config'; import { getPageTitle } from '../config';
import { useAppDispatch, useAppSelector } from '../stores/hooks'; import { useAppSelector } from '../stores/hooks';
import { getPexelsImage } from '../helpers/pexels'; import CardBoxComponentTitle from "../components/CardBoxComponentTitle";
import { fetchPublic } from '../stores/events/eventsSlice'; import { getPexelsImage, getPexelsVideo } from '../helpers/pexels';
import LandingEventCards from '../components/Events/LandingEventCards';
import SectionMain from '../components/SectionMain';
export default function LandingPage() {
const dispatch = useAppDispatch();
const { events, loading } = useAppSelector((state) => state.events);
export default function Starter() {
const [illustrationImage, setIllustrationImage] = useState({ const [illustrationImage, setIllustrationImage] = useState({
src: undefined, src: undefined,
photographer: undefined, photographer: undefined,
photographer_url: undefined, photographer_url: undefined,
}); })
const [illustrationVideo, setIllustrationVideo] = useState({video_files: []})
const [contentType, setContentType] = useState('image');
const [contentPosition, setContentPosition] = useState('right');
const textColor = useAppSelector((state) => state.style.linkColor); const textColor = useAppSelector((state) => state.style.linkColor);
const title = 'EventCoord Pro';
const title = 'EventCoord Pro'
// Fetch Pexels image/video
useEffect(() => { useEffect(() => {
async function fetchData() { async function fetchData() {
// Using a more generic query for a beautiful background const image = await getPexelsImage();
const image = await getPexelsImage({ query: 'nature landscape', per_page: 1, page: Math.floor(Math.random() * 100) }); const video = await getPexelsVideo();
setIllustrationImage(image); setIllustrationImage(image);
setIllustrationVideo(video);
} }
fetchData(); fetchData();
dispatch(fetchPublic({})); }, []);
}, [dispatch]);
return ( const imageBlock = (image) => (
<> <div
<Head> className='hidden md:flex flex-col justify-end relative flex-grow-0 flex-shrink-0 w-1/3'
<title>{getPageTitle('Welcome')}</title> style={{
</Head> backgroundImage: `${
image
<SectionFullScreen bg="transparent"> ? `url(${image?.src?.original})`
<div : 'linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5))'
className="absolute top-0 left-0 w-full h-full bg-cover bg-center" }`,
style={{ backgroundSize: 'cover',
backgroundImage: `url(${illustrationImage.src?.original || '/path/to/default/bg.jpg'})`, backgroundPosition: 'left center',
filter: 'blur(3px) brightness(0.7)', backgroundRepeat: 'no-repeat',
}} }}
></div> >
<div className='flex justify-center w-full bg-blue-300/20'>
<div className="relative z-10 flex items-center justify-center flex-col space-y-8 w-full"> <a
<CardBox className="w-11/12 md:w-3/5 lg:w-2/5 bg-white bg-opacity-80 backdrop-blur-md shadow-2xl"> className='text-[8px]'
<div className="p-8 text-center"> href={image?.photographer_url}
<h1 className="text-4xl md:text-5xl font-bold text-gray-800 mb-4"> target='_blank'
Welcome to {title} rel='noreferrer'
</h1> >
<p className="text-lg text-gray-600 mb-8"> Photo by {image?.photographer} on Pexels
The all-in-one solution for planning, managing, and executing unforgettable events. </a>
</p> </div>
<BaseButton </div>
href="/login"
label="Get Started"
color="info"
className="w-full text-lg py-4"
roundedFull
/>
</div>
</CardBox>
{illustrationImage.photographer && (
<div className='flex justify-center w-full bg-blue-300/20'>
<a
className='text-xs text-white'
href={illustrationImage.photographer_url}
target='_blank'
rel='noreferrer'
>
Photo by {illustrationImage.photographer} on Pexels
</a>
</div>
)}
</div>
</SectionFullScreen>
<SectionMain>
<h2 className="text-3xl font-bold text-center my-8">Upcoming Events</h2>
<LandingEventCards
events={events.slice(0, 3)}
loading={loading}
/>
</SectionMain>
<footer className="bg-gray-900 text-white py-6 relative bottom-0 w-full">
<div className="container mx-auto text-center">
<p className="text-sm">© {new Date().getFullYear()} <span>{title}</span>. All rights reserved.</p>
<Link className="text-sm ml-4 hover:underline" href="/privacy-policy">
Privacy Policy
</Link>
<Link className="text-sm ml-4 hover:underline" href="/terms-of-use">
Terms of Use
</Link>
</div>
</footer>
</>
); );
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 EventCoord Pro 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>
<div className='grid grid-cols-1 gap-2 lg:grid-cols-4 mt-2'>
<div className='text-center'><a className={`${textColor}`} href='https://react.dev/'>React.js</a></div>
<div className='text-center'><a className={`${textColor}`} href='https://tailwindcss.com/'>Tailwind CSS</a></div>
<div className='text-center'><a className={`${textColor}`} href='https://nodejs.org/en'>Node.js</a></div>
<div className='text-center'><a className={`${textColor}`} href='https://flatlogic.com/forum'>Flatlogic Forum</a></div>
</div>
</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'>© 2024 <span>{title}</span>. All rights reserved</p>
<Link className='py-6 ml-4 text-sm' href='/privacy-policy/'>
Privacy Policy
</Link>
</div>
</div>
);
} }
LandingPage.getLayout = function getLayout(page: ReactElement) { Starter.getLayout = function getLayout(page: ReactElement) {
return <LayoutGuest>{page}</LayoutGuest>; return <LayoutGuest>{page}</LayoutGuest>;
}; };

View File

@ -38,16 +38,6 @@ export const fetch = createAsyncThunk('events/fetch', async (data: any) => {
return id ? result.data : {rows: result.data.rows, count: result.data.count}; return id ? result.data : {rows: result.data.rows, count: result.data.count};
}) })
export const fetchPublic = createAsyncThunk('events/fetch-public', async (data: any) => {
const result = await axios.get(
`public/events`,
{
withCredentials: false
}
)
return result.data;
})
export const deleteItemsByIds = createAsyncThunk( export const deleteItemsByIds = createAsyncThunk(
'events/deleteByIds', 'events/deleteByIds',
async (data: any, { rejectWithValue }) => { async (data: any, { rejectWithValue }) => {
@ -161,25 +151,6 @@ export const eventsSlice = createSlice({
state.loading = false state.loading = false
}) })
builder.addCase(fetchPublic.pending, (state) => {
state.loading = true
resetNotify(state);
})
builder.addCase(fetchPublic.rejected, (state, action) => {
state.loading = false
rejectNotify(state, action);
})
builder.addCase(fetchPublic.fulfilled, (state, action) => {
if (action.payload.rows && action.payload.count >= 0) {
state.events = action.payload.rows;
state.count = action.payload.count;
} else {
state.events = action.payload;
}
state.loading = false
})
builder.addCase(deleteItemsByIds.pending, (state) => { builder.addCase(deleteItemsByIds.pending, (state) => {
state.loading = true; state.loading = true;
resetNotify(state); resetNotify(state);

File diff suppressed because one or more lines are too long