Skip to content

Commit 1d329bd

Browse files
committed
fix: fixing bug in court page description redirection
1 parent 772c3a8 commit 1d329bd

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

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

+25-20
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,33 @@ const Description: React.FC = () => {
7070
const handleTabChange = (index: number) => {
7171
navigate(TABS[index].path);
7272
};
73+
console.log({ policy, currentTab, currentPathName });
7374

7475
return (
75-
<Container id="description">
76-
<StyledTabs currentValue={currentTab} items={filteredTabs} callback={handleTabChange} />
77-
<TextContainer>
78-
<Routes>
79-
<Route path="purpose" element={formatMarkdown(policy?.description)} />
80-
<Route path="skills" element={formatMarkdown(policy?.requiredSkills)} />
81-
<Route
82-
path="policy"
83-
element={
84-
policy?.summary ? (
85-
formatMarkdown(policy?.summary)
86-
) : (
87-
<Navigate to={filteredTabs.length > 0 ? filteredTabs[0].path : ""} replace />
88-
)
89-
}
90-
/>
91-
<Route path="*" element={<Navigate to={filteredTabs.length > 0 ? filteredTabs[0].path : ""} replace />} />
92-
</Routes>
93-
</TextContainer>
94-
</Container>
76+
<>
77+
{policy ? (
78+
<Container id="description">
79+
<StyledTabs currentValue={currentTab} items={filteredTabs} callback={handleTabChange} />
80+
<TextContainer>
81+
<Routes>
82+
<Route path="purpose" element={formatMarkdown(policy?.description)} />
83+
<Route path="skills" element={formatMarkdown(policy?.requiredSkills)} />
84+
<Route
85+
path="policy"
86+
element={
87+
policy?.summary.trim() ? (
88+
formatMarkdown(policy.summary)
89+
) : (
90+
<Navigate to={filteredTabs.length > 0 ? filteredTabs[0].path : ""} replace />
91+
)
92+
}
93+
/>
94+
<Route path="*" element={<Navigate to={filteredTabs.length > 0 ? filteredTabs[0].path : ""} replace />} />
95+
</Routes>
96+
</TextContainer>
97+
</Container>
98+
) : null}
99+
</>
95100
);
96101
};
97102

0 commit comments

Comments
 (0)