chore: clean code
This commit is contained in:
@@ -10,13 +10,12 @@ import {
|
|||||||
MuiClickAwayListener,
|
MuiClickAwayListener,
|
||||||
styled,
|
styled,
|
||||||
} from '@toeverything/components/ui';
|
} from '@toeverything/components/ui';
|
||||||
import { useFlag } from '@toeverything/datasource/feature-flags';
|
|
||||||
import { useState, type MouseEvent } from 'react';
|
import { useState, type MouseEvent } from 'react';
|
||||||
import { useRefPage } from './RefPage';
|
import { useRefPage } from './RefPage';
|
||||||
|
|
||||||
const CardContent = styled('div')(({ theme }) => ({
|
const CardContent = styled('div')({
|
||||||
margin: '20px',
|
margin: '20px',
|
||||||
}));
|
});
|
||||||
|
|
||||||
const CardActions = styled('div')({
|
const CardActions = styled('div')({
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
@@ -86,7 +85,6 @@ export const CardItem = ({ block }: { block: KanbanCard['block'] }) => {
|
|||||||
const { addSubItem } = useKanban();
|
const { addSubItem } = useKanban();
|
||||||
const { openSubPage } = useRefPage();
|
const { openSubPage } = useRefPage();
|
||||||
const [editableBlock, setEditableBlock] = useState<string | null>(null);
|
const [editableBlock, setEditableBlock] = useState<string | null>(null);
|
||||||
const showKanbanRefPageFlag = useFlag('ShowKanbanRefPage', false);
|
|
||||||
const { editor } = useEditor();
|
const { editor } = useEditor();
|
||||||
|
|
||||||
const onAddItem = async () => {
|
const onAddItem = async () => {
|
||||||
@@ -113,7 +111,7 @@ export const CardItem = ({ block }: { block: KanbanCard['block'] }) => {
|
|||||||
activeBlock={editableBlock}
|
activeBlock={editableBlock}
|
||||||
/>
|
/>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
{showKanbanRefPageFlag && !editableBlock && (
|
{!editableBlock && (
|
||||||
<Overlay onClick={onClickCard}>
|
<Overlay onClick={onClickCard}>
|
||||||
<IconButton backgroundColor="#fff" onClick={onClickPen}>
|
<IconButton backgroundColor="#fff" onClick={onClickPen}>
|
||||||
<PenIcon />
|
<PenIcon />
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import type { PropsWithChildren } from 'react';
|
|
||||||
import { styled } from '@toeverything/components/ui';
|
import { styled } from '@toeverything/components/ui';
|
||||||
|
import type { PropsWithChildren } from 'react';
|
||||||
|
import { useRef } from 'react';
|
||||||
import type { AsyncBlock } from '../editor';
|
import type { AsyncBlock } from '../editor';
|
||||||
|
import { getRecastItemValue, useRecastBlockMeta } from '../recast-block';
|
||||||
import { PendantPopover } from './pendant-popover';
|
import { PendantPopover } from './pendant-popover';
|
||||||
import { PendantRender } from './pendant-render';
|
import { PendantRender } from './pendant-render';
|
||||||
import { useRef } from 'react';
|
|
||||||
import { getRecastItemValue, useRecastBlockMeta } from '../recast-block';
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { ComponentType, ReactElement } from 'react';
|
|
||||||
import type { Column } from '@toeverything/datasource/db-service';
|
import type { Column } from '@toeverything/datasource/db-service';
|
||||||
import {
|
import {
|
||||||
ArrayOperation,
|
ArrayOperation,
|
||||||
BlockDecoration,
|
BlockDecoration,
|
||||||
MapOperation,
|
MapOperation,
|
||||||
} from '@toeverything/datasource/jwt';
|
} from '@toeverything/datasource/jwt';
|
||||||
|
import type { ComponentType, ReactElement } from 'react';
|
||||||
import type { EventData } from '../block';
|
import type { EventData } from '../block';
|
||||||
import { AsyncBlock } from '../block';
|
import { AsyncBlock } from '../block';
|
||||||
|
import { HTML2BlockResult } from '../clipboard';
|
||||||
import type { Editor } from '../editor';
|
import type { Editor } from '../editor';
|
||||||
import { SelectBlock } from '../selection';
|
import { SelectBlock } from '../selection';
|
||||||
import { HTML2BlockResult } from '../clipboard';
|
|
||||||
export interface CreateView {
|
export interface CreateView {
|
||||||
block: AsyncBlock;
|
block: AsyncBlock;
|
||||||
editor: Editor;
|
editor: Editor;
|
||||||
|
|||||||
@@ -358,6 +358,7 @@ export const useKanban = () => {
|
|||||||
}
|
}
|
||||||
card.append(newBlock);
|
card.append(newBlock);
|
||||||
editor.selectionManager.activeNodeByNodeId(newBlock.id);
|
editor.selectionManager.activeNodeByNodeId(newBlock.id);
|
||||||
|
return newBlock;
|
||||||
},
|
},
|
||||||
[editor]
|
[editor]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Protocol } from '@toeverything/datasource/db-service';
|
import { Protocol } from '@toeverything/datasource/db-service';
|
||||||
import type { AsyncBlock, BlockEditor } from '../editor';
|
import type { AsyncBlock, BlockEditor } from '../editor';
|
||||||
import type { RecastBlock } from '.';
|
|
||||||
import { cloneRecastMetaTo, mergeRecastMeta } from './property';
|
import { cloneRecastMetaTo, mergeRecastMeta } from './property';
|
||||||
|
import type { RecastBlock } from './types';
|
||||||
|
|
||||||
const mergeGroupProperties = async (...groups: RecastBlock[]) => {
|
const mergeGroupProperties = async (...groups: RecastBlock[]) => {
|
||||||
const [headGroup, ...restGroups] = groups;
|
const [headGroup, ...restGroups] = groups;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { nanoid } from 'nanoid';
|
|||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { AsyncBlock } from '../editor';
|
import { AsyncBlock } from '../editor';
|
||||||
import { useRecastBlock } from './Context';
|
import { useRecastBlock } from './Context';
|
||||||
|
import { getHistory, removeHistory, setHistory } from './history';
|
||||||
import type { RecastBlock, RecastItem, StatusProperty } from './types';
|
import type { RecastBlock, RecastItem, StatusProperty } from './types';
|
||||||
import {
|
import {
|
||||||
META_PROPERTIES_KEY,
|
META_PROPERTIES_KEY,
|
||||||
@@ -15,7 +16,6 @@ import {
|
|||||||
SelectProperty,
|
SelectProperty,
|
||||||
TABLE_VALUES_KEY,
|
TABLE_VALUES_KEY,
|
||||||
} from './types';
|
} from './types';
|
||||||
import { getHistory, removeHistory, setHistory } from './history';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a unique id for a property
|
* Generate a unique id for a property
|
||||||
@@ -275,7 +275,7 @@ const isSelectLikeProperty = (
|
|||||||
metaProperty?: RecastMetaProperty
|
metaProperty?: RecastMetaProperty
|
||||||
): metaProperty is SelectProperty | MultiSelectProperty | StatusProperty => {
|
): metaProperty is SelectProperty | MultiSelectProperty | StatusProperty => {
|
||||||
return (
|
return (
|
||||||
metaProperty &&
|
!!metaProperty &&
|
||||||
(metaProperty.type === PropertyType.Status ||
|
(metaProperty.type === PropertyType.Status ||
|
||||||
metaProperty.type === PropertyType.Select ||
|
metaProperty.type === PropertyType.Select ||
|
||||||
metaProperty.type === PropertyType.MultiSelect)
|
metaProperty.type === PropertyType.MultiSelect)
|
||||||
|
|||||||
Reference in New Issue
Block a user