fix: first workspace name (#1411)

This commit is contained in:
Himself65 2023-03-08 01:44:50 -06:00 committed by GitHub
parent 6d435398e3
commit 75a7e2339c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import { DEFAULT_WORKSPACE_NAME } from '@affine/env'; import { UNTITLED_WORKSPACE_NAME } from '@affine/env';
import { assertExists } from '@blocksuite/store'; import { assertExists } from '@blocksuite/store';
import { useCallback, useEffect, useState } from 'react'; import { useCallback, useEffect, useState } from 'react';
@ -8,7 +8,7 @@ export function useBlockSuiteWorkspaceName(
blockSuiteWorkspace: BlockSuiteWorkspace | null blockSuiteWorkspace: BlockSuiteWorkspace | null
) { ) {
const [name, set] = useState( const [name, set] = useState(
() => blockSuiteWorkspace?.meta.name ?? DEFAULT_WORKSPACE_NAME () => blockSuiteWorkspace?.meta.name ?? UNTITLED_WORKSPACE_NAME
); );
useEffect(() => { useEffect(() => {
if (blockSuiteWorkspace) { if (blockSuiteWorkspace) {

View File

@ -1,2 +1,2 @@
export const DEFAULT_WORKSPACE_NAME = 'Untitled Workspace'; export const DEFAULT_WORKSPACE_NAME = 'Demo Workspace';
export const UNTITLED_WORKSPACE_NAME = 'Untitled'; export const UNTITLED_WORKSPACE_NAME = 'Untitled';

View File

@ -26,7 +26,7 @@ test.describe('Local first create page', () => {
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
const text = await page.getByTestId('workspace-avatar').textContent(); const text = await page.getByTestId('workspace-avatar').textContent();
// default avatar for default workspace // default avatar for default workspace
expect(text).toBe('U'); expect(text).toBe('D');
await page.getByTestId('workspace-name').click(); await page.getByTestId('workspace-name').click();
await page.getByTestId('workspace-card').nth(1).click(); await page.getByTestId('workspace-card').nth(1).click();
const blobUrl = await page const blobUrl = await page

View File

@ -8,7 +8,7 @@ loadPage();
test.describe('Local first default workspace', () => { test.describe('Local first default workspace', () => {
test('preset workspace name', async ({ page }) => { test('preset workspace name', async ({ page }) => {
const workspaceName = page.getByTestId('workspace-name'); const workspaceName = page.getByTestId('workspace-name');
expect(await workspaceName.textContent()).toBe('Untitled Workspace'); expect(await workspaceName.textContent()).toBe('Demo Workspace');
}); });
// test('default workspace avatar', async ({ page }) => { // test('default workspace avatar', async ({ page }) => {