Skip to content

Commit 9a16b5f

Browse files
committed
refactor(submissions): reuse TrendingNoteCard grid with status pills and remove ResourceRow
1 parent f69f4c7 commit 9a16b5f

3 files changed

Lines changed: 75 additions & 253 deletions

File tree

‎resources/js/components/ResourceRow.vue‎

Lines changed: 0 additions & 241 deletions
This file was deleted.

‎resources/js/components/resources/TrendingNoteCard.vue‎

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import {
88
BookOpen,
99
Play,
1010
Video,
11+
Clock,
12+
AlertCircle,
13+
CheckCircle2,
1114
} from 'lucide-vue-next';
1215
import { computed } from 'vue';
1316
@@ -42,8 +45,10 @@ interface ResourceNote {
4245
resource_type: string;
4346
thumbnail?: string | null;
4447
items_count?: number;
45-
vote_score: number;
48+
vote_score?: number;
4649
created_at?: string;
50+
status?: string;
51+
admin_note?: string | null;
4752
user?: User | null;
4853
node?: NodeItem | null;
4954
subject?: {
@@ -54,9 +59,17 @@ interface ResourceNote {
5459
} | null;
5560
}
5661
57-
const props = defineProps<{
58-
note: ResourceNote;
59-
}>();
62+
const props = withDefaults(
63+
defineProps<{
64+
note: ResourceNote;
65+
showStatus?: boolean;
66+
hideAuthor?: boolean;
67+
}>(),
68+
{
69+
showStatus: false,
70+
hideAuthor: false,
71+
},
72+
);
6073
6174
const previewImageUrl = computed(() => props.note.thumbnail || null);
6275
@@ -82,10 +95,14 @@ const typeLabel = computed(() => {
8295
text: 'দাগানো বই',
8396
color: 'text-emerald-600 dark:text-emerald-400',
8497
};
98+
case 'lecture_sheet':
8599
case 'other':
86100
return {
87101
icon: FileText,
88-
text: 'Study material',
102+
text:
103+
props.note.resource_type === 'lecture_sheet'
104+
? 'Lecture sheet'
105+
: 'Study material',
89106
color: 'text-slate-600 dark:text-slate-400',
90107
};
91108
default:
@@ -218,8 +235,39 @@ const subtitle = computed(() => {
218235
</div>
219236
</div>
220237

238+
<!-- Top Left: Status Pill (for user submissions) -->
239+
<div
240+
v-if="showStatus && note.status"
241+
class="absolute top-2 left-2 z-10 inline-flex items-center gap-1 rounded-lg px-2 py-0.5 text-xs font-bold shadow-xs backdrop-blur-xs"
242+
:class="
243+
note.status === 'pending'
244+
? 'border border-amber-300/60 bg-amber-500/90 text-white dark:border-amber-500/40 dark:bg-amber-600/90'
245+
: note.status === 'approved'
246+
? 'border border-emerald-300/60 bg-emerald-600/90 text-white dark:border-emerald-500/40 dark:bg-emerald-700/90'
247+
: 'border border-rose-300/60 bg-rose-600/90 text-white dark:border-rose-500/40 dark:bg-rose-700/90'
248+
"
249+
>
250+
<Clock
251+
v-if="note.status === 'pending'"
252+
class="h-3 w-3 animate-pulse"
253+
/>
254+
<CheckCircle2
255+
v-else-if="note.status === 'approved'"
256+
class="h-3 w-3"
257+
/>
258+
<AlertCircle v-else class="h-3 w-3" />
259+
<span>{{
260+
note.status === 'pending'
261+
? 'পর্যালোচনাধীন'
262+
: note.status === 'approved'
263+
? 'অনুমোদিত'
264+
: 'বাতিলকৃত'
265+
}}</span>
266+
</div>
267+
221268
<!-- Top Right: Vote Score Pill (Read-only) -->
222269
<div
270+
v-if="!hideAuthor"
223271
class="absolute top-2 right-2 inline-flex items-center gap-1 rounded-lg bg-black/65 px-2 py-0.5 text-xs font-bold text-white shadow-xs backdrop-blur-xs"
224272
title="Vote score"
225273
>
@@ -274,10 +322,24 @@ const subtitle = computed(() => {
274322
>
275323
{{ subtitle }}
276324
</p>
325+
326+
<!-- Rejection note if rejected and present -->
327+
<div
328+
v-if="
329+
showStatus &&
330+
note.status === 'rejected' &&
331+
note.admin_note
332+
"
333+
class="mt-2 rounded-lg bg-rose-50 px-2.5 py-1.5 text-xs text-rose-700 dark:bg-rose-950/40 dark:text-rose-300"
334+
>
335+
<span class="font-bold">বাতিলের কারণ:</span>
336+
<span class="ml-1">{{ note.admin_note }}</span>
337+
</div>
277338
</div>
278339

279-
<!-- Author & Avatar Footer -->
340+
<!-- Author & Avatar Footer (Hidden on submissions / user-centric view) -->
280341
<div
342+
v-if="!hideAuthor"
281343
class="relative z-20 mt-3 flex items-center justify-between border-t border-slate-100 pt-2.5 text-xs text-slate-500 dark:border-gray-800 dark:text-gray-400"
282344
>
283345
<div class="flex min-w-0 items-center gap-1.5">

0 commit comments

Comments
 (0)