From 0265cf17ecccb5bbfa4c2bc0ba6ffcb16e421a11 Mon Sep 17 00:00:00 2001 From: Urban Suppiger Date: Sat, 10 Sep 2022 13:16:55 +0200 Subject: [PATCH 01/29] feat(frontend): on picasso, display avatars of users responsible for activities --- .../components/program/picasso/Picasso.vue | 15 ++++++ .../picasso/ScheduleEntryResponsibles.vue | 47 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 frontend/src/components/program/picasso/ScheduleEntryResponsibles.vue diff --git a/frontend/src/components/program/picasso/Picasso.vue b/frontend/src/components/program/picasso/Picasso.vue index fcb26d8304..8b55cd0ad0 100644 --- a/frontend/src/components/program/picasso/Picasso.vue +++ b/frontend/src/components/program/picasso/Picasso.vue @@ -11,6 +11,7 @@ Listing all given activity schedule entries in a calendar view. :class="editable ? 'ec-picasso-editable' : 'ec-picasso'" :events="events" :event-name="getActivityName" + event-overlap-mode="column" :event-color="getActivityColor" event-start="startTimestamp" event-end="endTimestamp" @@ -90,6 +91,12 @@ Listing all given activity schedule entries in a calendar view.

{{ getActivityName(event) }}

