Tykayn
fa372387aa
- Added possibility to follow groups and be notified from new upcoming events - Export list of participants to CSV, `PDF` and `ODS` - Allow to set timezone for an event. The timezone is automatically defined from the address if one is defined. If the event timezone is different than the user's current one, a toggle is shown to switch between the two. - Added initial support for Right To Left languages (such as arabic) and [BiDi](https://en.wikipedia.org/wiki/Bidirectional_text) - Group followers and members get an notification email by default when a group publishes a new event (subject to activity notification settings) - Group admins can now approve or deny new memberships - Build releases in `arm` and `arm64` format in addition to `amd64` - Build Docker images in `arm` and `arm64` format in addition to `amd64` - Added possibility to indicate the event is fully online - Added possibility to search only for online events - Added possibility to search only in past events - Detect event, comments and posts languages automatically. Allows setting language - Allow to change an user's password through the users.modify mix task - Add instance setting so that only the admin can create groups - Add instance setting so that only groups can create events - Added JSON-LD metadata about the event in emails - Added a quick link to email notification settings at the bottom of emails - Allow to access Mobilizon with a specific language directly by using `https://instance.tld/lang` where `lang` is a language supported by Mobilizon - Added organizer actor name (profile or group) in the icalendar export - Add initial support for federation with Gancio - Multiple UI improvements, including post, event and participation cards, discussions and emails. The « My Events » page was also redesigned to allow showing events from your groups. - Various accessibility improvements - Event update notification is send to participants ~30 minutes after the event update, so that successive edits are throttled. - Event, post and comments titles and content now have expose their detected language in HTML, for improved screen reader experience - Delete current actor ID as well from local storage when unlogging - Show a default text for instance contact in default terms text when no instance contact is set - Only show locatecontrol button in leaflet map when we can do geolocation - Disable push column in notification settings when push is not available - Show actual language instead of language code in Users admin view - Empty old & new passwords fields when successful password change - Don't link to the group page from admin when actor is suspended - Warn participants when the event organizer is suspended (and therefore the event cancelled) - Improve metadata on public page - Make sure some event action pages (participate remotely or without an account) don't get indexed by search engines - Only send `Tombstone` element in `Delete` activities, not the whole previous deleted element. - Make sure `Delete` activity are send correctly to everyone - Only add address and tags to event icalendar export if they exist - `master` branch has been renamed to `main` - Mention following groups on the registration page - Add missing group name to activity notifications - Warn while registering and logging when the email contains uppercase characters - Improve json-ld metadata on event live streams - Add "eventAttendanceMode" to JSON-ld schema.org event representation - Improve sending pending participation notifications - Add "formerType" and "delete" attributes on Tombstones ActivityPub objects representation - Improve MyEvents page description text - Support for Elixir < 1.12 and OTP < 22 - Fix tags autocomplete - Fix config onboarding after LDAP initial connexion - Fix events pagination on tags page - Fixed deduplicated files from orphan media being deleted as well - Fix deleting own account - Fix search returning user profiles instead of only groups - Fix federating geo coordinates - Fix an issue with group activity items when moving resources - Fix an issue with Identity Picker - Fix an issue with TagInput - Fix an issue when leaving a group - Fix admin settings edition - Fix an issue when showing public page of suspended group - Removed non existing page (`/about/mobilizon`) from sitemap - Fix action logs containing group suspension events - Fixed group physical address not exposed to ActivityPub - Release front-end files are no longer in duplicate - Only show datetime timezone toggle on event if the timezone offset is different from our own - Fix error when determining audience for Discussion when deleting a comment - Fix a couple of accessibility issues - Limit to acceptable tags when pasting raw HTML into comment fields on front-end - Fixed group map display - Fixed updating group physical address - Allow group members to access group drafts - Improve group refreshment workflow - Fixed date signature generation for federation - Fixed an issue when duplicating a group event from another profile - Fixed event metadata not saved on eventcreation - Use a different pagination parameter for searched events and featured events on search page - Fixed creating group activities when creating events with some fields - Move release package at correct path for CI upload - Fixed event contacts that were not exposed and fetched over federation - Don't sign fetch when fetching actor for a given signature - Some various HTTP signatures issues - Fixed actor AP representation of avatar - Handle errors when fetching actor pictures - Fixed sending group events to followers on Mastodon - Fixed actors avatars and banners being deleted if the same file was also an orphan media - Fix spacing in organizer picker - Increase number of close events and follow group events - Fix accessing user profile in admin section - Set initial values for some EventMetadata elements, fixing submitting them right away with no value - Avoid giving an error page if the apollo futureParticipations query is undefined - Fixed path to exports in production - Fixed padding below truncated title of event cards - Fixed exports that weren't enabled in Docker - Fixed error page when event end date is null - Fixed event language not being allowed to be null - Fixed private messages sent as event replies from Mastodon that were shown publically as public comments. They are now discarded. - Czech - Gaelic - German - Hungarian - Indonesian - Norwegian Nynorsk - Occitan - Persian - Portuguese (Brazil) - Russian - Slovenian - Spanish -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEExMITpfxOHHCvHn8FoGG53eDKB3MFAmGcqEMACgkQoGG53eDK B3NlaA/8DoAi7WtC+//xJn8tRSP04PuTRDi2+9/D9a6gjTsiPXDZdb7LtEHuCg1H PXsHNQOTafUM/T7b7XTGmKOST3Sz2kw4eKJArCyF+NuvCwiO/Iw/v1wev2Mo8vvC eDBbMkfiCnMHcytqheeM9gvGuRyIOfgQ9uPk54snfa9a+SGELR5XDRKhwBlGAs6i nkUPbOB72oCou79HZ6CjyLTG6CoWUVsheuvAEhYw52e5JlWSJb9yOUdnOYUV1sr6 OzLct996Z3IOQX4ToaQ+Re99tOaEyqO98aHsv+Wbz128sku0WrfseKn9zi3PL6cF LYjtZ9+0dwdNi3MfgKoEoWJaMlN3+6WUw/blcVP+6b6Ibn5YV/HkVacke/rGoAry oiEjP4HFKnvT83dTBn+LRcU6MY3MrZsarjUACjcKIwpTiylw9gaqA0i7dPBdW35p Q4c1gIh1Q/aE5OKCxXGLrg6s1SNZ754cAyEVo85UnF8Iu4wiaY++ImvyG8xIoOWf vQuya3LcDT8Gj9KY/LWMrVT8LJ2ij5t8oRMFLIHLlfiWbq05m6QaBIWr5sLjLO/N w2N1//ZHNM3sJNl0bZgc9g4lhcdj52VhOcHLot4fdcg5RTektCK0ky5uTD4WJ3GP keihAR8ZtFLaiAQ+XN6ng3IhrgQcpIdJBLlHzgFBx2rTBy8a0Tw= =jyrf -----END PGP SIGNATURE----- Merge tag '2.0.0' into chapril Please read the [UPGRADE.md](https://framagit.org/framasoft/mobilizon/-/blob/main/UPGRADE.md#upgrading-from-13-to-20) file as well. - Added possibility to follow groups and be notified from new upcoming events - Export list of participants to CSV, `PDF` and `ODS` - Allow to set timezone for an event. The timezone is automatically defined from the address if one is defined. If the event timezone is different than the user's current one, a toggle is shown to switch between the two. - Added initial support for Right To Left languages (such as arabic) and [BiDi](https://en.wikipedia.org/wiki/Bidirectional_text) - Group followers and members get an notification email by default when a group publishes a new event (subject to activity notification settings) - Group admins can now approve or deny new memberships - Build releases in `arm` and `arm64` format in addition to `amd64` - Build Docker images in `arm` and `arm64` format in addition to `amd64` - Added possibility to indicate the event is fully online - Added possibility to search only for online events - Added possibility to search only in past events - Detect event, comments and posts languages automatically. Allows setting language - Allow to change an user's password through the users.modify mix task - Add instance setting so that only the admin can create groups - Add instance setting so that only groups can create events - Added JSON-LD metadata about the event in emails - Added a quick link to email notification settings at the bottom of emails - Allow to access Mobilizon with a specific language directly by using `https://instance.tld/lang` where `lang` is a language supported by Mobilizon - Added organizer actor name (profile or group) in the icalendar export - Add initial support for federation with Gancio - Multiple UI improvements, including post, event and participation cards, discussions and emails. The « My Events » page was also redesigned to allow showing events from your groups. - Various accessibility improvements - Event update notification is send to participants ~30 minutes after the event update, so that successive edits are throttled. - Event, post and comments titles and content now have expose their detected language in HTML, for improved screen reader experience - Delete current actor ID as well from local storage when unlogging - Show a default text for instance contact in default terms text when no instance contact is set - Only show locatecontrol button in leaflet map when we can do geolocation - Disable push column in notification settings when push is not available - Show actual language instead of language code in Users admin view - Empty old & new passwords fields when successful password change - Don't link to the group page from admin when actor is suspended - Warn participants when the event organizer is suspended (and therefore the event cancelled) - Improve metadata on public page - Make sure some event action pages (participate remotely or without an account) don't get indexed by search engines - Only send `Tombstone` element in `Delete` activities, not the whole previous deleted element. - Make sure `Delete` activity are send correctly to everyone - Only add address and tags to event icalendar export if they exist - `master` branch has been renamed to `main` - Mention following groups on the registration page - Add missing group name to activity notifications - Warn while registering and logging when the email contains uppercase characters - Improve json-ld metadata on event live streams - Add "eventAttendanceMode" to JSON-ld schema.org event representation - Improve sending pending participation notifications - Add "formerType" and "delete" attributes on Tombstones ActivityPub objects representation - Improve MyEvents page description text - Support for Elixir < 1.12 and OTP < 22 - Fix tags autocomplete - Fix config onboarding after LDAP initial connexion - Fix events pagination on tags page - Fixed deduplicated files from orphan media being deleted as well - Fix deleting own account - Fix search returning user profiles instead of only groups - Fix federating geo coordinates - Fix an issue with group activity items when moving resources - Fix an issue with Identity Picker - Fix an issue with TagInput - Fix an issue when leaving a group - Fix admin settings edition - Fix an issue when showing public page of suspended group - Removed non existing page (`/about/mobilizon`) from sitemap - Fix action logs containing group suspension events - Fixed group physical address not exposed to ActivityPub - Release front-end files are no longer in duplicate - Only show datetime timezone toggle on event if the timezone offset is different from our own - Fix error when determining audience for Discussion when deleting a comment - Fix a couple of accessibility issues - Limit to acceptable tags when pasting raw HTML into comment fields on front-end - Fixed group map display - Fixed updating group physical address - Allow group members to access group drafts - Improve group refreshment workflow - Fixed date signature generation for federation - Fixed an issue when duplicating a group event from another profile - Fixed event metadata not saved on eventcreation - Use a different pagination parameter for searched events and featured events on search page - Fixed creating group activities when creating events with some fields - Move release package at correct path for CI upload - Fixed event contacts that were not exposed and fetched over federation - Don't sign fetch when fetching actor for a given signature - Some various HTTP signatures issues - Fixed actor AP representation of avatar - Handle errors when fetching actor pictures - Fixed sending group events to followers on Mastodon - Fixed actors avatars and banners being deleted if the same file was also an orphan media - Fix spacing in organizer picker - Increase number of close events and follow group events - Fix accessing user profile in admin section - Set initial values for some EventMetadata elements, fixing submitting them right away with no value - Avoid giving an error page if the apollo futureParticipations query is undefined - Fixed path to exports in production - Fixed padding below truncated title of event cards - Fixed exports that weren't enabled in Docker - Fixed error page when event end date is null - Fixed event language not being allowed to be null - Fixed private messages sent as event replies from Mastodon that were shown publically as public comments. They are now discarded. - Czech - Gaelic - German - Hungarian - Indonesian - Norwegian Nynorsk - Occitan - Persian - Portuguese (Brazil) - Russian - Slovenian - Spanish
775 lines
21 KiB
Vue
775 lines
21 KiB
Vue
<template>
|
|
<div id="homepage">
|
|
<b-loading :active.sync="$apollo.loading" />
|
|
<section
|
|
class="hero"
|
|
:class="{ webp: supportsWebPFormat }"
|
|
v-if="config && (!currentUser.id || !currentActor.id)"
|
|
>
|
|
<div class="hero-body">
|
|
<div class="container">
|
|
<h1 class="title">
|
|
{{ config.slogan || $t("Gather ⋅ Organize ⋅ Mobilize") }}
|
|
</h1>
|
|
<p
|
|
v-html="
|
|
`${$t('Join <b>{instance}</b>, a Mobilizon instance', {
|
|
instance: config.name,
|
|
})}.`
|
|
"
|
|
/>
|
|
<p class="instance-description">{{ config.description }}</p>
|
|
<!-- We don't invite to find other instances yet -->
|
|
<!-- <p v-if="!config.registrationsOpen">
|
|
{{ $t("This instance isn't opened to registrations, but you can register on other instances.") }}
|
|
</p>-->
|
|
<b-message type="is-danger" v-if="!config.registrationsOpen">{{
|
|
$t("Unfortunately, this instance isn't opened to registrations")
|
|
}}</b-message>
|
|
<div class="buttons">
|
|
<b-button
|
|
type="is-primary"
|
|
tag="router-link"
|
|
:to="{ name: RouteName.REGISTER }"
|
|
v-if="config.registrationsOpen"
|
|
>
|
|
<i class="mdi mdi-account"></i>
|
|
{{ $t("Create an account") }}</b-button
|
|
>
|
|
<a
|
|
class="button is-light"
|
|
:title="config.contact"
|
|
href="mailto:mobilizon-support@chapril.org"
|
|
>{{ $t("Contact") }}</a
|
|
>
|
|
<!-- We don't invite to find other instances yet -->
|
|
<!-- <b-button v-else type="is-link" tag="a" href="https://joinmastodon.org">{{ $t('Find an instance') }}</b-button> -->
|
|
<b-button
|
|
type="is-text"
|
|
tag="router-link"
|
|
:to="{ name: RouteName.ABOUT }"
|
|
>
|
|
{{ $t("Learn more about {instance}", { instance: config.name }) }}
|
|
</b-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<div
|
|
id="recent_events"
|
|
class="container section"
|
|
v-if="config && (!currentUser.id || !currentActor.id)"
|
|
>
|
|
<section class="events-recent">
|
|
<h2 class="title">
|
|
{{ $t("Last published events") }}
|
|
</h2>
|
|
<p>
|
|
<i18n tag="span" path="On {instance} and other federated instances">
|
|
<b slot="instance">{{ config.name }}</b>
|
|
</i18n>
|
|
</p>
|
|
<div v-if="this.events.total > 0">
|
|
<multi-card :events="events.elements.slice(0, 6)" />
|
|
<span class="view-all">
|
|
<router-link :to="{ name: RouteName.SEARCH }"
|
|
>{{ $t("View everything") }} >></router-link
|
|
>
|
|
</span>
|
|
</div>
|
|
<b-message v-else type="is-danger">{{
|
|
$t("No events found")
|
|
}}</b-message>
|
|
</section>
|
|
</div>
|
|
<div id="picture" v-if="config && (!currentUser.id || !currentActor.id)">
|
|
<div class="picture-container">
|
|
<picture>
|
|
<source
|
|
media="(max-width: 799px)"
|
|
srcset="/img/pics/homepage-480w.webp"
|
|
type="image/webp"
|
|
/>
|
|
<source
|
|
media="(max-width: 799px)"
|
|
srcset="/img/pics/homepage-480w.jpg"
|
|
type="image/jpeg"
|
|
/>
|
|
|
|
<source
|
|
media="(max-width: 1024px)"
|
|
srcset="/img/pics/homepage-1024w.webp"
|
|
type="image/webp"
|
|
/>
|
|
<source
|
|
media="(max-width: 1024px)"
|
|
srcset="/img/pics/homepage-1024w.jpg"
|
|
type="image/jpeg"
|
|
/>
|
|
|
|
<source
|
|
media="(max-width: 1920px)"
|
|
srcset="/img/pics/homepage-1920w.webp"
|
|
type="image/webp"
|
|
/>
|
|
<source
|
|
media="(max-width: 1920px)"
|
|
srcset="/img/pics/homepage-1920w.jpg"
|
|
type="image/jpeg"
|
|
/>
|
|
|
|
<source
|
|
media="(min-width: 1921px)"
|
|
srcset="/img/pics/homepage.webp"
|
|
type="image/webp"
|
|
/>
|
|
<source
|
|
media="(min-width: 1921px)"
|
|
srcset="/img/pics/homepage.jpg"
|
|
type="image/jpeg"
|
|
/>
|
|
|
|
<img
|
|
src="/img/pics/homepage-1024w.jpg"
|
|
width="3840"
|
|
height="2719"
|
|
alt=""
|
|
loading="lazy"
|
|
/>
|
|
</picture>
|
|
</div>
|
|
<div class="container section">
|
|
<div class="columns">
|
|
<div class="column">
|
|
<h3 class="title">{{ $t("A practical tool") }}</h3>
|
|
<p
|
|
v-html="
|
|
$t(
|
|
'Mobilizon is a tool that helps you <b>find, create and organise events</b>.'
|
|
)
|
|
"
|
|
/>
|
|
</div>
|
|
<div class="column">
|
|
<h3 class="title">{{ $t("An ethical alternative") }}</h3>
|
|
<p
|
|
v-html="
|
|
$t(
|
|
'Ethical alternative to Facebook events, groups and pages, Mobilizon is a <b>tool designed to serve you</b>. Period.'
|
|
)
|
|
"
|
|
/>
|
|
</div>
|
|
<div class="column">
|
|
<h3 class="title">{{ $t("A federated software") }}</h3>
|
|
<p
|
|
v-html="
|
|
$t(
|
|
'Mobilizon is not a giant platform, but a <b>multitude of interconnected Mobilizon websites</b>.'
|
|
)
|
|
"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="buttons">
|
|
<a
|
|
class="button is-primary is-large"
|
|
href="https://joinmobilizon.org"
|
|
>{{ $t("Learn more about Mobilizon") }}</a
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="container section" v-if="config && loggedUserSettings">
|
|
<section v-if="currentActor.id && (welcomeBack || newRegisteredUser)">
|
|
<b-message type="is-info" v-if="welcomeBack">{{
|
|
$t("Welcome back {username}!", {
|
|
username: currentActor.displayName(),
|
|
})
|
|
}}</b-message>
|
|
<b-message type="is-info" v-if="newRegisteredUser">{{
|
|
$t("Welcome to Mobilizon, {username}!", {
|
|
username: currentActor.displayName(),
|
|
})
|
|
}}</b-message>
|
|
</section>
|
|
<!-- Your upcoming events -->
|
|
<section v-if="canShowMyUpcomingEvents">
|
|
<h2 class="title">{{ $t("Your upcoming events") }}</h2>
|
|
<div v-for="row of goingToEvents" class="upcoming-events" :key="row[0]">
|
|
<p
|
|
class="date-component-container"
|
|
v-if="isInLessThanSevenDays(row[0])"
|
|
>
|
|
<span v-if="isToday(row[0])">{{
|
|
$tc("You have one event today.", row[1].length, {
|
|
count: row[1].length,
|
|
})
|
|
}}</span>
|
|
<span v-else-if="isTomorrow(row[0])">{{
|
|
$tc("You have one event tomorrow.", row[1].length, {
|
|
count: row[1].length,
|
|
})
|
|
}}</span>
|
|
<span v-else-if="isInLessThanSevenDays(row[0])">
|
|
{{
|
|
$tc("You have one event in {days} days.", row[1].length, {
|
|
count: row[1].length,
|
|
days: calculateDiffDays(row[0]),
|
|
})
|
|
}}
|
|
</span>
|
|
</p>
|
|
<div>
|
|
<event-participation-card
|
|
v-for="participation in thisWeek(row)"
|
|
@event-deleted="eventDeleted"
|
|
:key="participation[1].id"
|
|
:participation="participation[1]"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<span class="view-all">
|
|
<router-link :to="{ name: RouteName.MY_EVENTS }"
|
|
>{{ $t("View everything") }} >></router-link
|
|
>
|
|
</span>
|
|
</section>
|
|
<hr
|
|
role="presentation"
|
|
class="home-separator"
|
|
v-if="canShowMyUpcomingEvents && canShowFollowedGroupEvents"
|
|
/>
|
|
<!-- Events from your followed groups -->
|
|
<section class="followActivity" v-if="canShowFollowedGroupEvents">
|
|
<h2 class="title">
|
|
{{ $t("Upcoming events from your groups") }}
|
|
</h2>
|
|
<p>{{ $t("That you follow or of which you are a member") }}</p>
|
|
<multi-card :events="filteredFollowedGroupsEvents" />
|
|
<span class="view-all">
|
|
<router-link
|
|
:to="{
|
|
name: RouteName.MY_EVENTS,
|
|
query: {
|
|
showUpcoming: 'true',
|
|
showDrafts: 'false',
|
|
showAttending: 'false',
|
|
showMyGroups: 'true',
|
|
},
|
|
}"
|
|
>{{ $t("View everything") }} >></router-link
|
|
>
|
|
</span>
|
|
</section>
|
|
<hr
|
|
role="presentation"
|
|
class="home-separator"
|
|
v-if="canShowFollowedGroupEvents && canShowCloseEvents"
|
|
/>
|
|
|
|
<!-- Events close to you -->
|
|
<section class="events-close" v-if="canShowCloseEvents">
|
|
<h2 class="title">
|
|
{{ $t("Events nearby") }}
|
|
</h2>
|
|
<p>
|
|
{{
|
|
$tc(
|
|
"Within {number} kilometers of {place}",
|
|
loggedUserSettings.location.range,
|
|
{
|
|
number: loggedUserSettings.location.range,
|
|
place: loggedUserSettings.location.name,
|
|
}
|
|
)
|
|
}}
|
|
<router-link
|
|
:to="{ name: RouteName.PREFERENCES }"
|
|
:title="$t('Change')"
|
|
>
|
|
<b-icon class="clickable" icon="pencil" size="is-small" />
|
|
</router-link>
|
|
</p>
|
|
<multi-card :events="closeEvents.elements.slice(0, 4)" />
|
|
</section>
|
|
<hr
|
|
role="presentation"
|
|
class="home-separator"
|
|
v-if="canShowMyUpcomingEvents || canShowCloseEvents"
|
|
/>
|
|
<section class="events-recent">
|
|
<h2 class="title">
|
|
{{ $t("Last published events") }}
|
|
</h2>
|
|
<p>
|
|
<i18n tag="span" path="On {instance} and other federated instances">
|
|
<b slot="instance">{{ config.name }}</b>
|
|
</i18n>
|
|
</p>
|
|
|
|
<div v-if="events.total > 0">
|
|
<multi-card :events="events.elements.slice(0, 8)" />
|
|
<span class="view-all">
|
|
<router-link :to="{ name: RouteName.SEARCH }"
|
|
>{{ $t("View everything") }} >></router-link
|
|
>
|
|
</span>
|
|
</div>
|
|
<b-message v-else type="is-danger"
|
|
>{{ $t("No events found") }}<br />
|
|
<div v-if="goingToEvents.size > 0">
|
|
<b-icon size="is-small" icon="information-outline" />
|
|
<small>{{
|
|
$t("The events you created are not shown here.")
|
|
}}</small>
|
|
</div>
|
|
</b-message>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { Component, Vue, Watch } from "vue-property-decorator";
|
|
import { EventSortField, ParticipantRole, SortDirection } from "@/types/enums";
|
|
import { Paginate } from "@/types/paginate";
|
|
import { supportsWebPFormat } from "@/utils/support";
|
|
import { IParticipant, Participant } from "../types/participant.model";
|
|
import { FETCH_EVENTS } from "../graphql/event";
|
|
import EventParticipationCard from "../components/Event/EventParticipationCard.vue";
|
|
import MultiCard from "../components/Event/MultiCard.vue";
|
|
import { CURRENT_ACTOR_CLIENT } from "../graphql/actor";
|
|
import { IPerson, Person } from "../types/actor";
|
|
import {
|
|
ICurrentUser,
|
|
IUser,
|
|
IUserSettings,
|
|
} from "../types/current-user.model";
|
|
import { CURRENT_USER_CLIENT } from "../graphql/user";
|
|
import { CLOSE_CONTENT, HOME_USER_QUERIES } from "../graphql/home";
|
|
import RouteName from "../router/name";
|
|
import { IEvent } from "../types/event.model";
|
|
import DateComponent from "../components/Event/DateCalendarIcon.vue";
|
|
import { CONFIG } from "../graphql/config";
|
|
import { IConfig } from "../types/config.model";
|
|
import { IFollowedGroupEvent } from "../types/followedGroupEvent.model";
|
|
import Subtitle from "../components/Utils/Subtitle.vue";
|
|
|
|
@Component({
|
|
apollo: {
|
|
events: {
|
|
query: FETCH_EVENTS,
|
|
variables: {
|
|
orderBy: EventSortField.INSERTED_AT,
|
|
direction: SortDirection.DESC,
|
|
},
|
|
},
|
|
currentActor: {
|
|
query: CURRENT_ACTOR_CLIENT,
|
|
update: (data) => new Person(data.currentActor),
|
|
},
|
|
currentUser: CURRENT_USER_CLIENT,
|
|
config: CONFIG,
|
|
closeContent: {
|
|
query: CLOSE_CONTENT,
|
|
variables() {
|
|
return {
|
|
location: this.loggedUser?.settings?.location?.geohash,
|
|
radius: this.loggedUser?.settings?.location?.range,
|
|
};
|
|
},
|
|
update(data) {
|
|
this.closeEvents = data.searchEvents;
|
|
},
|
|
skip() {
|
|
return (
|
|
!this.currentUser?.isLoggedIn ||
|
|
!this.loggedUser?.settings?.location?.geohash ||
|
|
!this.loggedUser?.settings?.location?.range
|
|
);
|
|
},
|
|
},
|
|
userQueries: {
|
|
query: HOME_USER_QUERIES,
|
|
update(data) {
|
|
console.log("loggedUser", data.loggedUser);
|
|
this.loggedUser = data.loggedUser;
|
|
this.followedGroupEvents = data.loggedUser.followedGroupEvents;
|
|
this.currentUserParticipations =
|
|
data.loggedUser.participations.elements.map(
|
|
(participation: IParticipant) => new Participant(participation)
|
|
);
|
|
},
|
|
variables: {
|
|
afterDateTime: new Date().toISOString(),
|
|
},
|
|
skip() {
|
|
return !this.currentUser?.isLoggedIn;
|
|
},
|
|
},
|
|
},
|
|
components: {
|
|
Subtitle,
|
|
DateComponent,
|
|
EventParticipationCard,
|
|
MultiCard,
|
|
"settings-onboard": () => import("./User/SettingsOnboard.vue"),
|
|
},
|
|
metaInfo() {
|
|
return {
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
title: this.instanceName,
|
|
titleTemplate: "%s | Mobilizon",
|
|
};
|
|
},
|
|
})
|
|
export default class Home extends Vue {
|
|
events: Paginate<IEvent> = {
|
|
elements: [],
|
|
total: 0,
|
|
};
|
|
|
|
locations = [];
|
|
|
|
city = { name: null };
|
|
|
|
country = { name: null };
|
|
|
|
currentUser!: ICurrentUser;
|
|
|
|
loggedUser: IUser | null = null;
|
|
|
|
currentActor!: IPerson;
|
|
|
|
config!: IConfig;
|
|
|
|
RouteName = RouteName;
|
|
|
|
currentUserParticipations: IParticipant[] = [];
|
|
|
|
supportsWebPFormat = supportsWebPFormat;
|
|
|
|
closeEvents: Paginate<IEvent> = { elements: [], total: 0 };
|
|
|
|
followedGroupEvents: Paginate<IFollowedGroupEvent> = {
|
|
elements: [],
|
|
total: 0,
|
|
};
|
|
|
|
// get displayed_name() {
|
|
// return this.loggedPerson && this.loggedPerson.name === null
|
|
// ? this.loggedPerson.preferredUsername
|
|
// : this.loggedPerson.name;
|
|
// }
|
|
|
|
get instanceName(): string | undefined {
|
|
if (!this.config) return undefined;
|
|
return this.config.name;
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
get welcomeBack(): boolean {
|
|
return window.localStorage.getItem("welcome-back") === "yes";
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
get newRegisteredUser(): boolean {
|
|
return window.localStorage.getItem("new-registered-user") === "yes";
|
|
}
|
|
|
|
thisWeek(
|
|
row: [string, Map<string, IParticipant>]
|
|
): Map<string, IParticipant> {
|
|
if (this.isInLessThanSevenDays(row[0])) {
|
|
return row[1];
|
|
}
|
|
return new Map();
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
mounted(): void {
|
|
if (window.localStorage.getItem("welcome-back")) {
|
|
window.localStorage.removeItem("welcome-back");
|
|
}
|
|
if (window.localStorage.getItem("new-registered-user")) {
|
|
window.localStorage.removeItem("new-registered-user");
|
|
}
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
isToday(date: Date): boolean {
|
|
return new Date(date).toDateString() === new Date().toDateString();
|
|
}
|
|
|
|
isTomorrow(date: string): boolean {
|
|
return this.isInDays(date, 1);
|
|
}
|
|
|
|
isInDays(date: string, nbDays: number): boolean {
|
|
return this.calculateDiffDays(date) === nbDays;
|
|
}
|
|
|
|
isBefore(date: string, nbDays: number): boolean {
|
|
return this.calculateDiffDays(date) < nbDays;
|
|
}
|
|
|
|
isAfter(date: string, nbDays: number): boolean {
|
|
return this.calculateDiffDays(date) >= nbDays;
|
|
}
|
|
|
|
isInLessThanSevenDays(date: string): boolean {
|
|
return this.isBefore(date, 7);
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
calculateDiffDays(date: string): number {
|
|
return Math.ceil(
|
|
(new Date(date).getTime() - new Date().getTime()) / 1000 / 60 / 60 / 24
|
|
);
|
|
}
|
|
|
|
get thisWeekGoingToEvents(): IParticipant[] {
|
|
const res = this.currentUserParticipations.filter(
|
|
({ event, role }) =>
|
|
event.beginsOn != null &&
|
|
this.isAfter(event.beginsOn.toDateString(), 0) &&
|
|
this.isBefore(event.beginsOn.toDateString(), 7) &&
|
|
role !== ParticipantRole.REJECTED
|
|
);
|
|
res.sort(
|
|
(a: IParticipant, b: IParticipant) =>
|
|
a.event.beginsOn.getTime() - b.event.beginsOn.getTime()
|
|
);
|
|
return res;
|
|
}
|
|
|
|
get goingToEvents(): Map<string, Map<string, IParticipant>> {
|
|
return this.thisWeekGoingToEvents.reduce(
|
|
(
|
|
acc: Map<string, Map<string, IParticipant>>,
|
|
participation: IParticipant
|
|
) => {
|
|
const day = new Date(participation.event.beginsOn).toDateString();
|
|
const participations: Map<string, IParticipant> =
|
|
acc.get(day) || new Map();
|
|
participations.set(
|
|
`${participation.event.uuid}${participation.actor.id}`,
|
|
participation
|
|
);
|
|
acc.set(day, participations);
|
|
return acc;
|
|
},
|
|
new Map()
|
|
);
|
|
}
|
|
|
|
eventDeleted(eventid: string): void {
|
|
this.currentUserParticipations = this.currentUserParticipations.filter(
|
|
(participation) => participation.event.id !== eventid
|
|
);
|
|
}
|
|
|
|
viewEvent(event: IEvent): void {
|
|
this.$router.push({ name: RouteName.EVENT, params: { uuid: event.uuid } });
|
|
}
|
|
|
|
@Watch("loggedUser")
|
|
detectEmptyUserSettings(loggedUser: IUser): void {
|
|
if (loggedUser?.id && loggedUser?.settings === null) {
|
|
this.$router.push({
|
|
name: RouteName.WELCOME_SCREEN,
|
|
params: { step: "1" },
|
|
});
|
|
}
|
|
}
|
|
|
|
get loggedUserSettings(): IUserSettings | undefined {
|
|
return this.loggedUser?.settings;
|
|
}
|
|
|
|
get canShowMyUpcomingEvents(): boolean {
|
|
return this.currentActor.id != undefined && this.goingToEvents.size > 0;
|
|
}
|
|
|
|
get canShowCloseEvents(): boolean {
|
|
return (
|
|
this.loggedUser?.settings?.location != undefined &&
|
|
this.closeEvents.total > 0
|
|
);
|
|
}
|
|
|
|
get canShowFollowedGroupEvents(): boolean {
|
|
return this.filteredFollowedGroupsEvents.length > 0;
|
|
}
|
|
|
|
get filteredFollowedGroupsEvents(): IEvent[] {
|
|
return this.followedGroupEvents.elements
|
|
.map(({ event }: { event: IEvent }) => event)
|
|
.filter(
|
|
({ id }) =>
|
|
!this.thisWeekGoingToEvents
|
|
.map(({ event: { id: event_id } }) => event_id)
|
|
.includes(id)
|
|
)
|
|
.slice(0, 4);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@use "@/styles/_mixins" as *;
|
|
@import "~bulma/sass/utilities/mixins.sass";
|
|
|
|
main > div > .container {
|
|
background: $whitest;
|
|
padding: 1rem 0.5rem 3rem;
|
|
}
|
|
|
|
.search-autocomplete {
|
|
border: 1px solid #dbdbdb;
|
|
color: rgba(0, 0, 0, 0.87);
|
|
}
|
|
|
|
.events-recent {
|
|
& > h3 {
|
|
@include padding-left(0.75rem);
|
|
}
|
|
|
|
.columns {
|
|
margin: 1rem auto 0;
|
|
}
|
|
}
|
|
|
|
.date-component-container {
|
|
display: flex;
|
|
align-items: center;
|
|
margin: 0.5rem auto 1rem;
|
|
|
|
h3.subtitle {
|
|
@include margin-left(7px);
|
|
}
|
|
}
|
|
|
|
span.view-all {
|
|
display: block;
|
|
margin-top: 1rem;
|
|
text-align: right;
|
|
|
|
a {
|
|
text-decoration: underline;
|
|
}
|
|
}
|
|
|
|
section.hero {
|
|
position: relative;
|
|
z-index: 1;
|
|
|
|
&::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
opacity: 0.3;
|
|
z-index: -1;
|
|
background: url("../../public/img/pics/homepage_background-1024w.png");
|
|
background-size: cover;
|
|
}
|
|
&.webp::before {
|
|
background-image: url("../../public/img/pics/homepage_background-1024w.webp");
|
|
}
|
|
|
|
& > .hero-body {
|
|
padding: 1rem 1.5rem 3rem;
|
|
}
|
|
|
|
.title {
|
|
color: $background-color;
|
|
}
|
|
|
|
.column figure.image img {
|
|
max-width: 400px;
|
|
}
|
|
|
|
.instance-description {
|
|
margin-bottom: 1rem;
|
|
}
|
|
}
|
|
|
|
#recent_events {
|
|
padding: 0;
|
|
min-height: 20vh;
|
|
z-index: 10;
|
|
|
|
.title {
|
|
margin: 20px auto 0;
|
|
}
|
|
|
|
.columns {
|
|
margin: 0 auto;
|
|
}
|
|
}
|
|
|
|
#picture {
|
|
.picture-container {
|
|
position: relative;
|
|
&::before {
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
z-index: 1;
|
|
}
|
|
|
|
& > img {
|
|
object-fit: cover;
|
|
max-height: 80vh;
|
|
display: block;
|
|
margin: auto;
|
|
width: 100%;
|
|
}
|
|
}
|
|
|
|
.container.section {
|
|
@include tablet {
|
|
margin-top: -4rem;
|
|
}
|
|
z-index: 10;
|
|
|
|
.title {
|
|
margin: 0 0 10px;
|
|
font-size: 30px;
|
|
}
|
|
|
|
.buttons {
|
|
justify-content: center;
|
|
margin-top: 2rem;
|
|
}
|
|
}
|
|
}
|
|
|
|
#homepage {
|
|
background: $white;
|
|
}
|
|
|
|
.home-separator {
|
|
background-color: $orange-2;
|
|
}
|
|
|
|
.clickable {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.title {
|
|
font-size: 27px;
|
|
&:not(:last-child) {
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
}
|
|
</style>
|