@parhelia/localization 0.1.12534 → 0.1.12555

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.
@@ -1 +1 @@
1
- {"version":3,"file":"RecentTranslations.d.ts","sourceRoot":"","sources":["../../src/translation-center/RecentTranslations.tsx"],"names":[],"mappings":"AAmEA,wBAAgB,kBAAkB,4CAyhBjC"}
1
+ {"version":3,"file":"RecentTranslations.d.ts","sourceRoot":"","sources":["../../src/translation-center/RecentTranslations.tsx"],"names":[],"mappings":"AAiDA,wBAAgB,kBAAkB,4CAygBjC"}
@@ -1,18 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useState, useMemo } from "react";
3
- import React from "react";
4
3
  import { useRouter } from "next/navigation";
5
4
  import { usePathname, useSearchParams } from "next/navigation";
6
5
  import { Button, Select, useEditContext } from "@parhelia/core";
7
6
  import { listBatches, getTranslationProviders, } from "../services/translationService";
8
7
  import { useDebouncedCallback } from "use-debounce";
9
- import { RefreshCw, X, ChevronDown, Languages, Loader2 } from "lucide-react";
10
- // Wrappers for lucide-react icons to work with React 19
11
- const RefreshIcon = (props) => React.createElement(RefreshCw, props);
12
- const XIcon = (props) => React.createElement(X, props);
13
- const ChevronDownIcon = (props) => React.createElement(ChevronDown, props);
14
- const LanguagesIcon = (props) => React.createElement(Languages, props);
15
- const LoaderIcon = (props) => React.createElement(Loader2, props);
16
8
  const DATE_RANGE_OPTIONS = [
17
9
  { value: "lastHour", label: "Last Hour" },
18
10
  { value: "last24hours", label: "Last 24 Hours" },
@@ -266,8 +258,7 @@ export function RecentTranslations() {
266
258
  router.push(`${pathname}?${current.toString()}`, { scroll: false });
267
259
  };
268
260
  const totalBatches = groupedBatches.reduce((sum, group) => sum + group.batches.length, 0);
269
- const isMobile = editContext?.isMobile ?? false;
270
- return (_jsxs("div", { className: "flex h-full flex-col min-h-0 bg-gray-5", "data-testid": "recent-translations", children: [_jsxs("div", { className: "shrink-0 border-b border-gray-3 bg-background p-4 md:p-6", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-xl font-semibold text-(--color-dark)", children: "Recent Translations" }), _jsx("p", { className: "text-sm text-gray-2 mt-1", children: "View and monitor translation jobs across all items" })] }), _jsx("div", { className: "flex gap-2", children: _jsxs(Button, { size: "sm", variant: "outline", onClick: () => loadRecentBatches(0, false), disabled: isLoading, className: "md:w-auto w-8 h-8 md:h-8 p-0 md:px-3", children: [_jsx(RefreshIcon, { className: `h-4 w-4 ${isLoading ? 'animate-spin' : ''}` }), _jsx("span", { className: "hidden md:inline", children: "Refresh" })] }) })] }), _jsxs("div", { className: "flex flex-wrap gap-4 items-center", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "Date Range:" }), _jsx(Select, { className: "w-40", options: DATE_RANGE_OPTIONS, value: filters.dateRange, onValueChange: (value) => setFilters((prev) => ({ ...prev, dateRange: value })), placeholder: "Select date range" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "Status:" }), _jsx(Select, { className: "w-36", options: STATUS_OPTIONS, value: filters.status, onValueChange: (value) => setFilters((prev) => ({ ...prev, status: value })), placeholder: "Select status" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "User:" }), _jsx(Select, { className: "w-44", options: [
261
+ return (_jsxs("div", { className: "flex h-full flex-col min-h-0 bg-[var(--color-gray-5)]", "data-testid": "recent-translations", children: [_jsxs("div", { className: "flex-shrink-0 border-b border-[var(--color-gray-3)] bg-background p-4 md:p-6", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-xl font-semibold text-[var(--color-dark)]", children: "Recent Translations" }), _jsx("p", { className: "text-sm text-[var(--color-gray-2)] mt-1", children: "View and monitor translation jobs across all items" })] }), _jsx("div", { className: "flex gap-2", children: _jsxs(Button, { size: "sm", variant: "outline", onClick: () => loadRecentBatches(0, false), disabled: isLoading, children: [_jsx("i", { className: `pi pi-refresh ${isLoading ? 'pi-spin' : ''}` }), "Refresh"] }) })] }), _jsxs("div", { className: "flex flex-wrap gap-4 items-center", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-[var(--color-gray-1)]", children: "Date Range:" }), _jsx(Select, { className: "w-40", options: DATE_RANGE_OPTIONS, value: filters.dateRange, onValueChange: (value) => setFilters((prev) => ({ ...prev, dateRange: value })), placeholder: "Select date range" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-[var(--color-gray-1)]", children: "Status:" }), _jsx(Select, { className: "w-36", options: STATUS_OPTIONS, value: filters.status, onValueChange: (value) => setFilters((prev) => ({ ...prev, status: value })), placeholder: "Select status" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-[var(--color-gray-1)]", children: "User:" }), _jsx(Select, { className: "w-44", options: [
271
262
  { value: "all", label: "All Users" },
272
263
  ...(currentUserName !== "all"
273
264
  ? [{ value: currentUserName, label: `${currentUserName} (You)` }]
@@ -275,21 +266,21 @@ export function RecentTranslations() {
275
266
  ...uniqueUsers
276
267
  .filter((u) => u !== currentUserName)
277
268
  .map((u) => ({ value: u, label: u })),
278
- ], value: isLimitedPreviewUser ? currentUserName : filters.user, onValueChange: (value) => setFilters((prev) => ({ ...prev, user: value })), disabled: isLimitedPreviewUser, placeholder: "Select user" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "Provider:" }), _jsx(Select, { className: "w-44", options: [
269
+ ], value: isLimitedPreviewUser ? currentUserName : filters.user, onValueChange: (value) => setFilters((prev) => ({ ...prev, user: value })), disabled: isLimitedPreviewUser, placeholder: "Select user" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-[var(--color-gray-1)]", children: "Provider:" }), _jsx(Select, { className: "w-44", options: [
279
270
  { value: "all", label: "All Providers" },
280
271
  ...providers.map((p) => ({
281
272
  value: p.name,
282
273
  label: p.displayName || p.name,
283
274
  })),
284
- ], value: filters.provider, onValueChange: (value) => setFilters((prev) => ({ ...prev, provider: value })), placeholder: "Select provider" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-(--color-gray-1)", children: "Target Language:" }), _jsx(Select, { className: "w-44", options: [
275
+ ], value: filters.provider, onValueChange: (value) => setFilters((prev) => ({ ...prev, provider: value })), placeholder: "Select provider" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-[var(--color-gray-1)]", children: "Target Language:" }), _jsx(Select, { className: "w-44", options: [
285
276
  { value: "all", label: "All Languages" },
286
277
  ...uniqueLanguages.map((lang) => ({
287
278
  value: lang,
288
279
  label: lang,
289
280
  })),
290
- ], value: filters.targetLanguage, onValueChange: (value) => setFilters((prev) => ({ ...prev, targetLanguage: value })), placeholder: "Select language" })] }), (filters.dateRange !== "last30days" || filters.status !== "all" || filters.user !== currentUserName || filters.provider !== "all" || filters.targetLanguage !== "all") && (_jsxs(Button, { size: "sm", variant: "ghost", onClick: () => setFilters({ dateRange: "last30days", status: "all", user: currentUserName, provider: "all", targetLanguage: "all" }), children: [_jsx("i", { className: "pi pi-times" }), "Clear Filters"] }))] }), _jsxs("div", { className: "mt-3 text-xs text-gray-2", children: ["Showing ", totalBatches, " batch", totalBatches !== 1 ? 'es' : '', batches.length !== totalBatches && (_jsxs("span", { children: [" (filtered from ", batches.length, " total batches)"] }))] })] }), _jsx("div", { className: "flex-1 overflow-auto p-4 md:p-6 min-h-0", children: isLoading && batches.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", children: _jsxs("div", { className: "flex items-center gap-2 text-gray-2", children: [_jsx(LoaderIcon, { className: "h-5 w-5 animate-spin text-theme-secondary" }), "Loading recent translations..."] }) })) : groupedBatches.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", children: _jsxs("div", { className: "text-center text-gray-2", children: [_jsx(LanguagesIcon, { className: "h-8 w-8 block mx-auto mb-2 text-gray-3" }), _jsx("p", { className: "font-medium text-(--color-gray-1)", children: "No translations found" }), _jsx("p", { className: "text-sm mt-1", children: filteredBatches.length !== batches.length
281
+ ], value: filters.targetLanguage, onValueChange: (value) => setFilters((prev) => ({ ...prev, targetLanguage: value })), placeholder: "Select language" })] }), (filters.dateRange !== "last30days" || filters.status !== "all" || filters.user !== currentUserName || filters.provider !== "all" || filters.targetLanguage !== "all") && (_jsxs(Button, { size: "sm", variant: "ghost", onClick: () => setFilters({ dateRange: "last30days", status: "all", user: currentUserName, provider: "all", targetLanguage: "all" }), children: [_jsx("i", { className: "pi pi-times" }), "Clear Filters"] }))] }), _jsxs("div", { className: "mt-3 text-xs text-[var(--color-gray-2)]", children: ["Showing ", totalBatches, " batch", totalBatches !== 1 ? 'es' : '', batches.length !== totalBatches && (_jsxs("span", { children: [" (filtered from ", batches.length, " total batches)"] }))] })] }), _jsx("div", { className: "flex-1 overflow-auto p-4 md:p-6 min-h-0", children: isLoading && batches.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", 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 recent translations..."] }) })) : groupedBatches.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", children: _jsxs("div", { className: "text-center text-[var(--color-gray-2)]", children: [_jsx("i", { className: "pi pi-language text-2xl block mb-2 text-[var(--color-gray-3)]" }), _jsx("p", { className: "font-medium text-[var(--color-gray-1)]", children: "No translations found" }), _jsx("p", { className: "text-sm mt-1", children: filteredBatches.length !== batches.length
291
282
  ? "Try adjusting your filters or start a translation to see it appear here"
