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

Let users set event location before registration type #4033

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
77 changes: 35 additions & 42 deletions app/routes/events/components/EventEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,41 @@ function EventEditor({
fieldClassName={styles.metaField}
className={styles.formField}
/>
<Field
label="Bruk MazeMap"
name="useMazemap"
component={CheckBox.Field}
fieldClassName={styles.metaField}
className={styles.formField}
normalize={(v) => !!v}
/>
{!event.useMazemap ? (
<Field
label="Sted"
name="location"
placeholder="Den Gode Nabo, Downtown, ..."
component={TextInput.Field}
fieldClassName={styles.metaField}
className={styles.formField}
warn={isTBA}
/>
) : (
<Flex alignItems="flex-end">
<Field
label="MazeMap-rom"
name="mazemapPoi"
component={SelectInput.MazemapAutocomplete}
fieldClassName={styles.metaField}
placeholder="R1, Abakus, Kjel4 ..."
/>
{event.mazemapPoi?.value && (
<MazemapLink
mazemapPoi={event.mazemapPoi?.value}
linkText="↗️"
/>
)}
</Flex>
)}
<Tooltip content="Kun la medlemmer i bestemt gruppe se arrangementet">
<Field
label="Kun for spesifikk gruppe"
Expand Down Expand Up @@ -256,48 +291,6 @@ function EventEditor({
fieldClassName={styles.metaField}
options={eventStatusTypes}
/>
{['NORMAL', 'OPEN', 'INFINITE'].includes(
event.eventStatusType && event.eventStatusType.value
) && (
<Field
label="Bruk mazemap"
name="useMazemap"
component={CheckBox.Field}
fieldClassName={styles.metaField}
className={styles.formField}
normalize={(v) => !!v}
/>
)}
{['NORMAL', 'OPEN', 'INFINITE'].includes(
event.eventStatusType && event.eventStatusType.value
) &&
(!event.useMazemap ? (
<Field
label="Sted"
name="location"
placeholder="Den gode nabo, R5, ..."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed R5 from the placeholder, since that's part of MazeMap.

component={TextInput.Field}
fieldClassName={styles.metaField}
className={styles.formField}
warn={isTBA}
/>
) : (
<Flex alignItems="flex-end">
<Field
label="Mazemap-rom"
name="mazemapPoi"
component={SelectInput.MazemapAutocomplete}
fieldClassName={styles.metaField}
placeholder="R1, Abakus, Kjel4"
/>
{event.mazemapPoi?.value && (
<MazemapLink
mazemapPoi={event.mazemapPoi?.value}
linkText="↗️"
/>
)}
</Flex>
))}
{['NORMAL', 'INFINITE'].includes(
event.eventStatusType && event.eventStatusType.value
) && (
Expand Down
13 changes: 13 additions & 0 deletions cypress/e2e/create_event_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('Create event', () => {
fieldError('cover').should('be.visible');
fieldError('title').should('be.visible');
fieldError('description').should('be.visible');
fieldError('mazemapPoi').should('be.visible');
fieldError('eventType').should('be.visible');
fieldError('isClarified').should('be.visible');

Expand All @@ -62,6 +63,11 @@ describe('Create event', () => {
field('description').type('blir fett').blur();
fieldError('description').should('not.exist');

field('useMazemap').uncheck();
cy.contains('Sted').click();
cy.focused().type('R4');
fieldError('mazemapPoi').should('not.exist');

field('isClarified').check();
fieldError('isClarified').should('not.exist');

Expand Down Expand Up @@ -165,6 +171,8 @@ describe('Create event', () => {
.click();
field('title').type('Pils på Webkomkontoret!').blur();
field('description').type('blir fett').blur();
field('useMazemap').uncheck();
field('location').type('DT').blur();
field('isClarified').check();
selectField('eventType').click();
cy.focused().type('sos{enter}', { force: true });
Expand Down Expand Up @@ -196,6 +204,9 @@ describe('Create event', () => {
selectField('eventType').click();
cy.focused().type('be{enter}', { force: true });

field('useMazemap').uncheck();
field('location').type('DT').blur();

// Select company
selectField('company').click();
cy.focused().type('BEKK', { force: true });
Expand Down Expand Up @@ -236,6 +247,8 @@ describe('Create event', () => {
field('title').type('Ubestemt event').blur();
field('description').type('mer info kommer').blur();
selectEditor().type('mer info kommer');
field('useMazemap').uncheck();
field('location').type('DT').blur();

// Select type
selectField('eventType').click();
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/event_editor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ describe('Editor', () => {
field('description').type('blir fett').blur();
selectField('eventType').click();
cy.focused().type('sos{enter}', { force: true });
field('useMazemap').uncheck();
field('location').type('DT').blur();
field('isClarified').check();

// Create event
Expand Down