Merge branch 'feat/filesystem_and_search' of github.com:toeverything/AFFiNE into feat/filesystem_and_search

This commit is contained in:
DiamondThree
2022-12-23 17:07:54 +08:00
15 changed files with 53 additions and 45 deletions
+3 -3
View File
@@ -9,10 +9,10 @@
"lint": "next lint"
},
"dependencies": {
"@blocksuite/blocks": "0.3.0-20221223060814-a3b97f6",
"@blocksuite/editor": "0.3.0-20221223060814-a3b97f6",
"@blocksuite/blocks": "0.3.0-20221223070752-455d89c",
"@blocksuite/editor": "0.3.0-20221223070752-455d89c",
"@blocksuite/icons": "^2.0.2",
"@blocksuite/store": "0.3.0-20221223060814-a3b97f6",
"@blocksuite/store": "0.3.0-20221223070752-455d89c",
"@emotion/css": "^11.10.0",
"@emotion/react": "^11.10.4",
"@emotion/server": "^11.10.0",
@@ -73,7 +73,7 @@ type TransitionsModalProps = {
export const ContactModal = ({ open, onClose }: TransitionsModalProps) => {
return (
<Modal open={open} onClose={onClose}>
<Modal open={open} onClose={onClose} data-testid="contact-us-modal-content">
<ModalWrapper
width={860}
height={540}
@@ -70,7 +70,10 @@ export const HelpIsland = ({
</Grow>
<div style={{ position: 'relative' }}>
<StyledIconWrapper isEdgelessDark={isEdgelessDark}>
<StyledIconWrapper
isEdgelessDark={isEdgelessDark}
data-testid="faq-icon"
>
<HelpIcon />
</StyledIconWrapper>
<StyledTransformIcon in={showContent}>
@@ -1,12 +1,17 @@
import React from 'react';
export const Empty = () => {
import { Empty } from '@/ui/empty';
export const PageListEmpty = () => {
return (
<div style={{ textAlign: 'center' }}>
<Empty
width={800}
height={300}
sx={{ marginTop: '100px', marginBottom: '30px' }}
/>
<p>Tips: Click Add to Favourites/Trash and the page will appear here.</p>
<p>(Designer is grappling with designing)</p>
</div>
);
};
export default Empty;
export default PageListEmpty;
@@ -2,7 +2,7 @@ import React from 'react';
import { AddIcon } from '@blocksuite/icons';
import { StyledModalFooterContent } from './style';
import { useModal } from '@/providers/global-modal-provider';
import { useAppState } from '@/providers/app-state-provider/context';
import { useAppState } from '@/providers/app-state-provider';
import { Command } from 'cmdk';
import { usePageHelper } from '@/hooks/use-page-helper';
@@ -13,7 +13,7 @@ import { Command } from 'cmdk';
import { useEffect, useState } from 'react';
import { useModal } from '@/providers/global-modal-provider';
import { getUaHelper } from '@/utils';
import { useAppState } from '@/providers/app-state-provider/context';
import { useAppState } from '@/providers/app-state-provider';
type TransitionsModalProps = {
open: boolean;
onClose: () => void;
@@ -8,6 +8,7 @@ import React, {
import { SearchIcon } from '@blocksuite/icons';
import { StyledInputContent, StyledLabel } from './style';
import { Command } from 'cmdk';
import { useAppState } from '@/providers/app-state-provider';
export const Input = (props: {
query: string;
setQuery: Dispatch<SetStateAction<string>>;
@@ -16,6 +17,11 @@ export const Input = (props: {
const [isComposition, setIsComposition] = useState(false);
const [inputValue, setInputValue] = useState('');
const inputRef = useRef<HTMLInputElement>(null);
const { currentWorkspaceId, workspacesMeta, currentWorkspace } =
useAppState();
const isPublic = workspacesMeta.find(
meta => String(meta.id) === String(currentWorkspaceId)
)?.public;
useEffect(() => {
inputRef.current?.addEventListener(
'blur',
@@ -73,7 +79,7 @@ export const Input = (props: {
}
}
}}
placeholder="Quick Search..."
placeholder={isPublic ? currentWorkspace?.meta.name : 'Quick Search...'}
/>
</StyledInputContent>
);
@@ -3,7 +3,7 @@ import { StyledListItem, StyledNotFound } from './style';
import { useModal } from '@/providers/global-modal-provider';
import { PaperIcon, EdgelessIcon } from '@blocksuite/icons';
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
import { useAppState } from '@/providers/app-state-provider/context';
import { useAppState } from '@/providers/app-state-provider';
import { useRouter } from 'next/router';
import { config } from './config';
import { NoResultSVG } from './noResultSVG';
@@ -8,7 +8,7 @@ import {
import { ModalCloseButton } from '@/ui/modal';
import { Button } from '@/ui/button';
import { leaveWorkspace } from '@pathfinder/data-services';
import { Router, useRouter } from 'next/router';
import { useRouter } from 'next/router';
import { useAppState } from '@/providers/app-state-provider';
interface WorkspaceDeleteProps {
+1
View File
@@ -92,6 +92,7 @@ const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run dev',
port: 8080,
reuseExistingServer: true,
},
};
+15 -15
View File
@@ -36,10 +36,10 @@ importers:
packages/app:
specifiers:
'@blocksuite/blocks': 0.3.0-20221223060814-a3b97f6
'@blocksuite/editor': 0.3.0-20221223060814-a3b97f6
'@blocksuite/blocks': 0.3.0-20221223070752-455d89c
'@blocksuite/editor': 0.3.0-20221223070752-455d89c
'@blocksuite/icons': ^2.0.2
'@blocksuite/store': 0.3.0-20221223060814-a3b97f6
'@blocksuite/store': 0.3.0-20221223070752-455d89c
'@emotion/css': ^11.10.0
'@emotion/react': ^11.10.4
'@emotion/server': ^11.10.0
@@ -72,10 +72,10 @@ importers:
react-i18next: ^11.18.4
typescript: 4.8.3
dependencies:
'@blocksuite/blocks': 0.3.0-20221223060814-a3b97f6
'@blocksuite/editor': 0.3.0-20221223060814-a3b97f6
'@blocksuite/blocks': 0.3.0-20221223070752-455d89c
'@blocksuite/editor': 0.3.0-20221223070752-455d89c
'@blocksuite/icons': 2.0.2_w5j4k42lgipnm43s3brx6h3c34
'@blocksuite/store': 0.3.0-20221223060814-a3b97f6
'@blocksuite/store': 0.3.0-20221223070752-455d89c
'@emotion/css': 11.10.0
'@emotion/react': 11.10.4_w5j4k42lgipnm43s3brx6h3c34
'@emotion/server': 11.10.0_@emotion+css@11.10.0
@@ -511,10 +511,10 @@ packages:
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
dev: true
/@blocksuite/blocks/0.3.0-20221223060814-a3b97f6:
resolution: {integrity: sha512-5YRdyy4ViLnTZH6oB8CeEBrRPsdyHdw3iE7mER4Up5UQWsfrH8Ha7t9fSDXsmm0/ybxPqY4YeCrYx2ifubbEOw==}
/@blocksuite/blocks/0.3.0-20221223070752-455d89c:
resolution: {integrity: sha512-5Bz4RERqe+C/r2ICObeIo5kClN12S+MwYJmq7lThSAN2Wg2dfCH6InV0AdVVjoOYWMdWXZZqXm6eTWBRwWL4Ug==}
dependencies:
'@blocksuite/store': 0.3.0-20221223060814-a3b97f6
'@blocksuite/store': 0.3.0-20221223070752-455d89c
'@tldraw/intersect': 1.8.0
highlight.js: 11.7.0
hotkeys-js: 3.10.0
@@ -528,11 +528,11 @@ packages:
- utf-8-validate
dev: false
/@blocksuite/editor/0.3.0-20221223060814-a3b97f6:
resolution: {integrity: sha512-wLNjthxSY4NYLBBtFNb/B8lq1ITtYWqQjvmuoajkcHPnjkOrK9mja+Mxln8ngc+5/XrVi79iAwz/KQ8lW8Pd2w==}
/@blocksuite/editor/0.3.0-20221223070752-455d89c:
resolution: {integrity: sha512-sviPTDjw4P4o+bAqglVJApo7cHIDlBy4ED2m0I52Gwc3HOTUeKC/yKBrHm2+FCyWzJRmv/kUQ2xlTqkoL/J9dQ==}
dependencies:
'@blocksuite/blocks': 0.3.0-20221223060814-a3b97f6
'@blocksuite/store': 0.3.0-20221223060814-a3b97f6
'@blocksuite/blocks': 0.3.0-20221223070752-455d89c
'@blocksuite/store': 0.3.0-20221223070752-455d89c
lit: 2.4.0
marked: 4.1.1
turndown: 7.1.1
@@ -552,8 +552,8 @@ packages:
react: 18.2.0
dev: false
/@blocksuite/store/0.3.0-20221223060814-a3b97f6:
resolution: {integrity: sha512-M+8IQ8B9nKXvDVPGSPUZ3Vd3QkvZbA4eluuH0ywIgcz4SmA4EVUrDh1KwM1rzQNlcREbntuzYu2Xbl3oJ7d+gQ==}
/@blocksuite/store/0.3.0-20221223070752-455d89c:
resolution: {integrity: sha512-pkfhyVA+5vHq+DRDRO0+SlN+e749cJu4oOFc6dcnv+F+ee7jFrc9fHJ+SQRg/XfPHKfY02QZlcTTNaSmvK3njQ==}
dependencies:
'@types/flexsearch': 0.7.3
'@types/quill': 1.3.10
+1 -1
View File
@@ -31,7 +31,7 @@ test.describe('Change page mode(Paper or Edgeless)', () => {
// (box?.y ?? 0) + 5
// );
const edgelessDom = page.locator('edgeless-page-block');
const edgelessDom = page.locator('affine-edgeless-page');
await expect(await edgelessDom.isVisible()).toBe(true);
});
+2 -11
View File
@@ -4,17 +4,8 @@ import { loadPage } from './libs/load-page';
loadPage();
test.describe('Open contact us', () => {
test('Click left-top corner Logo', async ({ page }) => {
const leftTopCorner = page.locator('[data-testid=left-top-corner-logo]');
await leftTopCorner.click();
const contactUsModal = page.locator(
'[data-testid=contact-us-modal-content]'
);
await expect(contactUsModal).toContainText('Join our community.');
});
test('Click right-bottom corner contact icon', async ({ page }) => {
page.waitForTimeout(1000);
const faqIcon = page.locator('[data-testid=faq-icon]');
const box = await faqIcon.boundingBox();
await expect(box?.x).not.toBeUndefined();
@@ -30,6 +21,6 @@ test.describe('Open contact us', () => {
const contactUsModal = page.locator(
'[data-testid=contact-us-modal-content]'
);
await expect(contactUsModal).toContainText('Join our community.');
await expect(contactUsModal).toContainText('AFFiNE Community');
});
});
+2 -2
View File
@@ -5,9 +5,9 @@ loadPage();
// ps aux | grep 8080
test.describe('exception page', () => {
test('bisit 404 page', async ({ page }) => {
test('visit 404 page', async ({ page }) => {
await page.goto('http://localhost:8080/404');
await page.waitForTimeout(300);
await page.waitForTimeout(1000);
const notFoundTipDom = await page.getByText('404 - Page Not Found');
await expect(await notFoundTipDom.isVisible()).toBe(true);
+5 -3
View File
@@ -61,13 +61,14 @@ test.describe('Open quick search', () => {
});
test.describe('Add new page in quick search', () => {
test('Create a new page without keyword', async ({ page }) => {
//TODO FIXME: This test is not working
test.skip('Create a new page without keyword', async ({ page }) => {
await openQuickSearchByShortcut(page);
const addNewPage = page.locator('[data-testid=quickSearch-addNewPage]');
await addNewPage.click();
await assertTitleTexts(page, [''], { delay: 50 });
});
test('Create a new page with keyword', async ({ page }) => {
test.skip('Create a new page with keyword', async ({ page }) => {
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test');
const addNewPage = page.locator('[data-testid=quickSearch-addNewPage]');
@@ -84,7 +85,8 @@ test.describe('Search and select', () => {
delay: 50,
});
});
test('Create a new page and search this page', async ({ page }) => {
//TODO FIXME: This test is not working
test.skip('Create a new page and search this page', async ({ page }) => {
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('Welcome');
const addNewPage = page.locator('[data-testid=quickSearch-addNewPage]');