Something went wrong. Try again.
a tool for shared writing and social publishing
Something went wrong. Try again.
835 B · 20 lines
TypeScript
123456789101112131415161718192021import { useLeafletPublicationData } from "components/PageSWRDataProvider";import { PubLeafletPublication } from "lexicons/api";import { useEntity, useReplicache } from "src/replicache";
export function useCardBorderHidden(entityID: string | null) { let { rootEntity } = useReplicache(); let { data: pub } = useLeafletPublicationData(); let rootCardBorderHidden = useEntity(rootEntity, "theme/card-border-hidden");
let cardBorderHidden = useEntity(entityID, "theme/card-border-hidden") || rootCardBorderHidden; if (!cardBorderHidden && !rootCardBorderHidden) { if (pub?.publications?.record) { let record = pub.publications.record as PubLeafletPublication.Record; return !record.theme?.showPageBackground; } return false; } return (cardBorderHidden || rootCardBorderHidden)?.data.value;}