Initial commit

This commit is contained in:
2025-10-11 17:02:49 +02:00
commit 92056f073f
243 changed files with 27536 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
Copyright 2016 The Oswald Project Authors (https://github.com/googlefonts/OswaldFont)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

View File

@@ -0,0 +1,68 @@
Oswald Variable Font
====================
This download contains Oswald as both a variable font and static fonts.
Oswald is a variable font with this axis:
wght
This means all the styles are contained in a single file:
Oswald-VariableFont_wght.ttf
If your app fully supports variable fonts, you can now pick intermediate styles
that arent available as static fonts. Not all apps support variable fonts, and
in those cases you can use the static font files for Oswald:
static/Oswald-ExtraLight.ttf
static/Oswald-Light.ttf
static/Oswald-Regular.ttf
static/Oswald-Medium.ttf
static/Oswald-SemiBold.ttf
static/Oswald-Bold.ttf
Get started
-----------
1. Install the font files you want to use
2. Use your app's font picker to view the font family and all the
available styles
Learn more about variable fonts
-------------------------------
https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
https://variablefonts.typenetwork.com
https://medium.com/variable-fonts
In desktop apps
https://theblog.adobe.com/can-variable-fonts-illustrator-cc
https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
Online
https://developers.google.com/fonts/docs/getting_started
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
Installing fonts
MacOS: https://support.apple.com/en-us/HT201749
Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
Android Apps
https://developers.google.com/fonts/docs/android
https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
License
-------
Please read the full license text (OFL.txt) to understand the permissions,
restrictions and requirements for usage, redistribution, and modification.
You can use them in your products & projects print or digital,
commercial or otherwise.
This isn't legal advice, please consider consulting a lawyer and see the full
license for all details.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

86
resources/css/app.css Normal file
View File

@@ -0,0 +1,86 @@
@font-face {
font-family: 'Oswald';
src: url('./Oswald/static/Oswald-Regular.ttf') format('truetype');
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Oswald';
src: url('./Oswald/static/Oswald-Bold.ttf') format('truetype');
font-weight: 700;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Oswald';
src: url('./Oswald/static/Oswald-Light.ttf') format('truetype');
font-weight: 300;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Oswald';
src: url('./Oswald/static/Oswald-Medium.ttf') format('truetype');
font-weight: 500;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Oswald';
src: url('./Oswald/static/Oswald-SemiBold.ttf') format('truetype');
font-weight: 600;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Oswald';
src: url('./Oswald/static/Oswald-ExtraLight.ttf') format('truetype');
font-weight: 200;
font-style: normal;
font-display: swap;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-size: 10px;
font-family: 'Oswald', Arial, sans-serif;
color: white;
font-weight: 300;
}
body {
min-height: 100vh;
}
a {
color: white;
text-decoration: none;
cursor: pointer;
}
a:hover {
text-decoration: underline;
}
img {
user-select: none;
}
.image-column {
text-align: center;
}
.image-container {
display: inline-block;
}

20
resources/js/app.tsx Normal file
View File

@@ -0,0 +1,20 @@
import '../css/app.css';
import { createInertiaApp } from '@inertiajs/react';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { createRoot } from 'react-dom/client';
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) => resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob('./pages/**/*.tsx')),
setup({ el, App, props }) {
const root = createRoot(el);
root.render(<App {...props} />);
},
progress: {
color: '#4B5563',
},
});

View File

@@ -0,0 +1,74 @@
.phone {
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
font-size: 3rem;
background-color: #f7941f;
border-radius: 20px;
padding: 5px 10px;
width: fit-content;
font-weight: 400;
}
.phone-fixed {
position: fixed;
right: 20px;
bottom: 20px;
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
font-size: 3rem;
background-color: #f7941f;
border-radius: 20px;
padding: 5px 10px;
width: fit-content;
font-weight: 400;
}
.onlineorder {
margin: 5px auto;
display: flex;
justify-content: center;
align-items: center;
font-size: 3rem;
background-color: #ED561A;
border-radius: 20px;
padding: 5px 10px;
width: fit-content;
font-weight: 400;
}
.onlineorder-fixed {
position: fixed;
right: 20px;
bottom: 84px;
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
font-size: 3rem;
background-color: #ED561A;
border-radius: 20px;
padding: 5px 10px;
width: fit-content;
font-weight: 400;
}
.onlineorder:hover, .onlineorder-fixed:hover {
background-color: #d12600;
}
.phone-icon {
margin-right: 7px;
}
.cart-icon {
margin-right: 7px;
}
.phone-link:hover {
text-decoration: none;
}

