Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement timezone feature on schedule/session page similar with Talk systems #243

Merged
merged 15 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions webapp/src/views/schedule/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
:class="onlyFavs ? ['active'] : []") {{favs.length}}

bunt-button.bunt-ripple-ink(@click="resetAllFiltered", icon="filter-off")

template(v-if="!inEventTimezone")
bunt-select.timezone-item(name="timezone", :options="[{id: schedule.timezone, label: schedule.timezone}, {id: userTimezone, label: userTimezone}]", v-model="currentTimezone", @blur="saveTimezone")
template(v-else)
div.timezone-label.timezone-item.bunt-tab-header-item {{ schedule.timezone }}

.export.dropdown
bunt-progress-circular.export-spinner(v-if="isExporting", size="small")
custom-dropdown(name="calendar-add1"
Expand Down Expand Up @@ -135,7 +141,9 @@
isExporting: false,
error: null,
defaultFilter: defaultFilter,
onlyFavs: false
onlyFavs: false,
userTimezone: null,
currentTimezone: null,
}
},
computed: {
Expand Down Expand Up @@ -195,9 +203,18 @@
filter.tracks.data = this.filterItemsByLanguage(this?.schedule?.tracks)

return filter
}
},
inEventTimezone () {

Check failure on line 207 in webapp/src/views/schedule/index.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected space before function parentheses
if (!this.schedule?.talks?.length) return false
const example = this.schedule.talks[0].start
return moment.tz(example, this.userTimezone).format('Z') === moment.tz(example, this.schedule.timezone).format('Z')
},
},
async created () {

Check failure on line 213 in webapp/src/views/schedule/index.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected space before function parentheses
this.userTimezone = moment.tz.guess()
this.currentTimezone = localStorage.getItem(`userTimezone`)

Check failure on line 215 in webapp/src/views/schedule/index.vue

View workflow job for this annotation

GitHub Actions / build

Strings must use singlequote
},
watch: {

Check warning on line 217 in webapp/src/views/schedule/index.vue

View workflow job for this annotation

GitHub Actions / build

The "watch" property should be above the "created" property on line 213
tracksFilter: {
handler: function(newValue) {
const arr = Object.keys(newValue).filter(key => newValue[key])
Expand Down Expand Up @@ -284,6 +301,9 @@
resetOnlyFavs() {
this.onlyFavs = false
},
saveTimezone () {

Check failure on line 304 in webapp/src/views/schedule/index.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected space before function parentheses
localStorage.setItem(`userTimezone`, this.currentTimezone)

Check failure on line 305 in webapp/src/views/schedule/index.vue

View workflow job for this annotation

GitHub Actions / build

Strings must use singlequote
},
}
}
</script>
Expand Down Expand Up @@ -372,4 +392,7 @@
.export-spinner
padding-top: 22px !important
margin-right: 10px
.bunt-select
.bunt-input
height: auto !important
</style>
103 changes: 63 additions & 40 deletions webapp/src/views/schedule/sessions/index.vue
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
<template lang="pug">
.c-schedule
template(v-if="schedule")
div.filter-actions
app-dropdown(v-for="item in filter", className="schedule")
template(slot="toggler")
span {{item.title}}
app-dropdown-content(className="schedule")
app-dropdown-item(v-for="track in item.data", :key="track.value")
.checkbox-line(:style="{'--track-color': track.color}")
bunt-checkbox.checkbox-text(type="checkbox", :label="track.label", name="track_room_views", v-model="track.selected", :value="track.value") {{ getTrackName(track) }}
bunt-button.bunt-ripple-ink(v-if="favs",
icon="star"
@click="onlyFavs = !onlyFavs; if (onlyFavs) resetFiltered()"
:class="onlyFavs ? ['active'] : []") {{favs.length}}
template(v-if="schedule")
div.filter-actions
app-dropdown(v-for="item in filter", className="schedule")
template(slot="toggler")
span {{item.title}}
app-dropdown-content(className="schedule")
app-dropdown-item(v-for="track in item.data", :key="track.value")
.checkbox-line(:style="{'--track-color': track.color}")
bunt-checkbox.checkbox-text(type="checkbox", :label="track.label", name="track_room_views", v-model="track.selected", :value="track.value") {{ getTrackName(track) }}
bunt-button.bunt-ripple-ink(v-if="favs",
icon="star"
@click="onlyFavs = !onlyFavs; if (onlyFavs) resetFiltered()"
:class="onlyFavs ? ['active'] : []") {{favs.length}}

bunt-button.bunt-ripple-ink(@click="resetAllFiltered", icon="filter-off")
.export.dropdown
bunt-progress-circular.export-spinner(v-if="isExporting", size="small")
custom-dropdown(name="calendar-add1"
v-model="selectedExporter"
:options="exportType"
label="Add to Calendar"
@input="makeExport")
bunt-button.bunt-ripple-ink(@click="resetAllFiltered", icon="filter-off")

bunt-tabs.days(v-if="days && days.length > 1", :active-tab="currentDay.toISOString()", ref="tabs", v-scrollbar.x="")
bunt-tab(v-for="day in days", :id="day.toISOString()", :header="moment(day).format('dddd DD. MMMM')", @selected="changeDay(day)")
.scroll-parent(ref="scrollParent", v-scrollbar.x.y="")
linear-schedule(:sessions="sessions",
:rooms="rooms",
:currentDay="currentDay",
:now="now",
:scrollParent="$refs.scrollParent",
:favs="favs",
@changeDay="changeDayByScroll",
@fav="$store.dispatch('schedule/fav', $event)",
@unfav="$store.dispatch('schedule/unfav', $event)"
)
.error(v-else-if="errorLoading")
.mdi.mdi-alert-octagon
h1 {{ $t('schedule/index:scheduleLoadingError') }}
bunt-progress-circular(v-else, size="huge", :page="true")
template(v-if="!inEventTimezone")
bunt-select.timezone-item(name="timezone", :options="[{id: schedule.timezone, label: schedule.timezone}, {id: userTimezone, label: userTimezone}]", v-model="currentTimezone", @blur="saveTimezone")
template(v-else)
div.timezone-label.timezone-item.bunt-tab-header-item {{ schedule.timezone }}

.export.dropdown
bunt-progress-circular.export-spinner(v-if="isExporting", size="small")
custom-dropdown(name="calendar-add1"
v-model="selectedExporter"
:options="exportType"
label="Add to Calendar"
@input="makeExport")

bunt-tabs.days(v-if="days && days.length > 1", :active-tab="currentDay.toISOString()", ref="tabs", v-scrollbar.x="")
bunt-tab(v-for="day in days", :id="day.toISOString()", :header="moment(day).format('dddd DD. MMMM')", @selected="changeDay(day)")
.scroll-parent(ref="scrollParent", v-scrollbar.x.y="")
linear-schedule(:sessions="sessions",
:rooms="rooms",
:currentDay="currentDay",
:now="now",
:scrollParent="$refs.scrollParent",
:favs="favs",
@changeDay="changeDayByScroll",
@fav="$store.dispatch('schedule/fav', $event)",
@unfav="$store.dispatch('schedule/unfav', $event)"
)
.error(v-else-if="errorLoading")
.mdi.mdi-alert-octagon
h1 {{ $t('schedule/index:scheduleLoadingError') }}
bunt-progress-circular(v-else, size="huge", :page="true")
</template>
<script>
import _ from 'lodash'
Expand Down Expand Up @@ -123,7 +129,9 @@
isExporting: false,
error: null,
defaultFilter: defaultFilter,
onlyFavs: false
onlyFavs: false,
userTimezone: null,
currentTimezone: null,
}
},
computed: {
Expand Down Expand Up @@ -182,9 +190,18 @@
filter.rooms.data = this.filterItemsByLanguage(this?.schedule?.rooms)
filter.tracks.data = this.filterItemsByLanguage(this?.schedule?.tracks)
return filter
}
},
inEventTimezone () {

Check failure on line 194 in webapp/src/views/schedule/sessions/index.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected space before function parentheses
if (!this.schedule?.talks?.length) return false
const example = this.schedule.talks[0].start
return moment.tz(example, this.userTimezone).format('Z') === moment.tz(example, this.schedule.timezone).format('Z')
},
},
async created () {

Check failure on line 200 in webapp/src/views/schedule/sessions/index.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected space before function parentheses
this.userTimezone = moment.tz.guess()
this.currentTimezone = localStorage.getItem(`userTimezone`)

Check failure on line 202 in webapp/src/views/schedule/sessions/index.vue

View workflow job for this annotation

GitHub Actions / build

Strings must use singlequote
},
watch: {

Check warning on line 204 in webapp/src/views/schedule/sessions/index.vue

View workflow job for this annotation

GitHub Actions / build

The "watch" property should be above the "created" property on line 200
tracksFilter: {
handler: function(newValue) {
const arr = Object.keys(newValue).filter(key => newValue[key])
Expand Down Expand Up @@ -271,6 +288,9 @@
resetOnlyFavs() {
this.onlyFavs = false
},
saveTimezone () {

Check failure on line 291 in webapp/src/views/schedule/sessions/index.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected space before function parentheses
localStorage.setItem(`userTimezone`, this.currentTimezone)

Check failure on line 292 in webapp/src/views/schedule/sessions/index.vue

View workflow job for this annotation

GitHub Actions / build

Strings must use singlequote
},
}
}
</script>
Expand Down Expand Up @@ -357,4 +377,7 @@
.export-spinner
padding-top: 22px !important
margin-right: 10px
.bunt-select
.bunt-input
height: auto !important
</style>
Loading