a tool for shared writing and social publishing
1import { useLeafletPublicationData } from "components/PageSWRDataProvider"; 2import { PubLeafletPublication } from "lexicons/api"; 3import { useEntity, useReplicache } from "src/replicache"; 4 5export function useCardBorderHidden(entityID: string | null) { 6 let { rootEntity } = useReplicache(); 7 let { data: pub } = useLeafletPublicationData(); 8 let rootCardBorderHidden = useEntity(rootEntity, "theme/card-border-hidden"); 9 10 let cardBorderHidden = 11 useEntity(entityID, "theme/card-border-hidden") || rootCardBorderHidden; 12 if (!cardBorderHidden && !rootCardBorderHidden) { 13 if (pub?.publications?.record) { 14 let record = pub.publications.record as PubLeafletPublication.Record; 15 return !record.theme?.showPageBackground; 16 } 17 return false; 18 } 19 return (cardBorderHidden || rootCardBorderHidden)?.data.value; 20}