mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
feat(core): hide starter-bar for template (#10112)
This commit is contained in:
@@ -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} />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user