feat: show namespace of related tasks if they are different than the current one #923
No reviewers
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
3 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#923
Loading…
Reference in New Issue
No description provided.
Delete Branch "feature/show-namespace-when-searching"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #588
@ -45,1 +44,3 @@
{{ $store.getters['lists/getListById'](props.option.listId) === null ? '' : $store.getters['lists/getListById'](props.option.listId).title }} >
>
<span
v-if="$store.getters['namespaces/getListAndNamespaceById'](props.option.listId) !== null && $store.getters['namespaces/getListAndNamespaceById'](props.option.listId).namespace.id !== namespace.id"
null
(?) I think the first condition can be removed ($store.getters['namespaces/getListAndNamespaceById'](props.option.listId) !== null
)Done.
Theoretically, it could be
null
. Even though very unlikely.@ -86,1 +94,3 @@
}} >
>
<span
v-if="$store.getters['namespaces/getListAndNamespaceById'](t.listId) !== null && $store.getters['namespaces/getListAndNamespaceById'](t.listId).namespace.id !== namespace.id"
relatedTasks
(wheret.listId
is indirectly coming from) should be a computed so that this computation doesn't need to be inline and can be cached.Done as well.
I meant something similar to this to reduce duplicate call to the store getter functions:
Ah yes, that makes a lot of sense! I've changed it accordingly.
@ -46,0 +51,4 @@
</span>
<span v-tooltip="$t('task.relation.differentList')">
{{
$store.getters['lists/getListById'](props.option.listId) === null ? '' : $store.getters['lists/getListById'](props.option.listId).title
@ -87,0 +101,4 @@
</span>
<span v-tooltip="$t('task.relation.differentList')">
{{
$store.getters['lists/getListById'](t.listId) === null ? '' : $store.getters['lists/getListById'](t.listId).title
Done.
11a1167a83
to4e913af56d
@ -77,3 +82,1 @@
<div :key="t.id" class="task" v-for="t in rts.filter(t => t)">
<router-link :to="{ name: $route.name, params: { id: t.id } }">
<span :class="{ 'done': t.done}" class="tasktext">
<div :key="kind" class="related-tasks" v-for="(rts, kind ) in mappedRelatedTasks">
I think the
:key
is old.It kind of is, but we do need it to remove a task. I've added it back in and made sure it is correctly used.
@ -186,0 +201,4 @@
return this.$store.getters['namespaces/getListAndNamespaceById'](this.listId, true)?.namespace
},
mappedRelatedTasks() {
return Object.keys(this.relatedTasks).map(kind => ({
(optional): use
Object.entries
+ spread the entry with[kind, task]
.Good idea. Done.
@ -325,0 +365,4 @@
border-radius: $radius;
border: 2px solid transparent;
a {
just realized that tasktext (in css above) can me merged with this
<a>
. Or do I miss a reason for the<span>
?No real reason. The
<span>
probably comes from copy-pasting from other places.Changed and cleaned up.
@ -325,0 +374,4 @@
}
}
.remove {
how about just showing the remove icon when the task / maybe even the whole relatedtasks module is hovered?
I think that's a great idea! Added.
@ -321,0 +320,4 @@
&.is-narrow .columns {
display: block;
.column {
Un
scopenest not bulma specfic stylesActually, these styles are not used at all. I've removed them.
Removing unused styles is cool.
What I meant was more the other styles:
There is no need to nest
.different-list
.related-tasks
They don't have to be inside
.task-relations
, because we now have scoped styles.This makes styling in general much easier to handle.
Ahhh yes, that makes a lot of sense. Will refactor it.
Done.
@ -222,3 +245,1 @@
this.relatedTasks[relationKind][t].id === this.relationToDelete.otherTaskId &&
relationKind === this.relationToDelete.relationKind
if (!found) return false
outer:
I think this is the first time I have encountered a label in the wild :D
Not a fan of this code — neither how it was — nor the new one.
Any idea how to simplify this in general?
And it's not even the first in Vikunja 🙃
I think I was able to refactor it quite a bit in
2f28b43243
- please take another look.I'm not sure if there is a more javascript-y way of doing this, but the thing it was before wasn't properly tracked by vue and therefore the UI did not remove the related task after removing it from the array. This one works.
:D
This looks nice!
Using
Array.some
like it was before and then not using the result (to have something similar tobreak
) is also kind of a hack.@ -291,2 +329,2 @@
width: calc(100% - #{$remove-icon-width});
}
a:not(.remove) {
width: calc(100% - #{$remove-icon-width});
Why does the
a
need a width? Asking because it'sdisplay: flex;
.Wouldn't
flex: 1;
be enough?Back in the day, when I didn't know how flexbox worked, I think this was done using float...
I think that was originally used to make sure the icon sticks at the side. I've refactored it to use flex's
justify-content
instead.@dpschen Could you give this another review?
Rest looks good! =)
@ -327,1 +349,3 @@
}
}
.related-tasks:hover .tasks .task .remove {
you removed the
related-tasks
class. Should probably go back in =)Where did I remove that 🤔 The hover effect still works...
You are right… My bad! I confused it for
task-relations
.Nevertheless I would keep that class even if unused: makes it much easier to debug if the wrapper of the component has the same class name as the components name =) (better then would be of course
related-tasks
that's where my confusion came from).Makes sense - added.
Hi konrad!
Thank you for creating a PR!
I've deployed the changes of this PR on a preview environment under this URL: https://923-featureshow-namespace-when-searching--vikunja-frontend-preview.netlify.app
You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.
Have a nice day!