Skip to content

Commit

Permalink
fix: Align card details better to take less space
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Nov 10, 2023
1 parent 21cc942 commit 4dfbd19
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 67 deletions.
1 change: 0 additions & 1 deletion src/components/board/Board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export default {
padding: $stack-spacing;
overflow-x: hidden;
overflow-y: auto;
scrollbar-gutter: stable;
padding-top: 15px;
margin-top: -10px;
scrollbar-gutter: stable;
Expand Down
2 changes: 1 addition & 1 deletion src/components/board/Stack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ export default {
content: ' ';
display: block;
position: absolute;
width: 100%;
width: calc(100% - 16px);
height: 20px;
top: 30px;
left: 0px;
Expand Down
33 changes: 19 additions & 14 deletions src/components/cards/AvatarList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="avatars">
<div class="avatar-list" @click.stop="togglePopover">
<div v-if="popover.length > 0">
<div class="avatardiv icon-more" />
<AccountMultiple class="avatardiv more-avatars" :size="24" />
</div>
<div v-for="user in firstUsers" :key="user.id">
<NcAvatar v-if="user.type === 0"
Expand Down Expand Up @@ -72,12 +72,14 @@
<script>
import { NcAvatar, NcPopoverMenu, Tooltip } from '@nextcloud/vue'
import { generateUrl } from '@nextcloud/router'
import AccountMultiple from 'vue-material-design-icons/AccountMultiple.vue'
export default {
name: 'AvatarList',
components: {
NcAvatar,
NcPopoverMenu,
AccountMultiple,
},
directives: {
tooltip: Tooltip,
Expand Down Expand Up @@ -151,7 +153,6 @@ export default {

<style scoped lang="scss">
.avatars {
margin-top: 5px;
position: relative;
flex-grow: 1;
:deep(.popovermenu) {
Expand All @@ -173,25 +174,29 @@ export default {
display: inline-flex;
padding-right: $avatar-offset;
flex-direction: row-reverse;
& > div {
height: 32px;
}
.avatardiv,
:deep(.avatardiv) {
width: 36px;
height: 36px;
width: 32px;
height: 32px;
box-sizing: content-box !important;
margin-right: -$avatar-offset;
transition: margin-right 0.2s ease-in-out;
&.icon-more {
width: 32px;
height: 32px;
opacity: .5;
background-color: var(--color-background-dark) !important;
cursor: pointer;
}
border: 2px solid var(--color-main-background);
}
&:hover div:nth-child(n+2) :deep(.avatardiv) {
margin-right: 1px;
.more-avatars {
width: 32px;
height: 32px;
background-color: var(--color-background-dark) !important;
cursor: pointer;
color: var(--color-text-maxcontrast);
}
}
.popovermenu {
Expand Down
34 changes: 22 additions & 12 deletions src/components/cards/CardBadges.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<template>
<div v-if="card" class="badges">
<CardId v-if="idBadge" class="icon-badge" :card="card" />

<DueDate v-if="!editing && !card.done" :card="card" />
<Done v-else-if="!editing && card.done" :card="card" />

<div v-if="card.commentsCount > 0"
v-tooltip="commentsHint"
class="icon-badge"
Expand All @@ -44,24 +48,35 @@
<span>{{ card.attachmentCount }}</span>
</div>

<NcAvatarList :users="card.assignedUsers" />
<NcAvatarList :users="card.assignedUsers" :size="32" />

<CardMenu class="card-menu" :card="card" />
<slot />
</div>
</template>
<script>
import NcAvatarList from './AvatarList.vue'
import CardId from './badges/CardId.vue'
import CardMenu from './CardMenu.vue'
import TextIcon from 'vue-material-design-icons/Text.vue'
import AttachmentIcon from 'vue-material-design-icons/Paperclip.vue'
import CheckmarkIcon from 'vue-material-design-icons/CheckboxMarked.vue'
import CommentIcon from 'vue-material-design-icons/Comment.vue'
import CommentUnreadIcon from 'vue-material-design-icons/CommentAccount.vue'
import DueDate from './badges/DueDate.vue'
import Done from './badges/Done.vue'
export default {
name: 'CardBadges',
components: { NcAvatarList, CardMenu, TextIcon, AttachmentIcon, CheckmarkIcon, CommentIcon, CommentUnreadIcon, CardId },
components: {
Done,
DueDate,
NcAvatarList,
TextIcon,
AttachmentIcon,
CheckmarkIcon,
CommentIcon,
CommentUnreadIcon,
CardId,
},
props: {
card: {
type: Object,
Expand Down Expand Up @@ -102,6 +117,7 @@ export default {
display: flex;
width: 100%;
flex-grow: 1;
gap: 3px;
.icon-badge {
opacity: .7;
Expand All @@ -110,16 +126,14 @@ export default {
span,
&:deep(span) {
padding: 10px 2px;
padding: 2px;
}
}
}
.badges .icon.due {
background-position: 4px center;
border-radius: 3px;
margin-top: 10px;
margin-bottom: 10px;
border-radius: var(--border-radius);
padding: 4px;
font-size: 90%;
display: flex;
Expand Down Expand Up @@ -166,9 +180,5 @@ export default {
align-items: flex-start;
max-height: none !important;
}
.card-menu {
display: none;
}
}
</style>
102 changes: 76 additions & 26 deletions src/components/cards/CardItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,26 @@
<input type="submit" value="" class="icon-confirm">
</form>

<DueDate v-if="!editing && !card.done" :card="card" />
<Done v-else-if="!editing && card.done" :card="card" />

<CardMenu v-if="!editing && compactMode" :card="card" class="right" />
<CardMenu v-if="showMenuAtTitle" :card="card" class="right card-menu" />
</div>

<transition-group v-if="card.labels && card.labels.length"
name="zoom"
tag="ul"
class="labels"
@click.stop="openCard">
<li v-for="label in labelsSorted" :key="label.id" :style="labelStyle(label)">
<span @click.stop="applyLabelFilter(label)">{{ label.title }}</span>
</li>
</transition-group>
<div class="card-labels" v-if="hasLabels">

Check warning on line 70 in src/components/cards/CardItem.vue

View workflow job for this annotation

GitHub Actions / eslint

Attribute "v-if" should go before "class"
<transition-group v-if="card.labels && card.labels.length"
name="zoom"
tag="ul"
class="labels"
@click.stop="openCard">
<li v-for="label in labelsSorted" :key="label.id" :style="labelStyle(label)">
<span @click.stop="applyLabelFilter(label)">{{ label.title }}</span>
</li>
</transition-group>
<CardMenu v-if="showMenuAtLabels" :card="card" class="right" />
</div>

<div v-show="!compactMode" class="card-controls compact-item" @click="openCard">
<CardBadges :card="card" />
<div v-if="hasBadges" v-show="!compactMode" class="card-controls compact-item" @click="openCard">

Check failure on line 83 in src/components/cards/CardItem.vue

View workflow job for this annotation

GitHub Actions / eslint

'@click' should be on a new line
<CardBadges :card="card">
<CardMenu v-if="showMenuAtBadges" :card="card" class="right" />
</CardBadges>
</div>
</div>
</AttachmentDragAndDrop>
Expand All @@ -95,13 +97,11 @@ import Color from '../../mixins/color.js'
import labelStyle from '../../mixins/labelStyle.js'
import AttachmentDragAndDrop from '../AttachmentDragAndDrop.vue'
import CardMenu from './CardMenu.vue'
import Done from './badges/Done.vue'
import DueDate from './badges/DueDate.vue'
import CardCover from './CardCover.vue'
export default {
name: 'CardItem',
components: { CardBadges, AttachmentDragAndDrop, CardMenu, DueDate, CardCover, Done },
components: { CardBadges, AttachmentDragAndDrop, CardMenu, CardCover },
directives: {
ClickOutside,
},
Expand Down Expand Up @@ -165,6 +165,39 @@ export default {
labelsSorted() {
return [...this.card.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
},
hasLabels() {
return this.card.labels.length > 0
},
hasBadges() {
return this.card.done
|| this.card.duedate
|| this.idBadge
|| this.card.commentsCount > 0
|| this.card.description
|| this.card.attachmentCount > 0
|| this.card.assignedUsers.length > 0
},
idBadge() {
return this.$store.getters.config('cardIdBadge')
},
showMenuAtTitle() {
if (this.editing) {
return false
}
return this.compactMode || (!this.compactMode && !this.hasBadges && !this.hasLabels)
},
showMenuAtLabels() {
if (this.compactMode) {
return false
}
return !this.hasBadges && this.hasLabels
},
showMenuAtBadges() {
if (this.compactMode) {
return false
}
return this.hasBadges
},
},
watch: {
currentCard(newValue) {
Expand Down Expand Up @@ -219,8 +252,12 @@ export default {
font-size: 100%;
background-color: var(--color-main-background);
margin-bottom: $card-spacing;
padding: $card-padding;
border: 2px solid var(--color-border);
width: 100%;
display: flex;
flex-direction: column;
gap: 6px;
&:deep(*) {
cursor: pointer;
Expand All @@ -240,7 +277,6 @@ export default {
.card-upper {
display: flex;
min-height: 44px;
form {
display: flex;
padding: 3px 5px;
Expand All @@ -251,13 +287,14 @@ export default {
}
h3 {
margin: 5px $card-padding;
margin: 0;
padding: 6px;
flex-grow: 1;
font-size: 100%;
overflow: hidden;
word-wrap: break-word;
padding-left: 4px;
align-self: center;
&.editable {
cursor: text;
Expand All @@ -270,19 +307,22 @@ export default {
input[type=text] {
font-size: 100%;
}
.card-menu {
height: 44px;
align-self: end;
}
}
/* stylelint-disable-next-line no-invalid-position-at-import-rule */
@import './../../css/labels';
.card-controls {
display: flex;
margin-left: $card-padding;
margin-right: $card-padding;
& > div {
display: flex;
max-height: 44px;
flex-wrap: wrap;
align-items: center;
}
}
&.card__editable .card-controls {
Expand All @@ -291,10 +331,15 @@ export default {
&.card__archived {
background-color: var(--color-background-dark);
}
}
.card-labels {
display: flex;
align-items: end;
.duedate {
margin-right: 9px;
.labels {
flex-wrap: wrap;
align-self: flex-start;
}
}
}
.right {
Expand Down Expand Up @@ -346,6 +391,11 @@ export default {
.card {
@include dark-card;
}
}
@media print {
.card-menu {
display: none;
}
}
</style>
2 changes: 1 addition & 1 deletion src/components/cards/CardMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<div v-if="card">
<div v-if="card" class="card-menu">
<div @click.stop.prevent>
<NcActions>
<NcActionButton v-if="showArchived === false && !isCurrentUserAssigned"
Expand Down
2 changes: 1 addition & 1 deletion src/components/cards/badges/Done.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
<style lang="scss" scoped>
.icon-check-circle {
color: var(--color-success);
margin: 14px;
margin: 12px 0;
}
@media print {
Expand Down
Loading

0 comments on commit 4dfbd19

Please sign in to comment.