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): add link to template tutorial (#10189)

CatsJuicef369a8dca096
diff --git a/packages/frontend/core/src/modules/template-doc/view/styles.css.ts b/packages/frontend/core/src/modules/template-doc/view/styles.css.ts
index 640f94f0a6..cc9ecc63f6 100644
--- a/packages/frontend/core/src/modules/template-doc/view/styles.css.ts
+++ b/packages/frontend/core/src/modules/template-doc/view/styles.css.ts
@@ -16,5 +16,28 @@ export const scrollableViewport = style({
maxHeight: 360,
});
export const emptyIcon = style({
+ fontSize: 20,
color: cssVarV2.icon.primary,
});
+export const empty = style({
+ pointerEvents: 'none',
+ display: 'flex',
+ gap: 8,
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ lineHeight: '20px',
+ padding: 4,
+});
+export const emptyText = style({
+ color: cssVarV2.text.secondary,
+});
+export const link = style({
+ lineHeight: 0,
+ pointerEvents: 'auto',
+ fontSize: 20,
+ color: cssVarV2.icon.primary,
+});
+export const space = style({
+ width: 0,
+ flex: 1,
+});
diff --git a/packages/frontend/core/src/modules/template-doc/view/template-list-menu.tsx b/packages/frontend/core/src/modules/template-doc/view/template-list-menu.tsx
index 8187b77827..b85ed0e034 100644
--- a/packages/frontend/core/src/modules/template-doc/view/template-list-menu.tsx
+++ b/packages/frontend/core/src/modules/template-doc/view/template-list-menu.tsx
@@ -1,7 +1,13 @@
-import { Menu, MenuItem, type MenuProps, Scrollable } from '@affine/component';
+import {
+ IconButton,
+ Menu,
+ MenuItem,
+ type MenuProps,
+ Scrollable,
+} from '@affine/component';
import { useAsyncCallback } from '@affine/core/components/hooks/affine-async-hooks';
import { useI18n } from '@affine/i18n';
-import { InformationIcon } from '@blocksuite/icons/rc';
+import { DualLinkIcon, InformationIcon } from '@blocksuite/icons/rc';
import { useLiveData, useService } from '@toeverything/infra';
import { useState } from 'react';
@@ -47,12 +53,21 @@ const DocItem = ({ doc, onSelect, asLink }: DocItemProps) => {
const Empty = () => {
const t = useI18n();
return (
- <MenuItem
- disabled
- prefixIcon={<InformationIcon className={styles.emptyIcon} />}
- >
- {t['com.affine.template-list.empty']()}
- </MenuItem>
+ <div className={styles.empty}>
+ <InformationIcon className={styles.emptyIcon} />
+ <span className={styles.emptyText}>
+ {t['com.affine.template-list.empty']()}
+ </span>
+ <div className={styles.space} />
+ <a
+ href="https://affine.pro/blog/how-to-use-template"
+ target="_blank"
+ rel="noopener noreferrer"
+ className={styles.link}
+ >
+ <IconButton icon={<DualLinkIcon />} />
+ </a>
+ </div>
);
};