a tool for shared writing and social publishing

add loader for publish

+7 -2
+6 -1
app/[leaflet_id]/Actions.tsx
··· 10 10 import { useIdentityData } from "components/IdentityProvider"; 11 11 import { useLeafletPublicationData } from "components/PageSWRDataProvider"; 12 12 import { useToaster } from "components/Toast"; 13 + import { DotLoader } from "components/utils/DotLoader"; 13 14 import { publications } from "drizzle/schema"; 14 15 import Link from "next/link"; 15 16 import { useParams } from "next/navigation"; 17 + import { useState } from "react"; 16 18 import { useBlocks } from "src/hooks/queries/useBlocks"; 17 19 import { useEntity, useReplicache } from "src/replicache"; 18 20 import { Json } from "supabase/database.types"; ··· 40 42 }; 41 43 42 44 export const PublishButton = () => { 45 + let [isLoading, setIsLoading] = useState(false); 43 46 let { data, mutate } = useLeafletPublicationData(); 44 47 let identity = useIdentityData(); 45 48 let { permission_token, rootEntity } = useReplicache(); ··· 51 54 <ActionButton 52 55 primary 53 56 icon={<PublishSmall className="shrink-0" />} 54 - label={pub.doc ? "Update!" : "Publish!"} 57 + label={isLoading ? <DotLoader /> : pub.doc ? "Update!" : "Publish!"} 55 58 onClick={async () => { 56 59 if (!pub || !pub.publications) return; 60 + setIsLoading(true); 57 61 let doc = await publishToPublication({ 58 62 root_entity: rootEntity, 59 63 blocks, ··· 62 66 title: pub.title, 63 67 description: pub.description, 64 68 }); 69 + setIsLoading(false); 65 70 mutate(); 66 71 toaster({ 67 72 content: (
+1 -1
components/ActionBar/ActionButton.tsx
··· 11 11 ButtonProps & { 12 12 id?: string; 13 13 icon: React.ReactNode; 14 - label: string; 14 + label: React.ReactNode; 15 15 primary?: boolean; 16 16 secondary?: boolean; 17 17 }