mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +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,16 +83,32 @@
|
||||
</span>
|
||||
<span
|
||||
v-if="assignedUsersCount === 1 && task.type === 'daily'"
|
||||
class="mr-1 d-inline-flex"
|
||||
>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.gray-200 > svg > g > path {
|
||||
fill: #878190;
|
||||
}
|
||||
|
||||
|
||||
.small-check {
|
||||
display: inline-flex;
|
||||
width: 16px;
|
||||
@@ -186,6 +202,15 @@
|
||||
.green-10 {
|
||||
color: $green-10;
|
||||
}
|
||||
|
||||
.last-completed {
|
||||
width: 16px;
|
||||
height: 14px;
|
||||
|
||||
+ .green-10 {
|
||||
margin-top: 1px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
@@ -196,6 +221,7 @@ import reduce from 'lodash/reduce';
|
||||
import { mapState } from '@/libs/store';
|
||||
import checkIcon from '@/assets/svg/check.svg';
|
||||
import lockIcon from '@/assets/svg/lock.svg';
|
||||
import lastComplete from '@/assets/svg/last-complete.svg';
|
||||
|
||||
export default {
|
||||
props: ['task', 'group'],
|
||||
@@ -204,6 +230,7 @@ export default {
|
||||
showStatus: false,
|
||||
icons: Object.freeze({
|
||||
check: checkIcon,
|
||||
lastComplete,
|
||||
lock: lockIcon,
|
||||
}),
|
||||
};
|
||||
@@ -290,19 +317,22 @@ export default {
|
||||
}
|
||||
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 () {
|
||||
if (this.assignedUsersCount !== 1) return false;
|
||||
const userId = this.assignedUsersKeys[0];
|
||||
const completion = this.task.group.assignedUsers[userId];
|
||||
return completion.completed && moment().diff(completion.completedDate, 'days') < 1;
|
||||
return this.singleAssignLastDone && moment().diff(this.singleAssignLastDone, 'days') < 1;
|
||||
},
|
||||
formattedCompletionTime () {
|
||||
const userId = this.assignedUsersKeys[0];
|
||||
const completion = this.task.group.assignedUsers[userId];
|
||||
if (!completion.completed) return '';
|
||||
const { completedDate } = completion;
|
||||
if (moment().diff(completedDate, 'days') < 1) return moment(completedDate).format('h:mm A');
|
||||
return moment(completedDate).format('M/D/YY');
|
||||
if (!this.singleAssignLastDone) return '';
|
||||
if (moment().diff(this.singleAssignLastDone, 'days') < 1) {
|
||||
return moment(this.singleAssignLastDone).format('h:mm A');
|
||||
}
|
||||
return moment(this.singleAssignLastDone).format('M/D/YY');
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user