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

Improve picasso & avatars #3174

Merged
merged 36 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0265cf1
feat(frontend): on picasso, display avatars of users responsible for …
usu Sep 10, 2022
193ef9e
Fix console error null dayResponsibles
manuelmeister Nov 18, 2022
fbd354d
Add drag and drop locked reminder for picasso view
manuelmeister Nov 19, 2022
28962b2
Improve user avatar style
manuelmeister Nov 19, 2022
9dd9253
Extract picasso entry
manuelmeister Nov 19, 2022
05774b9
Optimize styling of link hover and small detail
manuelmeister Nov 20, 2022
a3ba136
Move locked reminder up
manuelmeister Nov 20, 2022
2e75b44
Move activity name calculation to picasso entry
carlobeltrame Nov 22, 2022
f4b4216
Move schedule entry route calculation to picasso entry
carlobeltrame Nov 22, 2022
01b1176
Refactor often reused entities
carlobeltrame Nov 22, 2022
ccf9b86
Move even more schedule entry specific logic to PicassoEntry
carlobeltrame Nov 22, 2022
634fe86
Move useClickDetector usage to PicassoEntry to fix clicking entries i…
carlobeltrame Nov 22, 2022
2ef9139
Merge pull request #3 from carlobeltrame/improve/picasso
manuelmeister Nov 22, 2022
3a8f1cf
Merge remote-tracking branch 'upstream/devel' into improve/picasso
manuelmeister Nov 22, 2022
f095eaf
Fix native mouseleave not clearing
manuelmeister Nov 22, 2022
357d4db
Move AvatarRow outside of dashboard
manuelmeister Nov 22, 2022
36977ec
Implement avatars back into picasso with query flag "showAvatars"
manuelmeister Nov 22, 2022
f395113
Implement tests to define a contract for how these functions work
manuelmeister Nov 22, 2022
f9fcb61
Fix typo
manuelmeister Nov 22, 2022
d26c8cb
Fix param description
manuelmeister Nov 22, 2022
63d9721
Remove unused (replaced by AvatarRow) component
manuelmeister Nov 22, 2022
3c513b1
Remove unused display property helper
manuelmeister Nov 27, 2022
5183cc6
Use better naming for ActivityResponsibles select
manuelmeister Nov 27, 2022
b892564
Merge remote-tracking branch 'upstream/devel' into improve/picasso
manuelmeister Nov 27, 2022
3d27d80
Add screenreader text in PicassoEntry
manuelmeister Nov 27, 2022
53aeb77
Move reminderText into its own variable
manuelmeister Nov 27, 2022
60a7ec1
Fix vCalendarDragAndDrop test
manuelmeister Nov 27, 2022
7b328a5
Merge remote-tracking branch 'upstream/devel' into improve/picasso
manuelmeister Dec 6, 2022
e77b526
Optimize dense display of picasso entry
manuelmeister Dec 30, 2022
2aee635
Optimize layout
manuelmeister Dec 30, 2022
5688c7e
Merge remote-tracking branch 'upstream/devel' into improve/picasso
manuelmeister Dec 30, 2022
50f7e89
Fix missing constant
manuelmeister Dec 30, 2022
4b49022
Remove showAvatars option
manuelmeister Dec 31, 2022
017e71b
Merge branch 'devel' into improve/picasso
manuelmeister Jan 24, 2023
3bda184
Merge branch 'devel' into improve/picasso
manuelmeister Jan 24, 2023
55a687c
Change from v-timed padding to outline
manuelmeister Jan 24, 2023
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
39 changes: 39 additions & 0 deletions common/helpers/interpolation.js
Original file line number Diff line number Diff line change
@@ -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) {
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
return lerp(outputStart, outputEnd, invlerp(inputStart, inputEnd, input))
}
29 changes: 28 additions & 1 deletion frontend/src/components/activity/ActivityResponsibles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,31 @@
small-chips
v-bind="$attrs"
@input="onInput"
/>
>
<template #selection="{ item }">
<v-chip :key="item.value" small class="mx-0">
<UserAvatar
:user="item.info.user && item.info.user()"
:camp-collaboration="item.info.campCollaboration"
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
left
size="20"
class="ml-n3"
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
/>
<span>{{ item.text }}</span>
</v-chip>
</template>
</e-select>
</template>

