2019-01-21 15:08:22 +01:00
|
|
|
<template>
|
2020-10-21 17:49:18 +02:00
|
|
|
<div id="homepage">
|
2020-11-30 10:24:11 +01:00
|
|
|
<section
|
|
|
|
class="hero"
|
2020-12-11 15:27:04 +01:00
|
|
|
:class="{ webp: supportsWebPFormat }"
|
2020-11-30 10:24:11 +01:00
|
|
|
v-if="config && (!currentUser.id || !currentActor.id)"
|
|
|
|
>
|
2020-02-18 08:57:00 +01:00
|
|
|
<div class="hero-body">
|
|
|
|
<div class="container">
|
2020-11-30 10:24:11 +01:00
|
|
|
<h1 class="title">
|
|
|
|
{{ config.slogan || $t("Gather ⋅ Organize ⋅ Mobilize") }}
|
|
|
|
</h1>
|
2020-10-14 12:43:52 +02:00
|
|
|
<p
|
2020-11-30 10:24:11 +01:00
|
|
|
v-html="
|
|
|
|
$t('Join <b>{instance}</b>, a Mobilizon instance', {
|
|
|
|
instance: config.name,
|
|
|
|
})
|
|
|
|
"
|
2020-10-14 12:43:52 +02:00
|
|
|
/>
|
2020-02-18 08:57:00 +01:00
|
|
|
<p class="instance-description">{{ config.description }}</p>
|
|
|
|
<!-- We don't invite to find other instances yet -->
|
|
|
|
<!-- <p v-if="!config.registrationsOpen">
|
2019-10-07 16:48:13 +02:00
|
|
|
{{ $t("This instance isn't opened to registrations, but you can register on other instances.") }}
|
2020-02-18 08:57:00 +01:00
|
|
|
</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"
|
2020-10-12 08:50:51 +02:00
|
|
|
>{{ $t("Create an account") }}</b-button
|
2020-02-18 08:57:00 +01:00
|
|
|
>
|
|
|
|
<!-- 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> -->
|
2020-11-30 10:24:11 +01:00
|
|
|
<b-button
|
|
|
|
type="is-text"
|
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.ABOUT }"
|
|
|
|
>
|
2020-10-21 17:49:18 +02:00
|
|
|
{{ $t("Learn more about {instance}", { instance: config.name }) }}
|
2020-02-18 08:57:00 +01:00
|
|
|
</b-button>
|
2019-10-05 19:07:50 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-18 08:57:00 +01:00
|
|
|
</div>
|
|
|
|
</section>
|
2020-10-21 17:49:18 +02:00
|
|
|
<div
|
2021-02-12 18:19:49 +01:00
|
|
|
id="recent_events"
|
2020-10-21 17:49:18 +02:00
|
|
|
class="container section"
|
|
|
|
v-if="config && (!currentUser.id || !currentActor.id)"
|
|
|
|
>
|
2021-02-12 18:19:49 +01:00
|
|
|
<section class="events-recent">
|
|
|
|
<h2 class="is-size-2 has-text-weight-bold">
|
|
|
|
{{ $t("Last published events") }}
|
|
|
|
</h2>
|
|
|
|
<p>
|
|
|
|
{{ $t("On {instance}", { instance: config.name }) }}
|
|
|
|
<b-loading :active.sync="$apollo.loading" />
|
|
|
|
</p>
|
2020-06-11 11:45:52 +02:00
|
|
|
<b-loading :active.sync="$apollo.loading" />
|
2021-02-12 18:19:49 +01:00
|
|
|
<div v-if="this.events.total > 0" class="columns is-multiline">
|
2020-06-11 11:45:52 +02:00
|
|
|
<div
|
|
|
|
class="column is-one-third-desktop"
|
2021-02-12 18:19:49 +01:00
|
|
|
v-for="event in this.events.elements.slice(0, 6)"
|
2020-06-11 11:45:52 +02:00
|
|
|
:key="event.uuid"
|
|
|
|
>
|
|
|
|
<EventCard :event="event" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-30 10:24:11 +01:00
|
|
|
<b-message v-else type="is-danger">{{
|
|
|
|
$t("No events found")
|
|
|
|
}}</b-message>
|
2020-06-11 11:45:52 +02:00
|
|
|
</section>
|
|
|
|
</div>
|
2020-10-21 17:49:18 +02:00
|
|
|
<div id="picture" v-if="config && (!currentUser.id || !currentActor.id)">
|
|
|
|
<div class="picture-container">
|
2020-12-11 15:27:04 +01:00
|
|
|
<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>
|
2020-10-21 17:49:18 +02:00
|
|
|
</div>
|
|
|
|
<div class="container section">
|
|
|
|
<div class="columns">
|
|
|
|
<div class="column">
|
|
|
|
<h3 class="title">{{ $t("A practical tool") }}</h3>
|
|
|
|
<p
|
|
|
|
v-html="
|
2020-11-30 10:24:11 +01:00
|
|
|
$t(
|
|
|
|
'Mobilizon is a tool that helps you <b>find, create and organise events</b>.'
|
|
|
|
)
|
2020-10-21 17:49:18 +02:00
|
|
|
"
|
|
|
|
/>
|
|
|
|
</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">
|
2020-11-30 10:24:11 +01:00
|
|
|
<a
|
|
|
|
class="button is-primary is-large"
|
|
|
|
href="https://joinmobilizon.org"
|
|
|
|
>{{ $t("Learn more about Mobilizon") }}</a
|
|
|
|
>
|
2020-10-21 17:49:18 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-30 10:24:11 +01:00
|
|
|
<div
|
|
|
|
class="container section"
|
|
|
|
v-if="config && loggedUser && loggedUser.settings"
|
|
|
|
>
|
2019-10-15 17:33:02 +02:00
|
|
|
<section v-if="currentActor.id">
|
2020-02-18 08:57:00 +01:00
|
|
|
<b-message type="is-info" v-if="welcomeBack">{{
|
2020-11-30 10:24:11 +01:00
|
|
|
$t("Welcome back {username}!", {
|
|
|
|
username: currentActor.displayName(),
|
|
|
|
})
|
2020-02-18 08:57:00 +01:00
|
|
|
}}</b-message>
|
|
|
|
<b-message type="is-info" v-if="newRegisteredUser">{{
|
2020-11-30 10:24:11 +01:00
|
|
|
$t("Welcome to Mobilizon, {username}!", {
|
|
|
|
username: currentActor.displayName(),
|
|
|
|
})
|
2020-02-18 08:57:00 +01:00
|
|
|
}}</b-message>
|
2019-10-05 19:07:50 +02:00
|
|
|
</section>
|
2021-02-12 18:19:49 +01:00
|
|
|
<!-- Your upcoming events -->
|
2020-11-30 10:24:11 +01:00
|
|
|
<section
|
|
|
|
v-if="currentActor.id && goingToEvents.size > 0"
|
|
|
|
class="container"
|
|
|
|
>
|
2021-02-12 18:19:49 +01:00
|
|
|
<h3 class="title">{{ $t("Your upcoming events") }}</h3>
|
2020-02-07 16:13:29 +01:00
|
|
|
<b-loading :active.sync="$apollo.loading" />
|
2019-10-07 16:48:13 +02:00
|
|
|
<div v-for="row of goingToEvents" class="upcoming-events" :key="row[0]">
|
2020-11-30 10:24:11 +01:00
|
|
|
<span
|
|
|
|
class="date-component-container"
|
|
|
|
v-if="isInLessThanSevenDays(row[0])"
|
|
|
|
>
|
2020-02-07 16:13:29 +01:00
|
|
|
<date-component :date="row[0]" />
|
2020-02-18 08:57:00 +01:00
|
|
|
<subtitle v-if="isToday(row[0])">{{
|
2020-11-30 10:24:11 +01:00
|
|
|
$tc("You have one event today.", row[1].length, {
|
|
|
|
count: row[1].length,
|
|
|
|
})
|
2020-02-18 08:57:00 +01:00
|
|
|
}}</subtitle>
|
|
|
|
<subtitle v-else-if="isTomorrow(row[0])">{{
|
2020-11-30 10:24:11 +01:00
|
|
|
$tc("You have one event tomorrow.", row[1].length, {
|
|
|
|
count: row[1].length,
|
|
|
|
})
|
2020-02-18 08:57:00 +01:00
|
|
|
}}</subtitle>
|
|
|
|
<subtitle 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]),
|
|
|
|
})
|
|
|
|
}}
|
2020-02-18 08:47:41 +01:00
|
|
|
</subtitle>
|
2019-10-05 19:07:50 +02:00
|
|
|
</span>
|
|
|
|
<div>
|
|
|
|
<EventListCard
|
2020-11-27 19:27:44 +01:00
|
|
|
v-for="participation in thisWeek(row)"
|
2020-11-06 11:34:32 +01:00
|
|
|
@event-deleted="eventDeleted"
|
2020-02-18 08:57:00 +01:00
|
|
|
:key="participation[1].id"
|
|
|
|
:participation="participation[1]"
|
2019-10-05 19:07:50 +02:00
|
|
|
/>
|
|
|
|
</div>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2019-10-05 19:07:50 +02:00
|
|
|
<span class="view-all">
|
2020-02-18 08:57:00 +01:00
|
|
|
<router-link :to="{ name: RouteName.MY_EVENTS }"
|
|
|
|
>{{ $t("View everything") }} >></router-link
|
|
|
|
>
|
2019-09-18 17:32:37 +02:00
|
|
|
</span>
|
2019-10-05 19:07:50 +02:00
|
|
|
</section>
|
2021-02-12 18:19:49 +01:00
|
|
|
<!-- Last week events -->
|
2019-10-05 19:07:50 +02:00
|
|
|
<section v-if="currentActor && lastWeekEvents.length > 0">
|
2020-02-18 08:57:00 +01:00
|
|
|
<h3 class="title">{{ $t("Last week") }}</h3>
|
2020-02-07 16:13:29 +01:00
|
|
|
<b-loading :active.sync="$apollo.loading" />
|
2019-09-26 16:38:58 +02:00
|
|
|
<div>
|
2020-02-18 08:57:00 +01:00
|
|
|
<EventListCard
|
|
|
|
v-for="participation in lastWeekEvents"
|
|
|
|
:key="participation.id"
|
|
|
|
:participation="participation"
|
2020-11-06 11:34:32 +01:00
|
|
|
@event-deleted="eventDeleted"
|
2020-02-18 08:57:00 +01:00
|
|
|
:options="{ hideDate: false }"
|
|
|
|
/>
|
2019-03-21 20:23:42 +01:00
|
|
|
</div>
|
2019-10-05 19:07:50 +02:00
|
|
|
</section>
|
2021-02-12 18:19:49 +01:00
|
|
|
<!-- Events close to you -->
|
|
|
|
<section class="events-close" v-if="closeEvents.total > 0">
|
|
|
|
<h2 class="is-size-2 has-text-weight-bold">
|
|
|
|
{{ $t("Close events") }}
|
|
|
|
</h2>
|
|
|
|
<p>
|
|
|
|
{{
|
|
|
|
$tc(
|
|
|
|
"Within {number} kilometers of {place}",
|
|
|
|
loggedUser.settings.location.radius,
|
|
|
|
{
|
|
|
|
number: loggedUser.settings.location.radius,
|
|
|
|
place: loggedUser.settings.location.name,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
<router-link :to="{ name: RouteName.PREFERENCES }">
|
|
|
|
<b-icon
|
|
|
|
class="clickable"
|
|
|
|
icon="pencil"
|
|
|
|
:title="$t('Change')"
|
|
|
|
size="is-small"
|
|
|
|
/>
|
|
|
|
</router-link>
|
|
|
|
<b-loading :active.sync="$apollo.loading" />
|
|
|
|
</p>
|
|
|
|
<div class="columns is-multiline">
|
2020-02-18 08:57:00 +01:00
|
|
|
<div
|
|
|
|
class="column is-one-third-desktop"
|
2021-02-12 18:19:49 +01:00
|
|
|
v-for="event in closeEvents.elements.slice(0, 3)"
|
2020-02-18 08:57:00 +01:00
|
|
|
:key="event.uuid"
|
|
|
|
>
|
2021-02-12 18:19:49 +01:00
|
|
|
<event-card :event="event" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<hr class="home-separator" />
|
|
|
|
<section class="events-recent">
|
|
|
|
<h2 class="is-size-2 has-text-weight-bold">
|
|
|
|
{{ $t("Last published events") }}
|
|
|
|
</h2>
|
|
|
|
<p>
|
|
|
|
{{ $t("On {instance}", { instance: config.name }) }}
|
|
|
|
<b-loading :active.sync="$apollo.loading" />
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div v-if="this.events.total > 0" class="columns is-multiline">
|
|
|
|
<div
|
|
|
|
class="column is-one-third-desktop"
|
|
|
|
v-for="event in this.events.elements.slice(0, 6)"
|
|
|
|
:key="event.uuid"
|
|
|
|
>
|
|
|
|
<recent-event-card-wrapper :event="event" />
|
2019-10-05 19:07:50 +02:00
|
|
|
</div>
|
2019-04-03 17:29:03 +02:00
|
|
|
</div>
|
2021-01-12 16:31:09 +01:00
|
|
|
<b-message v-else type="is-danger"
|
|
|
|
>{{ $t("No events found") }}<br />
|
2021-01-14 15:06:26 +01:00
|
|
|
<div v-if="goingToEvents.size > 0 || lastWeekEvents.length > 0">
|
|
|
|
<b-icon size="is-small" icon="information-outline" />
|
|
|
|
<small>{{
|
|
|
|
$t("The events you created are not shown here.")
|
|
|
|
}}</small>
|
|
|
|
</div>
|
2021-01-12 16:31:09 +01:00
|
|
|
</b-message>
|
2019-10-05 19:07:50 +02:00
|
|
|
</section>
|
|
|
|
</div>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-11-13 13:39:52 +01:00
|
|
|
import { Component, Vue, Watch } from "vue-property-decorator";
|
2021-03-16 19:08:00 +01:00
|
|
|
import { EventSortField, ParticipantRole, SortDirection } from "@/types/enums";
|
2020-12-09 17:55:38 +01:00
|
|
|
import { Paginate } from "@/types/paginate";
|
2020-12-11 15:27:04 +01:00
|
|
|
import { supportsWebPFormat } from "@/utils/support";
|
2020-11-27 19:27:44 +01:00
|
|
|
import { IParticipant, Participant } from "../types/participant.model";
|
2021-02-12 18:19:49 +01:00
|
|
|
import { CLOSE_EVENTS, FETCH_EVENTS } from "../graphql/event";
|
2020-02-18 08:57:00 +01:00
|
|
|
import EventListCard from "../components/Event/EventListCard.vue";
|
|
|
|
import EventCard from "../components/Event/EventCard.vue";
|
2021-02-12 18:19:49 +01:00
|
|
|
import RecentEventCardWrapper from "../components/Event/RecentEventCardWrapper.vue";
|
2020-11-30 10:24:11 +01:00
|
|
|
import {
|
|
|
|
CURRENT_ACTOR_CLIENT,
|
|
|
|
LOGGED_USER_PARTICIPATIONS,
|
|
|
|
} from "../graphql/actor";
|
2020-02-18 08:57:00 +01:00
|
|
|
import { IPerson, Person } from "../types/actor";
|
2020-11-13 13:39:52 +01:00
|
|
|
import { ICurrentUser, IUser } from "../types/current-user.model";
|
2020-06-11 10:58:23 +02:00
|
|
|
import { CURRENT_USER_CLIENT, USER_SETTINGS } from "../graphql/user";
|
2020-02-18 08:57:00 +01:00
|
|
|
import RouteName from "../router/name";
|
2020-11-06 11:34:32 +01:00
|
|
|
import { IEvent } from "../types/event.model";
|
2020-02-18 08:57:00 +01:00
|
|
|
import DateComponent from "../components/Event/DateCalendarIcon.vue";
|
|
|
|
import { CONFIG } from "../graphql/config";
|
|
|
|
import { IConfig } from "../types/config.model";
|
|
|
|
import Subtitle from "../components/Utils/Subtitle.vue";
|
2019-01-21 15:08:22 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
apollo: {
|
|
|
|
events: {
|
|
|
|
query: FETCH_EVENTS,
|
2020-02-18 08:57:00 +01:00
|
|
|
fetchPolicy: "no-cache", // Debug me: https://github.com/apollographql/apollo-client/issues/3030
|
2021-03-16 19:08:00 +01:00
|
|
|
variables: {
|
|
|
|
orderBy: EventSortField.INSERTED_AT,
|
|
|
|
direction: SortDirection.DESC,
|
|
|
|
},
|
2019-01-21 15:08:22 +01:00
|
|
|
},
|
2019-09-18 17:32:37 +02:00
|
|
|
currentActor: {
|
|
|
|
query: CURRENT_ACTOR_CLIENT,
|
2020-02-18 08:57:00 +01:00
|
|
|
update: (data) => new Person(data.currentActor),
|
2019-01-21 15:08:22 +01:00
|
|
|
},
|
2020-06-11 10:58:23 +02:00
|
|
|
currentUser: CURRENT_USER_CLIENT,
|
|
|
|
loggedUser: {
|
|
|
|
query: USER_SETTINGS,
|
|
|
|
fetchPolicy: "no-cache",
|
2020-10-14 12:43:52 +02:00
|
|
|
error() {
|
|
|
|
return null;
|
|
|
|
},
|
2019-04-03 17:29:03 +02:00
|
|
|
},
|
2020-06-11 10:58:23 +02:00
|
|
|
config: CONFIG,
|
2019-10-07 16:48:13 +02:00
|
|
|
currentUserParticipations: {
|
|
|
|
query: LOGGED_USER_PARTICIPATIONS,
|
2020-10-21 12:14:53 +02:00
|
|
|
fetchPolicy: "cache-and-network",
|
2019-10-07 16:48:13 +02:00
|
|
|
variables() {
|
|
|
|
const lastWeek = new Date();
|
|
|
|
lastWeek.setDate(new Date().getDate() - 7);
|
|
|
|
return {
|
|
|
|
afterDateTime: lastWeek.toISOString(),
|
|
|
|
};
|
|
|
|
},
|
2020-02-18 08:57:00 +01:00
|
|
|
update: (data) =>
|
2020-06-09 14:07:49 +02:00
|
|
|
data.loggedUser.participations.elements.map(
|
2020-02-18 08:57:00 +01:00
|
|
|
(participation: IParticipant) => new Participant(participation)
|
|
|
|
),
|
2019-10-07 16:48:13 +02:00
|
|
|
skip() {
|
2021-02-12 18:19:49 +01:00
|
|
|
return this.currentUser?.isLoggedIn === false;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
closeEvents: {
|
|
|
|
query: CLOSE_EVENTS,
|
|
|
|
variables() {
|
|
|
|
return {
|
|
|
|
location: this.loggedUser?.settings?.location?.geohash,
|
|
|
|
radius: this.loggedUser?.settings?.location?.radius,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
update: (data) => data.searchEvents,
|
|
|
|
skip() {
|
|
|
|
return (
|
2021-03-16 18:26:49 +01:00
|
|
|
!this.currentUser?.isLoggedIn ||
|
|
|
|
!this.loggedUser?.settings?.location?.geohash ||
|
|
|
|
!this.loggedUser?.settings?.location?.radius
|
2021-02-12 18:19:49 +01:00
|
|
|
);
|
2019-10-07 16:48:13 +02:00
|
|
|
},
|
|
|
|
},
|
2019-01-21 15:08:22 +01:00
|
|
|
},
|
|
|
|
components: {
|
2020-02-18 08:47:41 +01:00
|
|
|
Subtitle,
|
2019-03-21 20:23:42 +01:00
|
|
|
DateComponent,
|
2019-09-18 17:32:37 +02:00
|
|
|
EventListCard,
|
2019-03-22 10:57:14 +01:00
|
|
|
EventCard,
|
2021-02-12 18:19:49 +01:00
|
|
|
RecentEventCardWrapper,
|
2020-06-11 10:58:23 +02:00
|
|
|
"settings-onboard": () => import("./User/SettingsOnboard.vue"),
|
2019-03-22 10:57:14 +01:00
|
|
|
},
|
2019-10-10 16:47:38 +02:00
|
|
|
metaInfo() {
|
|
|
|
return {
|
2020-10-12 08:50:51 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
2019-10-10 16:47:38 +02:00
|
|
|
// @ts-ignore
|
|
|
|
title: this.instanceName,
|
2020-02-18 08:57:00 +01:00
|
|
|
titleTemplate: "%s | Mobilizon",
|
2019-10-10 16:47:38 +02:00
|
|
|
};
|
|
|
|
},
|
2019-01-21 15:08:22 +01:00
|
|
|
})
|
|
|
|
export default class Home extends Vue {
|
2020-12-11 15:27:04 +01:00
|
|
|
events: Paginate<IEvent> = {
|
|
|
|
elements: [],
|
|
|
|
total: 0,
|
|
|
|
};
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
locations = [];
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
city = { name: null };
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
country = { name: null };
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2021-02-12 18:19:49 +01:00
|
|
|
currentUser!: IUser;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2020-06-11 10:58:23 +02:00
|
|
|
loggedUser!: ICurrentUser;
|
|
|
|
|
2019-09-18 17:32:37 +02:00
|
|
|
currentActor!: IPerson;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-10-07 16:48:13 +02:00
|
|
|
config!: IConfig;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-07-23 18:36:17 +02:00
|
|
|
RouteName = RouteName;
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2019-10-07 16:48:13 +02:00
|
|
|
currentUserParticipations: IParticipant[] = [];
|
|
|
|
|
2020-12-11 15:27:04 +01:00
|
|
|
supportsWebPFormat = supportsWebPFormat;
|
|
|
|
|
2021-02-12 18:19:49 +01:00
|
|
|
closeEvents: Paginate<IEvent> = { elements: [], total: 0 };
|
|
|
|
|
2019-04-03 17:29:03 +02:00
|
|
|
// get displayed_name() {
|
|
|
|
// return this.loggedPerson && this.loggedPerson.name === null
|
|
|
|
// ? this.loggedPerson.preferredUsername
|
|
|
|
// : this.loggedPerson.name;
|
|
|
|
// }
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2020-10-12 08:50:51 +02:00
|
|
|
get instanceName(): string | undefined {
|
2019-10-10 16:47:38 +02:00
|
|
|
if (!this.config) return undefined;
|
|
|
|
return this.config.name;
|
|
|
|
}
|
|
|
|
|
2020-10-12 08:50:51 +02:00
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
|
|
get welcomeBack(): boolean {
|
2020-02-18 08:57:00 +01:00
|
|
|
return window.localStorage.getItem("welcome-back") === "yes";
|
2019-10-14 14:25:08 +02:00
|
|
|
}
|
|
|
|
|
2020-10-12 08:50:51 +02:00
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
|
|
get newRegisteredUser(): boolean {
|
2020-02-18 08:57:00 +01:00
|
|
|
return window.localStorage.getItem("new-registered-user") === "yes";
|
2019-10-15 17:33:02 +02:00
|
|
|
}
|
|
|
|
|
2020-11-30 10:24:11 +01:00
|
|
|
thisWeek(
|
|
|
|
row: [string, Map<string, IParticipant>]
|
|
|
|
): Map<string, IParticipant> {
|
2020-11-27 19:27:44 +01:00
|
|
|
if (this.isInLessThanSevenDays(row[0])) {
|
|
|
|
return row[1];
|
|
|
|
}
|
|
|
|
return new Map();
|
|
|
|
}
|
|
|
|
|
2020-10-12 08:50:51 +02:00
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
|
|
mounted(): void {
|
2020-02-18 08:57:00 +01:00
|
|
|
if (window.localStorage.getItem("welcome-back")) {
|
|
|
|
window.localStorage.removeItem("welcome-back");
|
2019-10-15 17:33:02 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
if (window.localStorage.getItem("new-registered-user")) {
|
|
|
|
window.localStorage.removeItem("new-registered-user");
|
2019-10-15 17:33:02 +02:00
|
|
|
}
|
2019-10-14 14:25:08 +02:00
|
|
|
}
|
|
|
|
|
2020-10-12 08:50:51 +02:00
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
|
|
isToday(date: Date): boolean {
|
2020-02-18 08:57:00 +01:00
|
|
|
return new Date(date).toDateString() === new Date().toDateString();
|
2019-03-21 20:23:42 +01:00
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
isTomorrow(date: string): boolean {
|
2019-03-21 20:23:42 +01:00
|
|
|
return this.isInDays(date, 1);
|
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
isInDays(date: string, nbDays: number): boolean {
|
2019-03-21 20:23:42 +01:00
|
|
|
return this.calculateDiffDays(date) === nbDays;
|
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
isBefore(date: string, nbDays: number): boolean {
|
2019-09-18 17:32:37 +02:00
|
|
|
return this.calculateDiffDays(date) < nbDays;
|
2019-03-21 20:23:42 +01:00
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
isAfter(date: string, nbDays: number): boolean {
|
2019-09-20 18:22:03 +02:00
|
|
|
return this.calculateDiffDays(date) >= nbDays;
|
|
|
|
}
|
|
|
|
|
2019-03-21 20:23:42 +01:00
|
|
|
isInLessThanSevenDays(date: string): boolean {
|
2019-09-18 17:32:37 +02:00
|
|
|
return this.isBefore(date, 7);
|
2019-03-21 20:23:42 +01:00
|
|
|
}
|
|
|
|
|
2020-10-12 08:50:51 +02:00
|
|
|
// eslint-disable-next-line class-methods-use-this
|
2019-03-21 20:23:42 +01:00
|
|
|
calculateDiffDays(date: string): number {
|
2020-11-30 10:24:11 +01:00
|
|
|
return Math.ceil(
|
|
|
|
(new Date(date).getTime() - new Date().getTime()) / 1000 / 60 / 60 / 24
|
|
|
|
);
|
2019-03-21 20:23:42 +01:00
|
|
|
}
|
|
|
|
|
2021-01-12 16:31:09 +01:00
|
|
|
get thisWeekGoingToEvents(): IParticipant[] {
|
2020-02-18 08:57:00 +01:00
|
|
|
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
|
|
|
|
);
|
2019-03-21 20:23:42 +01:00
|
|
|
res.sort(
|
2020-11-30 10:24:11 +01:00
|
|
|
(a: IParticipant, b: IParticipant) =>
|
|
|
|
a.event.beginsOn.getTime() - b.event.beginsOn.getTime()
|
2019-03-21 20:23:42 +01:00
|
|
|
);
|
2021-01-12 16:31:09 +01:00
|
|
|
return res;
|
|
|
|
}
|
2019-10-07 16:48:13 +02:00
|
|
|
|
2021-01-12 16:31:09 +01:00
|
|
|
get goingToEvents(): Map<string, Map<string, IParticipant>> {
|
|
|
|
return this.thisWeekGoingToEvents.reduce(
|
2020-11-30 10:24:11 +01:00
|
|
|
(
|
|
|
|
acc: Map<string, Map<string, IParticipant>>,
|
|
|
|
participation: IParticipant
|
|
|
|
) => {
|
2020-02-18 08:57:00 +01:00
|
|
|
const day = new Date(participation.event.beginsOn).toDateString();
|
2020-11-30 10:24:11 +01:00
|
|
|
const participations: Map<string, IParticipant> =
|
|
|
|
acc.get(day) || new Map();
|
|
|
|
participations.set(
|
|
|
|
`${participation.event.uuid}${participation.actor.id}`,
|
|
|
|
participation
|
|
|
|
);
|
2020-02-18 08:57:00 +01:00
|
|
|
acc.set(day, participations);
|
|
|
|
return acc;
|
|
|
|
},
|
|
|
|
new Map()
|
|
|
|
);
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
|
|
|
|
2020-10-12 08:50:51 +02:00
|
|
|
get lastWeekEvents(): IParticipant[] {
|
2020-02-18 08:57:00 +01:00
|
|
|
const res = this.currentUserParticipations.filter(
|
|
|
|
({ event, role }) =>
|
|
|
|
event.beginsOn != null &&
|
|
|
|
this.isBefore(event.beginsOn.toDateString(), 0) &&
|
|
|
|
role !== ParticipantRole.REJECTED
|
|
|
|
);
|
2019-09-18 17:32:37 +02:00
|
|
|
res.sort(
|
2020-11-30 10:24:11 +01:00
|
|
|
(a: IParticipant, b: IParticipant) =>
|
|
|
|
a.event.beginsOn.getTime() - b.event.beginsOn.getTime()
|
2020-02-18 08:57:00 +01:00
|
|
|
);
|
2019-09-18 17:32:37 +02:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2020-10-12 08:50:51 +02:00
|
|
|
eventDeleted(eventid: string): void {
|
2020-06-25 14:09:01 +02:00
|
|
|
this.currentUserParticipations = this.currentUserParticipations.filter(
|
|
|
|
(participation) => participation.event.id !== eventid
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-10-12 08:50:51 +02:00
|
|
|
viewEvent(event: IEvent): void {
|
2019-02-22 14:55:47 +01:00
|
|
|
this.$router.push({ name: RouteName.EVENT, params: { uuid: event.uuid } });
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
2020-11-13 13:39:52 +01:00
|
|
|
|
|
|
|
@Watch("loggedUser")
|
|
|
|
detectEmptyUserSettings(loggedUser: IUser): void {
|
|
|
|
if (loggedUser && loggedUser.id && loggedUser.settings === null) {
|
2020-11-30 10:24:11 +01:00
|
|
|
this.$router.push({
|
|
|
|
name: RouteName.WELCOME_SCREEN,
|
|
|
|
params: { step: "1" },
|
|
|
|
});
|
2020-11-13 13:39:52 +01:00
|
|
|
}
|
|
|
|
}
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2019-09-20 18:22:03 +02:00
|
|
|
<style lang="scss" scoped>
|
2020-10-21 17:49:18 +02:00
|
|
|
@import "~bulma/sass/utilities/mixins.sass";
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
main > div > .container {
|
|
|
|
background: $white;
|
2020-10-14 12:43:52 +02:00
|
|
|
padding: 1rem 1.5rem 3rem;
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-12-20 13:04:34 +01:00
|
|
|
|
2019-01-21 15:08:22 +01:00
|
|
|
.search-autocomplete {
|
|
|
|
border: 1px solid #dbdbdb;
|
|
|
|
color: rgba(0, 0, 0, 0.87);
|
|
|
|
}
|
|
|
|
|
2021-02-12 18:19:49 +01:00
|
|
|
.events-recent {
|
2020-10-12 08:50:51 +02:00
|
|
|
& > h3 {
|
|
|
|
padding-left: 0.75rem;
|
|
|
|
}
|
|
|
|
|
2019-10-07 16:48:13 +02:00
|
|
|
.columns {
|
|
|
|
margin: 1rem auto 3rem;
|
|
|
|
}
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
|
|
|
|
.date-component-container {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
margin: 1.5rem auto;
|
|
|
|
|
|
|
|
h3.subtitle {
|
|
|
|
margin-left: 7px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
section.container {
|
|
|
|
margin: auto auto 3rem;
|
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
span.view-all {
|
|
|
|
display: block;
|
|
|
|
margin-top: 2rem;
|
|
|
|
text-align: right;
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
a {
|
|
|
|
text-decoration: underline;
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
section.hero {
|
2020-10-21 17:49:18 +02:00
|
|
|
position: relative;
|
|
|
|
z-index: 1;
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
opacity: 0.3;
|
|
|
|
z-index: -1;
|
2020-12-11 15:27:04 +01:00
|
|
|
background: url("/img/pics/homepage_background-1024w.png");
|
|
|
|
background-size: cover;
|
|
|
|
}
|
|
|
|
&.webp::before {
|
|
|
|
background-image: url("/img/pics/homepage_background-1024w.webp");
|
2020-10-21 17:49:18 +02:00
|
|
|
}
|
2019-10-05 19:07:50 +02:00
|
|
|
|
2020-10-14 12:43:52 +02:00
|
|
|
& > .hero-body {
|
|
|
|
padding: 1rem 1.5rem 3rem;
|
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.title {
|
2020-06-17 15:54:24 +02:00
|
|
|
color: $background-color;
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2020-02-18 08:47:41 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.column figure.image img {
|
|
|
|
max-width: 400px;
|
|
|
|
}
|
2019-10-10 13:39:24 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.instance-description {
|
|
|
|
margin-bottom: 1rem;
|
2019-10-05 19:07:50 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2020-10-21 17:49:18 +02:00
|
|
|
|
2021-02-12 18:19:49 +01:00
|
|
|
#recent_events {
|
2020-10-21 17:49:18 +02:00
|
|
|
padding: 1rem 0;
|
|
|
|
min-height: calc(100vh - 400px);
|
|
|
|
z-index: 10;
|
|
|
|
|
|
|
|
.title {
|
|
|
|
margin: 20px auto 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.columns {
|
|
|
|
margin: 0rem auto 3rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#picture {
|
|
|
|
.picture-container {
|
|
|
|
position: relative;
|
|
|
|
&::before {
|
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background: linear-gradient(
|
|
|
|
0deg,
|
|
|
|
$white 0,
|
|
|
|
rgba(0, 0, 0, 0) 5%,
|
|
|
|
rgba(0, 0, 0, 0) 90%,
|
|
|
|
$white 100%
|
|
|
|
);
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
& > img {
|
|
|
|
object-fit: cover;
|
|
|
|
max-height: 80vh;
|
|
|
|
display: block;
|
|
|
|
margin: auto;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.container.section {
|
|
|
|
background: $white;
|
|
|
|
|
|
|
|
@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;
|
|
|
|
}
|
2021-02-12 18:19:49 +01:00
|
|
|
|
|
|
|
.home-separator {
|
|
|
|
background-color: $orange-2;
|
|
|
|
}
|
|
|
|
|
|
|
|
.clickable {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2019-01-21 15:08:22 +01:00
|
|
|
</style>
|