View File

@@ -0,0 +1,83 @@
import React from 'react';
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
import { faCartShopping, faPhone } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import styles from './ActionButtons.module.css';
import { Link } from '@inertiajs/react';
const SolidIcons = {
faCartShopping,
faPhone,
}
interface ButtonData {
type: 'link';
data: {
name: string;
icon: keyof typeof SolidIcons;
btn_style: 'primary' | 'secondary';
link: string;
external: boolean;
new_tab: boolean;
};
}
interface ActionButtonsProps {
variant?: 'default' | 'floating';
}
export const ActionButtons: React.FC<ActionButtonsProps> = ({ variant = 'default' }) => {
const [buttons, setButtons] = React.useState<ButtonData[]>([]);
React.useEffect(() => {
fetch('/api/buttons')
.then(res => res.json())
.then(response => {
if (response.status === 'success') {
setButtons(response.data);
}
})
.catch(error => {
console.error('Error fetching buttons:', error);
});
}, []);
return (
<div>
{buttons && buttons.length > 0 && buttons.map((button, index) => {
const icon: IconDefinition | null = button.data.icon ? (SolidIcons[button.data.icon] as IconDefinition) : null;
const isPrimary = button.data.btn_style === 'primary';
const buttonClass = variant === 'floating'
? isPrimary ? styles['onlineorder-fixed'] : styles['phone-fixed']
: isPrimary ? styles.onlineorder : styles.phone;
return button.data.external ? (
<div className={buttonClass} key={index}>
<a
href={button.data.link}
target="_blank"
rel="noopener noreferrer"
className={styles['phone-link']}
>
{icon && <FontAwesomeIcon className={isPrimary ? styles['cart-icon'] : styles['phone-icon']} icon={icon} />}
<span>{button.data.name}</span>
</a>
</div>
) : (
<div className={buttonClass} key={index}>
<Link
href={button.data.link}
className={styles['phone-link']}
>
{icon && <FontAwesomeIcon className={isPrimary ? styles['cart-icon'] : styles['phone-icon']} icon={icon} />}
<span>{button.data.name}</span>
</Link>
</div>
);
})}
</div>
);
};

View File

@@ -0,0 +1,40 @@
.footer {
font-size: 2rem;
text-align: center;
font-weight: 300;
position: relative;
color: white;
bottom: 0;
left: 0;
width: 100%;
background-color: #242422;
padding: 20px 0;
}
.footer a {
color: #edb265;
}
.footer-icons {
margin-right: 5px;
}
.links {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 10px;
font-size: 2.5rem;
}
.links a {
margin-right: 20px;
color: white;
display: block;
}
.links a > div {
display: flex;
justify-content: center;
align-items: center;
}

View File

@@ -0,0 +1,76 @@
import React from 'react';
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core';
import { faFacebook, faGoogle } from '@fortawesome/free-brands-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Link } from '@inertiajs/react';
import styles from './Footer.module.css';
const BrandsIcons = {
faFacebook,
faGoogle,
}
interface FooterLink {
type: 'link';
data: {
name: string;
icon?: keyof typeof BrandsIcons;
link: string;
external: boolean;
};
}
export default function Footer() {
const [links, setLinks] = React.useState<FooterLink[]>([]);
React.useEffect(() => {
fetch('/api/footer')
.then(res => res.json())
.then(response => {
if (response.status === 'success') {
setLinks(response.data);
}
})
.catch(error => {
console.error('Error fetching footer links:', error);
});
}, []);
return (
<footer className={styles.footer}>
<div className={styles.links}>
{links && links.length > 0 && links.map((link, index) => {
const icon: IconDefinition | null = link.data.icon ? BrandsIcons[link.data.icon] : null;
const linkContent = (
<>
{icon && <FontAwesomeIcon icon={icon} className={styles['footer-icons']} />}
{link.data.name}
</>
);
return link.data.external ? (
<a
key={index}
href={link.data.link}
target="_blank"
rel="noopener noreferrer"
className="flex items-center text-white/80 hover:text-accent transition-colors"
>
{linkContent}
</a>
) : (
<Link
key={index}
href={link.data.link}
className="flex items-center text-white/80 hover:text-accent transition-colors"
>
{linkContent}
</Link>
);
})}
</div>
<div>© {new Date().getFullYear()} GHOST PIZZA Krzysztof Szymański. Wszelkie prawa zastrzeżone.</div>
<div>Wykonane przez <a target="_blank" rel="noreferrer" href='https://bwitek.dev'>BWitek.dev</a></div>
</footer>
);
}