292
- : "Start a translation to see it appear here" })] }) })) : (_jsxs("div", { className: "space-y-6", children: [groupedBatches.map((dateGroup) => (_jsxs("div", { children: [_jsxs("h2", { className: "text-lg font-semibold text-(--color-dark) mb-3 border-b border-gray-3 pb-2", children: [dateGroup.label, _jsxs("span", { className: "ml-2 text-sm font-normal text-gray-2", children: ["(", dateGroup.batches.length, " batch", dateGroup.batches.length !== 1 ? 'es' : '', ")"] })] }), _jsx("div", { className: "space-y-3", children: dateGroup.batches.map((b) => {
283
+ : "Start a translation to see it appear here" })] }) })) : (_jsxs("div", { className: "space-y-6", children: [groupedBatches.map((dateGroup) => (_jsxs("div", { children: [_jsxs("h2", { className: "text-lg font-semibold text-[var(--color-dark)] mb-3 border-b border-[var(--color-gray-3)] pb-2", children: [dateGroup.label, _jsxs("span", { className: "ml-2 text-sm font-normal text-[var(--color-gray-2)]", children: ["(", dateGroup.batches.length, " batch", dateGroup.batches.length !== 1 ? 'es' : '', ")"] })] }), _jsx("div", { className: "space-y-3", children: dateGroup.batches.map((b) => {
293
284
  const batchDate = new Date(b.timestamp);
294
285
  const now = new Date();
295
286
  const isToday = batchDate.toDateString() === now.toDateString();
@@ -304,8 +295,8 @@ export function RecentTranslations() {
304
295
  const completedJobs = info?.completedJobs ?? 0;
305
296
  const anyError = (info?.errorJobs ?? 0) > 0;
306
297
  const anyInProgress = info?.status === "In Progress";
307
- return (_jsx("div", { className: "border border-gray-3 rounded-lg bg-background shadow-sm overflow-hidden transition-shadow hover:shadow-md", children: _jsx("button", { className: "w-full px-4 py-3 md:px-6 md:py-4 hover:bg-gray-5 transition-colors text-left", onClick: () => navigateToBatch(b.id), title: "View batch details", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "text-left", children: [_jsx("div", { className: "font-medium text-(--color-dark)", children: `Translation Batch - ${timeDisplay}` }), _jsxs("div", { className: "text-sm text-gray-2 mt-1 flex flex-wrap items-center gap-x-2", children: [_jsxs("span", { className: "font-medium text-(--color-gray-1)", children: [totalJobs, " translations"] }), typeof itemsCount === 'number' && (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-gray-3", children: "\u2022" }), _jsxs("span", { children: [itemsCount, " items"] })] })), languages.length ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-gray-3", children: "\u2022" }), _jsx("span", { className: "truncate max-w-[200px]", title: languages.join(", "), children: languages.join(", ") })] })) : null, totalJobs > 0 && (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-gray-3", children: "\u2022" }), _jsxs("span", { className: "text-xs", children: [completedJobs, "/", totalJobs, " completed"] })] }))] }), _jsx("div", { className: "mt-2 block", children: _jsxs("span", { className: "inline-flex text-[10px] bg-gray-4 text-(--color-gray-1) px-2 py-0.5 rounded font-mono whitespace-nowrap overflow-hidden", children: ["ID: ", b.id] }) }), _jsxs("div", { className: "mt-2 flex flex-wrap gap-2 items-center text-xs", children: [info?.status && (_jsx("span", { className: `inline-flex items-center rounded-full px-2.5 py-1 font-medium ${info.status === 'Completed' ? 'bg-green-100 text-green-700' :
308
- info.status === 'In Progress' ? 'bg-theme-secondary-light text-theme-secondary' :
309
- info.status === 'Error' ? 'bg-red-100 text-red-600' : 'bg-gray-4 text-(--color-gray-1)'}`, children: info.status })), info?.provider && (_jsxs("span", { className: "text-(--color-gray-1)", children: ["Provider: ", _jsx("span", { className: "font-medium", children: info.provider })] })), info?.initiatedByUser && (_jsxs("span", { className: "text-(--color-gray-1)", children: ["By: ", _jsx("span", { className: "font-medium", children: info.initiatedByUser })] })), info?.lastUpdatedUtc && (_jsxs("span", { className: "text-gray-2", children: ["Updated: ", new Date(info.lastUpdatedUtc).toLocaleString()] }))] })] }), _jsxs("div", { className: "flex gap-2", children: [anyInProgress && (_jsx("span", { className: "rounded-full bg-theme-secondary-light px-3 py-1 text-xs font-medium text-theme-secondary", children: "In Progress" })), anyError && (_jsx("span", { className: "rounded-full bg-red-100 px-3 py-1 text-xs font-medium text-red-600", children: "Error" })), !anyInProgress && !anyError && (_jsx("span", { className: "rounded-full bg-green-100 px-3 py-1 text-xs font-medium text-green-700", children: "Completed" }))] })] }) }) }, b.id));
310
- }) })] }, 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-theme-secondary" }), "Loading more..."] })) : (_jsxs(_Fragment, { children: [_jsx(ChevronDownIcon, { className: "h-4 w-4" }), "Load More Batches"] })) }) }))] })) })] }));
298
+ return (_jsx("div", { className: "border border-[var(--color-gray-3)] rounded-lg bg-background shadow-sm overflow-hidden transition-shadow hover:shadow-md", children: _jsx("button", { className: "w-full px-4 py-3 md:px-6 md:py-4 hover:bg-[var(--color-gray-5)] transition-colors text-left", onClick: () => navigateToBatch(b.id), title: "View batch details", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "text-left", children: [_jsx("div", { className: "font-medium text-[var(--color-dark)]", children: `Translation Batch - ${timeDisplay}` }), _jsxs("div", { className: "text-sm text-[var(--color-gray-2)] mt-1", children: [totalJobs, " translations", typeof itemsCount === 'number' && (_jsxs("span", { children: [" \u2022 ", itemsCount, " items"] })), languages.length ? (_jsxs("span", { children: [" \u2022 ", languages.join(", ")] })) : null, _jsxs("span", { className: "ml-2 text-xs bg-[var(--color-gray-4)] text-[var(--color-gray-1)] px-2 py-0.5 rounded-full font-mono", children: ["ID: ", b.id] }), totalJobs > 0 && (_jsxs("span", { className: "ml-2 text-xs text-[var(--color-gray-2)]", children: ["(", completedJobs, "/", totalJobs, " completed", info?.errorJobs ? `, ${info.errorJobs} errors` : '', ")"] }))] }), _jsxs("div", { className: "mt-2 flex flex-wrap gap-2 items-center text-xs", children: [info?.status && (_jsx("span", { className: `inline-flex items-center rounded-full px-2.5 py-1 font-medium ${info.status === 'Completed' ? 'bg-green-100 text-green-700' :
299
+ info.status === 'In Progress' ? 'bg-[#f6eeff] text-[#9650fb]' :
300
+ info.status === 'Error' ? 'bg-red-100 text-red-600' : 'bg-[var(--color-gray-4)] text-[var(--color-gray-1)]'}`, children: info.status })), info?.provider && (_jsxs("span", { className: "text-[var(--color-gray-1)]", children: ["Provider: ", _jsx("span", { className: "font-medium", children: info.provider })] })), info?.initiatedByUser && (_jsxs("span", { className: "text-[var(--color-gray-1)]", children: ["By: ", _jsx("span", { className: "font-medium", children: info.initiatedByUser })] })), info?.lastUpdatedUtc && (_jsxs("span", { className: "text-[var(--color-gray-2)]", children: ["Updated: ", new Date(info.lastUpdatedUtc).toLocaleString()] }))] })] }), _jsxs("div", { className: "flex gap-2", children: [anyInProgress && (_jsx("span", { className: "rounded-full bg-[#f6eeff] px-3 py-1 text-xs font-medium text-[#9650fb]", children: "In Progress" })), anyError && (_jsx("span", { className: "rounded-full bg-red-100 px-3 py-1 text-xs font-medium text-red-600", children: "Error" })), !anyInProgress && !anyError && (_jsx("span", { className: "rounded-full bg-green-100 px-3 py-1 text-xs font-medium text-green-700", children: "Completed" }))] })] }) }) }, b.id));
301
+ }) })] }, 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("i", { className: "pi pi-spin pi-spinner text-[#9650fb]" }), "Loading more..."] })) : (_jsxs(_Fragment, { children: [_jsx("i", { className: "pi pi-chevron-down" }), "Load More Batches"] })) }) }))] })) })] }));
311
302
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parhelia/localization",
3
- "version": "0.1.12534",
3
+ "version": "0.1.12555",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,15 +25,17 @@
25
25
  "scripts": {
26
26
  "build": "tsc -p tsconfig.build.json",
27
27
  "lint": "eslint . --max-warnings 0",
28
+ "generate:component": "turbo gen react-component",
28
29
  "check-types": "tsc --noEmit"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@repo/eslint-config": "*",
32
33
  "@repo/typescript-config": "*",
33
34
  "@tailwindcss/postcss": "^4.1.18",
35
+ "@turbo/gen": "^2.4.4",
34
36
  "@types/node": "^22.13.9",
35
- "@types/react": "19.2.14",
36
- "@types/react-dom": "19.2.3",
37
+ "@types/react": "19.2.2",
38
+ "@types/react-dom": "19.2.2",
37
39
  "eslint": "^9.22.0",
38
40
  "tailwindcss": "^4.1.18",
39
41
  "typescript": "5.8.2"
@@ -41,13 +43,13 @@
41
43
  "dependencies": {
42
44
  "@parhelia/core": "*",
43
45
  "lucide-react": "^0.486.0",
44
- "next": "16.2.1",
46
+ "next": "16.0.10",
45
47
  "postcss": "^8.5.3",
46
- "react": "19.2.4",
47
- "react-dom": "19.2.4"
48
+ "react": "19.2.3",
49
+ "react-dom": "19.2.3"
48
50
  },
49
51
  "overrides": {
50
- "@types/react": "19.2.14",
51
- "@types/react-dom": "19.2.3"
52
+ "@types/react": "19.2.2",
53
+ "@types/react-dom": "19.2.2"
52
54
  }
53
55
  }