Fixes to navbar and edit page

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-10-03 11:37:34 +02:00
parent 1e945a3d14
commit f60ab9b5b8
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
5 changed files with 31 additions and 31 deletions

View file

@ -1,5 +1,5 @@
<template> <template>
<img svg-inline src="../assets/mobilizon_logo.svg" alt="Mobilizon" :class="{invert: invert}" height="60px"> <img svg-inline src="../assets/mobilizon_logo.svg" alt="Mobilizon" :class="{invert: invert}" height="40px">
</template> </template>
<script lang="ts"> <script lang="ts">

View file

@ -1,11 +1,14 @@
<template> <template>
<b-navbar type="is-secondary" shadow wrapper-class="container"> <b-navbar type="is-secondary" shadow wrapper-class="container">
<template slot="brand"> <template slot="brand">
<b-navbar-item tag="router-link" :to="{ name: 'Home' }"><logo /></b-navbar-item> <b-navbar-item tag="router-link" :to="{ name: RouteName.HOME }"><logo /></b-navbar-item>
</template> </template>
<template slot="start"> <template slot="start">
<b-navbar-item tag="router-link" :to="{ name: EventRouteName.EXPLORE }">{{ $t('Explore') }}</b-navbar-item> <b-navbar-item tag="router-link" :to="{ name: EventRouteName.EXPLORE }">{{ $t('Explore') }}</b-navbar-item>
<b-navbar-item tag="router-link" :to="{ name: EventRouteName.MY_EVENTS }">{{ $t('Events') }}</b-navbar-item> <b-navbar-item tag="router-link" :to="{ name: EventRouteName.MY_EVENTS }">{{ $t('Events') }}</b-navbar-item>
<b-navbar-item tag="span">
<b-button tag="router-link" :to="{ name: RouteName.CREATE_EVENT }" type="is-success">{{ $t('Create') }}</b-button>
</b-navbar-item>
</template> </template>
<template slot="end"> <template slot="end">
<b-navbar-item tag="div"> <b-navbar-item tag="div">
@ -56,11 +59,11 @@
<b-navbar-item v-else tag="div"> <b-navbar-item v-else tag="div">
<div class="buttons"> <div class="buttons">
<router-link class="button is-primary" v-if="config && config.registrationsOpen" :to="{ name: 'Register' }"> <router-link class="button is-primary" v-if="config && config.registrationsOpen" :to="{ name: RouteName.REGISTER }">
<strong>{{ $t('Sign up') }}</strong> <strong>{{ $t('Sign up') }}</strong>
</router-link> </router-link>
<router-link class="button is-light" :to="{ name: 'Login' }">{{ $t('Log in') }}</router-link> <router-link class="button is-light" :to="{ name: RouteName.LOGIN }">{{ $t('Log in') }}</router-link>
</div> </div>
</b-navbar-item> </b-navbar-item>
</template> </template>
@ -114,7 +117,7 @@ export default class NavBar extends Vue {
currentUser!: ICurrentUser; currentUser!: ICurrentUser;
ICurrentUserRole = ICurrentUserRole; ICurrentUserRole = ICurrentUserRole;
identities: IPerson[] = []; identities: IPerson[] = [];
showNavbar: boolean = false; RouteName = RouteName;
ActorRouteName = ActorRouteName; ActorRouteName = ActorRouteName;
AdminRouteName = AdminRouteName; AdminRouteName = AdminRouteName;

View file

@ -16,7 +16,7 @@ $colors: map-merge(
// Navbar // Navbar
$navbar-background-color: $secondary; $navbar-background-color: $secondary;
$navbar-item-color: $primary; $navbar-item-color: $primary;
$navbar-height: 7rem; $navbar-height: 4rem;
// Footer // Footer

View file

@ -162,7 +162,7 @@
<div class="container"> <div class="container">
<div class="navbar-menu"> <div class="navbar-menu">
<div class="navbar-start"> <div class="navbar-start">
<span class="navbar-item" v-if="isUpdate === true && isEventModified">{{ $t('Unsaved changes') }}</span> <span class="navbar-item" v-if="isEventModified">{{ $t('Unsaved changes') }}</span>
</div> </div>
<div class="navbar-end"> <div class="navbar-end">
<span class="navbar-item"> <span class="navbar-item">
@ -293,7 +293,7 @@ export default class EditEvent extends Vue {
if (this.eventId) { if (this.eventId) {
this.event = await this.getEvent(); this.event = await this.getEvent();
this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event)); this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON()));
this.pictureFile = await buildFileFromIPicture(this.event.picture); this.pictureFile = await buildFileFromIPicture(this.event.picture);
this.limitedPlaces = this.event.options.maximumAttendeeCapacity != null; this.limitedPlaces = this.event.options.maximumAttendeeCapacity != null;
@ -301,8 +301,16 @@ export default class EditEvent extends Vue {
} }
created() { created() {
const now = new Date(); this.initializeEvent();
const end = new Date(); this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON()));
}
private initializeEvent() {
const roundUpTo = roundTo => x => new Date(Math.ceil(x / roundTo) * roundTo);
const roundUpTo15Minutes = roundUpTo(1000 * 60 * 15);
const now = roundUpTo15Minutes(new Date());
const end = roundUpTo15Minutes(new Date());
end.setUTCHours(now.getUTCHours() + 3); end.setUTCHours(now.getUTCHours() + 3);
this.event.beginsOn = now; this.event.beginsOn = now;
@ -311,7 +319,7 @@ export default class EditEvent extends Vue {
} }
mounted() { mounted() {
this.observer = new IntersectionObserver((entries, observer) => { this.observer = new IntersectionObserver((entries) => {
for (const entry of entries) { for (const entry of entries) {
if (entry) { if (entry) {
this.showFixedNavbar = !entry.isIntersecting; this.showFixedNavbar = !entry.isIntersecting;
@ -454,7 +462,7 @@ export default class EditEvent extends Vue {
} }
get isEventModified(): boolean { get isEventModified(): boolean {
return JSON.stringify(this.event) !== JSON.stringify(this.unmodifiedEvent); return JSON.stringify(this.event.toEditJSON()) !== JSON.stringify(this.unmodifiedEvent);
} }
// getAddressData(addressData) { // getAddressData(addressData) {

View file

@ -1,12 +1,12 @@
<template> <template>
<div class="container" v-if="config"> <div class="container" v-if="config">
<section class="hero is-link" v-if="!currentUser.id || !currentActor"> <section class="hero is-info" v-if="!currentUser.id || !currentActor">
<div class="hero-body"> <div class="hero-body">
<div> <div>
<h1 class="title">{{ config.name }}</h1> <h1 class="title">{{ config.name }}</h1>
<h2 class="subtitle">{{ config.description }}</h2> <h2 class="subtitle">{{ config.description }}</h2>
<router-link class="button" :to="{ name: 'Register' }" v-if="config.registrationsOpen"> <router-link class="button" :to="{ name: 'Register' }" v-if="config.registrationsOpen">
{{ $t('Register') }} {{ $t('Sign up') }}
</router-link> </router-link>
<p v-else> <p v-else>
{{ $t("This instance isn't opened to registrations, but you can register on other instances.") }} {{ $t("This instance isn't opened to registrations, but you can register on other instances.") }}
@ -14,24 +14,12 @@
</div> </div>
</div> </div>
</section> </section>
<section v-else> <section v-else-if="currentActor">
<h1> <b-message type="is-info">
{{ $t('Welcome back {username}', {username: `@${currentActor.preferredUsername}`}) }} {{ $t('Welcome back {username}', { username: currentActor.displayName() }) }}
</h1> </b-message>
</section> </section>
<b-dropdown aria-role="list"> <section v-else-if="currentActor && goingToEvents.size > 0" class="container">
<button class="button is-primary" slot="trigger">
<span>{{ $t('Create') }}</span>
<b-icon icon="menu-down"></b-icon>
</button>
<b-dropdown-item aria-role="listitem">
<router-link :to="{ name: RouteName.CREATE_EVENT }">{{ $t('Event') }}</router-link>
</b-dropdown-item>
<b-dropdown-item aria-role="listitem">
<router-link :to="{ name: RouteName.CREATE_GROUP }">{{ $t('Group') }}</router-link>
</b-dropdown-item>
</b-dropdown>
<section v-if="currentActor && goingToEvents.size > 0" class="container">
<h3 class="title"> <h3 class="title">
{{ $t("Upcoming") }} {{ $t("Upcoming") }}
</h3> </h3>
@ -121,6 +109,7 @@ import { EventRouteName } from '@/router/event';
}, },
currentActor: { currentActor: {
query: CURRENT_ACTOR_CLIENT, query: CURRENT_ACTOR_CLIENT,
update: data => new Person(data.currentActor),
}, },
currentUser: { currentUser: {
query: CURRENT_USER_CLIENT, query: CURRENT_USER_CLIENT,