1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-22 14:44:21 +00:00

Make some progress on the event creation form

This commit is contained in:
Steffo 2022-06-01 16:57:19 +02:00
parent 28e85381b2
commit 2d10d48068
Signed by: steffo
GPG key ID: 6965406171929D01
5 changed files with 54 additions and 56 deletions

View file

@ -14,48 +14,58 @@ export function FormEventList(props: HTMLProps<HTMLFormElement>) {
"negative": error,
})
let message: JSX.Element
let contents: JSX.Element
if(error) {
message = t("formEventListError")
contents = (
<div>
<code>
{JSON.stringify(error)}
</code>
</div>
)
contents = <>
<p>
{t("eventListError")}
</p>
<code>
{JSON.stringify(error)}
</code>
</>
}
else if(!data) {
message = <Loading/>
contents = <></>
contents = <Loading/>
}
else {
console.debug(data)
if(data.length === 0) {
message = t("formEventListFirst")
contents = (
<div>zzz</div>
)
contents = <>
<p>
{t("eventListCreateFirst")}
</p>
</>
}
else {
message = t("formEventListAnother")
contents = (
contents = <>
<p>
{t("eventListDescription")}
</p>
<div>
{data.map((event: Event) => <div><a href={`/events/slug`}>{event.name}</a></div>)}
{data.map((event: Event) => <div><a href={`/events/${event.slug}`}>{event.name}</a></div>)}
</div>
)
<p>
{t("eventListCreateAnother")}
</p>
<form className="form-monorow">
<input
type="text"
placeholder={t("eventListCreatePlaceholder")}
/>
<input
type="submit"
className="positive square-40"
value="→"
/>
</form>
</>
}
}
return (
<form className={newClassName}>
<p>
{message}
</p>
<div className={newClassName}>
{contents}
</form>
</div>
)
}

View file

@ -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<HTMLFormElement>) {
const { t } = useTranslation("common")
const [_, setLogin] = useDefinedContext(LoginContext)
@ -69,11 +70,11 @@ export function FormLoginTelegram({className, ...props}: HTMLProps<HTMLFormEleme
}
return (
<form className={newClassName}>
<div className={newClassName}>
<p>
{message}
</p>
{contents}
</form>
</div>
)
}

View file

@ -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"
}

View file

@ -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;
}

View file

@ -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;
}