From 362b3cd13dd357679e7523e16614b69c6123bf7e Mon Sep 17 00:00:00 2001 From: celine Date: Tue, 2 Dec 2025 19:32:15 -0500 Subject: [PATCH] added a drafts page to looseleaf, along with some empty states --- app/(home-pages)/home/HomeLayout.tsx | 2 +- .../looseleafs/LooseleafsLayout.tsx | 53 +++++++++++++++++-- components/ActionBar/Publications.tsx | 4 +- components/EmptyState.tsx | 17 ++++++ 4 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 components/EmptyState.tsx diff --git a/app/(home-pages)/home/HomeLayout.tsx b/app/(home-pages)/home/HomeLayout.tsx index 7c31a67f..9669e893 100644 --- a/app/(home-pages)/home/HomeLayout.tsx +++ b/app/(home-pages)/home/HomeLayout.tsx @@ -211,7 +211,7 @@ export function LeafletList(props: { className={` leafletList w-full - ${display === "grid" ? "grid auto-rows-max md:grid-cols-4 sm:grid-cols-3 grid-cols-2 gap-y-4 gap-x-4 sm:gap-x-6 sm:gap-y-5 grow" : "flex flex-col gap-2 pt-2"} `} + ${display === "grid" ? "grid auto-rows-max md:grid-cols-4 sm:grid-cols-3 grid-cols-2 gap-y-4 gap-x-4 sm:gap-x-6 sm:gap-y-5 grow" : "flex flex-col gap-2 "} `} > {props.leaflets.map(({ token: leaflet, added_at, archived }, index) => ( } tabs={{ - home: { + Drafts: { + controls: ( + + ), + content: , + }, + Published: { controls: null, content: ( { + if (props.empty) + return ( + +
+ You haven't written any looseleaf drafts yet. +
+ + Start a Looseleaf Draft + +
+ ); + return ( +
+ New Looseleaf Draft + This is where the draft would go if we had them lol +
+ ); +}; + export const LooseleafList = (props: { titles: { [root_entity: string]: string }; initialFacts: { @@ -102,6 +138,17 @@ export const LooseleafList = (props: { token: ptoh.permission_tokens as PermissionToken, })) : []; + + if (!leaflets || leaflets.length === 0) + return ( + +
You haven't published any looseleafs yet.
+ + Start a Looseleaf Draft + +
+ ); + return ( { let { identity } = useIdentityData(); - let looseleaves = identity?.permission_token_on_homepage.find( + let hasLooseleafs = !!identity?.permission_token_on_homepage.find( (f) => f.permission_tokens.leaflets_to_documents, ); @@ -34,7 +34,7 @@ export const PublicationButtons = (props: { return (
- {looseleaves && ( + {hasLooseleafs && ( <> { + return ( +
+ {props.children} +
+ ); +}; -- 2.51.2