Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Oct 15, 2024
2 parents dd1acda + 1bf5584 commit 2a0a0c9
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
cd client
IMAGE_ID=ghcr.io/${{ github.repository }}
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
docker build -f Dockerfile -t $IMAGE_ID:${{ steps.tag.outputs.tag }} -t $IMAGE_ID:latest .
docker build -t $IMAGE_ID:${{ steps.tag.outputs.tag }} -t $IMAGE_ID:latest .
- name: 📦 Push Docker image
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ export default function OrganizationHeader({ data }: { data: Organization }) {
<Title className="fr-mb-0" as="h1" look="h5">
{getLangFieldValue(locale)(data.label)}
</Title>
{data?.creationYear && (
{data?.endDate && (
<Text className="fr-card__detail" size="sm">
<i>
{intl.formatMessage({ id: "organizations.header.until" })} {data.endDate.slice(0, 4)}
</i>
</Text>
)}
{!data?.endDate && data?.creationYear && (
<Text className="fr-card__detail" size="sm">
<i>
{intl.formatMessage({ id: "organizations.header.since" })} {data.creationYear}
Expand Down
36 changes: 24 additions & 12 deletions client/src/pages/organizations/[id]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
import { useParams } from "react-router-dom";
import { useQuery } from "@tanstack/react-query";
import { Breadcrumb, Container, Link, Notice, useDSFRConfig } from "@dataesr/dsfr-plus";
import {
Breadcrumb,
Container,
Link,
Notice,
useDSFRConfig,
} from "@dataesr/dsfr-plus";
import PageSkeleton from "../../../components/skeleton/page-skeleton";
import OrganizationPresentation from "./components/organization";
import { getOrganizationById } from "../../../api/organizations/[id]";
import getLangFieldValue from "../../../utils/lang";
import { RawIntlProvider, createIntl } from "react-intl";

const modules = import.meta.glob('./locales/*.json', { eager: true, import: 'default' })
const modules = import.meta.glob("./locales/*.json", {
eager: true,
import: "default",
});

const messages = Object.keys(modules).reduce((acc, key) => {
const locale = key.match(/\.\/locales\/(.+)\.json$/)?.[1];
if (locale) {
return { ...acc, [locale]: modules[key] }
return { ...acc, [locale]: modules[key] };
}
return acc;
}, {});


export default function Organization() {
const { locale } = useDSFRConfig();
const intl = createIntl({ locale, messages: messages[locale] })
const intl = createIntl({ locale, messages: messages[locale] });
const { id } = useParams();
const { data, isLoading } = useQuery({
queryKey: ["organizations", id],
Expand All @@ -29,11 +37,17 @@ export default function Organization() {
});
return (
<RawIntlProvider value={intl}>
{(data?.isFrench === false) && (
{!data?.isFrench && (
<Notice closeMode="disallow" type="warning">
{intl.formatMessage({ id: "organizations.notice.not-french" })}
</Notice>
)}
{data?.endDate && (
<Notice closeMode="disallow" type="warning">
{intl.formatMessage({ id: "organizations.notice.closed" })}{" "}
{data.endDate.slice(0, 4)}.
</Notice>
)}
<Container>
<Breadcrumb>
<Link href="/">
Expand All @@ -42,13 +56,11 @@ export default function Organization() {
<Link href="/search/organizations">
{intl.formatMessage({ id: "organizations.breadcrumb.search" })}
</Link>
<Link>
{getLangFieldValue(locale)(data?.label)}
</Link>
<Link>{getLangFieldValue(locale)(data?.label)}</Link>
</Breadcrumb>
{(isLoading || !data?.id) && <PageSkeleton />}
{(data?.id) && <OrganizationPresentation data={data} />}
{data?.id && <OrganizationPresentation data={data} />}
</Container>
</RawIntlProvider>
)
}
);
}
4 changes: 3 additions & 1 deletion client/src/pages/organizations/[id]/locales/de.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"organizations.notice.not-french": "Achtung, da es sich um eine ausländische Entität handelt, werden nur ihre Verbindungen zu französischen Organisationen, Finanzierungen und Produktionen angezeigt.",
"organizations.notice.closed": "Achtung, diese Entität ist geschlossen seit",
"organizations.breadcrumb.home": "Startseite",
"organizations.breadcrumb.search": "Strukturen",
"organizations.section.leaders.title": "Führungsteam",
Expand Down Expand Up @@ -31,7 +32,8 @@
"organizations.section.identifiers.title": "Struktur-Identifikatoren",
"organizations.copy": "Klicken Sie, um in die Zwischenablage zu kopieren",
"organizations.section.share.title": "Seite teilen",
"organizations.header.since": "Aktiv seit",
"organizations.header.since": "Struktur aktiv seit",
"organizations.header.until": "Struktur geschlossen seit",
"organizations.header.description.ia-generated-label": "KI-generierte Beschreibung",
"organizations.header.description.ia-generated-hover": "Lern mehr",
"organizations.header.description.ia-edit-label": "Bearbeiten",
Expand Down
8 changes: 5 additions & 3 deletions client/src/pages/organizations/[id]/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"organizations.notice.not-french": "Attention, this entity being a foreign entity, only its connections with French organizations, funding, and productions will be displayed.",
"organizations.notice.not-french": "Please note that this entity being a foreign entity, only its connections with French organizations, funding, and productions will be displayed.",
"organizations.notice.closed": "Please note that this entity has been closed since",
"organizations.breadcrumb.home": "Home",
"organizations.breadcrumb.search": "Structures",
"organizations.breadcrumb.search": "Organizations",
"organizations.section.leaders.title": "Leadership team",
"organizations.section.networks.title": "Membership and networks",
"organizations.section.networks.supervisors.title": "Supervising institution ({count})",
Expand Down Expand Up @@ -31,7 +32,8 @@
"organizations.section.identifiers.title": "Structure identifiers",
"organizations.copy": "Click to copy to clipboard",
"organizations.section.share.title": "Share the page",
"organizations.header.since": "Active since",
"organizations.header.since": "Organization active since",
"organizations.header.until": "Organization closed since",
"organizations.header.description.ia-generated-label": "IA generated description",
"organizations.header.description.ia-generated-hover": "Learn more",
"organizations.header.description.ia-edit-label": "Edit",
Expand Down
6 changes: 4 additions & 2 deletions client/src/pages/organizations/[id]/locales/es.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"organizations.notice.not-french": "Atención, al tratarse de una entidad extranjera, solo se mostrarán sus conexiones con organizaciones, financiamientos y producciones francesas.",
"organizations.notice.not-french": "Tenga al tratarse de una entidad extranjera, solo se mostrarán sus conexiones con organizaciones, financiamientos y producciones francesas.",
"organizations.notice.closed": "Tenga en cuenta que esta entidad lleva cerrada desde",
"organizations.breadcrumb.home": "Inicio",
"organizations.breadcrumb.search": "Estructuras",
"organizations.section.leaders.title": "Equipo Directivo",
Expand Down Expand Up @@ -31,7 +32,8 @@
"organizations.section.identifiers.title": "Identificadores de la Estructura",
"organizations.copy": "Haga clic para copiar al portapapeles",
"organizations.section.share.title": "Compartir la página",
"organizations.header.since": "Activo Desde",
"organizations.header.since": "Estructura activa desde",
"organizations.header.until": "Estructura cerrada desde",
"organizations.header.description.ia-generated-label": "Descripción generada por IA",
"organizations.header.description.ia-generated-hover": "Más información",
"organizations.header.description.ia-edit-label": "Editar",
Expand Down
2 changes: 2 additions & 0 deletions client/src/pages/organizations/[id]/locales/fr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"organizations.notice.not-french": "Attention, cette entité étant une entité étrangère, seuls ses liens avec des organisations, financements et productions françaises seront affichées.",
"organizations.notice.closed": "Attention, cette entité est fermée depuis",
"organizations.breadcrumb.home": "Accueil",
"organizations.breadcrumb.search": "Structures",
"organizations.section.leaders.title": "Équipe de direction",
Expand Down Expand Up @@ -32,6 +33,7 @@
"organizations.copy": "Cliquez pour copier dans le presse-papier",
"organizations.section.share.title": "Partager la page",
"organizations.header.since": "Structure active depuis",
"organizations.header.until": "Structure fermée depuis",
"organizations.header.description.ia-generated-label": "Description générée par IA",
"organizations.header.description.ia-generated-hover": "En savoir plus",
"organizations.header.description.ia-edit-label": "Éditer",
Expand Down
39 changes: 20 additions & 19 deletions client/src/types/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,33 +80,34 @@ export type OrganizationIaDescription = {

export type Organization = {
_id: string;
id: string;
isFrench: boolean;
label: LangField;
creationYear?: number;
acronym: LangField;
description: LangField;
address?: Address[];
agreements: OrganizationAgreementsData[];
ai_description?: OrganizationIaDescription;
awards: OrganizationAwardsData[];
badges?: OrganizationBadgesData[];
creationYear?: number;
description: LangField;
endDate: string;
externalIds: ExternalIdsData[];
id: string;
institutionOf?: RelatedOrganizationData[];
institutions?: RelatedOrganizationData[];
isFrench: boolean;
kind: string[];
nature?: string;
level?: string;
address?: Address[];
badges?: OrganizationBadgesData[];
label: LangField;
leaders?: OrganizationLeaderData[];
institutions?: RelatedOrganizationData[];
institutionOf?: RelatedOrganizationData[];
parents?: RelatedOrganizationData[];
level?: string;
links: OrganizationLinksData;
nature?: string;
parentOf?: RelatedOrganizationData[];
relations?: RelatedOrganizationData[];
parents?: RelatedOrganizationData[];
patents: OrganizationPatentsData;
projects: OrganizationProjectsData;
publications: OrganizationPublicationsData;
relationOf?: RelatedOrganizationData[];
relations?: RelatedOrganizationData[];
socialMedias: OrganizationSocialMediasData;
links: OrganizationLinksData;
publications: OrganizationPublicationsData;
projects: OrganizationProjectsData;
patents: OrganizationPatentsData;
awards: OrganizationAwardsData[];
agreements: OrganizationAgreementsData[];
};

export type OrganizationAggregations = {
Expand Down

0 comments on commit 2a0a0c9

Please sign in to comment.