From 1e3cc84ae6873d91d25bcb48b6080ed0a90910db Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Sat, 20 Apr 2024 18:51:32 +0200 Subject: [PATCH 1/4] Remove unnecessary function calls and this.api bindings --- .../src/components/activity/DaySwitcher.vue | 4 +- .../src/components/activity/ScheduleEntry.vue | 32 ++-- .../components/activity/content/Material.vue | 2 +- .../campAdmin/CampActivityProgressLabels.vue | 10 +- .../src/components/campAdmin/CampAddress.vue | 6 +- .../components/campAdmin/CampCategories.vue | 10 +- .../campAdmin/CampConditionalFields.vue | 10 +- .../components/campAdmin/CampDangerZone.vue | 12 +- .../campAdmin/CampMaterialLists.vue | 8 +- .../src/components/campAdmin/CampPeriods.vue | 8 +- .../src/components/campAdmin/CampSettings.vue | 6 +- .../material/DialogMaterialItemForm.vue | 4 +- .../src/components/material/MaterialLists.vue | 8 +- .../material/useMaterialViewHelper.js | 4 +- .../components/print/PrintConfigurator.vue | 60 +++---- .../program/DialogActivityCreate.vue | 4 +- .../components/program/DialogActivityForm.vue | 4 +- .../program/FormScheduleEntryList.vue | 8 +- .../src/components/program/PeriodSwitcher.vue | 10 +- .../components/program/ScheduleEntries.vue | 16 +- .../program/ScheduleEntryFilters.vue | 28 ++- frontend/src/router.js | 159 ++++++++++-------- frontend/src/views/activity/Activity.vue | 4 +- .../src/views/activity/SideBarProgram.vue | 10 +- frontend/src/views/admin/Activity.vue | 2 +- .../src/views/admin/AdminMaterialLists.vue | 6 +- frontend/src/views/admin/Collaborators.vue | 8 +- frontend/src/views/admin/Info.vue | 4 +- frontend/src/views/admin/Print.vue | 2 +- frontend/src/views/admin/SideBarAdmin.vue | 12 +- .../src/views/admin/__tests__/Admin.spec.js | 6 +- frontend/src/views/camp/Admin.vue | 8 +- frontend/src/views/camp/CampProgram.vue | 30 ++-- frontend/src/views/camp/Dashboard.vue | 28 ++- frontend/src/views/camp/Invitation.vue | 22 ++- frontend/src/views/camp/Story.vue | 16 +- .../views/camp/navigation/NavigationCamp.vue | 2 +- .../camp/navigation/desktop/NavTopbar.vue | 14 +- .../camp/navigation/mobile/NavBottombar.vue | 12 +- .../camp/navigation/mobile/NavSidebar.vue | 18 +- frontend/src/views/category/Category.vue | 52 +++--- .../src/views/category/SideBarCategory.vue | 6 +- .../src/views/material/MaterialDetail.vue | 17 +- frontend/src/views/material/MaterialLists.vue | 6 +- .../src/views/material/MaterialOverview.vue | 9 +- .../views/material/SideBarMaterialLists.vue | 2 +- 46 files changed, 360 insertions(+), 349 deletions(-) diff --git a/frontend/src/components/activity/DaySwitcher.vue b/frontend/src/components/activity/DaySwitcher.vue index 1034f02590..2235af6b0a 100644 --- a/frontend/src/components/activity/DaySwitcher.vue +++ b/frontend/src/components/activity/DaySwitcher.vue @@ -82,7 +82,7 @@ export default { name: 'DaySwitcher', components: { AvatarRow }, props: { - camp: { type: Function, required: true }, + camp: { type: Object, required: true }, daySelection: { type: Object, required: true }, loading: { type: Boolean }, }, @@ -104,7 +104,7 @@ export default { ) }, periods() { - return sortBy(this.camp().periods().items, 'start') + return sortBy(this.camp.periods().items, 'start') }, }, methods: { diff --git a/frontend/src/components/activity/ScheduleEntry.vue b/frontend/src/components/activity/ScheduleEntry.vue index 650e80b8ae..75b9afa3ee 100644 --- a/frontend/src/components/activity/ScheduleEntry.vue +++ b/frontend/src/components/activity/ScheduleEntry.vue @@ -7,13 +7,13 @@ Displays a single scheduleEntry class="ec-schedule-entry" toolbar back - :loaded="!scheduleEntry()._meta.loading && !activity.camp()._meta.loading" + :loaded="!scheduleEntry._meta.loading && !activity.camp()._meta.loading" :max-width="isPaperDisplaySize ? '944px' : ''" > @@ -286,13 +286,13 @@ export default { return { preferredContentTypes: () => this.preferredContentTypes, allContentNodes: () => this.contentNodes, - camp: () => this.camp, + camp: this.camp, isPaperDisplaySize: () => this.isPaperDisplaySize, } }, props: { scheduleEntry: { - type: Function, + type: Object, required: true, }, }, @@ -306,7 +306,7 @@ export default { }, computed: { activity() { - return this.scheduleEntry().activity() + return this.scheduleEntry.activity() }, camp() { return this.activity.camp() @@ -319,7 +319,7 @@ export default { }, activityName() { return ( - (this.scheduleEntry().number ? this.scheduleEntry().number + ' ' : '') + + (this.scheduleEntry.number ? this.scheduleEntry.number + ' ' : '') + (this.category.short ? this.category.short + ': ' : '') + this.activity.title ) @@ -347,7 +347,7 @@ export default { type: 'Activity', options: { activity: this.activity._meta.self, - scheduleEntry: this.scheduleEntry()._meta.self, + scheduleEntry: this.scheduleEntry._meta.self, }, }, ], @@ -369,11 +369,11 @@ export default { // reload data every time user navigates to Activity view async mounted() { this.loading = true - await this.scheduleEntry().activity()._meta.load // wait if activity is being loaded as part of a collection + await this.scheduleEntry.activity()._meta.load // wait if activity is being loaded as part of a collection this.loading = false // to avoid stale data, trigger reload (which includes embedded contentNode data). However, don't await in order to render early with cached data. - this.scheduleEntry().activity().$reload() + this.scheduleEntry.activity().$reload() }, methods: { @@ -410,7 +410,7 @@ export default { console.warn('clipboard permission not requestable') } - const scheduleEntry = scheduleEntryRoute(this.scheduleEntry()) + const scheduleEntry = scheduleEntryRoute(this.scheduleEntry) const url = window.location.origin + router.resolve(scheduleEntry).href await navigator.clipboard.writeText(url) @@ -423,7 +423,7 @@ export default { }, onDelete() { // redirect to Picasso - this.$router.push(periodRoute(this.scheduleEntry().period())) + this.$router.push(periodRoute(this.scheduleEntry.period())) }, }, } diff --git a/frontend/src/components/activity/content/Material.vue b/frontend/src/components/activity/content/Material.vue index 62eb316bf5..db78fe5c85 100644 --- a/frontend/src/components/activity/content/Material.vue +++ b/frontend/src/components/activity/content/Material.vue @@ -1,7 +1,7 @@