View File

@@ -0,0 +1,64 @@
.header ul {
list-style-type: none;
display: flex;
justify-content: center;
align-items: center;
background-color: black;
margin-bottom: 45px;
font-weight: 400;
width: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 3;
}
.header ul a {
color: white;
display: block;
text-decoration: none;
padding: 10px 20px;
font-size: 3rem;
}
.header ul a:hover {
text-decoration: underline;
}
.header {
margin: 0 auto;
}
.logo {
width: 100%;
max-width: 2000px;
height: auto;
}
.logo-small {
margin-top: 20px;
width: 90%;
max-width: 650px;
}
.img-container {
position: relative;
width: 100%;
height: 100%;
}
@media (max-width: 480px) {
.header ul a {
font-size: 2.4rem;
}
.logo {
width: 100%;
height: unset;
}
}
@media (max-width: 280px) {
.header ul a {
font-size: 1.6rem;
}
}

View File

@@ -0,0 +1,132 @@
import React, { useEffect, useState } from 'react';
import { Link } from '@inertiajs/react';
import styles from './Header.module.css';
interface HeaderData {
status: string;
data: {
photo: string | null;
photo_mobile: string | null;
photo_menu: string | null;
title: string | null;
};
}
interface NavigationLink {
id: number;
sort_order: number;
name: string;
link: string;
external: number;
created_at: string;
updated_at: string;
}
export default function Header({isSmall=false}) {
const [innerWidth, setInnerWidth] = useState(0);
const [links, setLinks] = React.useState<NavigationLink[]>([]);
const [data, setData] = useState<HeaderData['data'] | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
Promise.all([
fetch('/api/homepage').then(res => res.json()),
fetch('/api/navigation').then(res => res.json())
])
.then(([headerResponse, navigationResponse]) => {
setData(headerResponse.data);
setLinks(navigationResponse.data);
setLoading(false);
})
.catch(error => {
console.error('Error fetching data:', error);
setLoading(false);
});
setInnerWidth(prevState => prevState = window.innerWidth);
function handleResize() {
setInnerWidth(prevState => prevState = window.innerWidth);
}
window.addEventListener('resize', handleResize);
return () => {
window.removeEventListener('resize', handleResize);
}
}, []);
if (loading) {
return (
<></>
);
}
return (
<header className={styles.header}>
<nav>
<ul>
{links.map((link) => {
return link.external ? (
<li key={link.id}>
<a
href={link.link}
target="_blank"
rel="noopener noreferrer"
>
{link.name}
</a>
</li>
) : (
<li key={link.id}>
<Link
href={link.link}
>
{link.name}
</Link>
</li>
);
})}
</ul>
</nav>
<div className="image-column">
{isSmall ? (
<>
{data && data.photo && data.photo_menu ? (
<div className="image-container">
<img className={styles['logo-small']} fetchPriority="high" src={data.photo_menu} alt="Logo pizzeri GhostPizza" />
</div>
) : null}
</>
) : (
(data && data.photo && data.photo_mobile) ? (
<div className="image-container">
{innerWidth > 1450 ? (
<div className={styles['img-container']}>
<img
style={{ objectFit: "contain" }}
className={styles.logo}
src={data.photo}
alt={data.title || 'Ghost Pizza'}
fetchPriority="high"
/>
</div>
) : (
<div className={styles['img-container']}>
<img
style={{ objectFit: "contain" }}
className={styles.logo}
src={data.photo_mobile}
alt={data.title || 'Ghost Pizza'}
fetchPriority="high"
/>
</div>
)}
</div>
) : null
)}
</div>
</header>
);
}

View File

