mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
WIP(teams): snakey checkmark
This commit is contained in:
6
website/client/src/assets/svg/last-complete.svg
Normal file
6
website/client/src/assets/svg/last-complete.svg
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<svg width="16" height="14" viewBox="0 0 16 14" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g fill="none" fill-rule="evenodd">
|
||||||
|
<path d="M16 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-2h2v2h10V2H4v2.5h2l-3 3-3-3h2V2a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z" fill="#878190"/>
|
||||||
|
<path fill="#1CA372" d="m12.707 5.707-1.414-1.414L8 7.586 6.707 6.293 5.293 7.707 8 10.414z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 382 B |
@@ -83,9 +83,20 @@
|
|||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
v-if="assignedUsersCount === 1 && task.type === 'daily'"
|
v-if="assignedUsersCount === 1 && task.type === 'daily'"
|
||||||
:class="{'green-10': showGreen}"
|
class="mr-1 d-inline-flex"
|
||||||
>
|
>
|
||||||
{{ formattedCompletionTime }}
|
<span
|
||||||
|
v-if="singleAssignLastDone"
|
||||||
|
v-html="icons.lastComplete"
|
||||||
|
class="last-completed mr-1"
|
||||||
|
:class="{'gray-200': !showGreen}"
|
||||||
|
>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
:class="{'green-10': showGreen}"
|
||||||
|
>
|
||||||
|
{{ formattedCompletionTime }}
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -93,6 +104,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
.gray-200 > svg > g > path {
|
||||||
|
fill: #878190;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.small-check {
|
.small-check {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
@@ -186,6 +202,15 @@
|
|||||||
.green-10 {
|
.green-10 {
|
||||||
color: $green-10;
|
color: $green-10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.last-completed {
|
||||||
|
width: 16px;
|
||||||
|
height: 14px;
|
||||||
|
|
||||||
|
+ .green-10 {
|
||||||
|
margin-top: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -196,6 +221,7 @@ import reduce from 'lodash/reduce';
|
|||||||
import { mapState } from '@/libs/store';
|
import { mapState } from '@/libs/store';
|
||||||
import checkIcon from '@/assets/svg/check.svg';
|
import checkIcon from '@/assets/svg/check.svg';
|
||||||
import lockIcon from '@/assets/svg/lock.svg';
|
import lockIcon from '@/assets/svg/lock.svg';
|
||||||
|
import lastComplete from '@/assets/svg/last-complete.svg';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['task', 'group'],
|
props: ['task', 'group'],
|
||||||
@@ -204,6 +230,7 @@ export default {
|
|||||||
showStatus: false,
|
showStatus: false,
|
||||||
icons: Object.freeze({
|
icons: Object.freeze({
|
||||||
check: checkIcon,
|
check: checkIcon,
|
||||||
|
lastComplete,
|
||||||
lock: lockIcon,
|
lock: lockIcon,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
@@ -290,19 +317,22 @@ export default {
|
|||||||
}
|
}
|
||||||
return this.$t('error'); // task is open, or the other conditions aren't hitting right
|
return this.$t('error'); // task is open, or the other conditions aren't hitting right
|
||||||
},
|
},
|
||||||
|
singleAssignLastDone () {
|
||||||
|
const userId = this.assignedUsersKeys[0];
|
||||||
|
const completion = this.task.group.assignedUsers[userId];
|
||||||
|
if (!completion.completed) return null;
|
||||||
|
return completion.completedDate;
|
||||||
|
},
|
||||||
showGreen () {
|
showGreen () {
|
||||||
if (this.assignedUsersCount !== 1) return false;
|
if (this.assignedUsersCount !== 1) return false;
|
||||||
const userId = this.assignedUsersKeys[0];
|
return this.singleAssignLastDone && moment().diff(this.singleAssignLastDone, 'days') < 1;
|
||||||
const completion = this.task.group.assignedUsers[userId];
|
|
||||||
return completion.completed && moment().diff(completion.completedDate, 'days') < 1;
|
|
||||||
},
|
},
|
||||||
formattedCompletionTime () {
|
formattedCompletionTime () {
|
||||||
const userId = this.assignedUsersKeys[0];
|
if (!this.singleAssignLastDone) return '';
|
||||||
const completion = this.task.group.assignedUsers[userId];
|
if (moment().diff(this.singleAssignLastDone, 'days') < 1) {
|
||||||
if (!completion.completed) return '';
|
return moment(this.singleAssignLastDone).format('h:mm A');
|
||||||
const { completedDate } = completion;
|
}
|
||||||
if (moment().diff(completedDate, 'days') < 1) return moment(completedDate).format('h:mm A');
|
return moment(this.singleAssignLastDone).format('M/D/YY');
|
||||||
return moment(completedDate).format('M/D/YY');
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user