Skip to content

Commit

Permalink
feat: wrap espaceco Communities avec AppLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
ocruze committed Sep 18, 2024
1 parent 80effd6 commit 338183c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 8 additions & 1 deletion assets/config/datastoreNavItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,19 @@ export const datastoreNavItems = (currentDatastore?: Datastore): MainNavigationP
});
}

navItems.push({
text: t("espaceco"),
linkProps: routes.espaceco_community_list().link,
});

navItems.push(assistanceNavItems(tNavItems));

return navItems;
};

// traductions
export const { i18n } = declareComponentKeys<
"dashboard" | "data" | "members" | "manage_storage" | "consumption_monitoring" | "permissions_granted" | "my_account" | "my_access_keys"
"dashboard" | "data" | "members" | "manage_storage" | "consumption_monitoring" | "permissions_granted" | "my_account" | "my_access_keys" | "espaceco"
>()("datastoreNavItems");

export const datastoreNavItemsFrTranslations: Translations<"fr">["datastoreNavItems"] = {
Expand All @@ -74,6 +79,7 @@ export const datastoreNavItemsFrTranslations: Translations<"fr">["datastoreNavIt
permissions_granted: "Permissions accordées",
my_account: "Mon compte",
my_access_keys: "Mes clés d’accès",
espaceco: "Espace Collaboratif",
};

export const datastoreNavItemsEnTranslations: Translations<"en">["datastoreNavItems"] = {
Expand All @@ -85,4 +91,5 @@ export const datastoreNavItemsEnTranslations: Translations<"en">["datastoreNavIt
permissions_granted: undefined,
my_account: undefined,
my_access_keys: undefined,
espaceco: undefined,
};
9 changes: 7 additions & 2 deletions assets/espaceco/pages/communities/Communities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import { Pagination } from "@codegouvfr/react-dsfr/Pagination";
import RadioButtons from "@codegouvfr/react-dsfr/RadioButtons";
import { useQuery } from "@tanstack/react-query";
import { FC, useMemo, useState } from "react";

import { CommunityListFilter, GetResponse, arrCommunityListFilters } from "../../../@types/app_espaceco";
import { CommunityResponseDTO } from "../../../@types/espaceco";
import AppLayout from "../../../components/Layout/AppLayout";
import Skeleton from "../../../components/Utils/Skeleton";
import { datastoreNavItems } from "../../../config/datastoreNavItems";
import { useTranslation } from "../../../i18n/i18n";
import RQKeys from "../../../modules/espaceco/RQKeys";
import { CartesApiException } from "../../../modules/jsonFetch";
Expand All @@ -17,6 +20,8 @@ import SearchCommunity from "./SearchCommunity";

const defaultLimit = 10;

const navItems = datastoreNavItems();

type QueryParamsType = {
page: number;
limit: number;
Expand Down Expand Up @@ -66,7 +71,7 @@ const Communities: FC = () => {
};

return (
<div className={fr.cx("fr-container")}>
<AppLayout navItems={navItems} documentTitle={t("title")}>
<h1>{t("title")}</h1>
<div>
{communityQuery.isError && <Alert severity="error" closable={false} title={communityQuery.error?.message} />}
Expand Down Expand Up @@ -151,7 +156,7 @@ const Communities: FC = () => {
)}
</div>
</div>
</div>
</AppLayout>
);
};

Expand Down

0 comments on commit 338183c

Please sign in to comment.