-
Notifications
You must be signed in to change notification settings - Fork 7
Fix: Display current note in BreadCrumbs component #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8ef87f4
42be923
3487637
0ab43a7
80e31b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,10 +2,10 @@ | |||||
<RouterLink | ||||||
v-for="(parent, index) in displayedParents" | ||||||
:key="index" | ||||||
:to="{ path: parent.id ? `/note/${parent.id}` : '' }" | ||||||
:to="`/note/${parent.id}`" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The updated :to directive always generates a URL using
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
class="breadcrumb" | ||||||
> | ||||||
{{ parent.content ? getTitle(parent.content) : '...' }} | ||||||
{{ parentTitle(parent.content) }} | ||||||
<Icon | ||||||
v-if="index < displayedParents.length - 1" | ||||||
name="ChevronRight" | ||||||
|
@@ -20,9 +20,10 @@ import { RouterLink } from 'vue-router'; | |||||
import { computed } from 'vue'; | ||||||
import { Note } from '@/domain/entities/Note.ts'; | ||||||
import { Icon } from '@codexteam/ui/vue'; | ||||||
import { OutputData } from '@editorjs/editorjs'; | ||||||
|
||||||
const props = defineProps<{ | ||||||
noteParents: Note[]; | ||||||
noteParents: (Note | { id: string; content: string })[]; | ||||||
}>(); | ||||||
/** | ||||||
* Note parents hierarchy | ||||||
|
@@ -40,6 +41,23 @@ const displayedParents = computed(() => { | |||||
|
||||||
return props.noteParents; | ||||||
}); | ||||||
|
||||||
/** | ||||||
* title of the parent | ||||||
* | ||||||
* @param content - parent's content | ||||||
* @returns {string} - parent title in string implementation | ||||||
*/ | ||||||
function parentTitle(content: string | null | OutputData): string { | ||||||
if (content === null) { | ||||||
return '...'; | ||||||
} | ||||||
if (typeof content === 'string') { | ||||||
return content; | ||||||
} | ||||||
|
||||||
return getTitle(content); | ||||||
} | ||||||
</script> | ||||||
|
||||||
<style scoped> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment explaining this statement, please