Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions resources/assets/js/label-trees/components/labelTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
:flat="flat"
:showFavouriteShortcuts="showFavouriteShortcuts"
:position="index"
:can-have-more-favourites="canHaveMoreFavourites"
@select="emitSelect"
@deselect="emitDeselect"
@save="emitSave"
Expand Down Expand Up @@ -149,6 +150,10 @@ export default {
type: Boolean,
default: false,
},
canHaveMoreFavourites: {
type: Boolean,
default: true,
},
},
computed: {
labelMap() {
Expand Down
15 changes: 13 additions & 2 deletions resources/assets/js/label-trees/components/labelTreeLabel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<span class="fa fa-keyboard" aria-hidden="true"></span>
<span v-text="actualPosition"></span>
</span>
<button v-if="showFavourites" type="button" class="label-tree-label__favourite" :class="favouriteClass" @click.stop="toggleFavourite" :title="favouriteTitle">
<button v-if="showFavourites" type="button" class="label-tree-label__favourite" :class="favouriteClass" @click.stop="toggleFavourite" :title="favouriteTitle" :disabled="cantBeAddedAsFavourite">
Comment thread
yannik131 marked this conversation as resolved.
<span class="fa fa-star" aria-hidden="true"></span>
</button>
Comment thread
yannik131 marked this conversation as resolved.
<span if="editable">
Expand All @@ -28,7 +28,7 @@
</span>
</div>
<ul v-if="expandable && label.open" class="label-tree__list">
<label-tree-label :key="child.id" :label="child" :editable="editable" :show-favourites="showFavourites" v-for="child in label.children" @select="emitSelect" @deselect="emitDeselect" @save="emitSave" @delete="emitDelete" @add-favourite="emitAddFavourite" @remove-favourite="emitRemoveFavourite"></label-tree-label>
<label-tree-label :key="child.id" :label="child" :editable="editable" :show-favourites="showFavourites" :can-have-more-favourites="canHaveMoreFavourites" v-for="child in label.children" @select="emitSelect" @deselect="emitDeselect" @save="emitSave" @delete="emitDelete" @add-favourite="emitAddFavourite" @remove-favourite="emitRemoveFavourite"></label-tree-label>
</ul>
</li>
</template>
Expand Down Expand Up @@ -87,6 +87,10 @@ export default {
type: Number,
default:-1,
},
canHaveMoreFavourites: {
type: Boolean,
default: true,
},
},
computed: {
showColor() {
Expand Down Expand Up @@ -121,8 +125,15 @@ export default {
};
},
favouriteTitle() {
if (this.cantBeAddedAsFavourite) {
return `You cannot add more than ${MAX_FAVOURITES} favourite labels`;
}

return (this.label.favourite ? 'Remove' : 'Add') + ' as favourite';
},
cantBeAddedAsFavourite() {
return !this.label.favourite && !this.canHaveMoreFavourites;
},
editTitle() {
return 'Edit label ' + this.label.name;
},
Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/label-trees/components/labelTrees.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
:allow-select-children="allowSelectChildren"
:show-favourites="showFavourites"
:collapsible="collapsible"
:can-have-more-favourites="canHaveMoreFavourites"
@select="handleSelect"
@deselect="handleDeselect"
@add-favourite="handleAddFavourite"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,10 @@
.label-tree-label_position {
pointer-events: none;
}

.label-tree-label__favourite:disabled {
color: $gray-light;
cursor: not-allowed;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@

.label-trees__body {
flex: 1;
overflow: auto;
overflow-y: scroll;
scrollbar-width: none;

&::-webkit-scrollbar {
display: none;
}
Comment thread
yannik131 marked this conversation as resolved.
Comment on lines +15 to +19
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hesitant to hide it completely. What about scrollbar-width: thin?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side-by-side, it does make it sufficiently small

Bildschirmfoto 2026-05-22 um 11 46 33 Bildschirmfoto 2026-05-22 um 11 46 22

However, even with thin, once the cursor gets near the scroll bar, the browser "snaps" to it, taking half of the space of the button away, hiding it:

Bildschirmfoto 2026-05-22 um 11 48 01

and since scrollbar-width is only supported by firefox, we'd have to add custom styling for webkit-based-browsers, for example:

/* Chrome, Safari, Edge */
.label-trees__body::-webkit-scrollbar {
  width: 6px; /* thin */
}

.label-trees__body::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.4);
  border-radius: 3px;
}

.label-trees__body::-webkit-scrollbar-track {
  background: transparent;
}

but even here I'm struggling with preventing the scrollbar from growing once the cursor is close to it. Not sure.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scrollbar-width: thin should be supported by other browsers too. But then maybe we should increase the padding-right so there is enough space for a scrollbar?

}

.typeahead {
Expand Down