Skip to content

Commit

Permalink
feat: task indicator in neutral color, displayed for everyone
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 committed Sep 19, 2024
1 parent 479a485 commit 0c834fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const Panel = ({
data,
itemsCountFunction,
hideWhenCountZero,
hideCount,
onToggle,
open,
}: Props) => {
Expand All @@ -79,7 +80,7 @@ export const Panel = ({
? itemsCount
: itemsCountFunction?.(data) ?? null;

const hidden = !countContent && hideWhenCountZero;
const hidden = countContent === 0 && hideWhenCountZero;

if (hidden) {
return null;
Expand All @@ -90,7 +91,8 @@ export const Panel = ({
<StyledHeader onMouseDown={(e) => e.preventDefault()}>
{icon}
<StyledName>{name}</StyledName>
{typeof itemsCount === 'number' || itemsCountFunction ? (
{!hideCount &&
(typeof itemsCount === 'number' || itemsCountFunction) ? (
<StyledBadge>{countContent}</StyledBadge>
) : (
<div />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ export type PanelConfig = {
itemsCountFunction?: (props: PanelContentData) => number | React.ReactNode;
displayPanel?: (value: PanelContentData) => boolean;
hideWhenCountZero?: boolean;
hideCount?: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const Tasks: React.FC<PanelContentProps> = ({
};

export const tasksCount = ({ keyData, language }: PanelContentData) => {
return keyData.tasks?.filter((t) => t.languageId === language.id)?.length ?? 0
? '...'
: null;
return (
keyData.tasks?.filter((t) => t.languageId === language.id)?.length ?? 0
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ export const PANELS = [
displayPanel: ({ projectPermissions }) =>
projectPermissions.satisfiesPermission('tasks.view'),
hideWhenCountZero: true,
hideCount: true,
},
] satisfies PanelConfig[];

0 comments on commit 0c834fb

Please sign in to comment.