mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-24 22:09:08 +08:00
@@ -5,6 +5,7 @@ import {
|
||||
useLiveData,
|
||||
useService,
|
||||
} from '@toeverything/infra';
|
||||
import clsx from 'clsx';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { ToolContainer } from '../../workspace';
|
||||
@@ -14,6 +15,7 @@ import {
|
||||
aiIslandBtn,
|
||||
aiIslandWrapper,
|
||||
gradient,
|
||||
toolStyle,
|
||||
} from './styles.css';
|
||||
|
||||
const RIGHT_SIDEBAR_AI_HAS_EVER_OPENED_KEY =
|
||||
@@ -49,7 +51,7 @@ export const AIIsland = () => {
|
||||
}, [activeTab, haveChatTab, sidebarOpen]);
|
||||
|
||||
return (
|
||||
<ToolContainer>
|
||||
<ToolContainer className={clsx(toolStyle, { hide })}>
|
||||
<div
|
||||
className={aiIslandWrapper}
|
||||
data-hide={hide}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import { cssVar } from '@toeverything/theme';
|
||||
import { createVar, keyframes, style } from '@vanilla-extract/css';
|
||||
|
||||
export const toolStyle = style({
|
||||
selectors: {
|
||||
'&.hide': {
|
||||
pointerEvents: 'none',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const aiIslandWrapper = style({
|
||||
width: 44,
|
||||
height: 44,
|
||||
|
||||
@@ -71,7 +71,9 @@ export const MainContainer = forwardRef<
|
||||
|
||||
MainContainer.displayName = 'MainContainer';
|
||||
|
||||
export const ToolContainer = (props: PropsWithChildren): ReactElement => {
|
||||
export const ToolContainer = (
|
||||
props: PropsWithChildren<{ className?: string }>
|
||||
): ReactElement => {
|
||||
const docId = useLiveData(
|
||||
useService(GlobalContextService).globalContext.docId.$
|
||||
);
|
||||
@@ -79,11 +81,7 @@ export const ToolContainer = (props: PropsWithChildren): ReactElement => {
|
||||
const doc = useLiveData(docId ? docRecordList.doc$(docId) : undefined);
|
||||
const inTrash = useLiveData(doc?.meta$)?.trash;
|
||||
return (
|
||||
<div
|
||||
className={clsx(toolStyle, {
|
||||
trash: inTrash,
|
||||
})}
|
||||
>
|
||||
<div className={clsx(toolStyle, { trash: inTrash }, props.className)}>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user