@@ -1,3 +1,4 @@
|
|||||||
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
||||||
import { style } from '@vanilla-extract/css';
|
import { style } from '@vanilla-extract/css';
|
||||||
|
|
||||||
export const list = style({
|
export const list = style({
|
||||||
@@ -14,3 +15,6 @@ export const scrollableViewport = style({
|
|||||||
paddingRight: 8,
|
paddingRight: 8,
|
||||||
maxHeight: 360,
|
maxHeight: 360,
|
||||||
});
|
});
|
||||||
|
export const emptyIcon = style({
|
||||||
|
color: cssVarV2.icon.primary,
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { Menu, MenuItem, type MenuProps, Scrollable } from '@affine/component';
|
import { Menu, MenuItem, type MenuProps, Scrollable } from '@affine/component';
|
||||||
import { useAsyncCallback } from '@affine/core/components/hooks/affine-async-hooks';
|
import { useAsyncCallback } from '@affine/core/components/hooks/affine-async-hooks';
|
||||||
|
import { useI18n } from '@affine/i18n';
|
||||||
|
import { InformationIcon } from '@blocksuite/icons/rc';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
@@ -31,6 +33,18 @@ const DocItem = ({ doc, onSelect }: DocItemProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const Empty = () => {
|
||||||
|
const t = useI18n();
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
disabled
|
||||||
|
prefixIcon={<InformationIcon className={styles.emptyIcon} />}
|
||||||
|
>
|
||||||
|
{t['com.affine.template-list.empty']()}
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
interface TemplateListMenuContentProps extends CommonProps {
|
interface TemplateListMenuContentProps extends CommonProps {
|
||||||
prefixItems?: React.ReactNode;
|
prefixItems?: React.ReactNode;
|
||||||
suffixItems?: React.ReactNode;
|
suffixItems?: React.ReactNode;
|
||||||
@@ -48,9 +62,11 @@ export const TemplateListMenuContent = ({
|
|||||||
return (
|
return (
|
||||||
<ul className={styles.list}>
|
<ul className={styles.list}>
|
||||||
{prefixItems}
|
{prefixItems}
|
||||||
{templateDocs.map(doc => (
|
{templateDocs.length ? (
|
||||||
<DocItem key={doc.id} doc={doc} {...props} />
|
templateDocs.map(doc => <DocItem key={doc.id} doc={doc} {...props} />)
|
||||||
))}
|
) : (
|
||||||
|
<Empty />
|
||||||
|
)}
|
||||||
{suffixItems}
|
{suffixItems}
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1630,6 +1630,7 @@
|
|||||||
"com.affine.page-starter-bar.ai": "With AI",
|
"com.affine.page-starter-bar.ai": "With AI",
|
||||||
"com.affine.page-starter-bar.edgeless": "Edgeless",
|
"com.affine.page-starter-bar.edgeless": "Edgeless",
|
||||||
"Template": "Template",
|
"Template": "Template",
|
||||||
|
"com.affine.template-list.empty": "No template",
|
||||||
"com.affine.settings.workspace.template.title": "My Templates",
|
"com.affine.settings.workspace.template.title": "My Templates",
|
||||||
"com.affine.settings.workspace.template.journal": "Template for journal",
|
"com.affine.settings.workspace.template.journal": "Template for journal",
|
||||||
"com.affine.settings.workspace.template.journal-desc": "Select a template for your journal",
|
"com.affine.settings.workspace.template.journal-desc": "Select a template for your journal",
|
||||||
|
|||||||
Reference in New Issue
Block a user