Skip to content

Commit

Permalink
fix(core): keep the delete button from being blocked (toeverything#6836)
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmFly committed May 9, 2024
1 parent d8b3a0b commit f4a422c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/frontend/core/src/components/workspace/index.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ export const toolStyle = style({
display: 'flex',
flexDirection: 'column',
gap: '12px',
selectors: {
'&.trash': {
bottom: '78px',
},
},
'@media': {
'screen and (max-width: 960px)': {
right: 'calc((100vw - 640px) * 3 / 19 + 14px)',
Expand Down
22 changes: 21 additions & 1 deletion packages/frontend/core/src/components/workspace/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import {
DocsService,
GlobalContextService,
useLiveData,
useService,
} from '@toeverything/infra';
import { clsx } from 'clsx';
import { useAtomValue } from 'jotai';
import type { HTMLAttributes, PropsWithChildren, ReactElement } from 'react';
Expand Down Expand Up @@ -63,7 +69,21 @@ export const MainContainer = forwardRef<
MainContainer.displayName = 'MainContainer';

export const ToolContainer = (props: PropsWithChildren): ReactElement => {
return <div className={toolStyle}>{props.children}</div>;
const docId = useLiveData(
useService(GlobalContextService).globalContext.docId.$
);
const docRecordList = useService(DocsService).list;
const doc = useLiveData(docId ? docRecordList.doc$(docId) : undefined);
const inTrash = useLiveData(doc?.meta$)?.trash;
return (
<div
className={clsx(toolStyle, {
trash: inTrash,
})}
>
{props.children}
</div>
);
};

export const WorkspaceFallback = (): ReactElement => {
Expand Down

0 comments on commit f4a422c

Please sign in to comment.