Skip to content

Commit

Permalink
fix: display correct clauses in correct panel
Browse files Browse the repository at this point in the history
  • Loading branch information
ledouxm committed Jun 26, 2024
1 parent dbb555b commit 2c7c34c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/frontend/src/features/menu/ClauseMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export const ClauseMenu = ({ isNational }: { isNational: boolean }) => {
const clausesQuery = useLiveQuery(
db.clause.liveMany({
where: {
udap_id: isNational ? "ALL" : user.udap_id,
key: {
in: isNational ? ["type-espace", "decision"] : ["contacts-utiles", "bonnes-pratiques"],
},
OR: [{ udap_id: "ALL" }, { udap_id: user.udap_id! }],
},
}),
);
Expand All @@ -29,7 +32,7 @@ export const ClauseMenu = ({ isNational }: { isNational: boolean }) => {
<Fragment key={key}>
<Stack gap="16px">
<styled.h2 fontSize="24px" fontWeight="bold">
{key}
{(clauseNameMap as any)[key] ?? key}
</styled.h2>
{clauses.map((clause) => (
<Flex key={clause.value} flexDir="column">
Expand All @@ -53,3 +56,10 @@ export const ClauseMenu = ({ isNational }: { isNational: boolean }) => {
</>
);
};

const clauseNameMap = {
"type-espace": "Type d'espace",
decision: "Décision",
"contacts-utiles": "Contacts utiles",
"bonnes-pratiques": "Bonnes pratiques",
};

0 comments on commit 2c7c34c

Please sign in to comment.