@parhelia/localization 0.4.12884 → 0.4.12903
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/LocalizeItemDialog.d.ts.map +1 -1
- package/dist/LocalizeItemDialog.js +8 -2
- package/dist/LocalizeItemUtils.d.ts +1 -0
- package/dist/LocalizeItemUtils.d.ts.map +1 -1
- package/dist/LocalizeItemUtils.js +44 -18
- package/dist/api/discovery.d.ts +17 -3
- package/dist/api/discovery.d.ts.map +1 -1
- package/dist/api/discovery.js +35 -14
- package/dist/hooks/useTranslationWizard.d.ts.map +1 -1
- package/dist/hooks/useTranslationWizard.js +10 -2
- package/dist/index.js +1 -1
- package/dist/services/translationService.d.ts +31 -27
- package/dist/services/translationService.d.ts.map +1 -1
- package/dist/services/translationService.js +29 -32
- package/dist/services/translationSettingsService.d.ts +79 -0
- package/dist/services/translationSettingsService.d.ts.map +1 -0
- package/dist/services/translationSettingsService.js +68 -0
- package/dist/settings/ExcludedContentTypeDialog.d.ts +12 -0
- package/dist/settings/ExcludedContentTypeDialog.d.ts.map +1 -0
- package/dist/settings/ExcludedContentTypeDialog.js +27 -0
- package/dist/settings/TranslationProviderDialog.d.ts +18 -0
- package/dist/settings/TranslationProviderDialog.d.ts.map +1 -0
- package/dist/settings/TranslationProviderDialog.js +85 -0
- package/dist/settings/TranslationServicesPanel.d.ts +14 -4
- package/dist/settings/TranslationServicesPanel.d.ts.map +1 -1
- package/dist/settings/TranslationServicesPanel.js +175 -264
- package/dist/setup/LocalizationSetupStep.d.ts.map +1 -1
- package/dist/setup/LocalizationSetupStep.js +14 -33
- package/dist/sidebar/TranslationSidebar.d.ts.map +1 -1
- package/dist/sidebar/TranslationSidebar.js +35 -14
- package/dist/steps/ItemSelectionTree.d.ts.map +1 -1
- package/dist/steps/ItemSelectionTree.js +124 -41
- package/dist/steps/ProviderStep.d.ts.map +1 -1
- package/dist/steps/ProviderStep.js +54 -42
- package/dist/steps/ServiceLanguageSelectionStep.d.ts.map +1 -1
- package/dist/steps/ServiceLanguageSelectionStep.js +32 -9
- package/dist/steps/types.d.ts +7 -1
- package/dist/steps/types.d.ts.map +1 -1
- package/dist/translation-center/TranslationBatches.d.ts +27 -0
- package/dist/translation-center/TranslationBatches.d.ts.map +1 -1
- package/dist/translation-center/TranslationBatches.js +119 -70
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState, useMemo, useSyncExternalStore, } from "react";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { Button, Badge, Select, Input, UserPicker, Popover, PopoverContent, PopoverTrigger, Tooltip, TooltipContent, TooltipTrigger, ContentTree, ContentInspectorPopover, PageHeader, fetchItemStubs, searchUsers as searchBackendUsers, useEditContext, getLanguages, SimpleIconButton, WorkspaceHomeView, capitalizeFirstLetter, formatDateTime, } from "@parhelia/core";
|
|
5
|
-
import { listBatches, getTranslationProviders, getTranslationJobLastPayload, listBatchTranslationJobs, retryBatchTranslation, abortJob, abortBatch, subscribeToBatch, unsubscribeFromBatch, } from "../services/translationService";
|
|
4
|
+
import { Button, Badge, ContentStoreSelect, Select, Input, UserPicker, Popover, PopoverContent, PopoverTrigger, Tooltip, TooltipContent, TooltipTrigger, ContentTree, ContentInspectorPopover, PageHeader, fetchItemStubs, searchUsers as searchBackendUsers, useEditContext, useContentModel, getLanguages, SimpleIconButton, WorkspaceHomeView, capitalizeFirstLetter, formatDateTime, LanguageIcon, } from "@parhelia/core";
|
|
5
|
+
import { listBatches, getTranslationProviders, getTranslationJobLastPayload, listBatchTranslationJobs, retryBatchTranslation, abortJob, abortBatch, subscribeToBatch, unsubscribeFromBatch, translationItemKey, } from "../services/translationService";
|
|
6
6
|
import { TRANSLATION_BATCH_STARTED_EVENT, } from "../translationEvents";
|
|
7
7
|
import { useDebouncedCallback } from "use-debounce";
|
|
8
|
-
import { X, ChevronDown, Languages, Loader2,
|
|
8
|
+
import { X, ChevronDown, Languages, Loader2, FolderTree, ExternalLink, Check, AlertCircle, CircleStop, Hourglass, Copy, Sparkles, RotateCcw, Plus, Bug, } from "lucide-react";
|
|
9
9
|
import { toast } from "sonner";
|
|
10
10
|
import { openLocalizeItemDialog } from "../LocalizeItemCommand";
|
|
11
11
|
// Wrappers for lucide-react icons to work with React 19
|
|
@@ -13,7 +13,6 @@ const XIcon = (props) => React.createElement(X, props);
|
|
|
13
13
|
const ChevronDownIcon = (props) => React.createElement(ChevronDown, props);
|
|
14
14
|
const LanguagesIcon = (props) => React.createElement(Languages, props);
|
|
15
15
|
const LoaderIcon = (props) => React.createElement(Loader2, props);
|
|
16
|
-
const GlobeIcon = (props) => React.createElement(Globe, props);
|
|
17
16
|
const FolderTreeIcon = (props) => React.createElement(FolderTree, props);
|
|
18
17
|
const ExternalLinkIcon = (props) => React.createElement(ExternalLink, props);
|
|
19
18
|
const CheckIcon = (props) => React.createElement(Check, props);
|
|
@@ -26,18 +25,10 @@ const RetryIcon = (props) => React.createElement(RotateCcw, props);
|
|
|
26
25
|
const PlusIcon = (props) => React.createElement(Plus, props);
|
|
27
26
|
const BugIcon = (props) => React.createElement(Bug, props);
|
|
28
27
|
function renderTargetLanguageIcon(language) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
alt: "",
|
|
34
|
-
"aria-hidden": true,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return React.createElement(GlobeIcon, {
|
|
38
|
-
className: "h-3.5 w-3.5 text-neutral-grey-50",
|
|
39
|
-
strokeWidth: 1,
|
|
40
|
-
"aria-hidden": true,
|
|
28
|
+
return React.createElement(LanguageIcon, {
|
|
29
|
+
language,
|
|
30
|
+
flagClassName: "h-[15px] w-5 shrink-0",
|
|
31
|
+
globeClassName: "h-3.5 w-3.5 text-neutral-grey-50",
|
|
41
32
|
});
|
|
42
33
|
}
|
|
43
34
|
const DEFAULT_FILTERS = {
|
|
@@ -120,12 +111,13 @@ function isActiveBatchStatus(status) {
|
|
|
120
111
|
return status === "Pending" || status === "In Progress";
|
|
121
112
|
}
|
|
122
113
|
function isRetriableJob(job) {
|
|
123
|
-
return job?.status === "Error";
|
|
114
|
+
return job?.status === "Error" && !!job.store;
|
|
124
115
|
}
|
|
125
116
|
function buildRetryJobRequest(job) {
|
|
126
|
-
if (!job.itemId || !job.sourceLanguage || !job.targetLanguage)
|
|
117
|
+
if (!job.store || !job.itemId || !job.sourceLanguage || !job.targetLanguage)
|
|
127
118
|
return null;
|
|
128
119
|
return {
|
|
120
|
+
store: job.store,
|
|
129
121
|
sourceTranslationId: job.id,
|
|
130
122
|
itemId: job.itemId,
|
|
131
123
|
sourceLanguage: job.sourceLanguage,
|
|
@@ -240,7 +232,7 @@ export function TranslationBatches() {
|
|
|
240
232
|
const editContext = useEditContext();
|
|
241
233
|
const [emptyStateSlogan] = useState(() => EMPTY_STATE_SLOGANS[Math.floor(Math.random() * EMPTY_STATE_SLOGANS.length)]);
|
|
242
234
|
const [batches, setBatches] = useState([]);
|
|
243
|
-
const [
|
|
235
|
+
const [contentLanguages, setContentLanguages] = useState([]);
|
|
244
236
|
const [isLoading, setIsLoading] = useState(false);
|
|
245
237
|
// False until the first list response lands. Later reloads (the user filter
|
|
246
238
|
// defaulting in, socket refreshes, the reconciliation poll) update in place
|
|
@@ -334,12 +326,18 @@ export function TranslationBatches() {
|
|
|
334
326
|
provider: filters.provider === "all" ? undefined : filters.provider,
|
|
335
327
|
targetLanguage: filters.targetLanguage === "all" ? undefined : filters.targetLanguage,
|
|
336
328
|
itemIdOrPath: trimmedItem ? trimmedItem : undefined,
|
|
329
|
+
store: filters.store,
|
|
330
|
+
language: filters.language,
|
|
337
331
|
itemIncludeSubitems: trimmedItem && filters.itemIncludeSubitems ? true : undefined,
|
|
338
332
|
};
|
|
339
333
|
}, [filters, userFilterLocked, currentUserName]);
|
|
340
|
-
const loadRecentBatches = useCallback(async (offset, append, filtersToUse) => {
|
|
334
|
+
const loadRecentBatches = useCallback(async (offset, append, filtersToUse, background = false) => {
|
|
341
335
|
const myRequestId = ++requestIdRef.current;
|
|
342
|
-
if (
|
|
336
|
+
if (background) {
|
|
337
|
+
// Background reconciliation must not replace the list with a loading
|
|
338
|
+
// state; websocket events remain the fast path.
|
|
339
|
+
}
|
|
340
|
+
else if (offset === 0) {
|
|
343
341
|
setIsLoading(true);
|
|
344
342
|
}
|
|
345
343
|
else {
|
|
@@ -380,7 +378,7 @@ export function TranslationBatches() {
|
|
|
380
378
|
console.error("Failed to load batches:", error);
|
|
381
379
|
}
|
|
382
380
|
finally {
|
|
383
|
-
if (myRequestId === requestIdRef.current) {
|
|
381
|
+
if (!background && myRequestId === requestIdRef.current) {
|
|
384
382
|
setIsLoading(false);
|
|
385
383
|
setIsLoadingMore(false);
|
|
386
384
|
setHasLoadedOnce(true);
|
|
@@ -393,24 +391,43 @@ export function TranslationBatches() {
|
|
|
393
391
|
loadRecentBatches(currentOffset, true, effectiveFilters);
|
|
394
392
|
}
|
|
395
393
|
};
|
|
396
|
-
// Load
|
|
394
|
+
// Load the content languages for language chips in expanded batches.
|
|
397
395
|
useEffect(() => {
|
|
398
396
|
const loadLanguages = async () => {
|
|
399
397
|
try {
|
|
400
|
-
const res = await getLanguages();
|
|
398
|
+
const res = await getLanguages(editContext?.currentItemDescriptor?.database ?? "");
|
|
401
399
|
const langs = (res?.data ?? res ?? []);
|
|
402
|
-
|
|
400
|
+
setContentLanguages(Array.isArray(langs) ? langs : []);
|
|
403
401
|
}
|
|
404
402
|
catch (error) {
|
|
405
|
-
console.error("Failed to load
|
|
403
|
+
console.error("Failed to load content languages:", error);
|
|
406
404
|
}
|
|
407
405
|
};
|
|
408
406
|
loadLanguages();
|
|
409
|
-
}, []);
|
|
407
|
+
}, [editContext?.currentItemDescriptor?.database]);
|
|
410
408
|
// Reload when filters change (resets pagination)
|
|
411
409
|
useEffect(() => {
|
|
412
410
|
loadRecentBatches(0, false, effectiveFilters);
|
|
413
411
|
}, [loadRecentBatches, effectiveFilters]);
|
|
412
|
+
// Socket delivery is best-effort across reconnects and host restarts. Keep
|
|
413
|
+
// the visible list eventually consistent with a quiet REST reconciliation.
|
|
414
|
+
useEffect(() => {
|
|
415
|
+
let inFlight = false;
|
|
416
|
+
const reconcile = () => {
|
|
417
|
+
if (document.visibilityState === "hidden" || inFlight)
|
|
418
|
+
return;
|
|
419
|
+
inFlight = true;
|
|
420
|
+
void loadRecentBatches(0, false, effectiveFilters, true).finally(() => {
|
|
421
|
+
inFlight = false;
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
const interval = window.setInterval(reconcile, 3000);
|
|
425
|
+
document.addEventListener("visibilitychange", reconcile);
|
|
426
|
+
return () => {
|
|
427
|
+
window.clearInterval(interval);
|
|
428
|
+
document.removeEventListener("visibilitychange", reconcile);
|
|
429
|
+
};
|
|
430
|
+
}, [effectiveFilters, loadRecentBatches]);
|
|
414
431
|
// Seed the cache with the current user's full name so rows authored by us
|
|
415
432
|
// resolve immediately, without waiting on a searchUsers round-trip.
|
|
416
433
|
useEffect(() => {
|
|
@@ -489,6 +506,7 @@ export function TranslationBatches() {
|
|
|
489
506
|
// Live progress: patch the matching job's message in-place so an open
|
|
490
507
|
// popover reflects the latest progress text without a REST reload.
|
|
491
508
|
if (message.type === "translation-progress" && batchIdFromPayload) {
|
|
509
|
+
const storeFromPayload = message?.payload?.store ?? message?.payload?.Store;
|
|
492
510
|
const itemIdFromPayload = normalizeGuid(message?.payload?.itemId ?? message?.payload?.ItemId);
|
|
493
511
|
const languageFromPayload = (message?.payload?.language ??
|
|
494
512
|
message?.payload?.Language ??
|
|
@@ -503,7 +521,9 @@ export function TranslationBatches() {
|
|
|
503
521
|
return prev;
|
|
504
522
|
let changed = false;
|
|
505
523
|
const nextJobs = jobs.map((job) => {
|
|
506
|
-
if (
|
|
524
|
+
if (storeFromPayload &&
|
|
525
|
+
job.store === storeFromPayload &&
|
|
526
|
+
normalizeGuid(job.itemId) === itemIdFromPayload &&
|
|
507
527
|
job.targetLanguage === languageFromPayload &&
|
|
508
528
|
// A late progress text must not replace a terminal
|
|
509
529
|
// outcome (an error text, or the final record).
|
|
@@ -903,10 +923,16 @@ export function TranslationBatches() {
|
|
|
903
923
|
const jobs = batchJobs[batchId] ?? (await loadBatchJobs(batchId));
|
|
904
924
|
await handleRetryJobs(batchId, batch.provider, jobs, `batch:${batchId}`);
|
|
905
925
|
}, [batchJobs, handleRetryJobs, loadBatchJobs]);
|
|
906
|
-
const openItemInEditor = useCallback(async (itemId, language) => {
|
|
907
|
-
|
|
926
|
+
const openItemInEditor = useCallback(async (itemId, language, store) => {
|
|
927
|
+
if (!store || !language)
|
|
928
|
+
return;
|
|
908
929
|
editContext?.setShowAgentsWorkspaceEditor(true);
|
|
909
|
-
await editContext?.loadItem(
|
|
930
|
+
await editContext?.loadItem({
|
|
931
|
+
id: itemId,
|
|
932
|
+
language,
|
|
933
|
+
version: 0,
|
|
934
|
+
database: store,
|
|
935
|
+
});
|
|
910
936
|
}, [editContext]);
|
|
911
937
|
// The blank-slate home view (no header, grey full-height greeting) also
|
|
912
938
|
// covers the initial load, so the greeting mounts exactly once.
|
|
@@ -1032,15 +1058,18 @@ export function TranslationBatches() {
|
|
|
1032
1058
|
? "whitespace-normal break-words leading-5"
|
|
1033
1059
|
: "truncate"}`, style: isCompactBatches
|
|
1034
1060
|
? { overflowWrap: "anywhere" }
|
|
1035
|
-
: undefined, title: formattedBatchDate, children: batchDisplayName }), _jsx("div", { className: "mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[12px] text-neutral-grey-50", children: desktopMetaParts.map((part, i) => (_jsxs(React.Fragment, { children: [i > 0 && (_jsx("span", { className: "text-neutral-grey-15", children: "\u00B7" })), part] }, i))) }), mobileFooterMetaParts.length > 0 && (_jsx("div", { className: "mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[12px] text-neutral-grey-50", children: mobileFooterMetaParts.map((part, i) => (_jsxs(React.Fragment, { children: [i > 0 && (_jsx("span", { className: "text-neutral-grey-15", children: "\u00B7" })), part] }, `footer-${i}`))) }))] }), isCompactBatches && (_jsxs("div", { className: "mt-2 flex min-w-0 items-center gap-2", children: [totalJobs > 0 && (_jsx("div", { className: "min-w-0 flex-1", children: _jsx(BatchProgressIndicator, { counts: statusCounts, status: info?.status, testId: `batch-progress-${b.id}`, variant: "bar" }) })), hasBatchActions && (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: batchActions }))] })), !isCompactBatches && hasBatchActions && (_jsx("div", { className: "flex shrink-0 items-center gap-2 self-center", children: batchActions }))] })] }) }), isExpanded && (_jsxs("div", { className: "border-t border-border-default/50", children: [_jsx(CustomPromptPanel, { prompts: parseCustomPrompts(info?.metadata) }), _jsx(BatchItemList, { batchId: b.id, batchProvider: info?.provider, jobs: jobs, isLoading: isLoadingThis, expandedItems: expandedItems, languages:
|
|
1061
|
+
: undefined, title: formattedBatchDate, children: batchDisplayName }), _jsx("div", { className: "mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[12px] text-neutral-grey-50", children: desktopMetaParts.map((part, i) => (_jsxs(React.Fragment, { children: [i > 0 && (_jsx("span", { className: "text-neutral-grey-15", children: "\u00B7" })), part] }, i))) }), mobileFooterMetaParts.length > 0 && (_jsx("div", { className: "mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[12px] text-neutral-grey-50", children: mobileFooterMetaParts.map((part, i) => (_jsxs(React.Fragment, { children: [i > 0 && (_jsx("span", { className: "text-neutral-grey-15", children: "\u00B7" })), part] }, `footer-${i}`))) }))] }), isCompactBatches && (_jsxs("div", { className: "mt-2 flex min-w-0 items-center gap-2", children: [totalJobs > 0 && (_jsx("div", { className: "min-w-0 flex-1", children: _jsx(BatchProgressIndicator, { counts: statusCounts, status: info?.status, testId: `batch-progress-${b.id}`, variant: "bar" }) })), hasBatchActions && (_jsx("div", { className: "flex shrink-0 items-center gap-1.5", children: batchActions }))] })), !isCompactBatches && hasBatchActions && (_jsx("div", { className: "flex shrink-0 items-center gap-2 self-center", children: batchActions }))] })] }) }), isExpanded && (_jsxs("div", { className: "border-t border-border-default/50", children: [_jsx(CustomPromptPanel, { prompts: parseCustomPrompts(info?.metadata) }), _jsx(BatchItemList, { batchId: b.id, batchProvider: info?.provider, jobs: jobs, isLoading: isLoadingThis, expandedItems: expandedItems, languages: contentLanguages, currentLanguage: editContext?.item?.language, itemFilter: filters.itemIdOrPath.trim(), itemFilterStore: filters.store, itemIncludeSubitems: filters.itemIncludeSubitems, statusFilter: filters.status, batchIsTerminal: isTerminalBatchStatus(info?.status), batchStartedAtUtc: info?.startedAtUtc ?? info?.createdAtUtc, abortingJobIds: abortingJobIds, retryingKeys: retryingKeys, isMobile: isMobile, onToggleItem: toggleItem, onOpenItem: openItemInEditor, onAbortJob: handleAbortJob, onRetryJobs: handleRetryJobs })] }))] }, b.id));
|
|
1036
1062
|
}) })] }, dateGroup.label))), hasMore && (_jsx("div", { className: "flex justify-center pt-6", children: _jsx(Button, { variant: "outline", size: "sm", onClick: loadMore, disabled: isLoadingMore, children: isLoadingMore ? (_jsxs(_Fragment, { children: [_jsx(LoaderIcon, { className: "h-4 w-4 animate-spin text-highlight-100" }), "Loading more..."] })) : (_jsxs(_Fragment, { children: [_jsx(ChevronDownIcon, { className: "h-4 w-4" }), "Load More Batches"] })) }) }))] })) }) })] }));
|
|
1037
1063
|
}
|
|
1038
1064
|
export const TRANSLATION_BATCH_FILTERS_SIDEBAR_ID = "translation-batch-filters";
|
|
1039
1065
|
export function TranslationBatchFiltersSidebar() {
|
|
1040
1066
|
const editContext = useEditContext();
|
|
1067
|
+
const model = useContentModel();
|
|
1041
1068
|
const { filters, itemIdOrPathInput } = useTranslationBatchFilterSnapshot();
|
|
1069
|
+
const filterStore = filters.store ?? editContext?.currentItemDescriptor?.database ?? "";
|
|
1070
|
+
const filterLanguage = filters.language ?? editContext?.currentItemDescriptor?.language ?? "";
|
|
1042
1071
|
const [providers, setProviders] = useState([]);
|
|
1043
|
-
const [
|
|
1072
|
+
const [contentLanguages, setContentLanguages] = useState([]);
|
|
1044
1073
|
const [itemPickerOpen, setItemPickerOpen] = useState(false);
|
|
1045
1074
|
const currentUserName = editContext?.user?.name || "all";
|
|
1046
1075
|
// Limited-preview sessions and accounts confined to their own batches (see
|
|
@@ -1065,6 +1094,8 @@ export function TranslationBatchFiltersSidebar() {
|
|
|
1065
1094
|
const debouncedSetItemFilter = useDebouncedCallback((value) => setTranslationBatchFilters((prev) => ({
|
|
1066
1095
|
...prev,
|
|
1067
1096
|
itemIdOrPath: value,
|
|
1097
|
+
store: filterStore,
|
|
1098
|
+
language: filterLanguage,
|
|
1068
1099
|
})), 400);
|
|
1069
1100
|
useEffect(() => {
|
|
1070
1101
|
const loadProviders = async () => {
|
|
@@ -1084,23 +1115,23 @@ export function TranslationBatchFiltersSidebar() {
|
|
|
1084
1115
|
useEffect(() => {
|
|
1085
1116
|
const loadLanguages = async () => {
|
|
1086
1117
|
try {
|
|
1087
|
-
const res = await getLanguages();
|
|
1118
|
+
const res = await getLanguages(editContext?.currentItemDescriptor?.database ?? "");
|
|
1088
1119
|
const langs = (res?.data ?? res ?? []);
|
|
1089
|
-
|
|
1120
|
+
setContentLanguages(Array.isArray(langs) ? langs : []);
|
|
1090
1121
|
}
|
|
1091
1122
|
catch (error) {
|
|
1092
|
-
console.error("Failed to load
|
|
1123
|
+
console.error("Failed to load content languages:", error);
|
|
1093
1124
|
}
|
|
1094
1125
|
};
|
|
1095
1126
|
loadLanguages();
|
|
1096
|
-
}, []);
|
|
1097
|
-
const languageOptions = useMemo(() =>
|
|
1127
|
+
}, [editContext?.currentItemDescriptor?.database]);
|
|
1128
|
+
const languageOptions = useMemo(() => contentLanguages
|
|
1098
1129
|
.map((language) => {
|
|
1099
1130
|
const code = language.languageCode || language.name;
|
|
1100
1131
|
return code ? { ...language, languageCode: code } : null;
|
|
1101
1132
|
})
|
|
1102
1133
|
.filter((language) => language !== null)
|
|
1103
|
-
.sort((a, b) => a.languageCode.localeCompare(b.languageCode)), [
|
|
1134
|
+
.sort((a, b) => a.languageCode.localeCompare(b.languageCode)), [contentLanguages]);
|
|
1104
1135
|
const currentItem = editContext?.item;
|
|
1105
1136
|
const multiItemEnabled = editContext?.configuration?.localization?.multiItem !== false;
|
|
1106
1137
|
const canStartTranslation = !!editContext && (multiItemEnabled || !!currentItem);
|
|
@@ -1175,11 +1206,19 @@ export function TranslationBatchFiltersSidebar() {
|
|
|
1175
1206
|
})), placeholder: "Select language" })] }), _jsxs("div", { className: filterFieldClass, children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("label", { className: filterLabelClass, children: "Item ID / Path" }), _jsxs("label", { className: "flex cursor-pointer items-center gap-1 text-[10px] text-neutral-grey-50 select-none", children: [_jsx("input", { type: "checkbox", checked: filters.itemIncludeSubitems, onChange: (e) => setTranslationBatchFilters((prev) => ({
|
|
1176
1207
|
...prev,
|
|
1177
1208
|
itemIncludeSubitems: e.target.checked,
|
|
1178
|
-
})), className: "h-3 w-3 cursor-pointer accent-highlight-100" }), "Include subitems"] })] }), _jsxs("
|
|
1209
|
+
})), className: "h-3 w-3 cursor-pointer accent-highlight-100" }), "Include subitems"] })] }), _jsxs("label", { className: "flex items-center gap-2 text-xs", children: ["Store", _jsx(ContentStoreSelect, { "aria-label": "Item filter store", className: "w-full bg-white", value: filterStore, placeholder: "Select a store", onValueChange: (storeId) => setTranslationBatchFilters((prev) => ({
|
|
1210
|
+
...prev,
|
|
1211
|
+
store: storeId,
|
|
1212
|
+
language: filterLanguage,
|
|
1213
|
+
})), stores: model?.stores ?? [] })] }), _jsx(Input, { "aria-label": "Item filter language", value: filterLanguage, onChange: (event) => setTranslationBatchFilters((prev) => ({
|
|
1214
|
+
...prev,
|
|
1215
|
+
store: filterStore,
|
|
1216
|
+
language: event.target.value,
|
|
1217
|
+
})), placeholder: "Language" }), _jsxs("div", { className: "relative", children: [_jsx(Input, { value: itemIdOrPathInput, disabled: !filterStore || !filterLanguage, onChange: (e) => {
|
|
1179
1218
|
const next = e.target.value;
|
|
1180
1219
|
setTranslationBatchItemInput(next);
|
|
1181
1220
|
debouncedSetItemFilter(next);
|
|
1182
|
-
}, placeholder: "
|
|
1221
|
+
}, placeholder: "Item ID or path", className: "h-auto min-h-[34px] w-full bg-white py-2 pr-14 text-xs" }), _jsxs("div", { className: "absolute top-1/2 right-1.5 flex -translate-y-1/2 items-center gap-1", children: [itemIdOrPathInput && (_jsx("button", { type: "button", onClick: () => {
|
|
1183
1222
|
setTranslationBatchItemInput("");
|
|
1184
1223
|
debouncedSetItemFilter.cancel();
|
|
1185
1224
|
setTranslationBatchFilters((prev) => ({
|
|
@@ -1187,18 +1226,21 @@ export function TranslationBatchFiltersSidebar() {
|
|
|
1187
1226
|
itemIdOrPath: "",
|
|
1188
1227
|
itemIncludeSubitems: false,
|
|
1189
1228
|
}));
|
|
1190
|
-
}, className: "cursor-pointer text-neutral-grey-50 hover:text-neutral-grey-100", "aria-label": "Clear", children: _jsx(XIcon, { className: "h-3.5 w-3.5" }) })), _jsxs(Popover, { open: itemPickerOpen, onOpenChange: setItemPickerOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "cursor-pointer text-neutral-grey-50 hover:text-neutral-grey-100", "aria-label": "Browse content tree", title: "Browse content tree", children: _jsx(FolderTreeIcon, { className: "h-3.5 w-3.5" }) }) }), _jsxs(PopoverContent, { align: "end", sideOffset: 6, className: "w-[28rem] max-w-[calc(100vw-2rem)] p-0", children: [_jsx("div", { className: "flex items-center justify-between gap-2 border-b border-border-default px-3 py-2 text-[11px] text-neutral-grey-50", children: _jsx("span", { children: "Pick item to filter by" }) }), _jsx("div", { className: "max-h-80 overflow-auto p-2", children: _jsx(ContentTree, { language:
|
|
1191
|
-
"0de95ae4-41ab-4d01-9eb0-67441b7c2450",
|
|
1192
|
-
], onSelectionChange: (items) => {
|
|
1229
|
+
}, className: "cursor-pointer text-neutral-grey-50 hover:text-neutral-grey-100", "aria-label": "Clear", children: _jsx(XIcon, { className: "h-3.5 w-3.5" }) })), _jsxs(Popover, { open: itemPickerOpen, onOpenChange: setItemPickerOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "cursor-pointer text-neutral-grey-50 hover:text-neutral-grey-100", "aria-label": "Browse content tree", disabled: !filterStore || !filterLanguage, title: "Browse content tree", children: _jsx(FolderTreeIcon, { className: "h-3.5 w-3.5" }) }) }), _jsxs(PopoverContent, { align: "end", sideOffset: 6, className: "w-[28rem] max-w-[calc(100vw-2rem)] p-0", children: [_jsx("div", { className: "flex items-center justify-between gap-2 border-b border-border-default px-3 py-2 text-[11px] text-neutral-grey-50", children: _jsx("span", { children: "Pick item to filter by" }) }), _jsx("div", { className: "max-h-80 overflow-auto p-2", children: filterStore && filterLanguage && (_jsx(ContentTree, { language: filterLanguage, database: filterStore, selectionMode: "single", onSelectionChange: (items) => {
|
|
1193
1230
|
const picked = items?.[0];
|
|
1194
1231
|
if (!picked)
|
|
1195
1232
|
return;
|
|
1196
|
-
|
|
1197
|
-
|
|
1233
|
+
// multi-cms cftree-2: a picked item filters by its id — the one address every store
|
|
1234
|
+
// resolves (a Contentful block's or asset's place is shown only, and a page's slug path
|
|
1235
|
+
// can name two pages) — while the box shows its path where it has one.
|
|
1236
|
+
const applyValue = (shown) => {
|
|
1237
|
+
setTranslationBatchItemInput(shown);
|
|
1198
1238
|
debouncedSetItemFilter.cancel();
|
|
1199
1239
|
setTranslationBatchFilters((prev) => ({
|
|
1200
1240
|
...prev,
|
|
1201
|
-
itemIdOrPath:
|
|
1241
|
+
itemIdOrPath: picked.id,
|
|
1242
|
+
store: picked.database,
|
|
1243
|
+
language: picked.language,
|
|
1202
1244
|
}));
|
|
1203
1245
|
setItemPickerOpen(false);
|
|
1204
1246
|
};
|
|
@@ -1209,7 +1251,8 @@ export function TranslationBatchFiltersSidebar() {
|
|
|
1209
1251
|
fetchItemStubs([
|
|
1210
1252
|
{
|
|
1211
1253
|
id: picked.id,
|
|
1212
|
-
language:
|
|
1254
|
+
language: picked.language,
|
|
1255
|
+
database: picked.database,
|
|
1213
1256
|
version: 1,
|
|
1214
1257
|
},
|
|
1215
1258
|
])
|
|
@@ -1218,7 +1261,7 @@ export function TranslationBatchFiltersSidebar() {
|
|
|
1218
1261
|
applyValue(stubPath || picked.id);
|
|
1219
1262
|
})
|
|
1220
1263
|
.catch(() => applyValue(picked.id));
|
|
1221
|
-
} }) })] })] })] })] })] }), _jsx("div", { className: "flex justify-start pt-1", children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", onClick: resetFilters, disabled: !hasActiveFilters, children: [_jsx(XIcon, { className: "h-3.5 w-3.5" }), "Reset Filters"] }) })] }) })] }));
|
|
1264
|
+
} })) })] })] })] })] })] }), _jsx("div", { className: "flex justify-start pt-1", children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", onClick: resetFilters, disabled: !hasActiveFilters, children: [_jsx(XIcon, { className: "h-3.5 w-3.5" }), "Reset Filters"] }) })] }) })] }));
|
|
1222
1265
|
}
|
|
1223
1266
|
function isLikelyGuid(value) {
|
|
1224
1267
|
return /^[{(]?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}[)}]?$/i.test(value.trim());
|
|
@@ -1524,8 +1567,8 @@ function InlineLanguageJobChips({ batchId, batchProvider, jobs, languageMap, isE
|
|
|
1524
1567
|
? undefined
|
|
1525
1568
|
: { maxHeight: firstRowHeight ?? COLLAPSED_CHIP_ROW_HEIGHT_PX }, children: jobs.map((job, idx) => {
|
|
1526
1569
|
const lang = languageMap.get((job.targetLanguage || "").toLowerCase());
|
|
1527
|
-
const retryKey = `job:${job.id ?? `${job
|
|
1528
|
-
return (_jsx("span", { className: "shrink-0", onClick: (event) => event.stopPropagation(), children: _jsx(LanguageJobChip, { job: job, language: lang, provider: batchProvider, batchStartedAtUtc: batchStartedAtUtc, onOpen: () => onOpenItem(job.itemId, job.targetLanguage), isAborting: !!job.id && abortingJobIds.has(job.id), onAbort: () => onAbortJob(job), isRetrying: retryingKeys.has(retryKey), onRetry: () => onRetryJobs(batchId, batchProvider, [job], retryKey) }) }, `${job.id ?? idx}-${job.targetLanguage}`));
|
|
1570
|
+
const retryKey = `job:${job.id ?? `${translationItemKey(job)}:${job.sourceLanguage}:${job.targetLanguage}`}`;
|
|
1571
|
+
return (_jsx("span", { className: "shrink-0", onClick: (event) => event.stopPropagation(), children: _jsx(LanguageJobChip, { job: job, language: lang, provider: batchProvider, batchStartedAtUtc: batchStartedAtUtc, onOpen: () => onOpenItem(job.itemId, job.targetLanguage, job.store), isAborting: !!job.id && abortingJobIds.has(job.id), onAbort: () => onAbortJob(job), isRetrying: retryingKeys.has(retryKey), onRetry: () => onRetryJobs(batchId, batchProvider, [job], retryKey) }) }, `${job.id ?? idx}-${job.targetLanguage}`));
|
|
1529
1572
|
}) }), !isExpanded && hiddenCount > 0 && (_jsxs("button", { type: "button", className: "mt-px shrink-0 rounded border border-border-default bg-neutral-grey-5 badge-pad-sm text-[12px] leading-none tabular-nums text-neutral-grey-50 transition-colors hover:bg-neutral-grey-15 hover:text-neutral-grey-100", "aria-label": `Show ${hiddenCount} more language${hiddenCount !== 1 ? "s" : ""}`, title: `${hiddenCount} more language${hiddenCount !== 1 ? "s" : ""}`, onClick: (event) => {
|
|
1530
1573
|
event.stopPropagation();
|
|
1531
1574
|
onToggle();
|
|
@@ -1569,7 +1612,7 @@ function CustomPromptPanel({ prompts }) {
|
|
|
1569
1612
|
}, icon: justCopied ? (_jsx(CheckIcon, { className: "h-3.5 w-3.5", strokeWidth: 1 })) : (_jsx(CopyIcon, { className: "h-3.5 w-3.5", strokeWidth: 1 })), label: justCopied ? "Copied" : "Copy prompt" })), _jsx(ChevronDownIcon, { className: `h-3.5 w-3.5 text-neutral-grey-100 transition-transform ${isOpen ? "rotate-180" : ""}` })] })] }), isOpen && (_jsx("div", { style: { paddingLeft: "2.5rem" }, className: "pr-3 md:pr-4 pb-3", children: _jsx("pre", { className: "max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded border border-border-default/50 bg-white p-2 font-mono text-[12px] text-neutral-grey-100", children: p.prompt }) }))] }, p.provider));
|
|
1570
1613
|
}) }));
|
|
1571
1614
|
}
|
|
1572
|
-
function BatchItemList({ batchId, batchProvider, jobs, isLoading, expandedItems, languages, currentLanguage, itemFilter, itemIncludeSubitems, statusFilter, batchIsTerminal, batchStartedAtUtc, abortingJobIds, retryingKeys, isMobile = false, onToggleItem, onOpenItem, onAbortJob, onRetryJobs, }) {
|
|
1615
|
+
export function BatchItemList({ batchId, batchProvider, jobs, isLoading, expandedItems, languages, currentLanguage, itemFilter, itemFilterStore, itemIncludeSubitems, statusFilter, batchIsTerminal, batchStartedAtUtc, abortingJobIds, retryingKeys, isMobile = false, onToggleItem, onOpenItem, onAbortJob, onRetryJobs, }) {
|
|
1573
1616
|
const languageMap = React.useMemo(() => {
|
|
1574
1617
|
const map = new Map();
|
|
1575
1618
|
for (const l of languages) {
|
|
@@ -1600,6 +1643,7 @@ function BatchItemList({ batchId, batchProvider, jobs, isLoading, expandedItems,
|
|
|
1600
1643
|
const filter = itemFilter.trim();
|
|
1601
1644
|
if (!filter)
|
|
1602
1645
|
return effectiveJobs;
|
|
1646
|
+
const scopedJobs = effectiveJobs.filter((job) => !!itemFilterStore && job.store === itemFilterStore);
|
|
1603
1647
|
// When subitems is enabled and the filter is a GUID, derive the root path
|
|
1604
1648
|
// from any job in this batch that matches the GUID — then fall through to
|
|
1605
1649
|
// prefix-matching on path. If no such job is in the batch we keep only
|
|
@@ -1609,29 +1653,29 @@ function BatchItemList({ batchId, batchProvider, jobs, isLoading, expandedItems,
|
|
|
1609
1653
|
if (isLikelyGuid(filter)) {
|
|
1610
1654
|
const normalized = normalizeGuid(filter);
|
|
1611
1655
|
if (itemIncludeSubitems) {
|
|
1612
|
-
const rootJob =
|
|
1656
|
+
const rootJob = scopedJobs.find((j) => normalizeGuid((j.itemId || "").toString()) === normalized);
|
|
1613
1657
|
pathPrefix = rootJob?.itemPath ? rootJob.itemPath.toLowerCase() : null;
|
|
1614
1658
|
}
|
|
1615
1659
|
if (!pathPrefix) {
|
|
1616
|
-
return
|
|
1660
|
+
return scopedJobs.filter((j) => normalizeGuid((j.itemId || "").toString()) === normalized);
|
|
1617
1661
|
}
|
|
1618
1662
|
}
|
|
1619
1663
|
else if (filter.startsWith("/")) {
|
|
1620
1664
|
pathPrefix = filter.toLowerCase();
|
|
1621
1665
|
}
|
|
1622
1666
|
else {
|
|
1623
|
-
return
|
|
1667
|
+
return scopedJobs;
|
|
1624
1668
|
}
|
|
1625
1669
|
if (itemIncludeSubitems) {
|
|
1626
1670
|
const prefix = pathPrefix;
|
|
1627
1671
|
const prefixSlash = prefix.endsWith("/") ? prefix : prefix + "/";
|
|
1628
|
-
return
|
|
1672
|
+
return scopedJobs.filter((j) => {
|
|
1629
1673
|
const p = (j.itemPath || "").toLowerCase();
|
|
1630
1674
|
return p === prefix || p.startsWith(prefixSlash);
|
|
1631
1675
|
});
|
|
1632
1676
|
}
|
|
1633
|
-
return
|
|
1634
|
-
}, [effectiveJobs, itemFilter, itemIncludeSubitems]);
|
|
1677
|
+
return scopedJobs.filter((j) => (j.itemPath || "").toLowerCase() === pathPrefix);
|
|
1678
|
+
}, [effectiveJobs, itemFilter, itemFilterStore, itemIncludeSubitems]);
|
|
1635
1679
|
// Keep all jobs of items that have at least one job matching the selected status —
|
|
1636
1680
|
// this way the per-item language overview stays intact even when filtering.
|
|
1637
1681
|
const statusFilteredJobs = React.useMemo(() => {
|
|
@@ -1643,12 +1687,12 @@ function BatchItemList({ batchId, batchProvider, jobs, isLoading, expandedItems,
|
|
|
1643
1687
|
const matchingItemIds = new Set();
|
|
1644
1688
|
for (const j of filteredJobs) {
|
|
1645
1689
|
if (j.status === targetDbStatus) {
|
|
1646
|
-
matchingItemIds.add((j
|
|
1690
|
+
matchingItemIds.add(translationItemKey(j));
|
|
1647
1691
|
}
|
|
1648
1692
|
}
|
|
1649
1693
|
if (matchingItemIds.size === 0)
|
|
1650
1694
|
return [];
|
|
1651
|
-
return filteredJobs.filter((j) => matchingItemIds.has((j
|
|
1695
|
+
return filteredJobs.filter((j) => matchingItemIds.has(translationItemKey(j)));
|
|
1652
1696
|
}, [filteredJobs, statusFilter]);
|
|
1653
1697
|
const [stackLanguageChips, setStackLanguageChips] = React.useState(isMobile);
|
|
1654
1698
|
const itemTableContainerRef = React.useRef(null);
|
|
@@ -1712,7 +1756,7 @@ function BatchItemList({ batchId, batchProvider, jobs, isLoading, expandedItems,
|
|
|
1712
1756
|
}
|
|
1713
1757
|
const byItem = new Map();
|
|
1714
1758
|
for (const job of statusFilteredJobs) {
|
|
1715
|
-
const key = (job
|
|
1759
|
+
const key = translationItemKey(job);
|
|
1716
1760
|
if (!byItem.has(key))
|
|
1717
1761
|
byItem.set(key, []);
|
|
1718
1762
|
byItem.get(key).push(job);
|
|
@@ -1727,8 +1771,8 @@ function BatchItemList({ batchId, batchProvider, jobs, isLoading, expandedItems,
|
|
|
1727
1771
|
const itemPath = firstJob?.itemPath ?? null;
|
|
1728
1772
|
const serverName = firstJob?.itemName ?? null;
|
|
1729
1773
|
const metadataName = parseItemName(firstJob?.metadata, "");
|
|
1730
|
-
const displayName = serverName || metadataName || itemId;
|
|
1731
|
-
const titleAttr = `${itemPath ?? ""}\n${itemId}`.trim();
|
|
1774
|
+
const displayName = serverName || metadataName || firstJob?.itemId;
|
|
1775
|
+
const titleAttr = `${firstJob?.store || "Legacy row: store unavailable; editor navigation and retry disabled"}\n${itemPath ?? ""}\n${firstJob?.itemId}`.trim();
|
|
1732
1776
|
const itemErrorJobs = itemJobs.filter(isRetriableJob);
|
|
1733
1777
|
const itemRetryKey = `item:${batchId}:${itemId}`;
|
|
1734
1778
|
const isRetryingItem = retryingKeys.has(itemRetryKey);
|
|
@@ -1747,13 +1791,16 @@ function BatchItemList({ batchId, batchProvider, jobs, isLoading, expandedItems,
|
|
|
1747
1791
|
}, icon: _jsx(RetryIcon, { className: `h-3.5 w-3.5 ${isRetryingItem ? "animate-spin" : ""}`, strokeWidth: 1 }), label: "Retry failed translations for this item", disabled: itemErrorJobs.length === 0 || isRetryingItem }) })) : null;
|
|
1748
1792
|
const itemContent = (_jsxs("div", { className: `flex min-w-0 items-start ${stackLanguageChips ? "gap-2" : "gap-2.5"}`, children: [_jsx("span", { className: "mt-1 shrink-0", children: itemAnyInProgress ? (_jsx(LoaderIcon, { className: "h-3 w-3 animate-spin text-neutral-grey-50" })) : itemIsQueued ? (_jsx(QueuedIcon, { className: "h-3 w-3 text-neutral-grey-50", strokeWidth: 1, "aria-label": "Queued" })) : (_jsx("span", { className: `block h-1.5 w-1.5 rounded-full ${status.cls}`, "aria-hidden": "true" })) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("span", { className: `block min-w-0 text-[13px] text-neutral-grey-100 ${stackLanguageChips ? "break-words" : "truncate"}`, style: stackLanguageChips
|
|
1749
1793
|
? { overflowWrap: "anywhere" }
|
|
1750
|
-
: undefined, title: titleAttr, children: displayName }), itemPath && (_jsx("div", { className: "whitespace-normal break-words font-mono text-[11px] text-neutral-grey-50", style: { overflowWrap: "anywhere" }, title: titleAttr, children: itemPath })),
|
|
1751
|
-
|
|
1752
|
-
|
|
1794
|
+
: undefined, title: titleAttr, children: displayName }), itemPath && (_jsx("div", { className: "whitespace-normal break-words font-mono text-[11px] text-neutral-grey-50", style: { overflowWrap: "anywhere" }, title: titleAttr, children: itemPath })), _jsx("div", { className: "text-[11px] text-neutral-grey-50", children: firstJob?.store ||
|
|
1795
|
+
"Legacy record: content store unavailable; retry and navigation disabled." }), stackLanguageChips && (_jsx("div", { className: "mt-2", children: languageChips })), stackLanguageChips && retryAction && (_jsx("div", { className: "mt-2 flex justify-start", children: retryAction }))] })] }));
|
|
1796
|
+
return (_jsxs("tr", { role: "button", "aria-disabled": !firstJob?.store, tabIndex: firstJob?.store ? 0 : -1, className: `group cursor-pointer transition-colors hover:bg-neutral-grey-5 ${itemIndex > 0 ? "border-t border-border-default/50" : ""}`, onClick: () => {
|
|
1797
|
+
if (firstJob?.store)
|
|
1798
|
+
void onOpenItem(firstJob.itemId, rowOpenLanguage, firstJob.store);
|
|
1753
1799
|
}, onKeyDown: (e) => {
|
|
1754
1800
|
if (e.key === "Enter" || e.key === " ") {
|
|
1755
1801
|
e.preventDefault();
|
|
1756
|
-
|
|
1802
|
+
if (firstJob?.store)
|
|
1803
|
+
void onOpenItem(firstJob.itemId, rowOpenLanguage, firstJob.store);
|
|
1757
1804
|
}
|
|
1758
1805
|
}, children: [!stackLanguageChips && (_jsx("td", { "aria-hidden": "true", className: "px-3 py-2 md:px-4" })), _jsx("td", { className: `py-2 align-top ${stackLanguageChips ? "pr-2 pl-2.5" : "pr-4"}`, children: itemContent }), !stackLanguageChips && (_jsx("td", { className: "py-2 pr-2 align-top", children: languageChips })), !stackLanguageChips && (_jsx("td", { className: "w-12 py-2 pr-3 align-top whitespace-nowrap md:pr-4", children: retryAction }))] }, itemId));
|
|
1759
1806
|
}) })] }) }));
|
|
@@ -1854,7 +1901,7 @@ function LanguageJobChip({ job, language, provider, batchStartedAtUtc, onOpen, i
|
|
|
1854
1901
|
const emptyFieldText = statistics && statistics.emptyFieldCount > 0
|
|
1855
1902
|
? `${formatCount(statistics.emptyFieldCount)} empty`
|
|
1856
1903
|
: null;
|
|
1857
|
-
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: `group inline-flex items-center gap-1.5 rounded border badge-pad-sm text-[12px] transition-colors cursor-pointer ${chipCls}`, children: [
|
|
1904
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: `group inline-flex items-center gap-1.5 rounded border badge-pad-sm text-[12px] transition-colors cursor-pointer ${chipCls}`, children: [_jsx(LanguageIcon, { language: { languageCode: job.targetLanguage, name: langName }, flagClassName: "h-[10.5px] w-3.5 shrink-0", globeClassName: "h-3.5 w-3.5 shrink-0" }), _jsx("span", { className: "font-mono tracking-tight", children: job.targetLanguage }), jobInProgress && (_jsx(LoaderIcon, { className: "h-3 w-3 shrink-0 animate-spin" })), jobPending && (_jsx(QueuedIcon, { className: "h-3 w-3 shrink-0", strokeWidth: 1, "aria-label": "Queued" })), jobError && _jsx(AlertCircleIcon, { className: "h-3 w-3 shrink-0" }), !jobInProgress && !jobError && !jobPending && !jobAborted && (_jsx(CheckIcon, { className: "h-3 w-3 shrink-0 text-feedback-green" }))] }) }), _jsxs(PopoverContent, { align: "start", sideOffset: 6, className: "w-[26rem] max-w-[calc(100vw-2rem)] p-0", children: [_jsxs("div", { className: "flex items-center gap-2 border-b border-border-default px-3 py-2", children: [_jsx(LanguageIcon, { language: { languageCode: job.targetLanguage, name: langName }, flagClassName: "h-3 w-4 shrink-0", globeClassName: "h-4 w-4 shrink-0" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "text-[13px] font-medium text-neutral-grey-100 truncate", children: langName }), _jsxs("div", { className: "text-[11px] text-neutral-grey-50 font-mono truncate", children: [job.targetLanguage, job.sourceLanguage ? ` ← ${job.sourceLanguage}` : ""] })] }), _jsxs(Badge, { size: "sm", className: statusBadgeCls, children: [jobInProgress && (_jsx(LoaderIcon, { className: "h-2.5 w-2.5 animate-spin" })), capitalizeFirstLetter(jobStatus || "Unknown")] })] }), _jsxs("dl", { className: "divide-y divide-border-default/60", children: [claimedAtValid && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Claimed" }), _jsx("dd", { className: "text-[12px] text-neutral-grey-100", children: formatDateTime(claimedAt) })] })), timestampValid && (jobInProgress || jobPending) && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: "Updated" }), _jsx("dd", { className: "text-[12px] text-neutral-grey-100", children: formatDateTime(timestamp) })] })), durationMs != null && (_jsxs("div", { className: "flex items-baseline gap-3 px-3 py-2", children: [_jsx("dt", { className: "w-20 shrink-0 text-[10px] tracking-wide text-neutral-grey-50", children: heartbeatStale
|
|
1858
1905
|
? "Stalled"
|
|
1859
1906
|
: jobInProgress || jobPending
|
|
1860
1907
|
? "Running"
|
|
@@ -1883,11 +1930,13 @@ function LanguageJobChip({ job, language, provider, batchStartedAtUtc, onOpen, i
|
|
|
1883
1930
|
e.stopPropagation();
|
|
1884
1931
|
void onAbort?.();
|
|
1885
1932
|
setOpen(false);
|
|
1886
|
-
}, className: "gap-1.5 text-neutral-grey-50 hover:text-neutral-grey-100", children: [isAborting ? (_jsx(LoaderIcon, { className: "h-3.5 w-3.5 animate-spin" })) : (_jsx(AbortIcon, { className: "h-3.5 w-3.5" })), "Abort"] })), jobError && onRetry && (_jsxs(Button, { size: "sm", variant: "outline", disabled: isRetrying, onClick: (e) => {
|
|
1933
|
+
}, className: "gap-1.5 text-neutral-grey-50 hover:text-neutral-grey-100", children: [isAborting ? (_jsx(LoaderIcon, { className: "h-3.5 w-3.5 animate-spin" })) : (_jsx(AbortIcon, { className: "h-3.5 w-3.5" })), "Abort"] })), jobError && job.store && onRetry && (_jsxs(Button, { size: "sm", variant: "outline", disabled: isRetrying, onClick: (e) => {
|
|
1887
1934
|
e.stopPropagation();
|
|
1888
1935
|
void onRetry();
|
|
1889
1936
|
setOpen(false);
|
|
1890
|
-
}, className: "gap-1.5", children: [_jsx(RetryIcon, { className: `h-3.5 w-3.5 ${isRetrying ? "animate-spin" : ""}` }), "Retry"] })), _jsxs(Button, { size: "sm", variant: "default",
|
|
1937
|
+
}, className: "gap-1.5", children: [_jsx(RetryIcon, { className: `h-3.5 w-3.5 ${isRetrying ? "animate-spin" : ""}` }), "Retry"] })), _jsxs(Button, { size: "sm", variant: "default", disabled: !job.store, title: !job.store
|
|
1938
|
+
? "Legacy row has no content store; navigation is unavailable."
|
|
1939
|
+
: undefined, onClick: (e) => {
|
|
1891
1940
|
e.stopPropagation();
|
|
1892
1941
|
void onOpen();
|
|
1893
1942
|
setOpen(false);
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,SAAS,CAAC;QAChB,MAAM,EAAE,aAAa,EAAE,CAAC;KACzB,EAAE,CAAC;CACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,SAAS,CAAC;QAChB,MAAM,EAAE,aAAa,EAAE,CAAC;KACzB,EAAE,CAAC;CACL,CAAC"}
|