+ + @@ -99,6 +106,12 @@ Listing all given activity schedule entries in a calendar view. {{ getActivityName(event) }} + +
+ + + From 193ef9e763fc2dd76fe02a776cdb8870e1e65bc7 Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Fri, 18 Nov 2022 18:32:39 +0100 Subject: [PATCH 02/29] Fix console error null dayResponsibles --- .../src/components/program/picasso/DayResponsibles.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/program/picasso/DayResponsibles.vue b/frontend/src/components/program/picasso/DayResponsibles.vue index 39be01eff3..167acb6fd8 100644 --- a/frontend/src/components/program/picasso/DayResponsibles.vue +++ b/frontend/src/components/program/picasso/DayResponsibles.vue @@ -81,10 +81,13 @@ export default { }) }, currentCampCollaborationIRIs() { - return this.dayResponsibles.items.map((item) => item.campCollaboration()._meta.self) + return ( + this.dayResponsibles?.items.map((item) => item.campCollaboration()._meta.self) ?? + [] + ) }, dayResponsibles() { - return this.day.dayResponsibles() + return this.day?.dayResponsibles() }, campCollaborations() { return this.period.camp().campCollaborations() From fbd354d7db4d4c0676584318378986b9c90c2a7e Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Sat, 19 Nov 2022 01:11:33 +0100 Subject: [PATCH 03/29] Add drag and drop locked reminder for picasso view --- frontend/src/components/generic/LockIcon.vue | 41 +++++++- .../components/program/picasso/Picasso.vue | 21 +++-- .../program/picasso/useClickDetector.js | 7 +- .../program/picasso/useDragAndDropMove.js | 13 ++- .../program/picasso/useDragAndDropNew.js | 12 +-- .../program/picasso/useDragAndDropReminder.js | 93 +++++++++++++++++++ .../program/picasso/useDragAndDropResize.js | 16 ++-- frontend/src/helpers/vCalendarDragAndDrop.js | 13 ++- frontend/src/locales/de.json | 7 +- frontend/src/locales/en.json | 7 +- frontend/src/views/camp/CampProgram.vue | 18 ++++ 11 files changed, 210 insertions(+), 38 deletions(-) create mode 100644 frontend/src/components/program/picasso/useDragAndDropReminder.js diff --git a/frontend/src/components/generic/LockIcon.vue b/frontend/src/components/generic/LockIcon.vue index d14881de9c..e81845aef8 100644 --- a/frontend/src/components/generic/LockIcon.vue +++ b/frontend/src/components/generic/LockIcon.vue @@ -4,7 +4,14 @@ mdi-lock-open-variant - + mdi-lock @@ -30,6 +37,10 @@ export default { required: false, default: false, }, + shake: { + type: Boolean, + default: false, + }, }, methods: { iconDblClick() { @@ -43,4 +54,32 @@ export default { .v-icon { cursor: pointer; } + +.e-shake-lock { + animation: horizontal-shaking 0.5s linear 1; +} + +@keyframes horizontal-shaking { + 0% { + transform: translateX(0); + } + 10% { + transform: translateX(5px); + } + 25% { + transform: translateX(-5px); + } + 45% { + transform: translateX(4px); + } + 65% { + transform: translateX(-4px); + } + 80% { + transform: translateX(3px); + } + 100% { + transform: translateX(0); + } +} diff --git a/frontend/src/components/program/picasso/Picasso.vue b/frontend/src/components/program/picasso/Picasso.vue index 8b55cd0ad0..5e29ebca39 100644 --- a/frontend/src/components/program/picasso/Picasso.vue +++ b/frontend/src/components/program/picasso/Picasso.vue @@ -129,11 +129,12 @@ Listing all given activity schedule entries in a calendar view.
From 28962b2bd477d6e8c7caca308772c3fbb4a0ba04 Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Sat, 19 Nov 2022 01:13:25 +0100 Subject: [PATCH 04/29] Improve user avatar style --- common/helpers/interpolation.js | 39 +++++++++++++++++++ .../activity/ActivityResponsibles.vue | 29 +++++++++++++- .../src/components/dashboard/ActivityRow.vue | 4 +- .../src/components/dashboard/AvatarRow.vue | 20 ++++++---- .../program/picasso/DayResponsibles.vue | 14 ++++++- frontend/src/components/user/UserAvatar.vue | 5 ++- frontend/src/views/camp/Dashboard.vue | 13 ++++--- 7 files changed, 105 insertions(+), 19 deletions(-) create mode 100644 common/helpers/interpolation.js diff --git a/common/helpers/interpolation.js b/common/helpers/interpolation.js new file mode 100644 index 0000000000..5ea4f7bb09 --- /dev/null +++ b/common/helpers/interpolation.js @@ -0,0 +1,39 @@ +/** + * Curve fitting + * @param x + * @param y + * @param a + * @returns {number} + */ +export const lerp = (x, y, a) => x * (1 - a) + y * a + +/** + * Clamps value between min and max + * @param a + * @param min + * @param max + * @returns {number} + */ +export const clamp = (a, min = 0, max = 1) => Math.min(max, Math.max(min, a)) + +/** + * Inverse curve fitting function + * @param x + * @param y + * @param a + * @returns {number} + */ +export const invlerp = (x, y, a) => clamp((a - x) / (y - x)) + +/** + * Maps input to output range + * @param inputStart + * @param inputEnd + * @param outputStart + * @param outputEnd + * @param input + * @returns number + */ +export function range(inputStart, inputEnd, outputStart, outputEnd, input) { + return lerp(outputStart, outputEnd, invlerp(inputStart, inputEnd, input)) +} diff --git a/frontend/src/components/activity/ActivityResponsibles.vue b/frontend/src/components/activity/ActivityResponsibles.vue index 93f0194726..46adae7df9 100644 --- a/frontend/src/components/activity/ActivityResponsibles.vue +++ b/frontend/src/components/activity/ActivityResponsibles.vue @@ -14,16 +14,31 @@ small-chips v-bind="$attrs" @input="onInput" - /> + > + + + + diff --git a/frontend/src/components/dashboard/ActivityRow.vue b/frontend/src/components/dashboard/ActivityRow.vue index 4a07ebc604..09e2f4a594 100644 --- a/frontend/src/components/dashboard/ActivityRow.vue +++ b/frontend/src/components/dashboard/ActivityRow.vue @@ -17,14 +17,14 @@ {{ title }}
{{ location }} - + diff --git a/frontend/src/components/dashboard/AvatarRow.vue b/frontend/src/components/dashboard/AvatarRow.vue index db92f4ac60..54909a5a23 100644 --- a/frontend/src/components/dashboard/AvatarRow.vue +++ b/frontend/src/components/dashboard/AvatarRow.vue @@ -1,11 +1,11 @@ @@ -18,14 +18,17 @@ export default { components: { UserAvatar }, props: { campCollaborations: { type: Array, default: () => [] }, - size: { type: [Number, String], default: 20 }, + maxSize: { type: [Number, String], default: 20 }, }, + data: () => ({ + maxHeight: 1000, + }), computed: { + size() { + return Number(this.maxSize) < this.maxHeight ? Number(this.maxSize) : this.maxHeight + }, maxWidth() { - return ( - (this.campCollaborations?.length - 1) * (Number(this.size) * 0.25) + - Number(this.size) - ) + return this.campCollaborations?.length * (this.size * 0.5) + this.size }, avatarrow() { return { @@ -34,6 +37,9 @@ export default { } }, }, + mounted() { + this.maxHeight = this.$el.clientHeight + }, } diff --git a/frontend/src/components/program/picasso/DayResponsibles.vue b/frontend/src/components/program/picasso/DayResponsibles.vue index 167acb6fd8..0a1679650d 100644 --- a/frontend/src/components/program/picasso/DayResponsibles.vue +++ b/frontend/src/components/program/picasso/DayResponsibles.vue @@ -21,7 +21,7 @@ persistent-placeholder v-bind="$attrs" :readonly="readonly" - :class="{ 'ec-day-responsible--readonly': readonly }" + :class="{ 'e-day-responsible--readonly': readonly }" @input="onInput" >