diff --git a/src/app/giveaway/page.tsx b/src/app/giveaway/page.tsx new file mode 100644 index 0000000..2ef6191 --- /dev/null +++ b/src/app/giveaway/page.tsx @@ -0,0 +1,12 @@ +import { GiveawayTile } from '@/components/tiles/giveaway-tile'; +import { getIndexData } from '@/models/get-index-data'; + +export default async function Giveaway() { + const { giveaway } = await getIndexData(); + + return ( +
+ +
+ ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx index 2aef5cd..8364eca 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -6,18 +6,10 @@ import { GiveawayTile } from '@/components/tiles/giveaway-tile'; import { PromoVideoTile } from '@/components/tiles/promo-video-tile'; import { RegisterTile } from '@/components/tiles/register-tile'; import { StatTile } from '@/components/tiles/stat-tile'; -import { IndexPageData } from '@/models/models'; +import { getIndexData } from '@/models/get-index-data'; import konfLogo from '../../public/img/konf.svg'; -async function getIndexData(): Promise { - const res = await fetch(`${process.env.BACKEND_URL}/conference/index`); - if (!res.ok) { - throw new Error(res.status.toString()); - } - return res.json(); -} - export default async function Landing() { const data = await getIndexData(); return ( diff --git a/src/components/tiles/giveaway-tile.tsx b/src/components/tiles/giveaway-tile.tsx index 42679ba..2f14195 100644 --- a/src/components/tiles/giveaway-tile.tsx +++ b/src/components/tiles/giveaway-tile.tsx @@ -4,9 +4,10 @@ import { GiveawayData } from '@/models/models'; type Props = { data: GiveawayData; + showLink?: boolean; }; -export function GiveawayTile({ data: { description, sectionTitle, pictureUrl } }: Props) { +export function GiveawayTile({ data: { description, sectionTitle, pictureUrl }, showLink = true }: Props) { const [preText, shinyText, postText] = description.split('***'); return (
@@ -16,9 +17,11 @@ export function GiveawayTile({ data: { description, sectionTitle, pictureUrl } }

{preText}

{shinyText}

{postText}

- - További részleteket itt találsz - + {showLink && ( + + További részleteket itt találsz + + )}
diff --git a/src/models/get-index-data.ts b/src/models/get-index-data.ts new file mode 100644 index 0000000..8a915cb --- /dev/null +++ b/src/models/get-index-data.ts @@ -0,0 +1,9 @@ +import { IndexPageData } from './models'; + +export async function getIndexData(): Promise { + const res = await fetch(`${process.env.BACKEND_URL}/conference/index`); + if (!res.ok) { + throw new Error(res.status.toString()); + } + return res.json(); +}