diff --git a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx index fec065fd15..7776838d2f 100644 --- a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx +++ b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx @@ -120,41 +120,43 @@ const HistoryEditorPreview = ({ return (
-
- - - - - -
{title}
- -
- {ts ? timestampToLocalTime(ts) : null} +
+
+
+
+ + + + +
{title}
+
+ {ts ? timestampToLocalTime(ts) : null} +
+ + {snapshotPage ? ( + + + + ) : ( +
+ +
+ )}
- - {snapshotPage ? ( - - - - ) : ( -
- -
- )}
); }; @@ -182,43 +184,57 @@ const PlanPrompt = () => { const t = useAFFiNEI18N(); + const planTitle = useMemo(() => { + return ( +
+ {freePlan + ? t[ + 'com.affine.history.confirm-restore-modal.plan-prompt.limited-title' + ]() + : t['com.affine.history.confirm-restore-modal.plan-prompt.title']()} + + } + onClick={closeFreePlanPrompt} + /> +
+ ); + }, [closeFreePlanPrompt, freePlan, t]); + + const planDescription = useMemo(() => { + if (freePlan) { + return ( + <> + + Free users can view up to the last 7 days of page history. + + {isOwner ? ( + + {t[ + 'com.affine.history.confirm-restore-modal.pro-plan-prompt.upgrade' + ]()} + + ) : null} + + ); + } else { + return ( + + Pro users can view up to the last 30 days of page history. + + ); + } + }, [freePlan, isOwner, onClickUpgrade, t]); + return !planPromptClosed ? (
-
- {freePlan - ? t[ - 'com.affine.history.confirm-restore-modal.plan-prompt.limited-title' - ]() - : t['com.affine.history.confirm-restore-modal.plan-prompt.title']()} - - } - onClick={closeFreePlanPrompt} - /> -
- {freePlan ? ( - <> - - Free users can view up to the last 7 days of page history. - - {isOwner ? ( - - {t[ - 'com.affine.history.confirm-restore-modal.pro-plan-prompt.upgrade' - ]()} - - ) : null} - - ) : ( - - Pro users can view up to the last 30 days of page history. - - )} + {planTitle} + {planDescription}
) : null; diff --git a/packages/frontend/core/src/components/affine/page-history-modal/styles.css.ts b/packages/frontend/core/src/components/affine/page-history-modal/styles.css.ts index 25e5fa80a9..600534ba5c 100644 --- a/packages/frontend/core/src/components/affine/page-history-modal/styles.css.ts +++ b/packages/frontend/core/src/components/affine/page-history-modal/styles.css.ts @@ -32,10 +32,46 @@ export const previewWrapper = style({ flexDirection: 'column', flexGrow: 1, height: '100%', + position: 'relative', + overflow: 'hidden', width: `calc(100% - ${historyListWidth})`, backgroundColor: 'var(--affine-background-secondary-color)', }); +export const previewContainer = style({ + display: 'flex', + flexDirection: 'column', + flexGrow: 1, + position: 'absolute', + bottom: 0, + left: 40, + borderTopLeftRadius: 8, + borderTopRightRadius: 8, + overflow: 'hidden', + boxShadow: 'var(--affine-shadow-3)', + height: 'calc(100% - 40px)', + width: `calc(100% - 80px)`, + backgroundColor: 'var(--affine-background-secondary-color)', +}); + +export const previewContainerStack1 = style([ + previewContainer, + { + left: 48, + height: 'calc(100% - 32px)', + width: `calc(100% - 96px)`, + }, +]); + +export const previewContainerStack2 = style([ + previewContainer, + { + left: 56, + height: 'calc(100% - 24px)', + width: `calc(100% - 112px)`, + }, +]); + export const previewHeader = style({ display: 'flex', alignItems: 'center',