From 8064b48ae21e23c1b6290af9447106b5227057f1 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 19 Aug 2020 10:59:41 +1000 Subject: [PATCH] publish: improve responsivity on mobile --- .../apps/publish/components/lib/NoteForm.tsx | 8 ++--- .../apps/publish/components/lib/Notebook.tsx | 6 ++-- .../apps/publish/components/lib/Settings.tsx | 30 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pkg/interface/src/views/apps/publish/components/lib/NoteForm.tsx b/pkg/interface/src/views/apps/publish/components/lib/NoteForm.tsx index 8a3946fbb..813ab814d 100644 --- a/pkg/interface/src/views/apps/publish/components/lib/NoteForm.tsx +++ b/pkg/interface/src/views/apps/publish/components/lib/NoteForm.tsx @@ -34,8 +34,8 @@ export function PostForm(props: PostFormProps) { p={[2, 4]} display="grid" justifyItems="start" - gridTemplateRows={["64px 64px 1fr", "64px 1fr"]} - gridTemplateColumns={["1fr", "1fr 1fr"]} + gridAutoRows="min-content" + gridTemplateColumns={["100%", "1fr 1fr"]} gridColumnGap={2} gridRowGap={2} > @@ -46,12 +46,12 @@ export function PostForm(props: PostFormProps) { >
- + {submitLabel} - +
diff --git a/pkg/interface/src/views/apps/publish/components/lib/Notebook.tsx b/pkg/interface/src/views/apps/publish/components/lib/Notebook.tsx index 085f1dd6e..d6efec5a8 100644 --- a/pkg/interface/src/views/apps/publish/components/lib/Notebook.tsx +++ b/pkg/interface/src/views/apps/publish/components/lib/Notebook.tsx @@ -60,16 +60,16 @@ export function Notebook(props: NotebookProps & RouteComponentProps) { mx="auto" display="grid" gridAutoRows="min-content" - gridTemplateColumns={["1fr", "1fr 1fr"]} + gridTemplateColumns={["100%", "1fr 1fr"]} maxWidth="500px" gridRowGap={[4, 6]} gridColumnGap={3} > - + {"<- All Notebooks"} - {notebook?.title} + {notebook?.title}
by diff --git a/pkg/interface/src/views/apps/publish/components/lib/Settings.tsx b/pkg/interface/src/views/apps/publish/components/lib/Settings.tsx index eaa6f897a..aba15abf1 100644 --- a/pkg/interface/src/views/apps/publish/components/lib/Settings.tsx +++ b/pkg/interface/src/views/apps/publish/components/lib/Settings.tsx @@ -12,10 +12,11 @@ import { Center, } from "@tlon/indigo-react"; import { Formik, Form, useFormikContext, FormikHelpers } from "formik"; -import GlobalApi from "../../../../api/global"; -import { Notebook } from "../../../../types/publish-update"; -import { Contacts } from "../../../../types/contact-update"; -import { FormError } from "../../../../components/FormError"; +import GlobalApi from "~/logic/api/global"; +import { Notebook } from "~/types/publish-update"; +import { Contacts } from "~/types/contact-update"; +import { FormError } from "~/views/components/FormError"; +import { RouteComponentProps, useHistory } from "react-router-dom"; interface SettingsProps { host: string; @@ -48,6 +49,7 @@ const ResetOnPropsChange = (props: { init: FormSchema; book: string }) => { export function Settings(props: SettingsProps) { const { host, notebook, api, book } = props; + const history = useHistory(); const initialValues: FormSchema = { name: notebook?.title, description: notebook?.about, @@ -59,15 +61,8 @@ export function Settings(props: SettingsProps) { actions: FormikHelpers ) => { try { - await api.publish.publishAction({ - "edit-book": { - book, - title: values.name, - about: values.description, - coms: values.comments, - group: null, - }, - }); + const { name, description, comments } = values; + await api.publish.editBook(book, name, description, comments); api.publish.fetchNotebook(host, book); actions.setStatus({ success: null }); } catch (e) { @@ -76,6 +71,11 @@ export function Settings(props: SettingsProps) { } }; + const onDelete = async () => { + await api.publish.delBook(book); + history.push("/~publish"); + }; + return ( Delete Notebook Permanently delete this notebook. (All current members will no - longer see this notebook + longer see this notebook.) -