@@ -0,0 +1,13 @@
import { type ReactNode } from 'react';
import { Head } from '@inertiajs/react';
interface AppLayoutProps {
children: ReactNode;
}
export default ({ children }: AppLayoutProps) =>
(<>
<Head>
</Head>
{children}
</>);

View File

@@ -0,0 +1,62 @@
.bg {
padding-top: 65px;
background: rgb(232,97,39);
background: linear-gradient(180deg, #0077ad 0%, #242422 40%);
background-position: center;
background-size: cover;
}
.logo {
margin-top: 20px;
width: 90%;
max-width: 650px;
}
.main h2 {
text-align: center;
font-weight: 400;
font-size: 4.5rem;
margin: 30px 0;
}
.container {
min-height: 100vh;
max-width: 1200px;
margin: 0 auto 50px auto;
padding: 0 30px;
line-height: 0;
column-count: 3;
column-gap: 20px;
}
.image {
position: relative;
margin: 10px 0;
border-radius: 15px;
width: 100%;
height: auto;
}
@media (max-width: 915px) {
.container {
column-count: 2;
}
.main h2 {
font-size: 3rem;
}
}
@media (max-width: 480px) {
.bg {
background: linear-gradient(180deg, #0077ad 0%, #242422 50%);
}
.container {
column-count: 1;
}
.main h2 {
font-size: 2.4rem;
}
}

View File

@@ -0,0 +1,72 @@
import { useEffect, useState } from 'react';
import { Head } from '@inertiajs/react';
import AppLayout from '@/layouts/AppLayout';
import styles from './Gallery.module.css';
import { ActionButtons } from '@/components/ActionButtons/ActionButtons';
import Header from '@/components/Header/Header';
import Footer from '@/components/Footer/Footer';
interface Photo {
id: number;
sort_order: number;
name: string;
description: string | null;
photo: string;
created_at: string;
updated_at: string;
}
interface PhotosResponse {
status: string;
data: Photo[];
}
export default function Gallery() {
const [photos, setPhotos] = useState<Photo[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
fetch('/api/photos')
.then(res => res.json())
.then((response: PhotosResponse) => {
if (response.status === 'success') {
setPhotos(response.data);
}
setLoading(false);
})
.catch(error => {
console.error('Error fetching photos:', error);
setLoading(false);
});
}, []);
if (loading) {
return (
<></>
);
}
return (
<AppLayout>
<Head title="Galeria - Ghost Pizza" />
<div className={styles.bg}>
<Header isSmall={true} />
<main className={styles.main}>
<h2>Poniżej znajdziesz kilka zdjęć naszej przepysznej pizzy.</h2>
<div className={styles.container}>
{photos.map((photo, index) => (
<img
key={index}
src={photo.photo}
alt={photo.description ? photo.description : ""}
className={styles.image}
/>
))}
</div>
</main>
<ActionButtons variant="floating" />
<Footer />
</div>
</AppLayout>
);
}

View File

@@ -0,0 +1,146 @@
.container {
padding-top: 65px;
background: #242422;
background-position: center;
background-size: cover;
}
.container h1 {
font-weight: 400;
font-size: 3rem;
}
.container h1 span {
text-transform: uppercase;
}
.text {
font-size: 2rem;
}
.main {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 0 10px;
max-width: 1200px;
margin: 50px auto;
}
.main > div {
width: 50%;
}
.mapouter {
position: relative;
text-align: right;
height: 300px;
width: 500px;
margin: 20px 0;
border-radius: 20px;
}
.gmap_canvas {
overflow: hidden;
background: none !important;
height: 300px;
width: 500px;
border-radius: 20px;
}
.big {
font-weight: 400;
font-size: 2.8rem;
}
.big > h1, .big > h2, .big > h3, .big > h4, .big > h5, .big > h6 {
font-weight: normal;
}
.bold {
font-weight: 400;
}
.hours {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: flex-start;
font-size: 1.7rem;
}
.hours > div {
width: 33%;
}
.left {
padding: 0 60px;
}
.special {
font-size: 1.9rem;
margin-top: 20px;
margin-bottom: 20px;
padding-bottom: 20px;
border-bottom: 2px dashed rgba(0, 0, 0, 0.45);
}
.special strong {
text-transform: uppercase;
font-weight: 400;
font-size: 2.1rem;
color: #edb265;
}
.promo {
text-transform: uppercase;
font-weight: 400;
font-size: 1.8rem;
}
.promo strong {
color: #edb265;
font-size: 2rem;
font-weight: 400;
}
@media (max-width: 930px) {
.main {
flex-direction: column;
}
.main > div {
width: 100%;
}
.left {
padding: 0 20px;
}
.right {
margin-top: 50px;
padding: 0 20px;
}
}
@media (max-width: 660px) {
.mapouter,
.gmap_canvas {
width: 100%;
}
}
@media (max-width: 480px) {
.container {
padding-top: 55px;
}
.container h1 {
text-align: center;
margin-bottom: 30px;
}
.main {
margin: 10px auto 50px auto;
}
}

136
resources/js/pages/Home.tsx Normal file
View File

@@ -0,0 +1,136 @@
import { useEffect, useState } from 'react';
import Header from '../components/Header/Header';
import Footer from '../components/Footer/Footer';
import { Head } from '@inertiajs/react';
import styles from './Home.module.css';
import AppLayout from '@/layouts/AppLayout';
import { ActionButtons } from '../components/ActionButtons/ActionButtons';
import classNames from 'classnames';
interface OpeningHour {
type: 'opening_hour';
data: {
name: string;
time: string;
};
}
interface Promotion {
id: number;
sort_order: number;
title: string;
description: string;
additional_info: string | null;
created_at: string;
updated_at: string;
}
interface HomepageData {
status: string;
data: {
photo: string | null;
photo_mobile: string | null;
title: string | null;
body: string | null;
delivery: string | null;
address: string | null;
opening_hours: OpeningHour[];
widget_link: string | null;
};
}
export default function Home() {
const [data, setData] = useState<HomepageData['data'] | null>(null);
const [promotions, setPromotions] = useState<Promotion[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
Promise.all([
fetch('/api/homepage').then(res => res.json()),
fetch('/api/promotions').then(res => res.json())
])
.then(([homepageResponse, promotionsResponse]) => {
setData(homepageResponse.data);
setPromotions(promotionsResponse.data);
setLoading(false);
})
.catch(error => {
console.error('Error fetching data:', error);
setLoading(false);
});
}, []);
if (loading) {
return (
<></>
);
}
return (
<AppLayout>
<Head title={data?.title || 'Ghost Pizza'}/>
<div className={styles.container}>
<Header />
<main className={styles.main}>
<div className={styles.left}>
{data?.body && (
<div className={classNames(styles.text)}>
<div
dangerouslySetInnerHTML={{ __html: data.body }}
/>
</div>
)}
<div className={classNames(styles.text, styles.promo)}>
{promotions.map((promotion) => (
<div key={promotion.id}>
<strong>{promotion.title}</strong> {promotion.description} {promotion.additional_info}
</div>
))}
</div>
{data?.delivery && (
<div className={classNames(styles.text, styles.special)}>
<div
dangerouslySetInnerHTML={{ __html: data.delivery }}
/>
</div>
)}
<ActionButtons variant="default" />
</div>
<div className={styles.right}>
{data?.address && (
<div className={classNames(styles.big)} dangerouslySetInnerHTML={{ __html: data.address }} />
)}
<div className={styles.big}>Godziny otwarcia:</div>
<div className={styles.hours}>
{data?.opening_hours.map((hour, index) => (
<div key={index}><div>{hour.data.name}</div> <div className={styles.bold}>{hour.data.time}</div></div>
))}
</div>
<div className={styles.mapouter}>
<div className={styles['gmap_canvas']}>
{data?.widget_link ? (
<iframe
title="Mapa"
src={data.widget_link}
width="600"
height="500"
frameBorder="0"
scrolling="no"
id="gmap_canvas"
loading="lazy"
referrerPolicy="no-referrer-when-downgrade"
/>
) : null}
</div>
</div>
</div>
</main>
<Footer />
</div>
</AppLayout>
);
}

