Add product wordcloud board links
Build, Push and Deploy / build (push) Successful in 9s
Build, Push and Deploy / deploy (push) Successful in 24s

This commit is contained in:
2026-09-14 15:32:31 +08:00
parent 1f9eb2853c
commit 31e7053bb0
6 changed files with 111 additions and 3 deletions
+42
View File
@@ -3,6 +3,7 @@ import type { FormEvent } from 'react';
import AppSettingsWindow, { type ThemeMode } from '../components/AppSettingsWindow';
import { apiUrl, ensureOk } from '../lib/api';
import { IconArchive, IconGrid, IconHelp, IconLock, IconRefresh, IconTrash } from '../components/Icons';
import { wordCloudBoardUrl, type WordCloudBoardRoute } from '../lib/wordcloudBoard';
import {
deleteProduct,
getProduct,
@@ -21,6 +22,12 @@ interface ProductArchivePageProps {
const TOKEN_KEY = 'wordcloud-orders-token';
const wordCloudBoardActions: Array<{ label: string; route: WordCloudBoardRoute }> = [
{ label: '个人查找', route: 'cloud' },
{ label: '现场大屏', route: 'screen' },
{ label: '手机控制', route: 'control' },
];
function statusClass(status: ProductStatus): string {
if (status === 'active') return 'product-status-archived';
if (status === 'pending_cleanup' || status === 'failed_cleanup') return 'product-status-pending-cleanup';
@@ -57,6 +64,12 @@ function formatDateTime(value: string): string {
});
}
function hasWordCloudArchive(detail: ProductDetail): boolean {
return detail.versions.some(version =>
version.wordcloud_archives.some(archive => archive.source_job_id.trim().length > 0),
);
}
function AuthenticatedImage({
token,
imageUrl,
@@ -257,6 +270,9 @@ export default function ProductArchivePage({
: null;
const previewUrl = previewImage?.image_url || '';
const latestVersion = detail?.versions[detail.versions.length - 1] || null;
const canOpenWordCloudBoard = detail !== null
&& selected?.status === 'active'
&& hasWordCloudArchive(detail);
return (
<div className="orders-page product-archive-page">
@@ -426,6 +442,32 @@ export default function ProductArchivePage({
</div>
</div>
<section className="product-archive-board-links" aria-labelledby="wordcloud-board-title">
<h3 id="wordcloud-board-title"></h3>
<div className="product-archive-board-actions">
{wordCloudBoardActions.map(action => (
canOpenWordCloudBoard ? (
<a
className="btn btn-secondary btn-sm"
href={wordCloudBoardUrl(action.route, detail.product_id)}
key={action.route}
target="_blank"
rel="noopener noreferrer"
>
{action.label}
</a>
) : (
<button className="btn btn-secondary btn-sm" disabled key={action.route} type="button">
{action.label}
</button>
)
))}
</div>
{!canOpenWordCloudBoard && (
<p className="product-archive-board-note"></p>
)}
</section>
<div className="product-archive-timeline">
<h3>线</h3>
{detail.versions.length === 0 && <p></p>}