feat(web): simplify subscription and manual download flows and sync UHD styles

This commit is contained in:
root committed 2026-10-13 14:37:03 +08:00
1 parent 27c0f27434
commit c3c4456913
33 files changed
+1083 -633

No files matched your search

@@ -1,7 +1,7 @@
import type { AcquisitionSlot, WorkbenchRelease } from "@umt/contracts";
import type { WorkbenchRelease } from "@umt/contracts";
import { useSubmitRelease } from "~/api/releases.ts";
import { openAgentDrawer } from "~/components/agent/agent-store.ts";
import { ManualDownloadDialog, type ManualDownloadResource } from "~/components/downloads/manual-download-dialog.tsx";
import { ManualDownloadActions, type ManualDownloadResource } from "~/components/downloads/manual-download-dialog.tsx";
import { kindHintOf } from "~/components/downloads/manual-download-model.ts";
import { hrOf, promotionLabel } from "./release-fields.ts";
@@ -25,22 +25,11 @@ export function workbenchResource(r: WorkbenchRelease): ManualDownloadResource {
}
/** 工作台使用独立手动下载,不要求先建立订阅或收录版本。 */
export function DownloadDialog({
release,
open,
onOpenChange,
}: {
release: WorkbenchRelease;
slots: AcquisitionSlot[];
open: boolean;
onOpenChange: (open: boolean) => void;
}) {
export function DownloadActions({ release }: { release: WorkbenchRelease }) {
const submit = useSubmitRelease();
return (
<ManualDownloadDialog
<ManualDownloadActions
key={release.id}
open={open}
onOpenChange={onOpenChange}
resource={workbenchResource(release)}
onDelegate={() =>
openAgentDrawer({
@@ -1,6 +1,6 @@
import type { InventoryEntry, WorkbenchRelease } from "@umt/contracts";
import { ArrowDown, ArrowUp, Bot, Check, Download, RefreshCw } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { ArrowDown, ArrowUp, Bot, Check, RefreshCw } from "lucide-react";
import { useEffect, useRef } from "react";
import { Link } from "react-router";
import { toast } from "sonner";
import { useEntityDetail } from "~/api/inventory.ts";
@@ -15,7 +15,7 @@ import { Button } from "~/components/ui/button.tsx";
import { errorMessage } from "~/lib/api.ts";
import { useUiPrefs } from "~/lib/ui-prefs.ts";
import { formatBytes, formatDateTime } from "~/lib/utils.ts";
import { DownloadDialog } from "./download-dialog.tsx";
import { DownloadActions } from "./download-dialog.tsx";
import { absTime, categoryLabel, countText, ORIGIN_LABEL, relTime, snatchedOf } from "./release-fields.ts";
import { InventoryOverlay, ReleaseBadges } from "./release-list.tsx";
import { ExternalIdTags, externalLinks, ReleasePageSections } from "./release-page-section.tsx";
@@ -136,10 +136,8 @@ export function ReleaseDetailSheet({
const rid = release?.id ?? releaseId;
const detail = useReleaseDetail(siteId, rid);
const refresh = useRefreshReleaseDetail();
const [dl, setDl] = useState(false);
const techOpen = useUiPrefs().techInfoExpanded;
const r = detail.data?.release ?? release;
const entity = useEntityDetail(r?.entity?.id);
// 按需抓详情页:打开抽屉时没有缓存的详情页扩展内容就抓一次(服务端缓存 24 小时,同一资源本次会话只自动抓一次)
const autoTried = useRef(new Set<string>());
@@ -191,10 +189,7 @@ export function ReleaseDetailSheet({
<Bot />
问智能体
</Button>
<Button size="sm" onClick={() => setDl(true)}>
<Download />
下载
</Button>
<DownloadActions key={r.id} release={r} />
</>
) : null
}
@@ -321,7 +316,6 @@ export function ReleaseDetailSheet({
<JsonView label="解析结果" value={r.parsed} defaultOpen={techOpen} />
</>
)}
{r ? <DownloadDialog release={r} slots={entity.data?.slots ?? []} open={dl} onOpenChange={setDl} /> : null}
</DetailSheet>
);
}