From 918dc6f10ba8ebd6069bc2bf1f29678bb3b26019 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 15 Jun 2020 18:12:49 +0200 Subject: [PATCH] Multiples fixes Signed-off-by: Thomas Citharel --- js/src/components/Event/EventListCard.vue | 9 ++-- js/src/components/Event/EventListViewCard.vue | 2 +- js/src/components/Footer.vue | 36 ++++++++------ js/src/components/NavBar.vue | 10 +++- js/src/graphql/actor.ts | 9 ++-- js/src/graphql/event.ts | 1 - js/src/i18n/en_US.json | 5 +- js/src/i18n/fr_FR.json | 5 +- js/src/mixins/event.ts | 9 ++-- js/src/types/actor/person.model.ts | 4 +- js/src/types/event.model.ts | 4 -- js/src/variables.scss | 47 +++++++++---------- js/src/views/Event/Edit.vue | 47 +++++++++++-------- js/src/views/Event/Event.vue | 5 +- 14 files changed, 108 insertions(+), 85 deletions(-) diff --git a/js/src/components/Event/EventListCard.vue b/js/src/components/Event/EventListCard.vue index a8095dd80..8a11d34f9 100644 --- a/js/src/components/Event/EventListCard.vue +++ b/js/src/components/Event/EventListCard.vue @@ -34,10 +34,13 @@ + - diff --git a/js/src/components/Event/EventListViewCard.vue b/js/src/components/Event/EventListViewCard.vue index 759bdb423..59d9ce971 100644 --- a/js/src/components/Event/EventListViewCard.vue +++ b/js/src/components/Event/EventListViewCard.vue @@ -23,7 +23,7 @@
- + diff --git a/js/src/components/Footer.vue b/js/src/components/Footer.vue index d790b29a0..d9b32510a 100644 --- a/js/src/components/Footer.vue +++ b/js/src/components/Footer.vue @@ -1,10 +1,10 @@ @@ -49,11 +51,13 @@ footer.footer { display: flex; flex-direction: column; align-items: center; + font-size: 14px; .logo { fill: $secondary; flex: 1; max-width: 300px; + margin-bottom: 2rem; } div.content { @@ -63,13 +67,15 @@ footer.footer { ul li { display: inline-flex; margin: auto 5px; - a { - color: #eee; - font-size: 1.5rem; - text-decoration: underline; - text-decoration-color: $secondary; + font-size: 1.1rem; } } + + a { + color: $white; + text-decoration: underline; + text-decoration-color: $secondary; + } } diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue index a97d6792c..e67f6145e 100644 --- a/js/src/components/NavBar.vue +++ b/js/src/components/NavBar.vue @@ -219,8 +219,14 @@ export default class NavBar extends Vue { @import "../variables.scss"; nav { - .navbar-item svg { - height: 1.75rem; + .navbar-item { + a.button.is-success { + background: #1e7d97; + } + + svg { + height: 1.75rem; + } } .navbar-dropdown .navbar-item { diff --git a/js/src/graphql/actor.ts b/js/src/graphql/actor.ts index d9cc41a1d..7e184dd1a 100644 --- a/js/src/graphql/actor.ts +++ b/js/src/graphql/actor.ts @@ -23,9 +23,12 @@ export const FETCH_PERSON = gql` token } organizedEvents { - uuid - title - beginsOn + total + elements { + uuid + title + beginsOn + } } } } diff --git a/js/src/graphql/event.ts b/js/src/graphql/event.ts index 7d619c956..bc97e7985 100644 --- a/js/src/graphql/event.ts +++ b/js/src/graphql/event.ts @@ -96,7 +96,6 @@ export const FETCH_EVENT = gql` name }, publishAt, - category, onlineAddress, phoneAddress, physicalAddress { diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json index 4ca76d8a4..82bade9cd 100644 --- a/js/src/i18n/en_US.json +++ b/js/src/i18n/en_US.json @@ -484,7 +484,6 @@ "{count} participants": "No participants yet | One participant | {count} participants", "{count} requests waiting": "{count} requests waiting", "{license} guarantees {respect} of the people who will use it. Since {source}, anyone can audit it, which guarantees its transparency.": "{license} guarantees {respect} of the people who will use it. Since {source}, anyone can audit it, which guarantees its transparency.", - "© The Mobilizon Contributors {date} - Made with Elixir, Phoenix, VueJS & with some love and some weeks": "© The Mobilizon Contributors {date} - Made with Elixir, Phoenix, VueJS & with some love and some weeks", "© The OpenStreetMap Contributors": "© The OpenStreetMap Contributors", "@{username} ({role})": "@{username} ({role})", "@{username}": "@{username}", @@ -641,5 +640,7 @@ "terms of service": "terms of service", "Please read the instance's {fullRules}": "Please read the instance's {fullRules}", "I agree to the {instanceRules} and {termsOfService}": "I agree to the {instanceRules} and {termsOfService}", - "This email is already used.": "This email is already used." + "This email is already used.": "This email is already used.", + "Powered by {mobilizon}. © 2018 - {date} The Mobilizon Contributors - Made with the financial support of {contributors}.": "Powered by {mobilizon}. © 2018 - {date} The Mobilizon Contributors - Made with the financial support of {contributors}.", + "more than 1360 contributors": "more than 1360 contributors" } diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json index c5d7b4ae7..9538c2387 100644 --- a/js/src/i18n/fr_FR.json +++ b/js/src/i18n/fr_FR.json @@ -591,7 +591,6 @@ "{going}/{capacity} available places": "Pas de places restantes|{going}/{capacity} places restantes", "{license} guarantees {respect} of the people who will use it. Since {source}, anyone can audit it, which guarantees its transparency.": "{license} garantit {respect} des personnes qui l'utiliseront. Puisque {source}, il est publiquement auditable, ce qui garantit sa transparence.", "{title} ({count} todos)": "{title} ({count} todos)", - "© The Mobilizon Contributors {date} - Made with Elixir, Phoenix, VueJS & with some love and some weeks": "© Les contributeurs de Mobilizon {date} - Fait avec Elixir, Phoenix, VueJS & et de l'amour et des semaines", "© The OpenStreetMap Contributors": "© Les Contributeur⋅ices OpenStreetMap", "Participation notifications": "Notifications de participation", "We'll always send you emails to notify about important event updates": "Nous vous enverrons toujours des emails pour vous notifier à propos des mises à jour importantes des événements", @@ -664,5 +663,7 @@ "terms of service": "conditions générales d'utilisation", "Please read the instance's {fullRules}": "Merci de lire les {fullRules} de l'instance", "I agree to the {instanceRules} and {termsOfService}": "J'accepte les {instanceRules} et les {termsOfService}", - "This email is already used.": "Cette adresse email est déjà utilisée." + "This email is already used.": "Cette adresse email est déjà utilisée.", + "Powered by {mobilizon}. © 2018 - {date} The Mobilizon Contributors - Made with the financial support of {contributors}.": "Propulsé par {mobilizon}. © 2018 - {date} Les contributeur·ices Mobilizon - Fait avec le soutien financier de {contributors}.", + "more than 1360 contributors": "plus de 1360 contributeur·ices" } diff --git a/js/src/mixins/event.ts b/js/src/mixins/event.ts index 4853b7637..7ef38d275 100644 --- a/js/src/mixins/event.ts +++ b/js/src/mixins/event.ts @@ -41,8 +41,9 @@ export default class EventMixin extends mixins(Vue) { console.error("Cannot update participation cache, because of null value."); return; } - [participation] = person.participations; - person.participations = []; + [participation] = person.participations.elements; + person.participations.elements = []; + person.participations.total = 0; store.writeQuery({ query: EVENT_PERSON_PARTICIPATION, variables: { eventId: event.id, actorId }, @@ -89,8 +90,8 @@ export default class EventMixin extends mixins(Vue) { protected async openDeleteEventModal(event: IEvent, currentActor: IPerson) { function escapeRegExp(string: string) { - return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string - } + return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + } const participantsLength = event.participantStats.participant; const prefix = participantsLength ? this.$tc("There are {participants} participants.", event.participantStats.participant, { diff --git a/js/src/types/actor/person.model.ts b/js/src/types/actor/person.model.ts index b34b36196..b0389e224 100644 --- a/js/src/types/actor/person.model.ts +++ b/js/src/types/actor/person.model.ts @@ -13,7 +13,7 @@ export interface IFeedToken { export interface IPerson extends IActor { feedTokens: IFeedToken[]; goingToEvents: IEvent[]; - participations: IParticipant[]; + participations: Paginate; memberships: Paginate; user?: ICurrentUser; } @@ -23,7 +23,7 @@ export class Person extends Actor implements IPerson { goingToEvents: IEvent[] = []; - participations: IParticipant[] = []; + participations!: Paginate; memberships!: Paginate; diff --git a/js/src/types/event.model.ts b/js/src/types/event.model.ts index 17d1665a9..02592eb49 100644 --- a/js/src/types/event.model.ts +++ b/js/src/types/event.model.ts @@ -127,7 +127,6 @@ export interface IEvent { title: string; slug: string; description: string; - category: Category | null; beginsOn: Date; endsOn: Date | null; publishAt: Date; @@ -229,8 +228,6 @@ export class EventModel implements IEvent { visibility = EventVisibility.PUBLIC; - category: Category | null = Category.MEETING; - joinOptions = EventJoinOptions.FREE; status = EventStatus.CONFIRMED; @@ -319,7 +316,6 @@ export class EventModel implements IEvent { picture: this.picture, onlineAddress: this.onlineAddress, phoneAddress: this.phoneAddress, - category: this.category, physicalAddress: this.physicalAddress, options: this.options, // organizerActorId: this.organizerActor && this.organizerActor.id ? this.organizerActor.id : null, diff --git a/js/src/variables.scss b/js/src/variables.scss index dbb33e128..446f830b4 100644 --- a/js/src/variables.scss +++ b/js/src/variables.scss @@ -6,30 +6,38 @@ $primary-invert: findColorInvert($primary); $secondary: #ffd599; $secondary-invert: findColorInvert($secondary); -$success: #1E7D97; +$success: #0eccaf; $success-invert: findColorInvert($success); $info: #36bcd4; $info-invert: findColorInvert($info); $danger: #ff7061; $danger-invert: findColorInvert($danger); -$colors: map-merge($colors, - ("primary": ($primary, +$colors: map-merge( + $colors, + ( + "primary": ( + $primary, $primary-invert, ), - "secondary": ($secondary, + "secondary": ( + $secondary, $secondary-invert, ), - "success": ($success, + "success": ( + $success, $success-invert, ), - "info": ($info, + "info": ( + $info, $info-invert, ), - "danger": ($danger, + "danger": ( + $danger, $danger-invert, ), - )); + ) +); // Navbar $navbar-background-color: $secondary; @@ -37,41 +45,32 @@ $navbar-item-color: $primary; $navbar-height: 4rem; // Footer -$footer-padding: 3rem 1.5rem 4rem; +$footer-padding: 3rem 1.5rem 1rem; $footer-background-color: $primary; $body-background-color: #efeef4; $fullhd-enabled: false; $hero-body-padding-medium: 6rem 1.5rem; -main>.container { +main > .container { background: $body-background-color; } $title-color: #3c376e; -$title-family: "Liberation Sans", -"Helvetica Neue", -Roboto, -Helvetica, -Arial, -serif; +$title-family: "Liberation Sans", "Helvetica Neue", Roboto, Helvetica, Arial, + serif; $title-weight: 700; $title-size: 40px; $title-sub-size: 45px; $title-sup-size: 30px; $subtitle-color: #3a384c; -$subtitle-family: "Liberation Sans", -"Helvetica Neue", -Roboto, -Helvetica, -Arial, -serif; +$subtitle-family: "Liberation Sans", "Helvetica Neue", Roboto, Helvetica, Arial, + serif; $subtitle-weight: 400; $subtitle-size: 32px; $subtitle-sub-size: 30px; $subtitle-sup-size: 15px; - .title { margin: 30px auto 45px; } @@ -81,4 +80,4 @@ $subtitle-sup-size: 15px; display: inline; padding: 3px 8px; margin: 15px auto 30px; -} \ No newline at end of file +} diff --git a/js/src/views/Event/Edit.vue b/js/src/views/Event/Edit.vue index 6959a3e5c..6f7871ebf 100644 --- a/js/src/views/Event/Edit.vue +++ b/js/src/views/Event/Edit.vue @@ -444,11 +444,6 @@ export default class EditEvent extends Vue { endsOnNull = false; - created() { - this.initializeEvent(); - this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON())); - } - @Watch("eventId", { immediate: true }) resetFormForCreation(eventId: string) { if (eventId === undefined) { @@ -486,10 +481,12 @@ export default class EditEvent extends Vue { } ); this.observer.observe(this.$refs.bottomObserver as Element); - this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON())); this.pictureFile = await buildFileFromIPicture(this.event.picture); this.limitedPlaces = this.event.options.maximumAttendeeCapacity > 0; + if (!(this.isUpdate || this.isDuplicate)) { + this.initializeEvent(); + } } createOrUpdateDraft(e: Event) { @@ -513,6 +510,13 @@ export default class EditEvent extends Vue { this.event.organizerActor = this.currentActor; } + @Watch("event") + setInitialData() { + if (this.isUpdate && this.unmodifiedEvent === undefined && this.event && this.event.uuid) { + this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON())); + } + } + resetAttributedToOnOrganizerChange() { this.event.attributedTo = new Group(); } @@ -621,21 +625,24 @@ export default class EditEvent extends Vue { person: { __typename: "Person", id: organizerActor.id, - participations: [ - { - __typename: "Participant", - id: "unknown", - role: ParticipantRole.CREATOR, - actor: { - __typename: "Actor", - id: organizerActor.id, + participations: { + total: 1, + elements: [ + { + __typename: "Participant", + id: "unknown", + role: ParticipantRole.CREATOR, + actor: { + __typename: "Actor", + id: organizerActor.id, + }, + event: { + __typename: "Event", + id: updateEvent.id, + }, }, - event: { - __typename: "Event", - id: updateEvent.id, - }, - }, - ], + ], + }, }, }, }); diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index 348ead9c1..7ddff6962 100644 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -592,7 +592,7 @@ import PopoverActorCard from "../../components/Account/PopoverActorCard.vue"; }, }, update: (data) => { - if (data && data.person) return data.person.participations; + if (data && data.person) return data.person.participations.elements; return []; }, skip() { @@ -809,7 +809,8 @@ export default class Event extends EventMixin { console.error("Cannot update participation cache, because of null value."); return; } - person.participations.push(data.joinEvent); + person.participations.elements.push(data.joinEvent); + person.participations.total += 1; store.writeQuery({ query: EVENT_PERSON_PARTICIPATION, variables: { eventId: this.event.id, actorId: identity.id },