Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(style): ajout d'un avertisement de compatibilité qml #574

Merged
merged 7 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Upload } from "@codegouvfr/react-dsfr/Upload";
import { FC } from "react";
import { UseFormReturn } from "react-hook-form";
import { getTranslation } from "../../../../../i18n/i18n";
import { Alert } from "@codegouvfr/react-dsfr/Alert";

type UploadLayerStylesProps = {
form: UseFormReturn;
Expand All @@ -21,6 +22,7 @@ const UploadLayerStyles: FC<UploadLayerStylesProps> = ({ form, format, layers })
return (
<>
<p>{t("add_file", { format: format })}</p>
{format === "qml" && <Alert className={fr.cx("fr-mb-3v")} closable={false} description={t("qml_message")} severity="warning" small />}
{Object.keys(layers).map((uid) => {
return (
<div key={uid} className={fr.cx("fr-grid-row", "fr-mb-3w")}>
Expand Down
3 changes: 3 additions & 0 deletions assets/i18n/Style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const { i18n } = declareComponentKeys<
| { K: "add_file"; P: { format: string }; R: string }
| { K: "select_file"; P: { format: string }; R: string }
| { K: "remove_style"; P: { styleName: string | undefined }; R: string }
| "qml_message"
>()("Style");

export const StyleFrTranslations: Translations<"fr">["Style"] = {
Expand All @@ -15,6 +16,7 @@ export const StyleFrTranslations: Translations<"fr">["Style"] = {
select_file: ({ format }) => `Sélectionner un fichier au format ${format}`,
remove_style: ({ styleName }) =>
styleName !== undefined ? `Êtes-vous sûr de vouloir supprimer le style ${styleName} ?` : "Êtes-vous sûr de vouloir supprimer ce style ?",
qml_message: "Les fichiers qml générés avec une version de QGIS > 3.28 ne sont pas encore compatibles",
};

export const StyleEnTranslations: Translations<"en">["Style"] = {
Expand All @@ -24,4 +26,5 @@ export const StyleEnTranslations: Translations<"en">["Style"] = {
select_file: ({ format }) => `Select file in format ${format}`,
remove_style: ({ styleName }) =>
styleName !== undefined ? `Are you sure you want to remove the style ${styleName}` : "Are you sure you want to remove this style",
qml_message: "qml files generated with QGIS version > 3.28 are not yet compatible",
};
Loading