mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 12:06:35 +08:00
feat(core): download template from snapshot url (#8211)
This commit is contained in:
+3
-5
@@ -3,20 +3,18 @@ import { useNavigateHelper } from '@affine/core/hooks/use-navigate-helper';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
|
||||
export const ImportTemplateButton = ({
|
||||
workspaceId,
|
||||
docId,
|
||||
name,
|
||||
snapshotUrl,
|
||||
}: {
|
||||
workspaceId: string;
|
||||
docId: string;
|
||||
name: string;
|
||||
snapshotUrl: string;
|
||||
}) => {
|
||||
const t = useI18n();
|
||||
const { jumpToImportTemplate } = useNavigateHelper();
|
||||
return (
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={() => jumpToImportTemplate(workspaceId, docId, name)}
|
||||
onClick={() => jumpToImportTemplate(name, snapshotUrl)}
|
||||
>
|
||||
{t['com.affine.share-page.header.import-template']()}
|
||||
</Button>
|
||||
|
||||
@@ -9,19 +9,17 @@ import * as styles from './styles.css';
|
||||
import { PublishPageUserAvatar } from './user-avatar';
|
||||
|
||||
export type ShareHeaderRightItemProps = {
|
||||
workspaceId: string;
|
||||
docId: string;
|
||||
publishMode: DocMode;
|
||||
isTemplate?: boolean;
|
||||
templateName?: string;
|
||||
snapshotUrl?: string;
|
||||
};
|
||||
|
||||
const ShareHeaderRightItem = ({
|
||||
publishMode,
|
||||
isTemplate,
|
||||
templateName,
|
||||
workspaceId,
|
||||
docId,
|
||||
snapshotUrl,
|
||||
}: ShareHeaderRightItemProps) => {
|
||||
const loginStatus = useLiveData(useService(AuthService).session.status$);
|
||||
const authenticated = loginStatus === 'authenticated';
|
||||
@@ -29,9 +27,8 @@ const ShareHeaderRightItem = ({
|
||||
<div className={styles.rightItemContainer}>
|
||||
{isTemplate ? (
|
||||
<ImportTemplateButton
|
||||
docId={docId}
|
||||
workspaceId={workspaceId}
|
||||
name={templateName ?? ''}
|
||||
snapshotUrl={snapshotUrl ?? ''}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user