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

Tce/trainschedule/bug image project #7963

Merged
merged 2 commits into from
Jul 8, 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
1 change: 1 addition & 0 deletions front/public/locales/en/operationalStudies/project.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"addImage": "Add an image",
"affairCode": "Affair code",
"budget": "Budget",
"createdOn": "Created on ",
Expand Down
1 change: 1 addition & 0 deletions front/public/locales/fr/operationalStudies/project.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"addImage": "Ajouter une image",
"affairCode": "Code affaire",
"budget": "Budget",
"createdOn": "Créée le",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type PictureUploaderProps = {

type PicturePlaceholderButtonsProps = {
setTempProjectImage: (tempProjectImage: Blob | null | undefined) => void;
tempProjectImage: Blob | null | undefined;
safeWord: string;
t: TFunction;
};
Expand All @@ -46,7 +47,7 @@ function displayNoImageMessages(isValid: boolean, t: (arg0: string) => string) {
<>
<Image />
{isValid ? (
<div className="project-edition-modal-picture-placeholder-text">{t('noImage')}</div>
<div className="project-edition-modal-picture-placeholder-text">{t('addImage')}</div>
) : (
<div className="project-edition-modal-picture-placeholder-text invalid">
{t('noImageInvalid')}
Expand Down Expand Up @@ -88,6 +89,7 @@ function PicturePlaceholder({ image, isValid, tempProjectImage }: PicturePlaceho

function PicturePlaceholderButtons({
setTempProjectImage,
tempProjectImage,
safeWord,
t,
}: PicturePlaceholderButtonsProps) {
Expand Down Expand Up @@ -183,14 +185,17 @@ function PicturePlaceholderButtons({
>
<img src={logoSNCF} alt="SNCF LOGO" />
</button>
<button
className="remove"
type="button"
aria-label={t('removeImage')}
onClick={() => setTempProjectImage(null)}
>
<XCircle variant="fill" />
</button>

{tempProjectImage && (
<button
className="remove"
type="button"
aria-label={t('removeImage')}
onClick={() => setTempProjectImage(null)}
>
<XCircle variant="fill" />
</button>
)}
</div>
);
}
Expand Down Expand Up @@ -247,6 +252,7 @@ export default function PictureUploader({
</label>
<PicturePlaceholderButtons
setTempProjectImage={setTempProjectImage}
tempProjectImage={tempProjectImage}
safeWord={safeWord}
t={t}
/>
Expand Down
Loading