fix(teams): hover states, missing snackbars

This commit is contained in:
SabreCat
2022-05-04 17:02:09 -05:00
parent 86b0d6d86c
commit 6a5f467a35
4 changed files with 19 additions and 22 deletions

View File

@@ -281,7 +281,7 @@
background: rgba($yellow-100, 0.15) !important; background: rgba($yellow-100, 0.15) !important;
.small-text { color: $yellow-1 !important; } .small-text { color: $yellow-1 !important; }
&:hover { background: rgba($yellow-100, 0.25) !important; } &:hover:not(.task-not-scoreable) { background: rgba($yellow-100, 0.25) !important; }
} }
&-bg-noninteractive { &-bg-noninteractive {
background: rgba($yellow-100, 0.15) !important; background: rgba($yellow-100, 0.15) !important;

View File

@@ -143,7 +143,7 @@ export default {
scrollPosToCheck += this.eventPromoBannerHeight ?? 0; scrollPosToCheck += this.eventPromoBannerHeight ?? 0;
} }
return scrollPosToCheck; return scrollPosToCheck + 48; // teams testing banner is always on, for now
}, },
visibleNotificationsWithoutErrors () { visibleNotificationsWithoutErrors () {
return this.visibleNotifications.filter(n => n.type !== 'error'); return this.visibleNotifications.filter(n => n.type !== 'error');

View File

@@ -4,7 +4,8 @@
class="task transition" class="task transition"
:class="[{ :class="[{
'groupTask': task.group.id, 'groupTask': task.group.id,
'task-not-editable': !teamManagerAccess 'task-not-editable': !teamManagerAccess,
'task-not-scoreable': showTaskLockIcon,
}, `type_${task.type}` }, `type_${task.type}`
]" ]"
@click="castEnd($event, task)" @click="castEnd($event, task)"
@@ -88,7 +89,7 @@
> >
<div <div
class="task-clickable-area" class="task-clickable-area"
:class="{ 'cursor-auto': showTaskLockIcon && !teamManagerAccess }" :class="{ 'cursor-auto': !teamManagerAccess }"
tabindex="0" tabindex="0"
@click="edit($event, task)" @click="edit($event, task)"
@keypress.enter="edit($event, task)" @keypress.enter="edit($event, task)"
@@ -361,7 +362,10 @@
<div <div
v-if="task.type === 'reward'" v-if="task.type === 'reward'"
class="right-control d-flex align-items-center justify-content-center reward-control" class="right-control d-flex align-items-center justify-content-center reward-control"
:class="controlClass.bg" :class="[
{ 'task-not-scoreable': showTaskLockIcon },
controlClass.bg,
]"
tabindex="0" tabindex="0"
@click="score('down')" @click="score('down')"
@keypress.enter="score('down')" @keypress.enter="score('down')"
@@ -422,8 +426,8 @@
border-radius: 4px; border-radius: 4px;
position: relative; position: relative;
&:hover:not(.task-not-editable), &:hover:not(.task-not-editable.task-not-scoreable),
&:focus-within:not(.task-not-editable) { &:focus-within:not(.task-not-editable.task-not-scoreable) {
box-shadow: 0 1px 8px 0 rgba($black, 0.12), 0 4px 4px 0 rgba($black, 0.16); box-shadow: 0 1px 8px 0 rgba($black, 0.12), 0 4px 4px 0 rgba($black, 0.16);
z-index: 11; z-index: 11;
} }
@@ -439,8 +443,8 @@
} }
.task.groupTask { .task.groupTask {
&:hover:not(.task-not-editable), &:hover:not(.task-not-editable.task-not-scoreable),
&:focus-within:not(.task-not-editable) { &:focus-within:not(.task-not-editable.task-not-scoreable) {
border: $purple-400 solid 1px; border: $purple-400 solid 1px;
border-radius: 5px; border-radius: 5px;
margin: -1px; // to counter the border width margin: -1px; // to counter the border width
@@ -1148,10 +1152,7 @@ export default {
this.task.completed = !this.task.completed; this.task.completed = !this.task.completed;
this.playTaskScoreSound(this.task, direction); this.playTaskScoreSound(this.task, direction);
} else { } else {
await this.taskScore(this.task, direction); this.taskScore(this.task, direction);
}
if (direction === 'down' && ['daily', 'todo'].includes(this.task.type)) {
this.sync();
} }
}, },
handleBrokenTask (task) { handleBrokenTask (task) {

View File

@@ -40,15 +40,11 @@ export default {
const canScoreTask = await this.beforeTaskScore(task); const canScoreTask = await this.beforeTaskScore(task);
if (!canScoreTask) return; if (!canScoreTask) return;
if (direction === 'down' && task.group.completedBy && task.group.completedBy !== user._id) { try {
task.completed = false; scoreTask({ task, user, direction });
} else { } catch (err) {
try { this.text(err.message);
scoreTask({ task, user, direction }); return;
} catch (err) {
this.text(err.message);
return;
}
} }
this.playTaskScoreSound(task, direction); this.playTaskScoreSound(task, direction);