diff --git a/packages/frontend/component/src/ui/divider/divider.tsx b/packages/frontend/component/src/ui/divider/divider.tsx index a012f917c2..c5a0cc4f8c 100644 --- a/packages/frontend/component/src/ui/divider/divider.tsx +++ b/packages/frontend/component/src/ui/divider/divider.tsx @@ -1,3 +1,4 @@ +import { assignInlineVars } from '@vanilla-extract/dynamic'; import clsx from 'clsx'; import type { HTMLAttributes, PropsWithChildren } from 'react'; import { forwardRef } from 'react'; @@ -8,6 +9,7 @@ export type DividerProps = PropsWithChildren & Omit, 'type'> & { orientation?: DividerOrientation; size?: 'thinner' | 'default'; + space?: number; dividerColor?: string; }; @@ -16,6 +18,7 @@ export const Divider = forwardRef( { orientation = 'horizontal', size = 'default', + space: propSpace, dividerColor, style, className, @@ -23,6 +26,8 @@ export const Divider = forwardRef( }, ref ) => { + const space = propSpace ?? (orientation === 'horizontal' ? 8 : 2); + return (
( style={{ borderColor: dividerColor ? dividerColor : undefined, ...style, + ...assignInlineVars({ [styles.dividerSpace]: `${space}px` }), }} {...otherProps} /> diff --git a/packages/frontend/component/src/ui/divider/style.css.ts b/packages/frontend/component/src/ui/divider/style.css.ts index a20aa3f153..cce083524d 100644 --- a/packages/frontend/component/src/ui/divider/style.css.ts +++ b/packages/frontend/component/src/ui/divider/style.css.ts @@ -1,9 +1,15 @@ import { cssVar } from '@toeverything/theme'; -import { style } from '@vanilla-extract/css'; +import { createVar, style } from '@vanilla-extract/css'; + +export const dividerSpace = createVar('dividerSpace'); + export const divider = style({ + vars: { + [dividerSpace]: '8px', + }, borderBottom: `1px solid ${cssVar('borderColor')}`, height: 0, - margin: '8px 0', + margin: `${dividerSpace} 0`, width: '100%', }); @@ -11,7 +17,7 @@ export const verticalDivider = style({ borderLeft: `1px solid ${cssVar('borderColor')}`, width: 0, height: '100%', - margin: '0 2px', + margin: `0 ${dividerSpace}`, }); export const thinner = style({ diff --git a/packages/frontend/core/src/components/affine/empty/docs.tsx b/packages/frontend/core/src/components/affine/empty/docs.tsx index 16eae21104..da67431077 100644 --- a/packages/frontend/core/src/components/affine/empty/docs.tsx +++ b/packages/frontend/core/src/components/affine/empty/docs.tsx @@ -19,11 +19,13 @@ export interface EmptyDocsProps extends UniversalEmptyProps { * Used for "New doc", if provided, new doc will be created with this tag. */ tagId?: string; + allowCreate?: boolean; } export const EmptyDocs = ({ type = 'all', tagId, + allowCreate = true, ...props }: EmptyDocsProps) => { const t = useI18n(); @@ -56,7 +58,7 @@ export const EmptyDocs = ({ : t['com.affine.empty.docs.all-description']() } action={ - showActionButton ? ( + allowCreate && showActionButton ? ( }> {t['com.affine.empty.docs.action.new-doc']()} diff --git a/packages/frontend/core/src/components/explorer/display-menu/index.tsx b/packages/frontend/core/src/components/explorer/display-menu/index.tsx index 00347510be..9e7b68d7e9 100644 --- a/packages/frontend/core/src/components/explorer/display-menu/index.tsx +++ b/packages/frontend/core/src/components/explorer/display-menu/index.tsx @@ -81,12 +81,13 @@ const ExplorerDisplayMenu = ({
- + - + + - -
- {t['com.affine.all-docs.display.list-view']()} -
-
- - -
+ {displayPreference.view === 'list' ? ( + <> + +
+ {t['com.affine.all-docs.display.list-view']()} +
+
+ + +
+ + ) : null} ); }; diff --git a/packages/frontend/core/src/components/explorer/docs-view/docs-list.tsx b/packages/frontend/core/src/components/explorer/docs-view/docs-list.tsx index 6c0c8366aa..aeda10cb8d 100644 --- a/packages/frontend/core/src/components/explorer/docs-view/docs-list.tsx +++ b/packages/frontend/core/src/components/explorer/docs-view/docs-list.tsx @@ -11,6 +11,7 @@ import { useLiveData, useService } from '@toeverything/infra'; import { cssVarV2 } from '@toeverything/theme/v2'; import { memo, useCallback, useContext, useEffect, useMemo } from 'react'; +import { EmptyDocs } from '../../affine/empty'; import { ListFloatingToolbar } from '../../page-list/components/list-floating-toolbar'; import { SystemPropertyTypes } from '../../system-property-types'; import { WorkspacePropertyTypes } from '../../workspace-property-types'; @@ -228,6 +229,12 @@ export const DocsExplorer = ({ [] ); + const isEmpty = masonryItems.length === 0; + + if (isEmpty) { + return ; + } + return ( <> void } & MenuProps) => { + const menuRef = useRef(null); + + useEffect(() => { + if (isDraft) { + menuRef.current?.changeOpen(true); + } + }, [isDraft]); + + return ( + + ); +}; diff --git a/packages/frontend/core/src/components/system-property-types/favorite.tsx b/packages/frontend/core/src/components/system-property-types/favorite.tsx index b11b04f541..61626fd095 100644 --- a/packages/frontend/core/src/components/system-property-types/favorite.tsx +++ b/packages/frontend/core/src/components/system-property-types/favorite.tsx @@ -1,6 +1,7 @@ -import { Menu, MenuItem, type MenuRef } from '@affine/component'; +import { MenuItem } from '@affine/component'; import type { FilterParams } from '@affine/core/modules/collection-rules'; -import { useEffect, useRef } from 'react'; + +import { FilterValueMenu } from '../filter/filter-value-menu'; export const FavoriteFilterValue = ({ filter, @@ -13,20 +14,10 @@ export const FavoriteFilterValue = ({ onDraftCompleted?: () => void; onChange?: (filter: FilterParams) => void; }) => { - const menuRef = useRef(null); - - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); - return ( - {filter.value === 'true' ? 'True' : 'False'} - + ); }; diff --git a/packages/frontend/core/src/components/system-property-types/integration-type.tsx b/packages/frontend/core/src/components/system-property-types/integration-type.tsx index 9a719c5fc0..17ca01ba1a 100644 --- a/packages/frontend/core/src/components/system-property-types/integration-type.tsx +++ b/packages/frontend/core/src/components/system-property-types/integration-type.tsx @@ -1,14 +1,17 @@ -import { Menu, MenuItem, type MenuRef } from '@affine/component'; +import { MenuItem } from '@affine/component'; import type { FilterParams } from '@affine/core/modules/collection-rules'; import type { DocRecord } from '@affine/core/modules/doc'; +import { IntegrationTypeIcon } from '@affine/core/modules/integration'; +import { INTEGRATION_TYPE_NAME_MAP } from '@affine/core/modules/integration/constant'; +import type { IntegrationType } from '@affine/core/modules/integration/type'; import { useI18n } from '@affine/i18n'; import { IntegrationsIcon, ReadwiseIcon } from '@blocksuite/icons/rc'; import { useLiveData } from '@toeverything/infra'; -import { useEffect, useRef } from 'react'; import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; export const IntegrationTypeFilterValue = ({ filter, @@ -22,41 +25,37 @@ export const IntegrationTypeFilterValue = ({ onChange?: (filter: FilterParams) => void; }) => { const t = useI18n(); - const menuRef = useRef(null); - - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); return ( - { - onChange?.({ - ...filter, - value: 'readwise', - }); - }} - prefixIcon={} - selected={filter.value === 'readwise'} - > - {t['com.affine.integration.readwise.name']()} - - } + { + const type = entries[0] as IntegrationType; + const i18nKey = entries[1]; + return ( + { + onChange?.({ + ...filter, + value: type, + }); + }} + prefixIcon={} + selected={filter.value === type} + > + {t.t(i18nKey)} + + ); + })} > - {filter.value === 'readwise' - ? t['com.affine.integration.readwise.name']() + {INTEGRATION_TYPE_NAME_MAP[filter.value as IntegrationType] + ? t.t(INTEGRATION_TYPE_NAME_MAP[filter.value as IntegrationType]) : filter.value} - + ); }; diff --git a/packages/frontend/core/src/components/system-property-types/shared.tsx b/packages/frontend/core/src/components/system-property-types/shared.tsx index cb7db2559e..6a8074aa4d 100644 --- a/packages/frontend/core/src/components/system-property-types/shared.tsx +++ b/packages/frontend/core/src/components/system-property-types/shared.tsx @@ -1,6 +1,7 @@ -import { Menu, MenuItem, type MenuRef } from '@affine/component'; +import { MenuItem } from '@affine/component'; import type { FilterParams } from '@affine/core/modules/collection-rules'; -import { useEffect, useRef } from 'react'; + +import { FilterValueMenu } from '../filter/filter-value-menu'; export const SharedFilterValue = ({ filter, @@ -13,20 +14,10 @@ export const SharedFilterValue = ({ onDraftCompleted?: () => void; onChange?: (filter: FilterParams) => void; }) => { - const menuRef = useRef(null); - - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); - return ( - {filter.value === 'true' ? 'True' : 'False'} - + ); }; diff --git a/packages/frontend/core/src/components/workspace-property-types/checkbox.tsx b/packages/frontend/core/src/components/workspace-property-types/checkbox.tsx index c5883609bb..90d7e14944 100644 --- a/packages/frontend/core/src/components/workspace-property-types/checkbox.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/checkbox.tsx @@ -1,18 +1,13 @@ -import { - Checkbox, - Menu, - MenuItem, - type MenuRef, - PropertyValue, -} from '@affine/component'; +import { Checkbox, MenuItem, PropertyValue } from '@affine/component'; import type { FilterParams } from '@affine/core/modules/collection-rules'; import { useI18n } from '@affine/i18n'; import { CheckBoxCheckLinearIcon } from '@blocksuite/icons/rc'; -import { useCallback, useEffect, useRef } from 'react'; +import { useCallback } from 'react'; import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { DocListPropertyProps, GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; import type { PropertyValueProps } from '../properties/types'; import * as styles from './checkbox.css'; @@ -55,20 +50,10 @@ export const CheckboxFilterValue = ({ onDraftCompleted?: () => void; onChange?: (filter: FilterParams) => void; }) => { - const menuRef = useRef(null); - - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); - return ( - {filter.value === 'true' ? 'True' : 'False'} - + ); }; diff --git a/packages/frontend/core/src/components/workspace-property-types/created-updated-by.css.ts b/packages/frontend/core/src/components/workspace-property-types/created-updated-by.css.ts index cd726f627c..2bbb1ea0ad 100644 --- a/packages/frontend/core/src/components/workspace-property-types/created-updated-by.css.ts +++ b/packages/frontend/core/src/components/workspace-property-types/created-updated-by.css.ts @@ -9,3 +9,7 @@ export const userLabelContainer = style({ display: 'flex', alignItems: 'center', }); + +export const filterValueMenu = style({ + top: 'calc(var(--radix-popper-anchor-height) - 18px) !important', +}); diff --git a/packages/frontend/core/src/components/workspace-property-types/created-updated-by.tsx b/packages/frontend/core/src/components/workspace-property-types/created-updated-by.tsx index 3fdd9a450c..6a6cc63a70 100644 --- a/packages/frontend/core/src/components/workspace-property-types/created-updated-by.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/created-updated-by.tsx @@ -160,6 +160,7 @@ export const CreatedByUpdatedByFilterValue = ({ onChange={handleChange} ref={menuRef} onEditorClose={onDraftCompleted} + menuClassName={styles.filterValueMenu} /> ); }; diff --git a/packages/frontend/core/src/components/workspace-property-types/date.tsx b/packages/frontend/core/src/components/workspace-property-types/date.tsx index 74f5bb4fff..a571ecf6ed 100644 --- a/packages/frontend/core/src/components/workspace-property-types/date.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/date.tsx @@ -19,6 +19,7 @@ import { import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { DocListPropertyProps, GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; import { FilterOptionsGroup } from '../filter/options'; import type { PropertyValueProps } from '../properties/types'; import * as styles from './date.css'; @@ -123,11 +124,14 @@ const DateSelectorMenu = ({ ); return ( - } > {value ? ( @@ -137,7 +141,7 @@ const DateSelectorMenu = ({ {t['com.affine.filter.empty']()} )} - + ); }; diff --git a/packages/frontend/core/src/components/workspace-property-types/doc-primary-mode.tsx b/packages/frontend/core/src/components/workspace-property-types/doc-primary-mode.tsx index 947e56fa6a..80099cbee9 100644 --- a/packages/frontend/core/src/components/workspace-property-types/doc-primary-mode.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/doc-primary-mode.tsx @@ -1,7 +1,5 @@ import { - Menu, MenuItem, - type MenuRef, notify, PropertyValue, type RadioItem, @@ -12,11 +10,12 @@ import { useI18n } from '@affine/i18n'; import type { DocMode } from '@blocksuite/affine/model'; import { EdgelessIcon, PageIcon } from '@blocksuite/icons/rc'; import { useLiveData, useService } from '@toeverything/infra'; -import { useCallback, useEffect, useMemo, useRef } from 'react'; +import { useCallback, useMemo } from 'react'; import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { DocListPropertyProps, GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; import type { PropertyValueProps } from '../properties/types'; import { PropertyRadioGroup } from '../properties/widgets/radio-group'; import * as styles from './doc-primary-mode.css'; @@ -89,20 +88,11 @@ export const DocPrimaryModeFilterValue = ({ onChange?: (filter: FilterParams) => void; }) => { const t = useI18n(); - const menuRef = useRef(null); - - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); return ( - {filter.value === 'edgeless' ? t['Edgeless']() : t['Page']()} - + ); }; diff --git a/packages/frontend/core/src/components/workspace-property-types/edgeless-theme.tsx b/packages/frontend/core/src/components/workspace-property-types/edgeless-theme.tsx index 5dcd328b8e..7bd62fb6b9 100644 --- a/packages/frontend/core/src/components/workspace-property-types/edgeless-theme.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/edgeless-theme.tsx @@ -1,20 +1,15 @@ -import { - Menu, - MenuItem, - type MenuRef, - PropertyValue, - type RadioItem, -} from '@affine/component'; +import { MenuItem, PropertyValue, type RadioItem } from '@affine/component'; import type { FilterParams } from '@affine/core/modules/collection-rules'; import { type DocRecord, DocService } from '@affine/core/modules/doc'; import { useI18n } from '@affine/i18n'; import { EdgelessIcon } from '@blocksuite/icons/rc'; import { useLiveData, useService } from '@toeverything/infra'; -import { useCallback, useEffect, useMemo, useRef } from 'react'; +import { useCallback, useMemo } from 'react'; import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; import type { PropertyValueProps } from '../properties/types'; import { PropertyRadioGroup } from '../properties/widgets/radio-group'; import * as styles from './edgeless-theme.css'; @@ -97,20 +92,11 @@ export const EdgelessThemeFilterValue = ({ onChange?: (filter: FilterParams) => void; }) => { const t = useI18n(); - const menuRef = useRef(null); - - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); return ( - - + ); }; diff --git a/packages/frontend/core/src/components/workspace-property-types/journal.tsx b/packages/frontend/core/src/components/workspace-property-types/journal.tsx index 565d1af4c2..82f21d8383 100644 --- a/packages/frontend/core/src/components/workspace-property-types/journal.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/journal.tsx @@ -3,7 +3,6 @@ import { DatePicker, Menu, MenuItem, - type MenuRef, PropertyValue, } from '@affine/component'; import { MobileJournalConflictList } from '@affine/core/mobile/pages/workspace/detail/menu/journal-conflicts'; @@ -25,6 +24,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { DocListPropertyProps, GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; import type { PropertyValueProps } from '../properties/types'; import * as styles from './journal.css'; @@ -192,20 +192,10 @@ export const JournalFilterValue = ({ onDraftCompleted?: () => void; onChange?: (filter: FilterParams) => void; }) => { - const menuRef = useRef(null); - - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); - return ( - {filter.value === 'true' ? 'True' : 'False'} - + ); }; diff --git a/packages/frontend/core/src/components/workspace-property-types/number.tsx b/packages/frontend/core/src/components/workspace-property-types/number.tsx index 863847495a..98ccf13492 100644 --- a/packages/frontend/core/src/components/workspace-property-types/number.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/number.tsx @@ -1,4 +1,4 @@ -import { Input, Menu, type MenuRef, PropertyValue } from '@affine/component'; +import { Input, PropertyValue } from '@affine/component'; import type { FilterParams } from '@affine/core/modules/collection-rules'; import { useI18n } from '@affine/i18n'; import { NumberIcon } from '@blocksuite/icons/rc'; @@ -8,13 +8,13 @@ import { type ChangeEventHandler, useCallback, useEffect, - useRef, useState, } from 'react'; import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; import type { PropertyValueProps } from '../properties/types'; import * as styles from './number.css'; @@ -77,15 +77,8 @@ export const NumberFilterValue = ({ }) => { const [tempValue, setTempValue] = useState(filter.value || ''); const [valueMenuOpen, setValueMenuOpen] = useState(false); - const menuRef = useRef(null); const t = useI18n(); - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); - useEffect(() => { // update temp value with new filter value setTempValue(filter.value || ''); @@ -126,8 +119,7 @@ export const NumberFilterValue = ({ }, [isDraft, filter.method, onDraftCompleted]); return filter.method !== 'is-not-empty' && filter.method !== 'is-empty' ? ( - )} - + ) : null; }; diff --git a/packages/frontend/core/src/components/workspace-property-types/page-width.tsx b/packages/frontend/core/src/components/workspace-property-types/page-width.tsx index 4ffa249398..72895f9eea 100644 --- a/packages/frontend/core/src/components/workspace-property-types/page-width.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/page-width.tsx @@ -1,21 +1,16 @@ -import { - Menu, - MenuItem, - type MenuRef, - PropertyValue, - type RadioItem, -} from '@affine/component'; +import { MenuItem, PropertyValue, type RadioItem } from '@affine/component'; import type { FilterParams } from '@affine/core/modules/collection-rules'; import { type DocRecord, DocService } from '@affine/core/modules/doc'; import { EditorSettingService } from '@affine/core/modules/editor-setting'; import { useI18n } from '@affine/i18n'; import { LongerIcon } from '@blocksuite/icons/rc'; import { useLiveData, useService } from '@toeverything/infra'; -import { useCallback, useEffect, useMemo, useRef } from 'react'; +import { useCallback, useMemo } from 'react'; import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; import type { PropertyValueProps } from '../properties/types'; import { PropertyRadioGroup } from '../properties/widgets/radio-group'; import { container } from './page-width.css'; @@ -99,20 +94,11 @@ export const PageWidthFilterValue = ({ onChange?: (filter: FilterParams) => void; }) => { const t = useI18n(); - const menuRef = useRef(null); - - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); return ( - - + ); }; diff --git a/packages/frontend/core/src/components/workspace-property-types/tags.css.ts b/packages/frontend/core/src/components/workspace-property-types/tags.css.ts index 780e36b94b..2ed733b4a0 100644 --- a/packages/frontend/core/src/components/workspace-property-types/tags.css.ts +++ b/packages/frontend/core/src/components/workspace-property-types/tags.css.ts @@ -24,3 +24,6 @@ export const groupHeaderLabel = style({ alignItems: 'center', gap: 4, }); +export const filterValueMenu = style({ + top: 'calc(var(--radix-popper-anchor-height) - 18px) !important', +}); diff --git a/packages/frontend/core/src/components/workspace-property-types/tags.tsx b/packages/frontend/core/src/components/workspace-property-types/tags.tsx index 05a9e3cebd..8e0d4b24ef 100644 --- a/packages/frontend/core/src/components/workspace-property-types/tags.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/tags.tsx @@ -118,6 +118,7 @@ export const TagsFilterValue = ({ selectedTags={selectedTags} onSelectTag={handleSelectTag} onDeselectTag={handleDeselectTag} + menuClassName={styles.filterValueMenu} tagMode="inline-tag" ref={menuRef} onEditorClose={onDraftCompleted} diff --git a/packages/frontend/core/src/components/workspace-property-types/template.tsx b/packages/frontend/core/src/components/workspace-property-types/template.tsx index 0b4ca6324f..1aabbbf2a9 100644 --- a/packages/frontend/core/src/components/workspace-property-types/template.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/template.tsx @@ -1,20 +1,15 @@ -import { - Checkbox, - Menu, - MenuItem, - type MenuRef, - PropertyValue, -} from '@affine/component'; +import { Checkbox, MenuItem, PropertyValue } from '@affine/component'; import type { FilterParams } from '@affine/core/modules/collection-rules'; import { type DocRecord, DocService } from '@affine/core/modules/doc'; import { useI18n } from '@affine/i18n'; import { TemplateIcon } from '@blocksuite/icons/rc'; import { useLiveData, useService } from '@toeverything/infra'; -import { type ChangeEvent, useCallback, useEffect, useRef } from 'react'; +import { type ChangeEvent, useCallback } from 'react'; import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; import type { PropertyValueProps } from '../properties/types'; import * as styles from './template.css'; @@ -95,20 +90,10 @@ export const TemplateFilterValue = ({ onDraftCompleted?: () => void; onChange?: (filter: FilterParams) => void; }) => { - const menuRef = useRef(null); - - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); - return ( - {filter.value === 'true' ? 'True' : 'False'} - + ); }; diff --git a/packages/frontend/core/src/components/workspace-property-types/text.tsx b/packages/frontend/core/src/components/workspace-property-types/text.tsx index 7e7d165447..0170df3760 100644 --- a/packages/frontend/core/src/components/workspace-property-types/text.tsx +++ b/packages/frontend/core/src/components/workspace-property-types/text.tsx @@ -1,4 +1,4 @@ -import { Input, Menu, type MenuRef, PropertyValue } from '@affine/component'; +import { Input, PropertyValue } from '@affine/component'; import type { FilterParams } from '@affine/core/modules/collection-rules'; import { useI18n } from '@affine/i18n'; import { TextIcon, TextTypeIcon } from '@blocksuite/icons/rc'; @@ -15,6 +15,7 @@ import { import { PlainTextDocGroupHeader } from '../explorer/docs-view/group-header'; import { StackProperty } from '../explorer/docs-view/stack-property'; import type { GroupHeaderProps } from '../explorer/types'; +import { FilterValueMenu } from '../filter/filter-value-menu'; import { ConfigModal } from '../mobile'; import type { PropertyValueProps } from '../properties/types'; import * as styles from './text.css'; @@ -188,15 +189,8 @@ export const TextFilterValue = ({ }) => { const [tempValue, setTempValue] = useState(filter.value || ''); const [valueMenuOpen, setValueMenuOpen] = useState(false); - const menuRef = useRef(null); const t = useI18n(); - useEffect(() => { - if (isDraft) { - menuRef.current?.changeOpen(true); - } - }, [isDraft]); - useEffect(() => { // update temp value with new filter value setTempValue(filter.value || ''); @@ -237,8 +231,8 @@ export const TextFilterValue = ({ }, [isDraft, filter.method, onDraftCompleted]); return filter.method !== 'is-not-empty' && filter.method !== 'is-empty' ? ( - )} - + ) : null; }; diff --git a/packages/frontend/core/src/desktop/pages/workspace/all-page/pinned-collections.css.ts b/packages/frontend/core/src/desktop/pages/workspace/all-page/pinned-collections.css.ts index b75f2a8125..947ec4fab1 100644 --- a/packages/frontend/core/src/desktop/pages/workspace/all-page/pinned-collections.css.ts +++ b/packages/frontend/core/src/desktop/pages/workspace/all-page/pinned-collections.css.ts @@ -45,4 +45,5 @@ export const container = style({ display: 'flex', flexDirection: 'row', gap: 4, + alignItems: 'center', }); diff --git a/packages/frontend/core/src/modules/db/schema/schema.ts b/packages/frontend/core/src/modules/db/schema/schema.ts index 0aa10a03fb..c323fd71b5 100644 --- a/packages/frontend/core/src/modules/db/schema/schema.ts +++ b/packages/frontend/core/src/modules/db/schema/schema.ts @@ -9,7 +9,7 @@ import { nanoid } from 'nanoid'; import type { WorkspacePropertyType } from '../../workspace-property'; -const integrationType = f.enum('readwise', 'zotero'); +const integrationType = f.enum('readwise'); export const AFFiNE_WORKSPACE_DB_SCHEMA = { folders: { diff --git a/packages/frontend/core/src/modules/integration/constant.ts b/packages/frontend/core/src/modules/integration/constant.ts index dce283965a..9db168c7e9 100644 --- a/packages/frontend/core/src/modules/integration/constant.ts +++ b/packages/frontend/core/src/modules/integration/constant.ts @@ -13,7 +13,7 @@ import type { IntegrationProperty, IntegrationType } from './type'; // name export const INTEGRATION_TYPE_NAME_MAP: Record = { readwise: 'com.affine.integration.name.readwise', - zotero: 'Zotero', + // zotero: 'Zotero', }; // schema @@ -50,7 +50,7 @@ export const INTEGRATION_PROPERTY_SCHEMA: { icon: HistoryIcon, }, }, - zotero: {}, + // zotero: {}, }; // icon @@ -59,5 +59,5 @@ export const INTEGRATION_ICON_MAP: Record< React.ComponentType> > = { readwise: ReadwiseLogoDuotoneIcon, - zotero: () => null, + // zotero: () => null, }; diff --git a/packages/frontend/core/src/modules/integration/type.ts b/packages/frontend/core/src/modules/integration/type.ts index 883b2e7971..cff2e1339d 100644 --- a/packages/frontend/core/src/modules/integration/type.ts +++ b/packages/frontend/core/src/modules/integration/type.ts @@ -9,7 +9,6 @@ export type IntegrationType = NonNullable; export type IntegrationDocPropertiesMap = { readwise: ReadwiseDocProperties; - zotero: never; }; export type IntegrationProperty = {