Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
9 changes: 9 additions & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
"Approved bugs": "Approved bugs",
"Area is a required field.": "Area is a required field.",
"As first step to be done, complete your profile with authentic and real data. This is the only way to be selected for the Campaigns and get your reward.": "Enter your details in the Profile section: they are important to be selected for suitable campaign and to request the payments.",
"At least one image is required": {
"BUGFORM_UPLOAD_ERROR_IMAGEREQUIRED": "At least one image is required"
},
"At least one video is required": {
"BUGFORM_UPLOAD_ERROR_VIDEOREQUIRED": "At least one video is required"
},
"Attribution date": "Attribution date",
"Available booty": "Available booty",
"Available tags \n<a> - Link to help article for fiscal type": {
Expand Down Expand Up @@ -555,6 +561,9 @@
"BUGFORM_UPLOAD_TXT": "Upload at least {{num}} media",
"BUGFORM_UPLOAD_TXT_plural": "Upload at least {{num}} media"
},
"Upload at least {{num}} files, including one video and one image (both are required)": {
"BUGFORM_UPLOAD_TXT_VIDEO_IMAGE": ""
},
"Uploaded Bugs": "Uploaded Bugs",
"User mail validation": {
"An Email has been sent to the provided address": "An Email has been sent to the provided address"
Expand Down
9 changes: 9 additions & 0 deletions src/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
"Approved bugs": "Bugs aprobados",
"Area is a required field.": "El área / La esfera es un campo obligatorio",
"As first step to be done, complete your profile with authentic and real data. This is the only way to be selected for the Campaigns and get your reward.": "Añade todos tus datos en la sección Perfil: los necesitaremos para seleccionarte cuando haya una campaña adecuada y para que puedas solicitar los pagos.",
"At least one image is required": {
"BUGFORM_UPLOAD_ERROR_IMAGEREQUIRED": "At least one image is required"
},
"At least one video is required": {
"BUGFORM_UPLOAD_ERROR_VIDEOREQUIRED": "At least one video is required"
},
"Attribution date": "Fecha de atribución",
"Available booty": "Saldo Disponible",
"Available tags \n<a> - Link to help article for fiscal type": {
Expand Down Expand Up @@ -555,6 +561,9 @@
"BUGFORM_UPLOAD_TXT": "Sube al menos {{num}} archivo",
"BUGFORM_UPLOAD_TXT_plural": "Sube al menos {{num}} archivos"
},
"Upload at least {{num}} files, including one video and one image (both are required)": {
"BUGFORM_UPLOAD_TXT_VIDEO_IMAGE": ""
},
"Uploaded Bugs": "Bugs Cargados",
"User mail validation": {
"An Email has been sent to the provided address": "Se ha enviado un correo electrónico a la dirección proporcionada"
Expand Down
9 changes: 9 additions & 0 deletions src/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
"Approved bugs": "Bugs approuvés",
"Area is a required field.": "Le domaine est un champ obligatoire.",
"As first step to be done, complete your profile with authentic and real data. This is the only way to be selected for the Campaigns and get your reward.": "Indiquez vos coordonnées dans la section Profil : elles sont importantes pour être sélectionné pour des campagnes adaptées et pour demander les paiements.",
"At least one image is required": {
"BUGFORM_UPLOAD_ERROR_IMAGEREQUIRED": "At least one image is required"
},
"At least one video is required": {
"BUGFORM_UPLOAD_ERROR_VIDEOREQUIRED": "At least one video is required"
},
"Attribution date": "Date d'attribution",
"Available booty": "Butin disponible",
"Available tags \n<a> - Link to help article for fiscal type": {
Expand Down Expand Up @@ -555,6 +561,9 @@
"BUGFORM_UPLOAD_TXT": "Téléchargez au moins {{num}} médias",
"BUGFORM_UPLOAD_TXT_plural": "Téléchargez au moins {{num}} médias"
},
"Upload at least {{num}} files, including one video and one image (both are required)": {
"BUGFORM_UPLOAD_TXT_VIDEO_IMAGE": ""
},
"Uploaded Bugs": "Bugs téléchargés",
"User mail validation": {
"An Email has been sent to the provided address": "Un email a été envoyé à l'adresse fournie"
Expand Down
9 changes: 9 additions & 0 deletions src/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
"Approved bugs": "Bug approvati",
"Area is a required field.": "L'area è un campo obbligatorio",
"As first step to be done, complete your profile with authentic and real data. This is the only way to be selected for the Campaigns and get your reward.": "Inserisci tutti i tuoi dati nella sezione Profilo: servirà a noi per selezionarti quando c'è una campagna adatta e a te per richiedere il pagamento.",
"At least one image is required": {
"BUGFORM_UPLOAD_ERROR_IMAGEREQUIRED": "At least one image is required"
},
"At least one video is required": {
"BUGFORM_UPLOAD_ERROR_VIDEOREQUIRED": "At least one video is required"
},
"Attribution date": "Data di attribuzione",
"Available booty": "Guadagni disponibili",
"Available tags \n<a> - Link to help article for fiscal type": {
Expand Down Expand Up @@ -555,6 +561,9 @@
"BUGFORM_UPLOAD_TXT": "Carica almeno {{num}} file",
"BUGFORM_UPLOAD_TXT_plural": "Carica almeno {{num}} file"
},
"Upload at least {{num}} files, including one video and one image (both are required)": {
"BUGFORM_UPLOAD_TXT_VIDEO_IMAGE": ""
},
"Uploaded Bugs": "Bug caricati",
"User mail validation": {
"An Email has been sent to the provided address": "Un'email è stata inviata all'indirizzo fornito"
Expand Down
49 changes: 40 additions & 9 deletions src/pages/BugForm/BugFormContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ export const BugFormContainer = () => {
);
}

const needsVideoAndImage =
data?.autoApprove === 1 && (data?.minimumMedia || 0) > 1;

const validationSchema = {
title: yup.string().required(t("This is a required field")),
severity: yup.string().required(t("This is a required field")),
Expand All @@ -115,17 +118,45 @@ export const BugFormContainer = () => {
.required(t("BUGFORM_BUGDTLS_TYPE_ERROR", "This is a required field")),
expected: yup.string().required(t("This is a required field")),
current: yup.string().required(t("This is a required field")),
media: yup.array().min(
data?.minimumMedia || 0,
t(
"Media field must have at least {{num}} items:::BUGFORM_UPLOAD_ERROR_MINIMUMFILES",
{
defaultValue: "Media field must have at least {{num}} items",
num: data?.minimumMedia || 0,
count: data?.minimumMedia,
media: yup
.array()
.min(
data?.minimumMedia || 0,
t(
"Media field must have at least {{num}} items:::BUGFORM_UPLOAD_ERROR_MINIMUMFILES",
Comment thread
sinatragianpaolo marked this conversation as resolved.
{
defaultValue: "Media field must have at least {{num}} items",
num: data?.minimumMedia || 0,
count: data?.minimumMedia,
}
)
)
.test(
"has-video",
t(
"At least one video is required:::BUGFORM_UPLOAD_ERROR_VIDEOREQUIRED",
{ defaultValue: "At least one video is required" }
),
() => {
if (!needsVideoAndImage) return true;
return mediaList.some(
(m) => m.status === "success" && m.fileType === "video"
);
}
)
),
.test(
"has-image",
t(
"At least one image is required:::BUGFORM_UPLOAD_ERROR_IMAGEREQUIRED",
{ defaultValue: "At least one image is required" }
),
() => {
if (!needsVideoAndImage) return true;
return mediaList.some(
(m) => m.status === "success" && m.fileType === "image"
);
}
),
additional: yup.object(),
};
if (data.titleRule) {
Expand Down
29 changes: 20 additions & 9 deletions src/pages/BugForm/FileUploader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,31 @@ export const FileUploader = () => {
const { data } = useCampaignData();
const { t } = useTranslation();

const needsVideoAndImage =
data?.autoApprove === 1 && (data?.minimumMedia || 0) > 1;

return (
<Card
title={t("BUGFORM_UPLOAD_TITLE", { defaultValue: "Uploading media" })}
>
<Text className="aq-text-primaryVariant">
<Trans
i18nKey="Upload a minimum number of {{num}} files:::BUGFORM_UPLOAD_TXT"
values={{
num: data?.minimumMedia || 0,
}}
tOptions={{ count: data?.minimumMedia }}
count={data?.minimumMedia}
defaults={"Upload a minimum number of {{num}} files"}
/>
{needsVideoAndImage ? (
<Trans
i18nKey="Upload at least {{num}} files, including one video and one image (both are required):::BUGFORM_UPLOAD_TXT_VIDEO_IMAGE"
values={{ num: data?.minimumMedia || 0 }}
defaults="Upload at least {{num}} files, including one video and one image (both are required)"
/>
) : (
<Trans
i18nKey="Upload a minimum number of {{num}} files:::BUGFORM_UPLOAD_TXT"
Comment thread
sinatragianpaolo marked this conversation as resolved.
Outdated
values={{
num: data?.minimumMedia || 0,
}}
tOptions={{ count: data?.minimumMedia }}
count={data?.minimumMedia}
defaults={"Upload a minimum number of {{num}} files"}
/>
)}
</Text>
<StyledFilesTypes className="aq-mb-3">
<FileType className="file-type-margin" type="image" />
Expand Down
Loading
Loading