feat: add shared page empty tip (#2077)

Co-authored-by: himself65 <himself65@outlook.com>
This commit is contained in:
Chi Zhang 2023-04-23 06:24:18 +08:00 committed by GitHub
parent 7d246f87e7
commit 70d8f9a0a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

View File

@ -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}

View File

@ -15,6 +15,9 @@ export const PageListEmpty = (props: { listType?: string }) => {
if (listType === 'trash') {
return t('emptyTrash');
}
if (listType === 'shared') {
return t('emptySharedPages');
}
};
return (

View File

@ -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);

View File

@ -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: ",