Skip to content

Commit 125760a

Browse files
Ripwordsclaude
andcommitted
feat(dashboard): expose user-file attachments tab in report drawer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f046de2 commit 125760a

2 files changed

Lines changed: 33 additions & 3 deletions

File tree

apps/dashboard/app/components/report-drawer/overview-tab.vue

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
<!-- apps/dashboard/app/components/report-drawer/overview-tab.vue -->
22
<script setup lang="ts">
3-
import type { ReportSummaryDTO } from "@reprojs/shared"
3+
import type { ReportDetailDTO } from "@reprojs/shared"
44
import { safeHref } from "~/composables/use-safe-href"
55
import { parseBrowser, parseOs } from "~/composables/use-user-agent"
66
import { useMarkdown } from "~/composables/use-markdown"
77
8-
const props = defineProps<{ projectId: string; report: ReportSummaryDTO }>()
9-
const emit = defineEmits<{ "select-tab": [tab: "console" | "network" | "replay"] }>()
8+
const props = defineProps<{ projectId: string; report: ReportDetailDTO }>()
9+
const emit = defineEmits<{
10+
"select-tab": [tab: "console" | "network" | "replay" | "attachments"]
11+
}>()
12+
13+
const userFileCount = computed(
14+
() => (props.report.attachments ?? []).filter((a) => a.kind === "user-file").length,
15+
)
1016
1117
const ctx = computed(() => props.report.context)
1218
const sys = computed(() => ctx.value?.systemInfo)
@@ -39,6 +45,18 @@ const descriptionHtml = computed(() =>
3945
</div>
4046
</UCard>
4147

48+
<!-- User-uploaded file chip. Only visible when the reporter attached extra
49+
files. Clicking navigates to the Attachments tab. -->
50+
<button
51+
v-if="userFileCount > 0"
52+
type="button"
53+
class="inline-flex items-center gap-1.5 rounded-full bg-primary/10 px-2.5 py-1 text-xs font-medium text-primary hover:bg-primary/20 transition-colors"
54+
@click="emit('select-tab', 'attachments')"
55+
>
56+
<UIcon name="i-heroicons-paper-clip" class="size-3.5" />
57+
{{ userFileCount }} additional {{ userFileCount === 1 ? "file" : "files" }}
58+
</button>
59+
4260
<!-- Reporter-authored description. Sits above the metadata so the user
4361
sees the "what" before the "where/when". Hidden entirely when the
4462
SDK caller submitted an empty description (common for widget-only

apps/dashboard/app/pages/projects/[id]/reports/[reportId].vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { LogsAttachment, ReportDetailDTO } from "@reprojs/shared"
1212
import AppErrorState from "~/components/common/app-error-state.vue"
1313
import AppLoadingSkeleton from "~/components/common/app-loading-skeleton.vue"
1414
import ActivityTab from "~/components/report-drawer/activity-tab.vue"
15+
import AttachmentsTab from "~/components/report-drawer/attachments-tab.vue"
1516
import CommentsTab from "~/components/report-drawer/comments-tab.vue"
1617
import ConsoleTab from "~/components/report-drawer/console-tab.vue"
1718
import CookiesTab from "~/components/report-drawer/cookies-tab.vue"
@@ -57,6 +58,7 @@ type TabId =
5758
| "activity"
5859
| "comments"
5960
| "cookies"
61+
| "attachments"
6062
| "system"
6163
| "raw"
6264
const activeTab = ref<TabId>("overview")
@@ -84,6 +86,9 @@ const consoleHasData = computed(
8486
)
8587
const networkHasData = computed(() => logs.value !== null && logs.value.network.length > 0)
8688
const cookiesHasData = computed(() => (report.value?.context?.cookies?.length ?? 0) > 0)
89+
const userFileCount = computed(
90+
() => (report.value?.attachments ?? []).filter((a) => a.kind === "user-file").length,
91+
)
8792
8893
const tabs = computed(() => {
8994
const base: { id: string; label: string; hasData?: boolean }[] = [
@@ -99,6 +104,9 @@ const tabs = computed(() => {
99104
if (report.value?.source !== "expo") {
100105
base.push({ id: "cookies", label: "Cookies", hasData: cookiesHasData.value })
101106
}
107+
if (userFileCount.value > 0) {
108+
base.push({ id: "attachments", label: "Attachments", hasData: true })
109+
}
102110
base.push({ id: "system", label: "System" })
103111
base.push({ id: "raw", label: "Raw" })
104112
return base
@@ -256,6 +264,10 @@ onUnmounted(() => window.removeEventListener("keydown", onKey))
256264
:report-id="report.id"
257265
/>
258266
<CookiesTab v-else-if="activeTab === 'cookies'" :project-id="projectId" :report="report" />
267+
<AttachmentsTab
268+
v-else-if="activeTab === 'attachments'"
269+
:attachments="report.attachments ?? []"
270+
/>
259271
<div v-else-if="activeTab === 'system'" class="p-5">
260272
<UCard :ui="{ body: 'p-4' }">
261273
<pre class="text-sm font-mono whitespace-pre-wrap break-all">{{

0 commit comments

Comments
 (0)