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

Add work in progress element and perhaps more things?

This commit is contained in:
Steffo 2022-06-08 02:12:03 +02:00
parent 98403da9a7
commit 7271488bae
Signed by: steffo
GPG key ID: 6965406171929D01
14 changed files with 67 additions and 25 deletions

View file

@ -4,8 +4,10 @@ import { useRouter } from "next/router"
import { useState } from "react" import { useState } from "react"
import { useAxiosRequest } from "../hooks/useAxiosRequest" import { useAxiosRequest } from "../hooks/useAxiosRequest"
import { Loading } from "./Loading" import { Loading } from "./Loading"
import { useEffect } from "react"
import { ErrorBlock } from "./errors/ErrorBlock" import { ErrorBlock } from "./errors/ErrorBlock"
import { FestaIcon } from "./extensions/FestaIcon"
import { faPlus } from "@fortawesome/free-solid-svg-icons"
import { FormMonorow } from "./form/FormMonorow"
export function EventCreate() { export function EventCreate() {
const { t } = useTranslation() const { t } = useTranslation()
@ -27,8 +29,7 @@ export function EventCreate() {
if (createEvent.data) return <Loading text={t("eventListCreateRedirecting")} /> if (createEvent.data) return <Loading text={t("eventListCreateRedirecting")} />
return <> return <>
<form <FormMonorow
className="form-monorow"
onSubmit={e => { e.preventDefault(); createEvent.run() }} onSubmit={e => { e.preventDefault(); createEvent.run() }}
noValidate noValidate
> >
@ -39,15 +40,15 @@ export function EventCreate() {
onChange={e => setName(e.target.value)} onChange={e => setName(e.target.value)}
required required
/> />
<input <button
type="submit"
aria-label={t("eventListCreateSubmitLabel")} aria-label={t("eventListCreateSubmitLabel")}
className="positive square-40" className="positive"
value="→"
onClick={e => createEvent.run()} onClick={e => createEvent.run()}
disabled={!name} disabled={!name}
/> >
</form> <FestaIcon icon={faPlus}/>
</button>
</FormMonorow>
{createEvent.error ? <ErrorBlock error={createEvent.error} text={t("eventListCreateError")} /> : null} {createEvent.error ? <ErrorBlock error={createEvent.error} text={t("eventListCreateError")} /> : null}
</> </>
} }

View file

@ -0,0 +1,14 @@
import { faBrush } from "@fortawesome/free-solid-svg-icons"
import { useTranslation } from "next-i18next"
import { FestaIcon } from "./extensions/FestaIcon"
export function WorkInProgress() {
const {t} = useTranslation()
return (
<div className="work-in-progress">
<FestaIcon icon={faBrush}/> {t("workInProgress")}
</div>
)
}

View file

@ -3,7 +3,7 @@ import { HTMLProps } from "react"
import { EditingContext } from "../../contexts/editing" import { EditingContext } from "../../contexts/editing"
import { useDefinedContext } from "../../utils/definedContext" import { useDefinedContext } from "../../utils/definedContext"
import { FestaIcon } from "../extensions/FestaIcon" import { FestaIcon } from "../extensions/FestaIcon"
import { FormDateRange } from "../FormDateRange" import { FormDateRange } from "../form/FormDateRange"
type EditableDateRangeProps = { type EditableDateRangeProps = {

View file

@ -0,0 +1,14 @@
import classNames from "classnames"
import { HTMLProps, ReactNode } from "react"
type FormMonorowProps = {
children: ReactNode
}
export function FormMonorow(props: FormMonorowProps & HTMLProps<HTMLFormElement>) {
return (
<form {...props} className={classNames("form-monorow", props.className)}>
{props.children}
</form>
)
}

View file

@ -1,5 +1,5 @@
import { ReactNode } from "react" import { ReactNode } from "react"
import { FormDateRange } from "../FormDateRange" import { FormDateRange } from "../form/FormDateRange"
type ViewEventProps = { type ViewEventProps = {
title: ReactNode, title: ReactNode,

View file

@ -3,21 +3,18 @@ import { NextPageContext } from "next";
import { useTranslation } from "next-i18next"; import { useTranslation } from "next-i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Head from "next/head"; import Head from "next/head";
import { ChangeEvent, FormEventHandler, useCallback, useState } from "react"; import { ChangeEvent, useCallback, useState } from "react";
import { ToolBar } from "../../components/tools/ToolBar"; import { ToolBar } from "../../components/tools/ToolBar";
import { EditableMarkdown } from "../../components/editable/EditableMarkdown"; import { EditableMarkdown } from "../../components/editable/EditableMarkdown";
import { EditableText } from "../../components/editable/EditableText"; import { EditableText } from "../../components/editable/EditableText";
import { ToolToggleEditing } from "../../components/tools/ToolToggleEditing"; import { ToolToggleEditing } from "../../components/tools/ToolToggleEditing";
import { EditingContext } from "../../contexts/editing"; import { EditingContext } from "../../contexts/editing";
import { database } from "../../utils/prismaClient"; import { database } from "../../utils/prismaClient";
import { Postcard } from "../../components/postcard/Postcard";
import { ViewContent } from "../../components/view/ViewContent";
import { EditablePostcard } from "../../components/editable/EditablePostcard"; import { EditablePostcard } from "../../components/editable/EditablePostcard";
import { ViewEvent } from "../../components/view/ViewEvent"; import { ViewEvent } from "../../components/view/ViewEvent";
import { EditableDateTime } from "../../components/editable/EditableDateTime";
import { FormDateRange } from "../../components/FormDateRange";
import { ToolToggleVisible } from "../../components/tools/ToolToggleVisible"; import { ToolToggleVisible } from "../../components/tools/ToolToggleVisible";
import { EditableDateRange } from "../../components/editable/EditableDateRange"; import { EditableDateRange } from "../../components/editable/EditableDateRange";
import { WorkInProgress } from "../../components/WorkInProgress";
export async function getServerSideProps(context: NextPageContext) { export async function getServerSideProps(context: NextPageContext) {
@ -76,6 +73,7 @@ export default function PageEventDetail({event}: PageEventDetailProps) {
<Head> <Head>
<title key="title">{event.name} - {t("siteTitle")}</title> <title key="title">{event.name} - {t("siteTitle")}</title>
</Head> </Head>
<WorkInProgress/>
<EditingContext.Provider value={editState}> <EditingContext.Provider value={editState}>
<ToolBar vertical="vadapt" horizontal="right"> <ToolBar vertical="vadapt" horizontal="right">
<ToolToggleEditing/> <ToolToggleEditing/>
@ -96,14 +94,14 @@ export default function PageEventDetail({event}: PageEventDetailProps) {
placeholder={t("eventDetailsPostcardPlaceholder")} placeholder={t("eventDetailsPostcardPlaceholder")}
/> />
} }
description={ description={<>
<EditableMarkdown <EditableMarkdown
value={description} value={description}
onChange={(e: ChangeEvent<HTMLTextAreaElement>) => setDescription(e.target.value)} onChange={(e: ChangeEvent<HTMLTextAreaElement>) => setDescription(e.target.value)}
rows={3} rows={3}
placeholder={t("eventDetailsDescriptionPlaceholder")} placeholder={t("eventDetailsDescriptionPlaceholder")}
/> />
} </>}
daterange={ daterange={
<EditableDateRange <EditableDateRange
startProps={{ startProps={{

View file

@ -30,5 +30,6 @@
"eventDetailsToggleEditingView": "Visualizza anteprima", "eventDetailsToggleEditingView": "Visualizza anteprima",
"eventDetailsTitlePlaceholder": "Titolo", "eventDetailsTitlePlaceholder": "Titolo",
"eventDetailsDescriptionPlaceholder": "Descrizione evento", "eventDetailsDescriptionPlaceholder": "Descrizione evento",
"eventDetailsPostcardPlaceholder": "Cartolina" "eventDetailsPostcardPlaceholder": "Cartolina",
"workInProgress": "Questa pagina è ancora in sviluppo e potrebbe contenere errori o testo inaspettato."
} }

View file

@ -12,6 +12,7 @@
--positive: #88ff88; --positive: #88ff88;
--negative: #ff8888; --negative: #ff8888;
--warning: #ffff88;
} }
.postcard { .postcard {
@ -33,6 +34,7 @@
--positive: #008800; --positive: #008800;
--negative: #880000; --negative: #880000;
--warning: #666600;
} }
.postcard { .postcard {

View file

@ -8,13 +8,15 @@
flex-direction: row; flex-direction: row;
gap: 4px; gap: 4px;
justify-content: center; justify-content: center;
align-items: center; align-items: stretch;
} }
.form-monorow *:first-child { .form-monorow > input {
flex-grow: 1; flex-grow: 1;
} }
.form-monorow *:last-child { .form-monorow > button, .form-monorow > input[type="submit"] {
flex-grow: 0; flex-grow: 0;
width: 40px;
height: 40px;
} }

View file

@ -4,7 +4,7 @@
justify-content: flex-start; justify-content: flex-start;
align-content: flex-start; align-content: flex-start;
position: absolute; position: fixed;
z-index: 2; z-index: 2;

View file

@ -0,0 +1,11 @@
.work-in-progress {
color: var(--warning);
/* TODO: Make this based on --warning. */
background-color: rgba(255, 255, 0, 0.1);
border-bottom-width: 1px;
box-shadow: 1px 1px 2px var(--warning);
padding: 4px 8px;
}

View file

@ -13,8 +13,6 @@ body {
main { main {
padding: 8px; padding: 8px;
min-height: 100vh;
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {

View file

@ -16,6 +16,7 @@
@import "components/form-monorow.css"; @import "components/form-monorow.css";
@import "components/error.css"; @import "components/error.css";
@import "components/form-daterange.css"; @import "components/form-daterange.css";
@import "components/work-in-progress.css";
* { * {