mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-10 17:46:05 +03:00
feat: add shared page empty tip (#2077)
Co-authored-by: himself65 <himself65@outlook.com>
This commit is contained in:
parent
7d246f87e7
commit
70d8f9a0a7
@ -1,6 +1,7 @@
|
||||
import { Tooltip } from '@affine/component';
|
||||
import { getEnvironment } from '@affine/env';
|
||||
import { useTranslation } from '@affine/i18n';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import {
|
||||
useGuideHidden,
|
||||
@ -29,12 +30,23 @@ export const SidebarSwitch = ({
|
||||
const [guideHiddenUntilNextUpdate, setGuideHiddenUntilNextUpdate] =
|
||||
useGuideHiddenUntilNextUpdate();
|
||||
const { t } = useTranslation();
|
||||
const checkIsMac = () => {
|
||||
const env = getEnvironment();
|
||||
return env.isBrowser && env.isMacOs;
|
||||
};
|
||||
const [isMac, setIsMac] = useState(false);
|
||||
const collapseKeyboardShortcuts = isMac ? ' ⌘+/' : ' Ctrl+/';
|
||||
|
||||
useEffect(() => {
|
||||
setIsMac(checkIsMac());
|
||||
}, []);
|
||||
|
||||
tooltipContent =
|
||||
tooltipContent || (open ? t('Collapse sidebar') : t('Expand sidebar'));
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
content={tooltipContent}
|
||||
content={tooltipContent + ' ' + collapseKeyboardShortcuts}
|
||||
placement="right"
|
||||
zIndex={1000}
|
||||
visible={tooltipVisible}
|
||||
|
@ -15,6 +15,9 @@ export const PageListEmpty = (props: { listType?: string }) => {
|
||||
if (listType === 'trash') {
|
||||
return t('emptyTrash');
|
||||
}
|
||||
if (listType === 'shared') {
|
||||
return t('emptySharedPages');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -94,6 +94,7 @@ export const WorkSpaceSliderBar: React.FC<WorkSpaceSliderBarProps> = ({
|
||||
const [isScrollAtTop, setIsScrollAtTop] = useState(true);
|
||||
const show = isPublicWorkspace ? false : sidebarOpen;
|
||||
const actualWidth = floatingSlider ? 'calc(10vw + 400px)' : sliderWidth;
|
||||
|
||||
useEffect(() => {
|
||||
if (environment.isDesktop) {
|
||||
window.apis?.onSidebarVisibilityChange(sidebarOpen);
|
||||
|
@ -114,6 +114,7 @@
|
||||
"Got it": "Got it",
|
||||
"emptyAllPages": "This workspace is empty. Create a new page to begin editing.",
|
||||
"emptyTrash": "Deleted pages will appear here.",
|
||||
"emptySharedPages": "Shared pages will appear here.",
|
||||
"still designed": "(This page is still being designed.)",
|
||||
"My Workspaces": "My Workspaces",
|
||||
"Tips": "Tips: ",
|
||||
|
Loading…
Reference in New Issue
Block a user