Skip to content

Commit 17696d8

Browse files
committed
refactor(web): hide any tab that has empty content (court description)
1 parent 02941a7 commit 17696d8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

web/src/pages/Courts/CourtDetails/Description.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ const TABS = [
1717
text: "Purpose",
1818
value: 0,
1919
path: "purpose",
20+
isVisible: (policy: any) => !!policy?.description,
2021
},
2122
{
2223
text: "Skills",
2324
value: 1,
2425
path: "skills",
26+
isVisible: (policy: any) => !!policy?.requiredSkills,
2527
},
2628
{
2729
text: "Policy",
2830
value: 2,
2931
path: "policy",
32+
isVisible: (policy: any) => !!policy?.summary,
3033
},
3134
];
3235

@@ -43,12 +46,7 @@ const Description: React.FC = () => {
4346
[currentPathName]
4447
);
4548

46-
const filteredTabs = TABS.filter((tab) => {
47-
if (tab.path === "skills" && !policy?.requiredSkills) {
48-
return false;
49-
}
50-
return true;
51-
});
49+
const filteredTabs = TABS.filter(({ isVisible }) => isVisible(policy));
5250

5351
return (
5452
<Container>

0 commit comments

Comments
 (0)