View File

@@ -0,0 +1,145 @@
.bg {
padding-top: 65px;
background: rgb(232,97,39);
background: linear-gradient(180deg, #0077ad 0%, #242422 40%);
background-position: center;
background-size: cover;
}
@media (max-width: 480px) {
.bg {
background: linear-gradient(180deg, #0077ad 0%, #242422 50%);
}
}
.container {
max-width: 1200px;
margin: 0 auto;
font-size: 2.5rem;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: flex-start;
align-content: flex-start;
}
.main h2 {
text-align: center;
font-size: 5rem;
font-weight: 400;
}
.product {
width: 30%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding: 5px 5px 12px 5px;
background-color: rgba(0, 0, 0, 0.6);
border-radius: 10px;
margin: 10px;
text-align: center;
}
.product:nth-last-child(1) {
margin-bottom: 10px;
}
.pepper-icon {
color: #d73c41;
}
.name {
color: #feea03;
font-weight: 400;
font-size: 2.6rem;
text-transform: uppercase;
display: flex;
justify-content: center;
align-items: center;
}
.vege {
text-align: center;
display: flex;
align-items: center;
justify-content: center;
font-size: 2.8rem;
text-transform: uppercase;
margin-bottom: 10px;
}
.vege > .circle {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: #84b341;
display: flex;
justify-content: center;
align-items: center;
margin-right: 7px;
}
.circle > .leaf {
font-size: 2.5rem;
color: white;
}
.legend {
display: flex;
justify-content: center;
align-items: center;
width: fit-content;
margin: 0 auto;
border-radius: 10px;
padding: 5px;
font-size: 2.5rem;
font-weight: 400;
}
.legend div {
display: flex;
justify-content: center;
align-items: center;
margin-right: 20px;
}
.legend div:nth-last-child(1) {
margin-right: 0;
}
.price {
margin-top: 12px;
}
.price span {
margin-right: 10px;
}
@media (max-width: 915px) {
.product {
width: 45%;
}
}
@media (max-width: 480px) {
.product {
width: 100%;
}
.legend {
flex-direction: column;
width: fit-content;
}
.legend div {
margin-right: 0;
margin-bottom: 10px;
}
.legend div:nth-last-child(1) {
margin-bottom: 0;
}
}

View File

@@ -0,0 +1,158 @@
import { useEffect, useState } from 'react';
import { Head } from '@inertiajs/react';
import AppLayout from '@/layouts/AppLayout';
import { faLeaf } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { ActionButtons } from '@/components/ActionButtons/ActionButtons';
import Header from '@/components/Header/Header';
import Footer from '@/components/Footer/Footer';
import styles from './Menu.module.css';
interface Ingredient {
id: number;
name: string;
description?: string;
}
interface SizeInfo {
description: string;
photo: string | null;
}
interface Sizes {
small: SizeInfo;
medium: SizeInfo;
large: SizeInfo;
}
interface ProductItem {
name: string;
description?: string;
ingredients: Ingredient[];
price_small?: number;
price_medium?: number;
price_large?: number;
spicy?: number;
}
interface Product {
id: number;
category: string;
description?: string;
products: Array<{
type: 'product';
data: ProductItem;
}>;
}
interface ProductsResponse {
status: string;
data: Product[];
}
const SizeIcon = ({ size, sizes }: { size: 'small' | 'medium' | 'large', sizes: Sizes | null }) => {
const sizeClasses = {
small: 'h-7 object-cover object-center',
medium: 'h-7 object-cover object-center',
large: 'h-7 object-cover object-center'
};
const getPhotoUrl = () => {
if (!sizes) return '/img/placeholder.png';
return sizes[size]?.photo || '/img/placeholder.png';
};
return (
<img
src={getPhotoUrl()}
className={sizeClasses[size]}
alt={`${size} size`}
/>
)
};
export default function Menu() {
const [products, setProducts] = useState<Product[]>([]);
const [sizes, setSizes] = useState<Sizes | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
Promise.all([
fetch('/api/products').then(res => res.json()),
fetch('/api/sizes').then(res => res.json())
])
.then(([productsResponse, sizesResponse]) => {
setProducts(productsResponse.data);
setSizes(sizesResponse.data);
setLoading(false);
})
.catch(error => {
console.error('Error fetching data:', error);
setLoading(false);
});
}, []);
if (loading) {
return (
<></>
);
}
const PepperIcon = function PepperIcon() {return (
<img src="/storage/static_images/pepper.png" alt="" width="37px" height="29px" />
)}
function getPepperIcons(length: number) {
const arr = [];
for(let pepper=0; pepper < length; pepper++) {
arr.push(<PepperIcon key={pepper} />)
}
return arr;
}
return (
<AppLayout>
<Head title="Menu - Ghost Pizza" />
<div className={styles.bg}>
<Header isSmall={true} />
<main className={styles.main}>
<h2>Pizza:</h2>
<div className={styles.vege}><div className={styles.circle}><FontAwesomeIcon icon={faLeaf} className={styles.leaf} /></div>VEGE? Zapytaj obsługę</div>
<div className={styles.legend}>
{sizes && (
<>
{(['small', 'medium', 'large'] as const).map((size) => (
<div key={size} className="flex items-center gap-2">
<SizeIcon size={size} sizes={sizes} />
{sizes[size].description}
</div>
))}
</>
)}
</div>
{products ? products.map((category, categoryIndex) => (
<div key={categoryIndex}>
{categoryIndex != 0 ? <h2>{category.category}</h2> : null}
<div className={styles.container}>
{category.products.map((item, index) => (
<div key={index} className={styles.product}>
<div className={styles.name}>{categoryIndex === 0 ? `${index + 1}. ` : ''}{item.data.name} {item.data.spicy ? getPepperIcons(item.data.spicy) : null}</div>
<div>{item.data.ingredients.map(i => i.name).join(', ')}</div>
{item.data.price_small && item.data.price_medium && item.data.price_large ?
<div className={styles.price}><span><SizeIcon size="small" sizes={sizes} />{item.data.price_small}</span> <span><SizeIcon size="medium" sizes={sizes} />{item.data.price_medium}</span><span><SizeIcon size="large" sizes={sizes} />{item.data.price_large}</span></div>
: item.data.price_small ? <div className={styles.price}><span>{item.data.price_small}</span></div> : null}
</div>
))}
</div>
</div>
)) : null}
</main>
<ActionButtons variant="floating" />
<Footer />
</div>
</AppLayout>
);
}

