Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions resources/js/components/resources/ResourceFeedCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ interface Resource {
comments_count?: number;
created_at: string;
user?: User;
node?: NodeItem | null;
chapter?: NodeItem | null;
user_vote?: number | null;
}

Expand Down Expand Up @@ -435,21 +435,21 @@ const shareResource = async () => {
class="shrink-0 font-medium text-indigo-600 dark:text-indigo-400"
>{{ typeBadge.text }}</span
>
<template v-if="resource.node">
<template v-if="resource.chapter">
<span class="text-slate-300 dark:text-gray-600">•</span>
<span
class="truncate font-medium text-slate-600 dark:text-gray-300"
>{{ resource.node.name }}</span
>{{ resource.chapter.name }}</span
>
</template>
<template v-if="resource.node?.subject">
<template v-if="resource.chapter?.subject">
<span class="text-slate-300 dark:text-gray-600">•</span>
<Link
:href="`/notes?subject=${resource.node.subject.id}`"
:href="`/notes?subject=${resource.chapter.subject.id}`"
@click.stop
class="shrink-0 transition hover:text-indigo-600 dark:hover:text-indigo-400"
>
{{ resource.node.subject.name }}
{{ resource.chapter.subject.name }}
</Link>
</template>
</div>
Expand Down
10 changes: 5 additions & 5 deletions resources/js/components/resources/TrendingNoteCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface ResourceNote {
status?: string;
admin_note?: string | null;
user?: User | null;
node?: NodeItem | null;
chapter?: NodeItem | null;
subject?: {
id: number;
name: string;
Expand Down Expand Up @@ -127,9 +127,9 @@ const pagesLabel = computed(() => {
const subtitle = computed(() => {
const parts: string[] = [];

const chapterName = props.note.node?.name;
const chapterName = props.note.chapter?.name;
const subjectName =
props.note.node?.subject?.name || props.note.subject?.name;
props.note.chapter?.subject?.name || props.note.subject?.name;

if (chapterName) {
parts.push(chapterName);
Expand Down Expand Up @@ -206,10 +206,10 @@ const subtitle = computed(() => {
</div>

<span
v-if="note.node?.subject?.name"
v-if="note.chapter?.subject?.name"
class="mt-2 line-clamp-1 text-[11px] font-bold text-slate-700 dark:text-gray-300"
>
{{ note.node.subject.name }}
{{ note.chapter.subject.name }}
</span>
<span
class="mt-0.5 text-[9px] font-bold tracking-wider text-slate-400 uppercase dark:text-gray-500"
Expand Down
6 changes: 3 additions & 3 deletions resources/js/pages/Resource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface ResourceData {
upvotes_count?: number;
downvotes_count?: number;
items?: ResourceItem[];
node?: {
chapter?: {
id: number;
name: string;
slug: string;
Expand Down Expand Up @@ -205,8 +205,8 @@ const primaryFormat = computed<'image' | 'video' | 'pdf'>(() => {
const subtitle = computed(() => {
const parts: string[] = [];

if (props.resource.node?.name) {
parts.push(props.resource.node.name);
if (props.resource.chapter?.name) {
parts.push(props.resource.chapter.name);
}

if (props.resource.subject?.name) {
Expand Down
8 changes: 4 additions & 4 deletions resources/js/pages/User/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1310,14 +1310,14 @@ const formatGroupName = (group?: string) => {
class="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-slate-400 dark:text-gray-500"
>
<span
v-if="note.node?.subject"
v-if="note.chapter?.subject"
class="font-medium text-slate-600 dark:text-gray-300"
>
{{ note.node.subject.name }}
{{ note.chapter.subject.name }}
</span>
<span v-if="note.node"
<span v-if="note.chapter"
>&middot;
{{ note.node.name }}</span
{{ note.chapter.name }}</span
>
<span v-if="note.items_count"
>&middot; {{ note.items_count }}
Expand Down
Loading