From 2d10d480682a33b4b90e62fa8b10eb63c31b3207 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 1 Jun 2022 16:57:19 +0200 Subject: [PATCH] Make some progress on the event creation form --- components/FormEventList.tsx | 62 ++++++++++++++++++-------------- components/FormLoginTelegram.tsx | 5 +-- public/locales/it-IT/common.json | 8 +++-- styles/globals.css | 9 +++++ styles/page-tweaks.css | 26 +------------- 5 files changed, 54 insertions(+), 56 deletions(-) diff --git a/components/FormEventList.tsx b/components/FormEventList.tsx index e3107e4..98b3789 100644 --- a/components/FormEventList.tsx +++ b/components/FormEventList.tsx @@ -14,48 +14,58 @@ export function FormEventList(props: HTMLProps) { "negative": error, }) - let message: JSX.Element let contents: JSX.Element if(error) { - message = t("formEventListError") - contents = ( -
- - {JSON.stringify(error)} - -
- ) + contents = <> +

+ {t("eventListError")} +

+ + {JSON.stringify(error)} + + } else if(!data) { - message = - contents = <> + contents = } else { - console.debug(data) if(data.length === 0) { - message = t("formEventListFirst") - contents = ( -
zzz
- ) + contents = <> +

+ {t("eventListCreateFirst")} +

+ } else { - message = t("formEventListAnother") - contents = ( + contents = <> +

+ {t("eventListDescription")} +

- {data.map((event: Event) => )} + {data.map((event: Event) => )}
- ) +

+ {t("eventListCreateAnother")} +

+
+ + +
+ } } - return ( -
-

- {message} -

+
{contents} - +
) } \ No newline at end of file diff --git a/components/FormLoginTelegram.tsx b/components/FormLoginTelegram.tsx index 83ba32d..2b4d0fd 100644 --- a/components/FormLoginTelegram.tsx +++ b/components/FormLoginTelegram.tsx @@ -8,6 +8,7 @@ import { FestaLoginData, TelegramLoginData } from "../types/user" import { useDefinedContext } from "../utils/definedContext" import { TelegramLoginButton } from "./TelegramLoginButton" + export function FormLoginTelegram({className, ...props}: HTMLProps) { const { t } = useTranslation("common") const [_, setLogin] = useDefinedContext(LoginContext) @@ -69,11 +70,11 @@ export function FormLoginTelegram({className, ...props}: HTMLProps +

{message}

{contents} - +
) } \ No newline at end of file diff --git a/public/locales/it-IT/common.json b/public/locales/it-IT/common.json index 0510959..f432b01 100644 --- a/public/locales/it-IT/common.json +++ b/public/locales/it-IT/common.json @@ -12,7 +12,9 @@ "eventsInputNamePlaceholder": "Festa a Festà", "eventsInputSubmitLabel": "Crea evento", "genericLoading": "Caricamento...", - "formEventListFirst": "Inserisci il nome del tuo primo evento qui sotto!", - "formEventListAnother": "Questi sono gli eventi che hai creato:", - "formEventListError": "Si è verificato il seguente errore durante il recupero dei tuoi eventi:" + "eventListError": "Si è verificato il seguente errore durante il recupero dei tuoi eventi:", + "eventListDescription": "Questi sono gli eventi che hai creato:", + "eventListCreateAnother": "Se vuoi crearne un altro, inserisci il suo nome qui sotto:", + "eventListCreateFirst": "Inserisci il nome del tuo primo evento qui sotto!", + "eventListCreatePlaceholder": "Nome evento" } diff --git a/styles/globals.css b/styles/globals.css index 4dfe59d..409ea01 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -121,4 +121,13 @@ input.negative, button.negative { .icon.fa-pulse { filter: drop-shadow(1px 1px 1px var(--background)); +} + +.form-monorow { + display: flex; + flex-direction: row; + gap: 4px; + + justify-content: center; + align-items: center; } \ No newline at end of file diff --git a/styles/page-tweaks.css b/styles/page-tweaks.css index 9d1b6b6..2760856 100644 --- a/styles/page-tweaks.css +++ b/styles/page-tweaks.css @@ -1,7 +1,7 @@ #page-index { display: grid; grid-template-columns: 100%; - grid-template-rows: 1fr 1fr; + grid-template-rows: 2fr 3fr; justify-content: center; text-align: center; @@ -34,27 +34,3 @@ align-self: start; grid-row: 2; } - -.form-event-create { - display: flex; - flex-direction: row; - - justify-content: space-evenly; - align-items: center; - text-align: center; - gap: 8px; - - width: 100%; - max-width: 480px; - - margin: 0 auto; -} - -.form-event-create #input-name { - flex-grow: 1; - width: 100%; -} - -.form-event-create #input-submit { - flex-shrink: 0; -} \ No newline at end of file