From aef30a386cddfbc444eea78e16f0d50a2b2eac2f Mon Sep 17 00:00:00 2001 From: mohamedlemineTELMOUDY <mohamedlemine.telmoudy@marketingconfort.com> Date: Wed, 28 Aug 2024 18:01:34 +0000 Subject: [PATCH] Add default render inputs --- .../components/event/createCampaign.tsx | 22 ++++++---------- .../components/event/createHackathon.tsx | 25 ++++++------------- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/src/shared/components/event/createCampaign.tsx b/src/shared/components/event/createCampaign.tsx index a073830..2eb9bb2 100644 --- a/src/shared/components/event/createCampaign.tsx +++ b/src/shared/components/event/createCampaign.tsx @@ -66,7 +66,7 @@ export function CreateCampaign({ onClose, onCreate }: CreateCampaignProps) { <TextField label="Nom" variant="outlined" - value={name} + value={name || `Titre du Campagne !!`} onChange={(e) => setName(e.target.value)} /> {errors.name && <FormHelperText>Ce champ est requis</FormHelperText>} @@ -78,7 +78,7 @@ export function CreateCampaign({ onClose, onCreate }: CreateCampaignProps) { type="date" InputLabelProps={{ shrink: true }} variant="outlined" - value={startDate} + value={startDate } onChange={(e) => setStartDate(e.target.value)} /> {errors.startDate && <FormHelperText>Ce champ est requis</FormHelperText>} @@ -90,21 +90,13 @@ export function CreateCampaign({ onClose, onCreate }: CreateCampaignProps) { type="date" InputLabelProps={{ shrink: true }} variant="outlined" - value={endDate} + value={endDate } onChange={(e) => setEndDate(e.target.value)} /> {errors.endDate && <FormHelperText>Ce champ est requis</FormHelperText>} </FormControl> - <FormControl error={errors.coverImage} fullWidth> - <TextField - label="Image de couverture" - variant="outlined" - value={coverImage} - onChange={(e) => setCoverImage(e.target.value)} - /> - {errors.coverImage && <FormHelperText>Ce champ est requis</FormHelperText>} - </FormControl> + <FormControl error={errors.shortDescription} fullWidth> <TextField @@ -112,7 +104,7 @@ export function CreateCampaign({ onClose, onCreate }: CreateCampaignProps) { variant="outlined" multiline rows={3} - value={shortDescription} + value={shortDescription || `Description..`} onChange={(e) => setShortDescription(e.target.value)} /> {errors.shortDescription && <FormHelperText>Ce champ est requis</FormHelperText>} @@ -122,7 +114,7 @@ export function CreateCampaign({ onClose, onCreate }: CreateCampaignProps) { <TextField label="Durée" variant="outlined" - value={duration} + value={duration || `Durée en jours..`} onChange={(e) => setDuration(e.target.value)} /> {errors.duration && <FormHelperText>Ce champ est requis</FormHelperText>} @@ -132,7 +124,7 @@ export function CreateCampaign({ onClose, onCreate }: CreateCampaignProps) { <TextField label="Activités" variant="outlined" - value={activities} + value={activities || `Activités.. !!`} onChange={(e) => setActivities(e.target.value)} /> {errors.activities && <FormHelperText>Ce champ est requis</FormHelperText>} diff --git a/src/shared/components/event/createHackathon.tsx b/src/shared/components/event/createHackathon.tsx index feccf34..09116a7 100644 --- a/src/shared/components/event/createHackathon.tsx +++ b/src/shared/components/event/createHackathon.tsx @@ -67,8 +67,8 @@ export function CreateHackathon({ onClose, onCreate }: CreateHackathonProps) { <TextField label="Nom" variant="outlined" - value={name} - onChange={(e) => setName(e.target.value)} + value={name || `Titre du Hackathon !!`} + onChange={(e) => setName(e.target.value)} /> {errors.name && <FormHelperText>Ce champ est requis</FormHelperText>} </FormControl> @@ -79,7 +79,7 @@ export function CreateHackathon({ onClose, onCreate }: CreateHackathonProps) { type="date" InputLabelProps={{ shrink: true }} variant="outlined" - value={startDate} + value={startDate } onChange={(e) => setStartDate(e.target.value)} /> {errors.startDate && <FormHelperText>Ce champ est requis</FormHelperText>} @@ -91,29 +91,20 @@ export function CreateHackathon({ onClose, onCreate }: CreateHackathonProps) { type="date" InputLabelProps={{ shrink: true }} variant="outlined" - value={endDate} + value={endDate } onChange={(e) => setEndDate(e.target.value)} /> {errors.endDate && <FormHelperText>Ce champ est requis</FormHelperText>} </FormControl> - <FormControl error={errors.coverImage} fullWidth> - <TextField - label="Image de couverture" - variant="outlined" - value={coverImage} - onChange={(e) => setCoverImage(e.target.value)} - /> - {errors.coverImage && <FormHelperText>Ce champ est requis</FormHelperText>} - </FormControl> - + <FormControl error={errors.shortDescription} fullWidth> <TextField label="Description courte" variant="outlined" multiline rows={3} - value={shortDescription} + value={shortDescription || `Description..`} onChange={(e) => setShortDescription(e.target.value)} /> {errors.shortDescription && <FormHelperText>Ce champ est requis</FormHelperText>} @@ -123,7 +114,7 @@ export function CreateHackathon({ onClose, onCreate }: CreateHackathonProps) { <TextField label="Durée" variant="outlined" - value={duration} + value={duration || `une seule Journée`} onChange={(e) => setDuration(e.target.value)} /> {errors.duration && <FormHelperText>Ce champ est requis</FormHelperText>} @@ -133,7 +124,7 @@ export function CreateHackathon({ onClose, onCreate }: CreateHackathonProps) { <TextField label="Activités" variant="outlined" - value={activities} + value={activities || `Activités.. !!`} onChange={(e) => setActivities(e.target.value)} /> {errors.activities && <FormHelperText>Ce champ est requis</FormHelperText>} -- GitLab