Skip to content

Commit b41805c

Browse files
committed
refactor(web): hide the Skills tab if empty content
1 parent 0d52e9a commit b41805c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,27 @@ const Description: React.FC = () => {
4242
() => setCurrentTab(TABS.findIndex(({ path }) => path === currentPathName)),
4343
[currentPathName]
4444
);
45+
46+
const filteredTabs = TABS.filter((tab) => {
47+
if (tab.path === "skills" && !policy?.requiredSkills) {
48+
return false;
49+
}
50+
return true;
51+
});
52+
4553
return (
4654
<Container>
4755
<StyledTabs
4856
currentValue={currentTab}
49-
items={TABS}
57+
items={filteredTabs}
5058
callback={(n: number) => {
5159
setCurrentTab(n);
5260
navigate(TABS[n].path);
5361
}}
5462
/>
5563
<Routes>
5664
<Route path="purpose" element={formatMarkdown(policy?.description)} />
57-
<Route path="skills" element={<p></p>} />
65+
<Route path="skills" element={<p>{policy?.requiredSkills}</p>} />
5866
<Route path="policy" element={formatMarkdown(policy?.summary)} />
5967
<Route path="*" element={<Navigate to="purpose" />} />
6068
</Routes>

0 commit comments

Comments
 (0)