@parhelia/localization 0.1.12787 → 0.1.12789
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/translation-center/BatchTranslationView.d.ts.map +1 -1
- package/dist/translation-center/BatchTranslationView.js +28 -8
- package/dist/translation-center/TranslationManagement.d.ts.map +1 -1
- package/dist/translation-center/TranslationManagement.js +31 -6
- package/dist/translation-center/TranslationsTitlebar.d.ts +7 -0
- package/dist/translation-center/TranslationsTitlebar.d.ts.map +1 -0
- package/dist/translation-center/TranslationsTitlebar.js +16 -0
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AActD,OAAO,EACL,mBAAmB,EAGpB,MAAM,gBAAgB,CAAC;AAUxB,QAAA,MAAM,wCAAwC;;;;;;;;;;;;8BAalB,qBAAqB;;CAchD,CAAC;AAEF,QAAA,MAAM,4CAA4C;;;;;;;CAUjD,CAAC;AAkCF,OAAO,EAAE,wCAAwC,EAAE,4CAA4C,EAAE,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,mBAAmB,EAClC,OAAO,CAAC,EAAE,yBAAyB,uBAsHpC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ServiceLanguageSelectionStep } from "./steps/ServiceLanguageSelectionStep";
|
|
3
3
|
import { SubitemDiscoveryStep } from "./steps/SubitemDiscoveryStep";
|
|
4
4
|
import { PromptCustomizationStep } from "./steps/PromptCustomizationStep";
|
|
5
5
|
import { localizeItemCommand } from "./LocalizeItemCommand";
|
|
6
6
|
import { TranslationSidebar } from "./sidebar/TranslationSidebar";
|
|
7
7
|
import { TranslationManagement } from "./translation-center/TranslationManagement";
|
|
8
|
+
import { TranslationsTitlebar } from "./translation-center/TranslationsTitlebar";
|
|
8
9
|
import { RecentTranslations } from "./translation-center/RecentTranslations";
|
|
9
10
|
import { TranslationServicesPanel } from "./settings/TranslationServicesPanel";
|
|
10
11
|
import { Languages as LucideLanguages, LayoutGrid as LucideLayoutGrid, Globe as LucideGlobe, } from "lucide-react";
|
|
@@ -76,7 +77,7 @@ const translationManagementWorkspace = {
|
|
|
76
77
|
title: "Translation Management",
|
|
77
78
|
icon: _jsx(GlobeIcon, { strokeWidth: 1 }),
|
|
78
79
|
component: _jsx(TranslationManagement, {}),
|
|
79
|
-
|
|
80
|
+
titlebar: _jsx(TranslationsTitlebar, {}),
|
|
80
81
|
supportsSidebars: false,
|
|
81
82
|
sortOrder: 30,
|
|
82
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchTranslationView.d.ts","sourceRoot":"","sources":["../../src/translation-center/BatchTranslationView.tsx"],"names":[],"mappings":"AA4CA,OAAO,qCAAqC,CAAC;AA4C7C,UAAU,yBAAyB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAwED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,MAAM,GACP,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"BatchTranslationView.d.ts","sourceRoot":"","sources":["../../src/translation-center/BatchTranslationView.tsx"],"names":[],"mappings":"AA4CA,OAAO,qCAAqC,CAAC;AA4C7C,UAAU,yBAAyB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAwED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,MAAM,GACP,EAAE,yBAAyB,2CAqqD3B"}
|
|
@@ -101,13 +101,13 @@ export function BatchTranslationView({ batchId, onBack, }) {
|
|
|
101
101
|
const provider = providers.find((p) => p.name === serviceName);
|
|
102
102
|
return provider?.displayName || serviceName;
|
|
103
103
|
}, [providers]);
|
|
104
|
-
const openItemInEditor = useCallback((itemId, language) => {
|
|
105
|
-
editContext?.
|
|
104
|
+
const openItemInEditor = useCallback(async (itemId, language) => {
|
|
105
|
+
editContext?.setShowAgentsWorkspaceEditor(true);
|
|
106
|
+
await editContext?.loadItem({
|
|
106
107
|
id: normalizeJobItemId(itemId),
|
|
107
108
|
language,
|
|
108
109
|
version: 0,
|
|
109
110
|
});
|
|
110
|
-
editContext?.switchWorkspace?.("editor");
|
|
111
111
|
}, [editContext]);
|
|
112
112
|
const openBatchInView = useCallback((nextBatchId) => {
|
|
113
113
|
const current = new URLSearchParams(searchParams.toString());
|
|
@@ -725,9 +725,16 @@ export function BatchTranslationView({ batchId, onBack, }) {
|
|
|
725
725
|
const itemError = jobs.some((j) => j.status === "Error");
|
|
726
726
|
const itemTerminalError = itemError && !itemInProgress;
|
|
727
727
|
const itemVisualProgress = itemTerminalError ? 100 : itemProgress;
|
|
728
|
-
|
|
728
|
+
const defaultItemLanguage = jobs.find((job) => job.sourceLanguage)?.sourceLanguage ||
|
|
729
|
+
jobs[0]?.targetLanguage ||
|
|
730
|
+
editContext?.currentItemDescriptor?.language ||
|
|
731
|
+
"en";
|
|
732
|
+
const normalizedItemId = normalizeJobItemId(itemId);
|
|
733
|
+
const isSelectedItem = normalizeJobItemId(editContext?.currentItemDescriptor?.id) ===
|
|
734
|
+
normalizedItemId;
|
|
735
|
+
return (_jsxs("div", { className: `rounded-lg border bg-background ${isSelectedItem ? "border-[#9650fb] ring-2 ring-[#9650fb]/20" : "border-gray-3"} ${isMobile ? "p-4" : "p-6"} shadow-sm`, children: [_jsxs("div", { className: "mb-4", children: [_jsx("div", { className: "mb-3", children: (() => {
|
|
729
736
|
const itemName = itemNames.get(itemId.toLowerCase());
|
|
730
|
-
return
|
|
737
|
+
return (_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("button", { type: "button", onClick: () => void openItemInEditor(itemId, defaultItemLanguage), className: "min-w-0 flex-1 rounded-md text-left transition-colors hover:bg-gray-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#9650fb]/40", title: `Load item in ${defaultItemLanguage}`, children: [itemName && (_jsx("div", { className: `${isMobile ? "text-sm" : "text-base"} mb-1 font-bold text-(--color-dark)`, children: itemName })), _jsxs("div", { className: "font-mono text-[10px] text-gray-2 break-all md:text-xs", children: ["Item ID: ", itemId] })] }), _jsx(SimpleIconButton, { onClick: () => void openItemInEditor(itemId, defaultItemLanguage), icon: _jsx(ExternalLinkIcon, { className: "h-3.5 w-3.5", strokeWidth: 1 }), label: `Load item in ${defaultItemLanguage}`, className: "mt-0.5 shrink-0 p-0! text-gray-2 hover:text-(--color-gray-1)" })] }));
|
|
731
738
|
})() }), _jsxs("div", { className: "flex items-center justify-between mb-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("span", { className: `${isMobile ? "text-xs" : "text-sm"} text-gray-2`, children: [itemCompleted, " / ", jobs.length, " languages"] }), itemInProgress && (_jsx("span", { className: `${isMobile ? "text-[10px]" : "text-xs"} px-2 py-0.5 md:px-2.5 md:py-1 rounded-full font-medium`, style: {
|
|
732
739
|
backgroundColor: "#f6eeff",
|
|
733
740
|
color: "#9650fb",
|
|
@@ -779,8 +786,15 @@ export function BatchTranslationView({ batchId, onBack, }) {
|
|
|
779
786
|
}, showValue: false })] })), job.status === "Error" && (_jsx("div", { className: "mb-2", children: _jsx(Progress, { value: 100, className: "h-2", indicatorClassName: "bg-destructive", showValue: false }) })), _jsx("div", { className: "text-[10px] text-gray-2 text-right mt-1", children: date.toLocaleTimeString([], {
|
|
780
787
|
hour: "2-digit",
|
|
781
788
|
minute: "2-digit",
|
|
782
|
-
}) }), _jsx("div", { className: "mt-2 flex justify-end", children: _jsxs("div", { className: "flex items-center gap-2", children: [job.status === "Error" && (_jsx(SimpleIconButton, { onClick: () => void handleRetryJobs([job], false), icon: _jsx(RefreshIcon, { className: `h-3.5 w-3.5 ${isRetryingJob ? "animate-spin" : ""}`, strokeWidth: 1 }), label: "Retry translation as new batch", disabled: isRetryingJob, className: "p-0! text-gray-2 hover:text-(--color-gray-1)" })), _jsx(SimpleIconButton, { onClick: () =>
|
|
783
|
-
|
|
789
|
+
}) }), _jsx("div", { className: "mt-2 flex justify-end", children: _jsxs("div", { className: "flex items-center gap-2", children: [job.status === "Error" && (_jsx(SimpleIconButton, { onClick: () => void handleRetryJobs([job], false), icon: _jsx(RefreshIcon, { className: `h-3.5 w-3.5 ${isRetryingJob ? "animate-spin" : ""}`, strokeWidth: 1 }), label: "Retry translation as new batch", disabled: isRetryingJob, className: "p-0! text-gray-2 hover:text-(--color-gray-1)" })), _jsx(SimpleIconButton, { onClick: (event) => {
|
|
790
|
+
event.stopPropagation();
|
|
791
|
+
void openItemInEditor(job.itemId, job.targetLanguage);
|
|
792
|
+
}, icon: _jsx(ExternalLinkIcon, { className: "h-3.5 w-3.5", strokeWidth: 1 }), label: `Open item in ${job.targetLanguage}`, disabled: isRetryingAll, className: "p-0! text-gray-2 hover:text-(--color-gray-1)" })] }) })] }, job.targetLanguage));
|
|
793
|
+
}) })) : (_jsx(SimpleTable, { onRowClick: ({ item }) => void openItemInEditor(item.itemId, item.targetLanguage), rowClassName: (job) => normalizeJobItemId(editContext?.currentItemDescriptor?.id) === normalizeJobItemId(job.itemId) &&
|
|
794
|
+
editContext?.currentItemDescriptor?.language ===
|
|
795
|
+
job.targetLanguage
|
|
796
|
+
? "bg-[#9650fb]/5"
|
|
797
|
+
: "", columns: [
|
|
784
798
|
{
|
|
785
799
|
header: "Language",
|
|
786
800
|
className: "w-16", // Fixed width for language column
|
|
@@ -836,7 +850,13 @@ export function BatchTranslationView({ batchId, onBack, }) {
|
|
|
836
850
|
body: (job) => {
|
|
837
851
|
const jobRetryKey = getRetryJobKey(job);
|
|
838
852
|
const isRetryingJob = isRetryingAll || retryingJobKeys.has(jobRetryKey);
|
|
839
|
-
return (_jsxs("div", { className: "flex items-center justify-center gap-2", children: [job.status === "Error" && (_jsx(SimpleIconButton, { onClick: () =>
|
|
853
|
+
return (_jsxs("div", { className: "flex items-center justify-center gap-2", children: [job.status === "Error" && (_jsx(SimpleIconButton, { onClick: (event) => {
|
|
854
|
+
event.stopPropagation();
|
|
855
|
+
void handleRetryJobs([job], false);
|
|
856
|
+
}, icon: _jsx(RefreshIcon, { className: `h-3.5 w-3.5 ${isRetryingJob ? "animate-spin" : ""}`, strokeWidth: 1 }), label: "Retry translation as new batch", disabled: isRetryingJob, className: "p-0! text-gray-2 hover:text-(--color-gray-1)" })), _jsx(SimpleIconButton, { onClick: (event) => {
|
|
857
|
+
event.stopPropagation();
|
|
858
|
+
void openItemInEditor(job.itemId, job.targetLanguage);
|
|
859
|
+
}, icon: _jsx(ExternalLinkIcon, { className: "h-3.5 w-3.5", strokeWidth: 1 }), label: `Open item in ${job.targetLanguage}`, disabled: isRetryingAll, className: "p-0! text-gray-2 hover:text-(--color-gray-1)" })] }));
|
|
840
860
|
},
|
|
841
861
|
},
|
|
842
862
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationManagement.d.ts","sourceRoot":"","sources":["../../src/translation-center/TranslationManagement.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TranslationManagement.d.ts","sourceRoot":"","sources":["../../src/translation-center/TranslationManagement.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,qBAAqB,4CAkFpC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEditContext, usePathname, useRouter, useSearchParams, } from "@parhelia/core";
|
|
2
|
+
import { EditorSlotContextProvider, SingleEditView, Splitter, useEditContext, usePathname, useRouter, useSearchParams, } from "@parhelia/core";
|
|
3
3
|
import { BatchTranslationView } from "./BatchTranslationView";
|
|
4
|
+
function TranslationEditorPanel() {
|
|
5
|
+
const editContext = useEditContext();
|
|
6
|
+
const slotContext = editContext?.getActiveSlotContext();
|
|
7
|
+
if (!slotContext) {
|
|
8
|
+
return (_jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-3 p-6 text-center", children: [_jsx("div", { className: "text-sm font-medium text-[var(--color-gray-1)]", children: "No item selected" }), _jsx("div", { className: "max-w-sm text-xs text-[var(--color-gray-2)]", children: "Select a translation batch item or language row to preview and edit it here." })] }));
|
|
9
|
+
}
|
|
10
|
+
return (_jsx(EditorSlotContextProvider, { value: slotContext, children: _jsx(SingleEditView, { compareView: false, name: "translation-management-preview", view: "primary" }) }));
|
|
11
|
+
}
|
|
4
12
|
export function TranslationManagement() {
|
|
5
13
|
const editContext = useEditContext();
|
|
6
14
|
const config = editContext?.configuration;
|
|
@@ -8,6 +16,8 @@ export function TranslationManagement() {
|
|
|
8
16
|
const batchId = searchParams.get("batchId");
|
|
9
17
|
const router = useRouter();
|
|
10
18
|
const pathname = usePathname();
|
|
19
|
+
const showEditorPanel = editContext?.showAgentsWorkspaceEditor ?? false;
|
|
20
|
+
const isMobile = editContext?.isMobile ?? false;
|
|
11
21
|
// Get the Recent Translations panel content (since it's the only one)
|
|
12
22
|
const recentTranslationsPanel = config?.translationCenter?.groups
|
|
13
23
|
?.flatMap((x) => x.panels)
|
|
@@ -15,9 +25,24 @@ export function TranslationManagement() {
|
|
|
15
25
|
if (!config) {
|
|
16
26
|
return (_jsx("div", { className: "flex h-full flex-col items-center justify-center bg-[var(--color-gray-5)]", children: _jsxs("div", { className: "flex items-center gap-2 text-[var(--color-gray-2)]", children: [_jsx("i", { className: "pi pi-spin pi-spinner text-[#9650fb]" }), "Loading..."] }) }));
|
|
17
27
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
const managementContent = batchId ? (_jsx(BatchTranslationView, { batchId: batchId, onBack: () => {
|
|
29
|
+
const current = new URLSearchParams(searchParams.toString());
|
|
30
|
+
current.delete("batchId");
|
|
31
|
+
router.push(`${pathname}?${current.toString()}`, { scroll: false });
|
|
32
|
+
} })) : recentTranslationsPanel ? (_jsx("div", { className: "flex-1 min-h-0", children: recentTranslationsPanel.content })) : (_jsxs("div", { className: "flex h-full flex-col items-center justify-center text-[var(--color-gray-2)]", children: [_jsx("i", { className: "pi pi-language mb-4 text-4xl text-[var(--color-gray-3)]" }), _jsx("p", { className: "font-medium text-[var(--color-gray-1)]", children: "Recent translations not available" })] }));
|
|
33
|
+
const panels = [
|
|
34
|
+
{
|
|
35
|
+
name: "translation-management",
|
|
36
|
+
defaultSize: "auto",
|
|
37
|
+
content: managementContent,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
if (showEditorPanel) {
|
|
41
|
+
panels.push({
|
|
42
|
+
name: "editor-preview",
|
|
43
|
+
defaultSize: isMobile ? 45 : 500,
|
|
44
|
+
content: (_jsx("div", { className: "h-full overflow-hidden border-l border-gray-200 bg-gray-50", children: _jsx(TranslationEditorPanel, {}) })),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return (_jsx("div", { className: "absolute inset-0 flex flex-col bg-[var(--color-gray-5)]", "data-testid": "translation-management", children: showEditorPanel ? (_jsx(Splitter, { panels: panels, direction: isMobile ? "vertical" : "horizontal", localStorageKey: "translation-management.panelSizes" })) : (managementContent) }));
|
|
23
48
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TranslationsTitlebar - Titlebar content for the Translation Management workspace.
|
|
3
|
+
* Matches the AI Agents / Tasks titlebar pattern: title + subtitle stacked,
|
|
4
|
+
* with consistent left padding so it aligns across workspaces.
|
|
5
|
+
*/
|
|
6
|
+
export declare function TranslationsTitlebar(): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
//# sourceMappingURL=TranslationsTitlebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationsTitlebar.d.ts","sourceRoot":"","sources":["../../src/translation-center/TranslationsTitlebar.tsx"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,wBAAgB,oBAAoB,mDA8CnC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SimpleIconButton, useEditContext, cn, } from "@parhelia/core";
|
|
3
|
+
import { SquarePen } from "lucide-react";
|
|
4
|
+
/**
|
|
5
|
+
* TranslationsTitlebar - Titlebar content for the Translation Management workspace.
|
|
6
|
+
* Matches the AI Agents / Tasks titlebar pattern: title + subtitle stacked,
|
|
7
|
+
* with consistent left padding so it aligns across workspaces.
|
|
8
|
+
*/
|
|
9
|
+
export function TranslationsTitlebar() {
|
|
10
|
+
const editContext = useEditContext();
|
|
11
|
+
if (!editContext?.workspace)
|
|
12
|
+
return null;
|
|
13
|
+
const showSubtitle = !editContext.isMobile;
|
|
14
|
+
const { showAgentsWorkspaceEditor, setShowAgentsWorkspaceEditor } = editContext;
|
|
15
|
+
return (_jsxs("div", { className: cn("flex w-full flex-row items-center gap-3 pl-2", editContext.isMobile && "border-b px-1.5 py-1"), children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col items-start justify-center leading-tight", "data-testid": "translations-titlebar-identity", children: [_jsx("span", { className: "truncate text-sm font-medium leading-tight text-gray-900", children: "Translation Management" }), showSubtitle && (_jsx("span", { className: "truncate text-[11px] leading-tight text-gray-500", children: "Track and manage content translations" }))] }), !editContext.isMobile && (_jsx("div", { className: "flex shrink-0 items-center gap-2", children: _jsx(SimpleIconButton, { icon: _jsx(SquarePen, { className: "h-5 w-5", strokeWidth: 1 }), label: showAgentsWorkspaceEditor ? "Hide Editor" : "Show Editor", size: "large", "data-testid": "translations-editor-panel-toggle", selected: showAgentsWorkspaceEditor, onClick: () => setShowAgentsWorkspaceEditor(!showAgentsWorkspaceEditor) }) }))] }));
|
|
16
|
+
}
|