Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat(core): hide starter-bar for template (#10112)

CatsJuice473f8bd167fa
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/starter-bar.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/starter-bar.tsx
index dde81b7e52..996e3a142b 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/starter-bar.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/starter-bar.tsx
@@ -157,6 +157,14 @@ const StarterBarNotEmpty = ({ doc }: { doc: Store }) => {
export const StarterBar = ({ doc }: { doc: Store }) => {
const [isEmpty, setIsEmpty] = useState(doc.isEmpty);
+ const templateDocService = useService(TemplateDocService);
+
+ const isTemplate = useLiveData(
+ useMemo(
+ () => templateDocService.list.isTemplate$(doc.id),
+ [doc.id, templateDocService.list]
+ )
+ );
useEffect(() => {
const disposable = doc.slots.blockUpdated.on(() => {
@@ -167,7 +175,7 @@ export const StarterBar = ({ doc }: { doc: Store }) => {
};
}, [doc]);
- if (!isEmpty) return null;
+ if (!isEmpty || isTemplate) return null;
return <StarterBarNotEmpty doc={doc} />;
};