30
resources/js/ssr.tsx Normal file
View File

@@ -0,0 +1,30 @@
import { createInertiaApp } from '@inertiajs/react';
import createServer from '@inertiajs/react/server';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import ReactDOMServer from 'react-dom/server';
import { type RouteName, route } from 'ziggy-js';
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
createServer((page) =>
createInertiaApp({
page,
render: ReactDOMServer.renderToString,
title: (title) => `${title} - ${appName}`,
resolve: (name) => resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob('./pages/**/*.tsx')),
setup: ({ App, props }) => {
/* eslint-disable */
// @ts-expect-error
global.route<RouteName> = (name, params, absolute) =>
route(name, params as any, absolute, {
// @ts-expect-error
...page.props.ziggy,
// @ts-expect-error
location: new URL(page.props.ziggy.location),
});
/* eslint-enable */
return <App {...props} />;
},
}),
);

5
resources/js/types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import type { route as routeFn } from 'ziggy-js';
declare global {
const route: typeof routeFn;
}

19
resources/js/types/index.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
import { LucideIcon } from 'lucide-react';
import type { Config } from 'ziggy-js';
export interface BreadcrumbItem {
title: string;
href: string;
}
export interface NavGroup {
title: string;
items: NavItem[];
}
export interface NavItem {
title: string;
href: string;
icon?: LucideIcon | null;
isActive?: boolean;
}

1
resources/js/types/vite-env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{-- Inline style to set the HTML background color based on our theme in app.css --}}
<style>
html {
background-color: oklch(1 0 0);
}
</style>
<title inertia>{{ config('app.name', 'Laravel') }}</title>
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
@routes
@viteReactRefresh
@vite(['resources/js/app.tsx', "resources/js/pages/{$page['component']}.tsx"])
@inertiaHead
</head>
<body class="font-sans antialiased">
@inertia
</body>
</html>

View File

@@ -0,0 +1,4 @@
<div style="display: flex; align-items: center; justify-content: center;">
<img src="{{ secure_asset('/storage/favicon/favicon-32x32.png') }}" alt="Logo GHOST PIZZA" class="h-10">
<h1 class="text-2xl font-semibold">GHOST PIZZA</h1>
</div>