fix: hide groupBy tag at kanban

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