From 305e9a52aecc37dfe6b0059b7340bc3fc15c6faf Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 9 Nov 2022 10:18:42 +0100 Subject: [PATCH] new navbar, loading component --- assets/style.css | 35 ++++- components/Calendar.vue | 2 +- components/DateInput.vue | 97 +++++--------- components/Nav.vue | 270 ++++++++++++++++++++++++++++++--------- nuxt.config.js | 5 +- pages/add/_edit.vue | 29 +++-- 6 files changed, 300 insertions(+), 138 deletions(-) diff --git a/assets/style.css b/assets/style.css index 935e1af5..34caabf2 100644 --- a/assets/style.css +++ b/assets/style.css @@ -13,10 +13,25 @@ li { background-color: #434343; } +.v-application { + font-family: sans-serif; +} + .v-application .p-description.text-body-1 { letter-spacing: normal !important; } +.v-main { + padding-top: 176px !important; +} + +.v-toolbar .v-list-item__subtitle, +.v-toolbar h4 { + white-space: break-spaces; + word-wrap: break-word; + word-break: break-word; +} + #home { max-width: 1400px; padding: 0px; @@ -27,10 +42,17 @@ li { margin: 0 auto; display: flex; flex-wrap: wrap; + gap: 16px; justify-content: center; } -#calh { +@media only screen and (max-width: 600px) { + #events { + gap: 8px; + } +} + +.calh { /* this is to avoid content shift layout as v-calendar does not support SSR */ height: 268px; } @@ -81,8 +103,8 @@ li { width: 330px; max-width: 500px !important; flex-grow: 1; - margin-top: .4em; - margin-right: .4em; + /* margin-top: 16px; + margin-right: 16px; */ transition: all .5s; overflow: hidden; } @@ -96,7 +118,7 @@ li { -webkit-box-orient: vertical; font-size: 1.1em !important; line-height: 1.2em !important; - text-decoration: none; + /* text-decoration: none; */ } .event .body { @@ -113,6 +135,11 @@ li { text-decoration: none; } +.event a:hover, +.event a:focus { + text-decoration: underline; +} + .vc-past { opacity: 0.4; } diff --git a/components/Calendar.vue b/components/Calendar.vue index 1f7a42a2..ffd7ce43 100644 --- a/components/Calendar.vue +++ b/components/Calendar.vue @@ -4,7 +4,7 @@ v-model='selectedDate' title-position='left' :is-dark="settings['theme.is_dark']" - :columns="$screens({ sm: 2 }, 1)" + :columns="!$vuetify.breakpoint.smAndDown ? 2 : 1" @input='click' @update:from-page='updatePage' :locale='$i18n.locale' diff --git a/components/DateInput.vue b/components/DateInput.vue index 4439a866..b4097c49 100644 --- a/components/DateInput.vue +++ b/components/DateInput.vue @@ -15,16 +15,17 @@ v-col(cols=12) .datePicker.mt-3 v-input(:value='fromDate' :rules="[$validators.required('common.when')]") vc-date-picker( - v-model='fromDate' + :value='fromDate' :is-range='type === "multidate"' @input="date => change('date', date)" - :timezone='settings.instance_timezone' :attributes='attributes' :locale='$i18n.locale' :is-dark="settings['theme.is_dark']" is-inline is-expanded :min-date='type !== "recurrent" && new Date()') + template(#placeholder) + span.calc Loading div.text-center.mb-2(v-if='type === "recurrent"') span(v-if='value.recurrent.frequency !== "1m" && value.recurrent.frequency !== "2m"') {{ whenPatterns }} @@ -37,7 +38,7 @@ v-col(cols=12) v-model="menuFromHour" :close-on-content-click="false" offset-y - :value="fromHour" + :value="value.fromHour" transition="scale-transition") template(v-slot:activator="{ on, attrs }") v-text-field( @@ -45,7 +46,7 @@ v-col(cols=12) :clear-icon='mdiClose' @click:clear='() => change("fromHour")' :label="$t('event.from')" - :value="fromHour" + :value="value.fromHour" :disabled='!value.from' readonly :prepend-icon="mdiClockTimeFourOutline" @@ -54,7 +55,7 @@ v-col(cols=12) v-on="on") v-time-picker( v-if="menuFromHour" - v-model="fromHour" + :value="value.fromHour" :allowedMinutes='allowedMinutes' format='24hr' @click:minute='menuFromHour = false' @@ -66,7 +67,7 @@ v-col(cols=12) v-model="menuDueHour" :close-on-content-click="false" offset-y - :value="dueHour" + :value="value.dueHour" transition="scale-transition") template(v-slot:activator="{ on, attrs }") v-text-field( @@ -74,15 +75,15 @@ v-col(cols=12) :clear-icon='mdiClose' @click:clear='() => change("dueHour")' :label="$t('event.due')" - :value="dueHour" - :disabled='!fromHour' + :value="value.dueHour" + :disabled='!value.fromHour' readonly :prepend-icon="mdiClockTimeEightOutline" v-bind="attrs" v-on="on") v-time-picker( v-if="menuDueHour" - v-model="dueHour" + :value="value.dueHour" :allowedMinutes='allowedMinutes' format='24hr' @click:minute='menuDueHour = false' @@ -102,7 +103,7 @@ export default { name: 'DateInput', components: { List }, props: { - value: { type: Object, default: () => ({ from: null, due: null, recurrent: null }) }, + value: { type: Object, default: () => ({ from: null, due: null, recurrent: null, fromHour: null, dueHour: null }) }, event: { type: Object, default: () => null } }, data() { @@ -122,26 +123,15 @@ export default { }, computed: { ...mapState(['settings']), - fromDate: { - set: () => {}, - get: function () { - if (this.value.from) { - if (this.value.multidate) { - return ({ start: dayjs(this.value.from).toDate(), end: dayjs(this.value.due).toDate() }) - } else { - return new Date(this.value.from) - } + fromDate () { + if (this.value.from) { + if (this.value.multidate) { + return ({ start: dayjs(this.value.from).toDate(), end: dayjs(this.value.due).toDate() }) + } else { + return new Date(this.value.from) } } }, - fromHour: { - set: () => {}, - get () { return this.value.from && dayjs.tz(this.value.from).format('HH:mm') || '' } - }, - dueHour: { - set: () => {}, - get () { return this.value.due && dayjs.tz(this.value.due).format('HH:mm') || '' } - }, todayEvents() { const start = dayjs.tz(this.value.from).startOf('day').unix() const end = dayjs.tz(this.value.from).endOf('day').unix() @@ -236,56 +226,39 @@ export default { } else if (what === 'recurrentType') { this.$emit('input', { ...this.value, recurrent: { ...this.value.recurrent, type: value } }) } else if (what === 'fromHour') { - const [hour, minute] = value ? value.split(':') : [0, 0] - let from = dayjs.tz(this.value.from).hour(hour).minute(minute).second(0).toDate() - this.$emit('input', { ...this.value, from }) - if (!value) { - this.fromHour = null + if (value) { + this.$emit('input', { ...this.value, fromHour: value }) + } else { + this.$emit('input', { ...this.value, fromHour: null, dueHour: null }) } } else if (what === 'dueHour') { - if (value) { - const [hour, minute] = value.split(':') - let due = dayjs.tz(this.value.due || this.value.from).hour(Number(hour)).minute(Number(minute)).second(0) + this.$emit('input', { ...this.value, dueHour: value }) - // add a day - if (dayjs(this.value.from).hour() > Number(hour) && !this.value.multidate) { - due = due.add(1, 'day') - } - due = due.hour(hour).minute(minute).second(0) - this.$emit('input', { ...this.value, due: due.toDate() }) - } else { - this.$emit('input', { ...this.value, due: null }) - this.dueHour = null - } + // if (value) { + // // const [hour, minute] = value.split(':') + // // let due = dayjs.tz(this.value.due || this.value.from).hour(Number(hour)).minute(Number(minute)).second(0) + + // // add a day + // // if (dayjs(this.value.from).hour() > Number(hour) && !this.value.multidate) { + // // due = due.add(1, 'day') + // // } + // // due = due.hour(hour).minute(minute).second(0) + // } else { + // this.$emit('input', { ...this.value, dueHour: null }) + // } // change date in calendar (could be a range or a recurrent event...) } else if (what === 'date') { if (value === null) { - this.$emit('input', { ...this.value, from: null, due: null }) + this.$emit('input', { ...this.value, from: null, due: null, fromHour: null, dueHour: null }) return } if (this.value.multidate) { let from = value.start let due = value.end - if (this.fromHour) { - const [hour, minute] = this.fromHour.split(':') - from = dayjs.tz(from).hour(hour).minute(minute).second(0).toDate() - } - if (this.dueHour) { - const [hour, minute] = this.dueHour.split(':') - due = dayjs.tz(due).hour(hour).minute(minute).second(0).toDate() - } this.$emit('input', { ...this.value, from, due }) } else { let from = value let due = this.value.due - if (this.fromHour) { - const [hour, minute] = this.fromHour.split(':') - from = dayjs.tz(value).hour(hour).minute(minute).second(0).toDate() - } - if (this.dueHour) { - const [hour, minute] = this.dueHour.split(':') - due = dayjs.tz(value).hour(hour).minute(minute).second(0).toDate() - } this.$emit('input', { ...this.value, from, due }) } } diff --git a/components/Nav.vue b/components/Nav.vue index 63765c0e..5bd83eef 100644 --- a/components/Nav.vue +++ b/components/Nav.vue @@ -1,87 +1,241 @@ -