fix: hide groupBy tag at kanban

This commit is contained in:
lawvs
2022-07-28 15:46:55 +08:00
parent 986b9f45a4
commit 1dfb241eee

View File

@@ -1,15 +1,20 @@
import React, { useRef, useState } from 'react';
import { AsyncBlock } from '../../editor';
import { getRecastItemValue, useRecastBlockMeta } from '../../recast-block';
import {
MuiZoom,
Popover,
PopperHandler,
styled,
} from '@toeverything/components/ui';
import { PendantTag } from '../PendantTag';
import { UpdatePendantPanel } from '../pendant-operation-panel';
import { useRef, useState } from 'react';
import { AsyncBlock } from '../../editor';
import {
getRecastItemValue,
RecastScene,
useCurrentView,
useRecastBlockMeta,
} from '../../recast-block';
import { AddPendantPopover } from '../AddPendantPopover';
import { UpdatePendantPanel } from '../pendant-operation-panel';
import { PendantTag } from '../PendantTag';
export const PendantRender = ({ block }: { block: AsyncBlock }) => {
const popoverHandlerRef = useRef<{ [key: string]: PopperHandler }>({});
@@ -17,7 +22,8 @@ export const PendantRender = ({ block }: { block: AsyncBlock }) => {
const [showAddBtn, setShowAddBtn] = useState(false);
const { getProperties } = useRecastBlockMeta();
const [currentView] = useCurrentView();
const isKanbanView = currentView.type === RecastScene.Kanban;
const { getValue, removeValue } = getRecastItemValue(block);
const properties = getProperties();
@@ -41,6 +47,11 @@ export const PendantRender = ({ block }: { block: AsyncBlock }) => {
return null;
}
// Hide the groupBy pendant at kanban view
if (isKanbanView && currentView.groupBy === property.id) {
return null;
}
const { id } = value;
return (