| 1 | <template> |
| 2 | <div class="flex flex-col gap-6"> |
| 3 | <!-- Toolbar: mode banner + replay trigger --> |
| 4 | <div class="flex flex-wrap items-start justify-between gap-3"> |
| 5 | <div v-if="existingReview" class="flex flex-col gap-2"> |
| 6 | <Badge type="splitted" bright color="success"> |
| 7 | <template #label>Already reviewed</template> |
| 8 | <template #value>Editing your previous submission</template> |
| 9 | </Badge> |
| 10 | <span v-if="existingReview.updated_at" class="text-secondary text-sm"> |
| 11 | Last edited {{ formatDate(existingReview.updated_at, dFormats.datetime) }} |
| 12 | </span> |
| 13 | <span v-else class="text-secondary text-sm"> |
| 14 | Submitted {{ formatDate(existingReview.created_at, dFormats.datetime) }} |
| 15 | </span> |
| 16 | </div> |
| 17 | <div v-else /> |
| 18 | <n-button size="small" @click="showReplayModal = true"> |
| 19 | <template #icon> |
| 20 | <Icon :name="ReplayIcon" :size="14" /> |
| 21 | </template> |
| 22 | Replay with different template |
| 23 | </n-button> |
| 24 | </div> |
| 25 | |
| 26 | <ReplayModal v-model:show="showReplayModal" :report @replayed="onReplayed" /> |
| 27 | </div> |
| 28 | </template> |
| 29 | |
| 30 | <script setup lang="ts"> |
| 31 | import type { AiAnalystReport, AiAnalystReview } from "@/types/aiAnalyst.d" |
| 32 | import { NButton, useMessage } from "naive-ui" |
| 33 | import { ref } from "vue" |
| 34 | import Badge from "@/components/common/Badge.vue" |
| 35 | import Icon from "@/components/common/Icon.vue" |
| 36 | import { useSettingsStore } from "@/stores/settings" |
| 37 | import { formatDate } from "@/utils/format" |
| 38 | import ReplayModal from "./ReplayModal.vue" |
| 39 | |
| 40 | defineProps<{ |
| 41 | report: AiAnalystReport |
| 42 | existingReview: AiAnalystReview | null |
| 43 | }>() |
| 44 | |
| 45 | const ReplayIcon = "carbon:restart" |
| 46 | |
| 47 | const message = useMessage() |
| 48 | |
| 49 | const dFormats = useSettingsStore().dateFormat |
| 50 | |
| 51 | const showReplayModal = ref(false) |
| 52 | |
| 53 | function onReplayed(_data: Record<string, unknown> | undefined) { |
| 54 | // The new report is created asynchronously by Talon's callbacks. Surface a |
| 55 | // pointer so the reviewer knows where to watch — they can switch to the |
| 56 | // Jobs tab or come back after the run completes. |
| 57 | message.success("Replay queued — check the Jobs tab for the new run", { duration: 6000 }) |
| 58 | } |
| 59 | </script> |