diff --git a/app/[leaflet_id]/Footer.tsx b/app/[leaflet_id]/Footer.tsx index f8ff45fa..fb671480 100644 --- a/app/[leaflet_id]/Footer.tsx +++ b/app/[leaflet_id]/Footer.tsx @@ -6,14 +6,17 @@ import { ThemePopover } from "components/ThemeManager/ThemeSetter"; import { Toolbar } from "components/Toolbar"; import { FootnoteToolbar } from "components/Toolbar/FootnoteToolbarWrapper"; import { ShareOptions } from "app/[leaflet_id]/actions/ShareOptions"; -import { HomeButton } from "app/[leaflet_id]/actions/HomeButton"; +import { + AddToHomeButton, + HomeButton, +} from "app/[leaflet_id]/actions/HomeButton"; import { PublishButton } from "./actions/PublishButton"; import { useEntitySetContext } from "components/EntitySetProvider"; import { Watermark } from "components/Watermark"; import { BackToPubButton } from "./actions/BackToPubButton"; import { useLeafletPublicationData } from "components/PageSWRDataProvider"; import { useIdentityData } from "components/IdentityProvider"; -import { useEntity } from "src/replicache"; +import { useEntity, useReplicache } from "src/replicache"; import { block } from "sharp"; import { PostSettings } from "components/PostSettings"; @@ -29,9 +32,9 @@ export function hasBlockToolbar(blockType: string | null | undefined) { } export function LeafletFooter(props: { entityID: string }) { let focusedBlock = useUIState((s) => s.focusedEntity); - let entity_set = useEntitySetContext(); let { identity } = useIdentityData(); + let { permission_token } = useReplicache(); let { data: pub } = useLeafletPublicationData(); let blockType = useEntity(focusedBlock?.entityID || null, "block/type")?.data .value; @@ -77,8 +80,17 @@ export function LeafletFooter(props: { entityID: string }) { ) : ( )} +
- + {identity && + !identity.permission_token_on_homepage.find( + (pth) => pth.permission_tokens.id === permission_token.id, + ) ? ( + + ) : ( + + )} + diff --git a/app/[leaflet_id]/Sidebar.tsx b/app/[leaflet_id]/Sidebar.tsx index 14ac86cc..4cefdcb9 100644 --- a/app/[leaflet_id]/Sidebar.tsx +++ b/app/[leaflet_id]/Sidebar.tsx @@ -2,7 +2,10 @@ import { Sidebar } from "components/ActionBar/Sidebar"; import { useEntitySetContext } from "components/EntitySetProvider"; import { HelpButton } from "app/[leaflet_id]/actions/HelpButton"; -import { HomeButton } from "app/[leaflet_id]/actions/HomeButton"; +import { + AddToHomeButton, + HomeButton, +} from "app/[leaflet_id]/actions/HomeButton"; import { Media } from "components/Media"; import { useLeafletPublicationData } from "components/PageSWRDataProvider"; import { ShareOptions } from "app/[leaflet_id]/actions/ShareOptions"; @@ -19,6 +22,7 @@ export function LeafletSidebar() { let { rootEntity } = useReplicache(); let { data: pub } = useLeafletPublicationData(); let { identity } = useIdentityData(); + let { permission_token } = useReplicache(); return ( @@ -28,8 +32,16 @@ export function LeafletSidebar() { >
{entity_set.permissions.write && ( - - + + {identity && + !identity.permission_token_on_homepage.find( + (pth) => pth.permission_tokens.id === permission_token.id, + ) ? ( + + ) : ( + + )} + diff --git a/app/[leaflet_id]/actions/HomeButton.tsx b/app/[leaflet_id]/actions/HomeButton.tsx index 54d54753..21c31140 100644 --- a/app/[leaflet_id]/actions/HomeButton.tsx +++ b/app/[leaflet_id]/actions/HomeButton.tsx @@ -23,26 +23,22 @@ export function HomeButton() { className="hover:no-underline" style={{ textDecorationLine: "none !important" }} > - } label="Go Home" /> + } label="Back Home" /> - {} ); } -const AddToHomeButton = (props: {}) => { +export const AddToHomeButton = (props: { primary?: boolean }) => { let { permission_token } = useReplicache(); let { identity, mutate } = useIdentityData(); let smoker = useSmoker(); - if ( - identity?.permission_token_on_homepage.find( - (pth) => pth.permission_tokens.id === permission_token.id, - ) || - !identity - ) - return null; + return ( { await addLeafletToHome(permission_token.id); mutate((identity) => { @@ -68,7 +64,7 @@ const AddToHomeButton = (props: {}) => { }); }} icon={} - label="Add to Home" + label="Save to Home" /> ); }; diff --git a/app/[leaflet_id]/actions/PublishButton.tsx b/app/[leaflet_id]/actions/PublishButton.tsx index 8823ece8..a17a31ce 100644 --- a/app/[leaflet_id]/actions/PublishButton.tsx +++ b/app/[leaflet_id]/actions/PublishButton.tsx @@ -52,6 +52,8 @@ export const PublishButton = (props: { entityID: string }) => { return ( } label={"Publish!"} onClick={() => { @@ -116,6 +118,8 @@ const UpdateButton = () => { return ( } label={isLoading ? : "Update!"} onClick={async () => { @@ -192,6 +196,8 @@ const PublishToPublicationButton = (props: { entityID: string }) => { trigger={ } label={"Publish"} /> diff --git a/app/[leaflet_id]/actions/ShareOptions/index.tsx b/app/[leaflet_id]/actions/ShareOptions/index.tsx index 3b5d0e3d..cd614893 100644 --- a/app/[leaflet_id]/actions/ShareOptions/index.tsx +++ b/app/[leaflet_id]/actions/ShareOptions/index.tsx @@ -63,8 +63,10 @@ export function ShareOptions() { trigger={ + className="sm:w-full! w-fit!" secondary label={`Share ${pub ? "Draft" : ""}`} + labelOnMobile /> } > diff --git a/components/ActionBar/ActionButton.tsx b/components/ActionBar/ActionButton.tsx index 77b83128..13c9aa24 100644 --- a/components/ActionBar/ActionButton.tsx +++ b/components/ActionBar/ActionButton.tsx @@ -52,7 +52,8 @@ export const ActionButton = forwardRef< {...buttonProps} ref={ref} className={` - actionButton relative + actionButton relative shrink-0 + h-fit rounded-md border py-0.5 px-1 flex gap-2 items-start justify-start diff --git a/components/ActionBar/Publications.tsx b/components/ActionBar/Publications.tsx index 23f388c0..9bff7819 100644 --- a/components/ActionBar/Publications.tsx +++ b/components/ActionBar/Publications.tsx @@ -67,7 +67,7 @@ export const PublicationButtons = (props: { className?: string }) => { - label="New" + label="New Publication" className="text-tertiary!" /> diff --git a/components/ActionBar/Sidebar.tsx b/components/ActionBar/Sidebar.tsx index e162b6a8..b00a2da2 100644 --- a/components/ActionBar/Sidebar.tsx +++ b/components/ActionBar/Sidebar.tsx @@ -36,13 +36,22 @@ export function Sidebar(props: { }} >
{ diff --git a/components/ThemeManager/ThemeSetter.tsx b/components/ThemeManager/ThemeSetter.tsx index 2d22deb5..22df519f 100644 --- a/components/ThemeManager/ThemeSetter.tsx +++ b/components/ThemeManager/ThemeSetter.tsx @@ -65,7 +65,13 @@ export const ThemePopover = (props: { entityID: string; home?: boolean }) => { asChild side={isMobile ? "top" : "right"} align={isMobile ? "center" : "start"} - trigger={} label="Theme" />} + trigger={ + } + label="Theme" + className="sm:w-full! w-fit!" + /> + } >