|
1 | 1 | <script setup lang="ts"> |
2 | | -import { ref } from 'vue'; |
| 2 | +import { ref, computed } from 'vue'; |
3 | 3 | import { useAppState } from '../composables/useAppState'; |
4 | 4 | import { usePosts, type PostFilter } from '../composables/usePosts'; |
5 | 5 | import { useConfig } from '../composables/useConfig'; |
@@ -43,6 +43,14 @@ const { |
43 | 43 | maxQueueSize, |
44 | 44 | } = usePosts(); |
45 | 45 |
|
| 46 | +// Extension version from manifest |
| 47 | +const extensionVersion = computed(() => { |
| 48 | + if (typeof chrome !== 'undefined' && chrome.runtime?.getManifest) { |
| 49 | + return chrome.runtime.getManifest().version; |
| 50 | + } |
| 51 | + return ''; |
| 52 | +}); |
| 53 | +
|
46 | 54 | // AI matching state (includes heat check) |
47 | 55 | const isAIMatching = ref(false); |
48 | 56 | const aiMatchError = ref<string | null>(null); |
@@ -241,6 +249,28 @@ function handleOpenQueued(postId: string, platform: string) { |
241 | 249 | } |
242 | 250 | } |
243 | 251 |
|
| 252 | +// Handle skip queued post - sends message to background to skip before AI analysis |
| 253 | +async function handleSkipQueued(postId: string, platform: string) { |
| 254 | + try { |
| 255 | + const response = (await sendMessage({ |
| 256 | + type: 'SKIP_QUEUED_POST', |
| 257 | + postId, |
| 258 | + platform, |
| 259 | + } as never)) as MessageResponse; |
| 260 | +
|
| 261 | + if (!response.success) { |
| 262 | + throw new Error(response.error ?? 'Failed to skip post'); |
| 263 | + } |
| 264 | +
|
| 265 | + // Reload posts to reflect the change |
| 266 | + await loadPosts(); |
| 267 | + toast.success('Post skipped'); |
| 268 | + } catch (error) { |
| 269 | + console.error('Failed to skip queued post:', error); |
| 270 | + toast.error('Failed to skip post'); |
| 271 | + } |
| 272 | +} |
| 273 | +
|
244 | 274 | // Handle jump to queued post - sends message to content script to scroll to the post |
245 | 275 | async function handleJumpToQueuedPost(postId: string, _platform: string) { |
246 | 276 | try { |
@@ -343,7 +373,10 @@ async function handleJumpToPost(postId: string, _platform: string) { |
343 | 373 |
|
344 | 374 | <!-- Header --> |
345 | 375 | <div class="mb-4 flex items-center justify-between"> |
346 | | - <h1 class="text-xl font-bold text-gray-900">ReplyQueue</h1> |
| 376 | + <div class="flex items-baseline gap-2"> |
| 377 | + <h1 class="text-xl font-bold text-gray-900">ReplyQueue</h1> |
| 378 | + <span v-if="extensionVersion" class="text-xs text-gray-400">v{{ extensionVersion }}</span> |
| 379 | + </div> |
347 | 380 | <div class="flex items-center gap-2"> |
348 | 381 | <TabStatusBadge :is-active="isActiveOnPlatform" :platform="currentPlatform" /> |
349 | 382 | <button |
@@ -577,6 +610,7 @@ async function handleJumpToPost(postId: string, _platform: string) { |
577 | 610 | :post="post" |
578 | 611 | @open="handleOpenQueued" |
579 | 612 | @jump-to-post="handleJumpToQueuedPost" |
| 613 | + @skip="handleSkipQueued" |
580 | 614 | /> |
581 | 615 | </div> |
582 | 616 |
|
|
0 commit comments