Initial local backup snapshot
This commit is contained in:
commit
acd9e14ba5
367 changed files with 118038 additions and 0 deletions
|
|
@ -0,0 +1,44 @@
|
|||
export const associationCommuneOptions = [
|
||||
{ value: "all", label: "Toutes" },
|
||||
{ value: "kourou", label: "Kourou" },
|
||||
{ value: "sinnamary", label: "Sinnamary" },
|
||||
{ value: "iracoubo", label: "Iracoubo" },
|
||||
{ value: "saint_elie", label: "Saint-Élie" },
|
||||
] as const;
|
||||
|
||||
export type AssociationCommuneFilter = (typeof associationCommuneOptions)[number]["value"];
|
||||
|
||||
const communeVariantMap: Record<Exclude<AssociationCommuneFilter, "all">, string[]> = {
|
||||
kourou: ["Kourou"],
|
||||
sinnamary: ["Sinnamary"],
|
||||
iracoubo: ["Iracoubo"],
|
||||
saint_elie: ["Saint-Élie", "Saint Elie", "ST ELIE", "St Elie", "St-Élie", "Saint-Elie"],
|
||||
};
|
||||
|
||||
export function getAssociationCommuneLabel(value: AssociationCommuneFilter) {
|
||||
return associationCommuneOptions.find(option => option.value === value)?.label ?? "Toutes";
|
||||
}
|
||||
|
||||
export function normalizeAssociationCommune(value: string | null | undefined): AssociationCommuneFilter {
|
||||
const normalized = (value || "")
|
||||
.normalize("NFD")
|
||||
.replace(/[\u0300-\u036f]/g, "")
|
||||
.replace(/[-_]/g, " ")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
|
||||
if (normalized.includes("saint elie") || normalized.includes("st elie")) return "saint_elie";
|
||||
if (normalized.includes("kourou")) return "kourou";
|
||||
if (normalized.includes("sinnamary")) return "sinnamary";
|
||||
if (normalized.includes("iracoubo")) return "iracoubo";
|
||||
return "all";
|
||||
}
|
||||
|
||||
export function getAssociationCommuneVariants(value?: string | null) {
|
||||
if (!value || value === "all") {
|
||||
return [];
|
||||
}
|
||||
|
||||
return communeVariantMap[value as Exclude<AssociationCommuneFilter, "all">] || [];
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
export const associationGeoSources = [
|
||||
"manual",
|
||||
"adresse_gouv",
|
||||
"dataasso",
|
||||
"commune_center",
|
||||
] as const;
|
||||
|
||||
export type AssociationGeoSource = (typeof associationGeoSources)[number];
|
||||
|
||||
export const associationGeoPrecisions = [
|
||||
"exact_address",
|
||||
"commune_center",
|
||||
"hidden",
|
||||
] as const;
|
||||
|
||||
export type AssociationGeoPrecision = (typeof associationGeoPrecisions)[number];
|
||||
|
||||
export const associationGeoSourceLabels: Record<AssociationGeoSource, string> = {
|
||||
manual: "Position définie manuellement",
|
||||
adresse_gouv: "Adresse.data.gouv.fr",
|
||||
dataasso: "DataAsso / référentiel association",
|
||||
commune_center: "Centre de commune",
|
||||
};
|
||||
|
||||
export const associationGeoPrecisionLabels: Record<AssociationGeoPrecision, string> = {
|
||||
exact_address: "Adresse exacte",
|
||||
commune_center: "Centre de commune",
|
||||
hidden: "Masquée du public",
|
||||
};
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
export const associationThematicValues = [
|
||||
"culture_loisirs",
|
||||
"social_sante",
|
||||
"education_formation",
|
||||
"economie_territoire",
|
||||
"environnement_patrimoine",
|
||||
"institutions_divers",
|
||||
] as const;
|
||||
|
||||
export type AssociationThematic = typeof associationThematicValues[number];
|
||||
|
||||
export const associationThematicDefinitions: Record<
|
||||
AssociationThematic,
|
||||
{ label: string; description: string }
|
||||
> = {
|
||||
culture_loisirs: {
|
||||
label: "Culture & Loisirs",
|
||||
description: "Arts, sport, chasse, pêche, activités civiques et religieuses.",
|
||||
},
|
||||
social_sante: {
|
||||
label: "Social & Santé",
|
||||
description: "Caritatif, humanitaire, aide aux seniors, santé, services aux familles.",
|
||||
},
|
||||
education_formation: {
|
||||
label: "Éducation et formation",
|
||||
description: "Écoles, formation continue, apprentissage.",
|
||||
},
|
||||
economie_territoire: {
|
||||
label: "Économie & Territoire",
|
||||
description: "Emploi, insertion, logement, tourisme, défense d'intérêts économiques.",
|
||||
},
|
||||
environnement_patrimoine: {
|
||||
label: "Environnement et patrimoine",
|
||||
description: "Écologie, cadre de vie, protection des monuments.",
|
||||
},
|
||||
institutions_divers: {
|
||||
label: "Institutions & Divers",
|
||||
description: "Justice, sécurité civile, recherche, activités politiques.",
|
||||
},
|
||||
};
|
||||
|
||||
export const associationThematicOptions = associationThematicValues.map((value) => ({
|
||||
value,
|
||||
label: associationThematicDefinitions[value].label,
|
||||
description: associationThematicDefinitions[value].description,
|
||||
}));
|
||||
|
||||
export function getAssociationThematicLabel(value: AssociationThematic | string | null | undefined) {
|
||||
if (!value) return "Non renseignée";
|
||||
return associationThematicDefinitions[value as AssociationThematic]?.label ?? value;
|
||||
}
|
||||
|
||||
export function getAssociationThematicDescription(value: AssociationThematic | string | null | undefined) {
|
||||
if (!value) return "";
|
||||
return associationThematicDefinitions[value as AssociationThematic]?.description ?? "";
|
||||
}
|
||||
|
||||
export function parseAssociationThematics(value: string | null | undefined): AssociationThematic[] {
|
||||
if (!value) return [];
|
||||
try {
|
||||
const parsed = JSON.parse(value);
|
||||
if (Array.isArray(parsed)) {
|
||||
return parsed.filter((item): item is AssociationThematic =>
|
||||
associationThematicValues.includes(item as AssociationThematic)
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
if (associationThematicValues.includes(value as AssociationThematic)) {
|
||||
return [value as AssociationThematic];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function serializeAssociationThematics(values: Array<AssociationThematic | string> | null | undefined) {
|
||||
const normalized = Array.from(
|
||||
new Set(
|
||||
(values || []).filter((item): item is AssociationThematic =>
|
||||
associationThematicValues.includes(item as AssociationThematic)
|
||||
)
|
||||
)
|
||||
);
|
||||
return normalized.length > 0 ? JSON.stringify(normalized) : null;
|
||||
}
|
||||
|
||||
export function getAssociationThematicLabels(values: Array<AssociationThematic | string> | null | undefined) {
|
||||
return (values || []).map((value) => getAssociationThematicLabel(value));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue