Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: add shared page empty tip (#2077)

Chi Zhang70d8f9a0a7b5
diff --git a/apps/web/src/components/affine/sidebar-switch/index.tsx b/apps/web/src/components/affine/sidebar-switch/index.tsx
index 6782acacf7..d9af30cac3 100644
--- a/apps/web/src/components/affine/sidebar-switch/index.tsx
+++ b/apps/web/src/components/affine/sidebar-switch/index.tsx
@@ -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}
diff --git a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/Empty.tsx b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/Empty.tsx
index 64ba45a137..b1ce9fcc81 100644
--- a/apps/web/src/components/blocksuite/block-suite-page-list/page-list/Empty.tsx
+++ b/apps/web/src/components/blocksuite/block-suite-page-list/page-list/Empty.tsx
@@ -15,6 +15,9 @@ export const PageListEmpty = (props: { listType?: string }) => {
if (listType === 'trash') {
return t('emptyTrash');
}
+ if (listType === 'shared') {
+ return t('emptySharedPages');
+ }
};
return (
diff --git a/apps/web/src/components/pure/workspace-slider-bar/index.tsx b/apps/web/src/components/pure/workspace-slider-bar/index.tsx
index 0fd81ca42b..dc5f18e37d 100644
--- a/apps/web/src/components/pure/workspace-slider-bar/index.tsx
+++ b/apps/web/src/components/pure/workspace-slider-bar/index.tsx
@@ -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);
diff --git a/packages/i18n/src/resources/en.json b/packages/i18n/src/resources/en.json
index 209aa4b203..33d67f1a66 100644
--- a/packages/i18n/src/resources/en.json
+++ b/packages/i18n/src/resources/en.json
@@ -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: ",