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

Develop #1299

Merged
merged 6 commits into from
Sep 2, 2024
Merged

Develop #1299

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
4 changes: 2 additions & 2 deletions src/components/BilingualInput/BilingualInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function BilingualInput(props) {

const items = [
{
label: labelFr,
label: <span data-cy={`tab-${props.fieldName}-french`}>{labelFr}</span>,
key: 'fr',
forceRender: true,
children: (
Expand All @@ -65,7 +65,7 @@ function BilingualInput(props) {
),
},
{
label: labelEn,
label: <span data-cy={`tab-${props.fieldName}-english`}>{labelEn}</span>,
key: 'en',
forceRender: true,
children: (
Expand Down
2 changes: 1 addition & 1 deletion src/components/BilingualTextEditor/BilingualTextEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function BilingualTextEditor(props) {

return (
<ContentLanguageInput calendarContentLanguage={calendarContentLanguage}>
<BilingualInput fieldData={data}>
<BilingualInput fieldData={data} fieldName={name}>
<TextEditor
formName={[`${name}`, 'fr']}
key={contentLanguage.FRENCH}
Expand Down
2 changes: 1 addition & 1 deletion src/components/DraggableTree/DraggableTree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ const DraggableTree = ({
<div className="add-new-concept-wrapper">
<Form.Item label={t('dashboard.taxonomy.addNew.concepts.conceptName')}>
<ContentLanguageInput calendarContentLanguage={calendarContentLanguage}>
<BilingualInput fieldData={newConceptName}>
<BilingualInput fieldData={newConceptName} fieldName="concept-name">
<Form.Item
name="frenchconcept"
key={contentLanguage.FRENCH}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ function QuickCreateOrganization(props) {
</Col>
</Row>
<ContentLanguageInput calendarContentLanguage={calendarContentLanguage}>
<BilingualInput defaultTab={interfaceLanguage}>
<BilingualInput defaultTab={interfaceLanguage} fieldName="organization-name">
<Form.Item
name="french"
key={contentLanguage.FRENCH}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function QuickCreatePerson(props) {
</Col>
</Row>
<ContentLanguageInput calendarContentLanguage={calendarContentLanguage}>
<BilingualInput defaultTab={interfaceLanguage}>
<BilingualInput defaultTab={interfaceLanguage} fieldName="person-name">
<Form.Item
name="french"
key={contentLanguage.FRENCH}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/QuickCreatePlace/QuickCreatePlace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ function QuickCreatePlace(props) {
</span>
</Col>
</Row>
<ContentLanguageInput calendarContentLanguage={calendarContentLanguage}>
<ContentLanguageInput calendarContentLanguage={calendarContentLanguage} fieldName="place-name">
<BilingualInput defaultTab={interfaceLanguage}>
<Form.Item
name="french"
Expand Down
2 changes: 1 addition & 1 deletion src/constants/calendarSettingsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const calendarSettingsFormFields = {
};

return (
<BilingualInput fieldData={fieldData}>
<BilingualInput fieldData={fieldData} fieldName="calendar-name">
<Form.Item name="calendarNameFr">
<TextArea
autoSize
Expand Down
2 changes: 1 addition & 1 deletion src/constants/formFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const formFieldValue = [
en: form.isFieldTouched(name?.concat(['en'])),
fr: form.isFieldTouched(name?.concat(['fr'])),
}}>
<BilingualInput fieldData={data}>
<BilingualInput fieldData={data} fieldName={name}>
<Form.Item
name={[`${name}`, 'fr']}
key={contentLanguage.FRENCH}
Expand Down
16 changes: 9 additions & 7 deletions src/pages/Dashboard/AddEvent/AddEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,7 @@ function AddEvent() {
<ContentLanguageInput
calendarContentLanguage={calendarContentLanguage}
isFieldsDirty={{ en: form.isFieldTouched('english'), fr: form.isFieldTouched('french') }}>
<BilingualInput fieldData={eventData?.name}>
<BilingualInput fieldData={eventData?.name} fieldName="event-title">
<Form.Item
name="french"
key={contentLanguage.FRENCH}
Expand Down Expand Up @@ -3005,7 +3005,9 @@ function AddEvent() {
en: form.isFieldTouched('englishVirtualLocation'),
fr: form.isFieldTouched('frenchVirtualLocation'),
}}>
<BilingualInput fieldData={initialVirtualLocation && initialVirtualLocation[0]?.name}>
<BilingualInput
fieldData={initialVirtualLocation && initialVirtualLocation[0]?.name}
fieldName="virtual-location">
<Form.Item
name="frenchVirtualLocation"
key={contentLanguage.FRENCH}
Expand Down Expand Up @@ -3125,7 +3127,7 @@ function AddEvent() {
en: form.isFieldTouched('englishEditor'),
fr: form.isFieldTouched('frenchEditor'),
}}>
<BilingualInput fieldData={eventData?.description}>
<BilingualInput fieldData={eventData?.description} fieldName="event-description">
<TextEditor
formName="frenchEditor"
key={contentLanguage.FRENCH}
Expand Down Expand Up @@ -3581,7 +3583,7 @@ function AddEvent() {
en: form.isFieldTouched('englishContactTitle'),
fr: form.isFieldTouched('frenchContactTitle'),
}}>
<BilingualInput fieldData={eventData?.contactPoint?.name}>
<BilingualInput fieldData={eventData?.contactPoint?.name} fieldName="contact-title">
<Form.Item
name="frenchContactTitle"
initialValue={eventData?.contactPoint?.name?.fr}
Expand Down Expand Up @@ -4560,7 +4562,7 @@ function AddEvent() {
en: form.isFieldTouched('englishAccessibilityNote'),
fr: form.isFieldTouched('frenchAccessibilityNote'),
}}>
<BilingualInput fieldData={eventData?.accessibilityNote}>
<BilingualInput fieldData={eventData?.accessibilityNote} fieldName="accessibility-note">
<Form.Item
name="frenchAccessibilityNote"
initialValue={eventData?.accessibilityNote?.fr}
Expand Down Expand Up @@ -4830,7 +4832,7 @@ function AddEvent() {
<ContentLanguageInput
calendarContentLanguage={calendarContentLanguage}
isFieldsDirty={{ en: form.isFieldTouched('prices'), fr: form.isFieldTouched('prices') }}>
<BilingualInput>
<BilingualInput fieldName="prices">
<Form.List
name="prices"
initialValue={eventData?.offerConfiguration?.prices ?? [undefined]}
Expand Down Expand Up @@ -4918,7 +4920,7 @@ function AddEvent() {
en: form.isFieldTouched('englishTicketNote'),
fr: form.isFieldTouched('frenchTicketNote'),
}}>
<BilingualInput fieldData={eventData?.offerConfiguration?.name}>
<BilingualInput fieldData={eventData?.offerConfiguration?.name} fieldName="ticket-note">
<Form.Item
name="frenchTicketNote"
key={contentLanguage.FRENCH}
Expand Down
7 changes: 5 additions & 2 deletions src/pages/Dashboard/AddTaxonomy/AddTaxonomy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ const AddTaxonomyTest = () => {
<Col flex="423px">
<Form.Item label={t('dashboard.taxonomy.addNew.name')} required data-cy="form-item-taxonomy-name">
<ContentLanguageInput calendarContentLanguage={calendarContentLanguage}>
<BilingualInput fieldData={taxonomyData?.name}>
<BilingualInput fieldData={taxonomyData?.name} fieldName="taxonomy-name">
<Form.Item
name="frenchName"
key={contentLanguage.FRENCH}
Expand Down Expand Up @@ -448,7 +448,10 @@ const AddTaxonomyTest = () => {
label={t('dashboard.taxonomy.addNew.description')}
data-cy="form-item-taxonomy-description-title">
<ContentLanguageInput calendarContentLanguage={calendarContentLanguage}>
<BilingualInput fieldData={taxonomyData?.disambiguatingDescription} key="description">
<BilingualInput
fieldData={taxonomyData?.disambiguatingDescription}
key="description"
fieldName="taxonomy-description">
<Form.Item
name="frenchdescription"
key={contentLanguage.FRENCH}
Expand Down
34 changes: 24 additions & 10 deletions src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ function CreateNewPlace() {
languageKey,
dynamicFields,
containedInPlaceObj,
latitude,
longitude,
containsPlace = [];

if (calendarContentLanguage == contentLanguage.ENGLISH) languageKey = 'en';
Expand Down Expand Up @@ -521,6 +523,11 @@ function CreateNewPlace() {
};
});
}
if (values?.coordinates) {
const coordinates = values.coordinates.split(',');
latitude = coordinates[0] || undefined;
longitude = coordinates[1] || undefined;
}

placeObj = {
name: {
Expand All @@ -538,8 +545,8 @@ function CreateNewPlace() {
containedInPlace: containedInPlaceObj,
}),
geo: {
latitude: values?.latitude,
longitude: values?.longitude,
latitude,
longitude,
},

...((values?.frenchAccessibilityNote || values?.englishAccessibilityNote) && {
Expand Down Expand Up @@ -1408,7 +1415,8 @@ function CreateNewPlace() {
: externalCalendarEntityId &&
externalCalendarEntityData?.length > 0 &&
externalCalendarEntityData[0]?.name
}>
}
fieldName="place-name">
<Form.Item
data-cy="form-item-place-name-french"
name={formFieldNames.FRENCH}
Expand Down Expand Up @@ -1586,7 +1594,8 @@ function CreateNewPlace() {
: externalCalendarEntityId &&
externalCalendarEntityData?.length > 0 &&
externalCalendarEntityData[0].disambiguatingDescription
}>
}
fieldName="place-disambiguating-description">
<Form.Item
name={formFieldNames.DISAMBIGUATING_DESCRIPTION_FRENCH}
key={contentLanguage.FRENCH}
Expand Down Expand Up @@ -1699,7 +1708,8 @@ function CreateNewPlace() {
: externalCalendarEntityId &&
externalCalendarEntityData?.length > 0 &&
externalCalendarEntityData[0].description
}>
}
fieldName="place-description">
<TextEditor
data-cy="editor-place-description-french"
formName={formFieldNames.EDITOR_FRENCH}
Expand Down Expand Up @@ -2031,7 +2041,8 @@ function CreateNewPlace() {
: externalCalendarEntityId &&
externalCalendarEntityData?.length > 0 &&
externalCalendarEntityData[0]?.address?.streetAddress
}>
}
fieldName="address-title">
<Form.Item
name={formFieldNames.STREET_ADDRESS_FRENCH}
key={contentLanguage.FRENCH}
Expand Down Expand Up @@ -2146,7 +2157,8 @@ function CreateNewPlace() {
: externalCalendarEntityId &&
externalCalendarEntityData?.length > 0 &&
externalCalendarEntityData[0]?.address?.addressLocality
}>
}
fieldName="place-city">
<Form.Item
name={formFieldNames.CITY_FRENCH}
key={contentLanguage.FRENCH}
Expand Down Expand Up @@ -2281,7 +2293,8 @@ function CreateNewPlace() {
: externalCalendarEntityId &&
externalCalendarEntityData?.length > 0 &&
externalCalendarEntityData[0]?.address?.addressRegion
}>
}
fieldName="place-province">
<Form.Item
name={formFieldNames.PROVINCE_FRENCH}
key={contentLanguage.FRENCH}
Expand Down Expand Up @@ -2392,7 +2405,8 @@ function CreateNewPlace() {
: externalCalendarEntityId &&
externalCalendarEntityData?.length > 0 &&
externalCalendarEntityData[0]?.address?.addressCountry
}>
}
fieldName="place-country">
<Form.Item
name={formFieldNames.COUNTRY_FRENCH}
key={contentLanguage.FRENCH}
Expand Down Expand Up @@ -3153,7 +3167,7 @@ function CreateNewPlace() {
en: form.isFieldTouched(formFieldNames.ACCESSIBILITY_NOTE_ENGLISH),
fr: form.isFieldTouched(formFieldNames.ACCESSIBILITY_NOTE_FRENCH),
}}>
<BilingualInput fieldData={placeData?.accessibilityNote}>
<BilingualInput fieldData={placeData?.accessibilityNote} fieldName="place-accessibility-note">
<Form.Item
name={formFieldNames.ACCESSIBILITY_NOTE_FRENCH}
initialValue={placeData?.accessibilityNote?.fr}
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Dashboard/Settings/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,28 @@ const Settings = () => {

const items = [
{
label: t('dashboard.settings.tab1'),
label: <span data-cy="tab-user-management">{t('dashboard.settings.tab1')}</span>,
key: '1',
children: <UserManagement tabKey={tabKey} />,
disabled: false,
adminOnly: false,
},
{
label: t('dashboard.settings.tab2'),
label: <span data-cy="tab-widget-settings">{t('dashboard.settings.tab2')}</span>,
key: '2',
children: <WidgetSettings tabKey={tabKey} setDirtyStatus={setIsFormDirty} />,
disabled: false,
adminOnly: true,
},
{
label: t('dashboard.settings.tab3'),
label: <span data-cy="tab-calendar-settings">{t('dashboard.settings.tab3')}</span>,
key: '3',
children: currentCalendarData && <CalendarSettings tabKey={tabKey} setDirtyStatus={setIsFormDirty} />,
disabled: false,
adminOnly: true,
},
{
label: t('dashboard.settings.tab4'),
label: <span data-cy="tab-mandatory-fields">{t('dashboard.settings.tab4')}</span>,
key: '4',
children: <MandatoryFields tabKey={tabKey} setDirtyStatus={setIsFormDirty} />,
disabled: false,
Expand Down
Loading