-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Julius Härtl <[email protected]>
- Loading branch information
1 parent
e804a9e
commit 37196bb
Showing
4 changed files
with
167 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<!-- | ||
- @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net> | ||
- | ||
- @author Julius Härtl <[email protected]> | ||
- | ||
- @license GNU AGPL version 3 or any later version | ||
- | ||
- This program is free software: you can redistribute it and/or modify | ||
- it under the terms of the GNU Affero General Public License as | ||
- published by the Free Software Foundation, either version 3 of the | ||
- License, or (at your option) any later version. | ||
- | ||
- This program is distributed in the hope that it will be useful, | ||
- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
- GNU Affero General Public License for more details. | ||
- | ||
- You should have received a copy of the GNU Affero General Public License | ||
- along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
- | ||
--> | ||
|
||
<template> | ||
<div class="duedate" v-if="card"> | ||
<transition name="zoom"> | ||
<div v-if="card.duedate" :class="dueIcon"> | ||
<span>{{ relativeDate }}</span> | ||
</div> | ||
</transition> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import moment from '@nextcloud/moment' | ||
|
||
export default { | ||
name: 'DueDate', | ||
props: { | ||
card: { | ||
type: Object, | ||
default: null, | ||
}, | ||
}, | ||
computed: { | ||
dueIcon() { | ||
const days = Math.floor(moment(this.card.duedate).diff(this.$root.time, 'seconds') / 60 / 60 / 24) | ||
if (days < 0) { | ||
return 'icon-calendar due icon overdue' | ||
} | ||
if (days === 0) { | ||
return 'icon-calendar-dark due icon now' | ||
} | ||
if (days === 1) { | ||
return 'icon-calendar-dark due icon next' | ||
} | ||
return 'icon-calendar-dark due icon' | ||
}, | ||
relativeDate() { | ||
const diff = moment(this.$root.time).diff(this.card.duedate, 'seconds') | ||
if (diff >= 0 && diff < 45) { | ||
return t('core', 'seconds ago') | ||
} | ||
return moment(this.card.duedate).fromNow() | ||
}, | ||
dueDateTooltip() { | ||
return moment(this.card.duedate).format('LLLL') | ||
}, | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" coped> | ||
.icon.due { | ||
background-position: 4px center; | ||
border-radius: 3px; | ||
margin-top: 9px; | ||
margin-bottom: 9px; | ||
padding: 3px 4px; | ||
padding-right: 0; | ||
font-size: 90%; | ||
display: flex; | ||
align-items: center; | ||
opacity: .5; | ||
flex-shrink: 1; | ||
z-index: 2; | ||
|
||
.icon { | ||
background-size: contain; | ||
} | ||
|
||
&.overdue { | ||
background-color: var(--color-error); | ||
color: var(--color-primary-text); | ||
opacity: .7; | ||
padding: 3px 4px; | ||
} | ||
&.now { | ||
background-color: var(--color-warning); | ||
opacity: .7; | ||
padding: 3px 4px; | ||
} | ||
&.next { | ||
background-color: var(--color-background-dark); | ||
opacity: .7; | ||
padding: 3px 4px; | ||
} | ||
|
||
span { | ||
margin-left: 20px; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
$card-spacing: 10px; | ||
$card-padding: 10px; | ||
|
||
.labels { | ||
flex-grow: 1; | ||
flex-shrink: 1; | ||
min-width: 0; | ||
display: flex; | ||
flex-direction: row; | ||
margin-left: $card-padding; | ||
margin-right: $card-padding; | ||
margin-top: -5px; | ||
|
||
li { | ||
flex-grow: 0; | ||
flex-shrink: 1; | ||
display: flex; | ||
flex-direction: row; | ||
overflow: hidden; | ||
padding: 0px 5px; | ||
border-radius: 15px; | ||
font-size: 85%; | ||
margin-right: 3px; | ||
margin-bottom: 3px; | ||
|
||
&:hover { | ||
overflow: unset; | ||
} | ||
|
||
span { | ||
flex-grow: 0; | ||
flex-shrink: 1; | ||
min-width: 0; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
} | ||
} |