<script>
import { serverErrorToString } from '@/helpers/serverError.js'
import campCollaborationDisplayName from '@/common/helpers/campCollaborationDisplayName.js'
import { isEqual, sortBy } from 'lodash'
import UserAvatar from '@/components/user/UserAvatar.vue'

export default {
name: 'ActivityResponsibles',
components: { UserAvatar },
props: {
activity: {
type: Object,
Expand Down Expand Up @@ -57,6 +72,7 @@ export default {
// following structure is defined by vuetify v-select items property
return {
value: value._meta.self,
info: value,
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
text: campCollaborationDisplayName(value, this.$tc.bind(this)),
}
})
Expand Down Expand Up @@ -159,3 +175,14 @@ export default {
},
}
</script>

<style scoped lang="scss">
::v-deep(.v-select__selections) {
gap: 4px;
padding-top: 8px !important;

& input {
padding: 0;
}
}
</style>
4 changes: 2 additions & 2 deletions frontend/src/components/dashboard/ActivityRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
<td style="width: 100%" class="contentrow">
<router-link
:to="routerLink"
class="text-decoration-none text-decoration-hover-underline black--text"
class="text-decoration-none text-decoration-hover-underline black--text font-weight-medium d-block"
>
{{ title }}<br />
</router-link>
<span class="e-subtitle">{{ location }}</span>
</td>
<td class="contentrow avatarrow overflow-visible">
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
<AvatarRow :camp-collaborations="collaborators" size="28" class="ml-auto" />
<AvatarRow :camp-collaborations="collaborators" max-size="28" class="ml-auto" />
</td>
</tr>
</template>
Expand Down
20 changes: 13 additions & 7 deletions frontend/src/components/dashboard/AvatarRow.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div class="avatarrow" :style="avatarrow">
<div ref="row" class="avatarrow" :style="avatarrow">
<div
v-for="campCollaboration in campCollaborations"
:key="campCollaboration && campCollaboration._meta.self"
class="avataritem"
>
<UserAvatar :size="Number(size)" :camp-collaboration="campCollaboration" />
<UserAvatar :size="size" :camp-collaboration="campCollaboration" />
</div>
</div>
</template>
Expand All @@ -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
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
},
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 {
Expand All @@ -34,6 +37,9 @@ export default {
}
},
},
mounted() {
this.maxHeight = this.$el.clientHeight
},
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
}
</script>

Expand Down
41 changes: 40 additions & 1 deletion frontend/src/components/generic/LockIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
<v-icon v-if="value" small v-on="{ dblclick: iconDblClick, ...on }">
mdi-lock-open-variant
</v-icon>
<v-icon v-else small color="grey" v-on="{ dblclick: iconDblClick, ...on }">
<v-icon
v-else
small
color="grey"
:title="$tc('components.generic.lockIcon.doubleClickToUnlock')"
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
:class="{ 'e-shake-lock': shake }"
v-on="{ dblclick: iconDblClick, ...on }"
>
mdi-lock
</v-icon>
</template>
Expand All @@ -30,6 +37,10 @@ export default {
required: false,
default: false,
},
shake: {
type: Boolean,
default: false,
},
},
methods: {
iconDblClick() {
Expand All @@ -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);
}
}
</style>
21 changes: 17 additions & 4 deletions frontend/src/components/program/picasso/DayResponsibles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
persistent-placeholder
v-bind="$attrs"
:readonly="readonly"
:class="{ 'ec-day-responsible--readonly': readonly }"
:class="{ 'e-day-responsible--readonly': readonly }"
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
@input="onInput"
>
<template #prepend-item>
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -170,7 +173,17 @@ export default {
padding-top: 0;
}

.ec-day-responsible--readonly:deep(.v-input__append-inner) {
.e-day-responsible--readonly {
&:deep(.v-input__append-inner) {
display: none;
}

&:deep(.v-select__selections) {
justify-content: center;
}
}

:deep(.v-select__selections) input {
display: none;
}
</style>
Loading