@focus-reactive/payload-plugin-translator 0.1.4 → 0.1.5
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/README.md +6 -3
- package/dist/client/app/cache/CacheProvider.d.ts +1 -2
- package/dist/client/app/cache/CacheProvider.export.d.ts +0 -1
- package/dist/client/app/config/TranslateKitConfigContext.d.ts +1 -2
- package/dist/client/app/config/index.d.ts +0 -1
- package/dist/client/entities/translation/api/mutations/useCancelCollectionTranslations.d.ts +0 -1
- package/dist/client/entities/translation/api/mutations/useCancelDocumentTranslation.d.ts +0 -1
- package/dist/client/entities/translation/api/mutations/useQueueDocumentTranslation.d.ts +0 -1
- package/dist/client/entities/translation/api/mutations/useQueueDocumentTranslations.d.ts +0 -1
- package/dist/client/entities/translation/api/mutations/useRunDocumentTranslation.d.ts +0 -1
- package/dist/client/entities/translation/api/queries/useCollectionTranslationStatus.d.ts +7 -72
- package/dist/client/entities/translation/api/queries/useDocumentTranslation.d.ts +7 -72
- package/dist/client/entities/translation/index.d.ts +0 -1
- package/dist/client/entities/translation/model/enums.d.ts +0 -1
- package/dist/client/entities/translation/model/enums.js +3 -3
- package/dist/client/entities/translation/model/types.d.ts +0 -1
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/CompletedTranslationStatus.d.ts +1 -2
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/index.d.ts +0 -1
- package/dist/client/entities/translation/ui/FailedTranslationStatus/FailedTranslationStatus.d.ts +1 -2
- package/dist/client/entities/translation/ui/FailedTranslationStatus/index.d.ts +0 -1
- package/dist/client/entities/translation/ui/PendingTranslationStatus/PendingTranslationStatus.d.ts +1 -2
- package/dist/client/entities/translation/ui/PendingTranslationStatus/index.d.ts +0 -1
- package/dist/client/entities/translation/ui/RunningTranslationStatus/RunningTranslationStatus.d.ts +1 -2
- package/dist/client/entities/translation/ui/RunningTranslationStatus/index.d.ts +0 -1
- package/dist/client/entities/translation/ui/TranslationDirection/TranslationDirection.d.ts +1 -2
- package/dist/client/entities/translation/ui/TranslationDirection/index.d.ts +0 -1
- package/dist/client/features/collection-translation-form/index.client.d.ts +0 -1
- package/dist/client/features/collection-translation-form/index.d.ts +0 -1
- package/dist/client/features/collection-translation-form/model/constants.d.ts +0 -1
- package/dist/client/features/collection-translation-form/model/form-model.d.ts +0 -1
- package/dist/client/features/collection-translation-form/model/index.d.ts +0 -1
- package/dist/client/features/collection-translation-form/model/schema.d.ts +0 -1
- package/dist/client/features/collection-translation-form/ui/CollectionTranslationForm.d.ts +1 -2
- package/dist/client/features/collection-translation-form/ui/index.d.ts +0 -1
- package/dist/client/features/collection-translation-popup/index.d.ts +0 -1
- package/dist/client/features/collection-translation-popup/ui/CollectionTranslationPopup.d.ts +1 -2
- package/dist/client/features/collection-translation-progress/index.d.ts +0 -1
- package/dist/client/features/collection-translation-progress/ui/CollectionTranslationProgress.d.ts +1 -2
- package/dist/client/features/document-translation-progress-failed/index.d.ts +0 -1
- package/dist/client/features/document-translation-progress-failed/ui/DocumentTranslationProgressFailed.d.ts +1 -2
- package/dist/client/features/document-translation-progress-pending/index.d.ts +0 -1
- package/dist/client/features/document-translation-progress-pending/ui/DocumentTranslationProgressPending.d.ts +1 -2
- package/dist/client/features/document-translation-progress-running/index.d.ts +0 -1
- package/dist/client/features/document-translation-progress-running/ui/DocumentTranslationProgressRunning.d.ts +1 -2
- package/dist/client/features/open-document-translation-popup/index.d.ts +0 -1
- package/dist/client/features/open-document-translation-popup/ui/OpenDocumentTranslationPopup.d.ts +1 -2
- package/dist/client/features/translate-document-form/index.client.d.ts +0 -1
- package/dist/client/features/translate-document-form/index.d.ts +0 -1
- package/dist/client/features/translate-document-form/model/constants.d.ts +0 -1
- package/dist/client/features/translate-document-form/model/form-model.d.ts +0 -1
- package/dist/client/features/translate-document-form/model/index.d.ts +0 -1
- package/dist/client/features/translate-document-form/model/schema.d.ts +0 -1
- package/dist/client/features/translate-document-form/ui/DocumentTranslationForm.d.ts +1 -2
- package/dist/client/features/translate-document-form/ui/index.d.ts +0 -1
- package/dist/client/shared/lib/assets/icons/LanguageTranslateIcon.d.ts +1 -2
- package/dist/client/shared/lib/assets/icons/QuestionCircleIcon.d.ts +1 -2
- package/dist/client/shared/lib/assets/icons/ReloadIcon.d.ts +1 -2
- package/dist/client/shared/lib/errors/handleApiError.d.ts +0 -1
- package/dist/client/shared/lib/errors/handleApiError.js +3 -1
- package/dist/client/shared/lib/forms/handle-form-error.d.ts +0 -1
- package/dist/client/shared/lib/payload/hooks/useCollectionDashboardUrlParams.d.ts +0 -1
- package/dist/client/shared/lib/payload/hooks/useCollectionDocumentUrlParams.d.ts +0 -1
- package/dist/client/shared/lib/payload/hooks/useLocaleOptions.d.ts +0 -1
- package/dist/client/shared/lib/utils/errors/handleApiError.d.ts +0 -1
- package/dist/client/shared/lib/utils/errors/handleApiError.js +3 -1
- package/dist/client/shared/lib/utils/react/useToggle.d.ts +0 -1
- package/dist/client/shared/providers/CacheClientProvider/CacheClientProvider.factory.d.ts +0 -1
- package/dist/client/shared/providers/CacheClientProvider/index.d.ts +0 -1
- package/dist/client/shared/types/AccessGuard.d.ts +0 -1
- package/dist/client/shared/types/PayloadComponentExport.d.ts +0 -1
- package/dist/client/shared/ui/Alert/Alert.d.ts +0 -1
- package/dist/client/shared/ui/Alert/index.d.ts +0 -1
- package/dist/client/shared/ui/Button/Button.d.ts +0 -1
- package/dist/client/shared/ui/Button/index.d.ts +0 -1
- package/dist/client/shared/ui/Checkbox/Checkbox.d.ts +0 -1
- package/dist/client/shared/ui/Checkbox/index.d.ts +0 -1
- package/dist/client/shared/ui/ColorIndicator/ColorIndicator.d.ts +1 -2
- package/dist/client/shared/ui/ColorIndicator/index.d.ts +0 -1
- package/dist/client/shared/ui/Description/Description.d.ts +1 -2
- package/dist/client/shared/ui/Description/index.d.ts +0 -1
- package/dist/client/shared/ui/Divider/Divider.d.ts +0 -1
- package/dist/client/shared/ui/Divider/index.d.ts +0 -1
- package/dist/client/shared/ui/Label/Label.d.ts +0 -1
- package/dist/client/shared/ui/Label/index.d.ts +0 -1
- package/dist/client/shared/ui/Loading/Loading.d.ts +1 -2
- package/dist/client/shared/ui/Loading/index.d.ts +0 -1
- package/dist/client/shared/ui/Popup/Popup.d.ts +1 -2
- package/dist/client/shared/ui/Popup/index.d.ts +0 -1
- package/dist/client/shared/ui/ProgressBar/ProgressBar.d.ts +1 -2
- package/dist/client/shared/ui/ProgressBar/index.d.ts +0 -1
- package/dist/client/shared/ui/Select/Select.d.ts +2 -3
- package/dist/client/shared/ui/Select/index.d.ts +0 -1
- package/dist/client/shared/ui/StatusCounter/StatusCounter.d.ts +1 -2
- package/dist/client/shared/ui/StatusCounter/index.d.ts +0 -1
- package/dist/client/shared/ui/StatusIndicator/StatusIndicator.d.ts +1 -2
- package/dist/client/shared/ui/StatusIndicator/index.d.ts +0 -1
- package/dist/client/shared/ui/Tooltip/Tooltip.d.ts +1 -2
- package/dist/client/shared/ui/Tooltip/index.d.ts +0 -1
- package/dist/client/shared/ui/form/FormCheckbox/FormCheckbox.d.ts +1 -2
- package/dist/client/shared/ui/form/FormCheckbox/index.d.ts +0 -1
- package/dist/client/shared/ui/form/FormCheckboxPublish/FormCheckboxPublish.d.ts +1 -2
- package/dist/client/shared/ui/form/FormCheckboxPublish/index.d.ts +0 -1
- package/dist/client/shared/ui/form/FormSelect/FormSelect.d.ts +1 -2
- package/dist/client/shared/ui/form/FormSelect/index.d.ts +0 -1
- package/dist/client/shared/ui/form/FormSelectLocale/FormSelectLocale.d.ts +1 -2
- package/dist/client/shared/ui/form/FormSelectLocale/index.d.ts +0 -1
- package/dist/client/shared/ui/form/FormSelectStrategy/FormSelectStrategy.d.ts +1 -2
- package/dist/client/shared/ui/form/FormSelectStrategy/index.d.ts +0 -1
- package/dist/client/shared/utils/componentPath.d.ts +0 -1
- package/dist/client/widgets/bulk-translation-dashboard/index.d.ts +0 -1
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.d.ts +1 -2
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.export.d.ts +0 -1
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.export.js +2 -1
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.server.d.ts +1 -2
- package/dist/client/widgets/bulk-translation-dashboard/ui/index.d.ts +0 -1
- package/dist/client/widgets/translate-document/index.d.ts +0 -1
- package/dist/client/widgets/translate-document/ui/TranslateDocument.d.ts +1 -2
- package/dist/client/widgets/translate-document/ui/TranslateDocument.export.d.ts +0 -1
- package/dist/client/widgets/translate-document/ui/TranslateDocument.export.js +2 -1
- package/dist/client/widgets/translate-document/ui/TranslateDocument.server.d.ts +1 -2
- package/dist/client/widgets/translate-document/ui/index.d.ts +0 -1
- package/dist/field-config.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/server/features/_lib/collection-utils.d.ts +0 -1
- package/dist/server/features/_lib/index.d.ts +0 -1
- package/dist/server/features/cancel/handler.d.ts +0 -1
- package/dist/server/features/cancel/index.d.ts +0 -1
- package/dist/server/features/cancel/model.d.ts +0 -1
- package/dist/server/features/cancel/route.d.ts +0 -1
- package/dist/server/features/cancel-by-collection/handler.d.ts +0 -1
- package/dist/server/features/cancel-by-collection/index.d.ts +0 -1
- package/dist/server/features/cancel-by-collection/model.d.ts +0 -1
- package/dist/server/features/cancel-by-collection/route.d.ts +0 -1
- package/dist/server/features/enqueue-translation/handler.d.ts +0 -1
- package/dist/server/features/enqueue-translation/index.d.ts +0 -1
- package/dist/server/features/enqueue-translation/model.d.ts +0 -1
- package/dist/server/features/enqueue-translation/route.d.ts +0 -1
- package/dist/server/features/get-collection-status/handler.d.ts +0 -1
- package/dist/server/features/get-collection-status/index.d.ts +0 -1
- package/dist/server/features/get-collection-status/model.d.ts +0 -1
- package/dist/server/features/get-collection-status/route.d.ts +0 -1
- package/dist/server/features/get-document-status/handler.d.ts +0 -1
- package/dist/server/features/get-document-status/index.d.ts +0 -1
- package/dist/server/features/get-document-status/model.d.ts +0 -1
- package/dist/server/features/get-document-status/route.d.ts +0 -1
- package/dist/server/features/index.d.ts +0 -1
- package/dist/server/features/run-translation/handler.d.ts +0 -1
- package/dist/server/features/run-translation/index.d.ts +0 -1
- package/dist/server/features/run-translation/model.d.ts +0 -1
- package/dist/server/features/run-translation/route.d.ts +0 -1
- package/dist/server/features/translate-document/handler.d.ts +0 -1
- package/dist/server/features/translate-document/index.d.ts +0 -1
- package/dist/server/features/translate-document/model.d.ts +0 -1
- package/dist/server/features/translate-document/task.d.ts +0 -1
- package/dist/server/index.d.ts +0 -1
- package/dist/server/modules/index.d.ts +0 -1
- package/dist/server/modules/task-runner/TaskRunner.interface.d.ts +0 -1
- package/dist/server/modules/task-runner/TaskRunnerProvider.interface.d.ts +3 -4
- package/dist/server/modules/task-runner/index.d.ts +0 -1
- package/dist/server/modules/task-runner/payload-jobs-runner/PayloadJobsRunnerProvider.d.ts +1 -2
- package/dist/server/modules/task-runner/payload-jobs-runner/PayloadJobsTaskRunner.d.ts +0 -1
- package/dist/server/modules/task-runner/payload-jobs-runner/index.d.ts +0 -1
- package/dist/server/modules/task-runner/payload-jobs-runner/normalizeJob.d.ts +0 -1
- package/dist/server/modules/task-runner/payload-jobs-runner/types.d.ts +0 -1
- package/dist/server/modules/task-runner/sync-runner/SyncRunnerProvider.d.ts +0 -1
- package/dist/server/modules/task-runner/sync-runner/SyncTaskRunner.d.ts +0 -1
- package/dist/server/modules/task-runner/sync-runner/index.d.ts +0 -1
- package/dist/server/modules/task-runner/sync-runner/types.d.ts +0 -1
- package/dist/server/modules/task-runner/types.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/TranslationPipeline.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/data-reconciler/DataReconciler.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/data-reconciler/DataReconciler.stage.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/data-reconciler/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/field-collector/FieldChunkCollector.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/field-collector/FieldChunkCollector.js +2 -1
- package/dist/server/modules/translation-pipeline/stages/field-collector/FieldChunkCollector.stage.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/field-collector/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/text-expander/PlainTextExpander.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/text-expander/RichTextExpander.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/text-expander/TextChunkExpander.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/text-expander/TextChunkExpander.stage.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/text-expander/TextExpander.interface.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/text-expander/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/translation/Translation.stage.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/translation/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/translation-applicator/TranslationMutator.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/translation-applicator/TranslationMutator.stage.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/translation-applicator/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/strategies/Overwrite.strategy.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/strategies/SkipExisting.strategy.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/strategies/TranslationStrategy.interface.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/strategies/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/types/FieldChunk.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/types/Pipeline.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/types/PipelineContext.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/types/TextChunk.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/types/index.d.ts +0 -1
- package/dist/server/modules/translation-providers/OpenAITranslation.provider.d.ts +1 -2
- package/dist/server/modules/translation-providers/TranslationProvider.interface.d.ts +0 -1
- package/dist/server/modules/translation-providers/index.d.ts +0 -1
- package/dist/server/shared/access/AnyAccessGuard.d.ts +0 -1
- package/dist/server/shared/access/handler.d.ts +1 -2
- package/dist/server/shared/access/index.d.ts +0 -1
- package/dist/server/shared/access/types.d.ts +0 -1
- package/dist/server/shared/field-config/getFieldConfig.d.ts +0 -1
- package/dist/server/shared/field-config/index.d.ts +0 -1
- package/dist/server/shared/field-config/types.d.ts +0 -1
- package/dist/server/shared/guards/collection-guards.d.ts +0 -1
- package/dist/server/shared/guards/field-guards.d.ts +0 -1
- package/dist/server/shared/guards/index.d.ts +0 -1
- package/dist/server/shared/http/ServerResponse.d.ts +0 -1
- package/dist/server/shared/http/index.d.ts +0 -1
- package/dist/server/shared/http/withAccessCheck.d.ts +0 -1
- package/dist/server/shared/http/withErrorHandler.d.ts +0 -1
- package/dist/server/shared/index.d.ts +0 -1
- package/dist/server/shared/lexical/collectTextNodes.d.ts +0 -1
- package/dist/server/shared/lexical/guards.d.ts +0 -1
- package/dist/server/shared/lexical/index.d.ts +0 -1
- package/dist/server/shared/lexical/isEmptyRichText.d.ts +0 -1
- package/dist/server/shared/lexical/traverseLexicalTree.d.ts +0 -1
- package/dist/server/shared/lexical/types.d.ts +0 -1
- package/dist/server/shared/utils/LazyMap.d.ts +0 -1
- package/dist/server/shared/utils/filterLocalizedFields.d.ts +0 -1
- package/dist/server/shared/utils/getByPath.d.ts +0 -1
- package/dist/server/shared/utils/index.d.ts +0 -1
- package/dist/server/shared/utils/isEmpty.d.ts +0 -1
- package/dist/server/shared/utils/isObject.d.ts +0 -1
- package/dist/server/shared/utils/normalizePath.d.ts +0 -1
- package/dist/server/shared/utils/pipe.d.ts +0 -1
- package/dist/server/shared/utils/setByPath.d.ts +0 -1
- package/dist/types/AccessGuard.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/package.json +33 -32
- package/dist/client/app/cache/CacheProvider.jsx +0 -11
- package/dist/client/app/config/TranslateKitConfigContext.jsx +0 -13
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/CompletedTranslationStatus.jsx +0 -25
- package/dist/client/entities/translation/ui/FailedTranslationStatus/FailedTranslationStatus.jsx +0 -24
- package/dist/client/entities/translation/ui/PendingTranslationStatus/PendingTranslationStatus.jsx +0 -38
- package/dist/client/entities/translation/ui/RunningTranslationStatus/RunningTranslationStatus.jsx +0 -32
- package/dist/client/entities/translation/ui/TranslationDirection/TranslationDirection.jsx +0 -16
- package/dist/client/features/collection-translation-form/ui/CollectionTranslationForm.jsx +0 -25
- package/dist/client/features/collection-translation-popup/ui/CollectionTranslationPopup.jsx +0 -23
- package/dist/client/features/collection-translation-progress/ui/CollectionTranslationProgress.jsx +0 -47
- package/dist/client/features/document-translation-progress-failed/ui/DocumentTranslationProgressFailed.jsx +0 -19
- package/dist/client/features/document-translation-progress-pending/ui/DocumentTranslationProgressPending.jsx +0 -34
- package/dist/client/features/document-translation-progress-running/ui/DocumentTranslationProgressRunning.jsx +0 -19
- package/dist/client/features/open-document-translation-popup/ui/OpenDocumentTranslationPopup.jsx +0 -15
- package/dist/client/features/translate-document-form/ui/DocumentTranslationForm.jsx +0 -24
- package/dist/client/shared/lib/assets/icons/LanguageTranslateIcon.jsx +0 -4
- package/dist/client/shared/lib/assets/icons/QuestionCircleIcon.jsx +0 -3
- package/dist/client/shared/lib/assets/icons/ReloadIcon.jsx +0 -3
- package/dist/client/shared/ui/Alert/Alert.jsx +0 -33
- package/dist/client/shared/ui/Button/Button.jsx +0 -35
- package/dist/client/shared/ui/Checkbox/Checkbox.jsx +0 -6
- package/dist/client/shared/ui/ColorIndicator/ColorIndicator.jsx +0 -7
- package/dist/client/shared/ui/Description/Description.jsx +0 -7
- package/dist/client/shared/ui/Divider/Divider.jsx +0 -7
- package/dist/client/shared/ui/Label/Label.jsx +0 -9
- package/dist/client/shared/ui/Loading/Loading.jsx +0 -11
- package/dist/client/shared/ui/Popup/Popup.jsx +0 -13
- package/dist/client/shared/ui/ProgressBar/ProgressBar.jsx +0 -11
- package/dist/client/shared/ui/Select/Select.jsx +0 -41
- package/dist/client/shared/ui/StatusCounter/StatusCounter.jsx +0 -26
- package/dist/client/shared/ui/StatusIndicator/StatusIndicator.jsx +0 -10
- package/dist/client/shared/ui/Tooltip/Tooltip.jsx +0 -16
- package/dist/client/shared/ui/form/FormCheckbox/FormCheckbox.jsx +0 -24
- package/dist/client/shared/ui/form/FormCheckboxPublish/FormCheckboxPublish.jsx +0 -21
- package/dist/client/shared/ui/form/FormSelect/FormSelect.jsx +0 -44
- package/dist/client/shared/ui/form/FormSelectLocale/FormSelectLocale.jsx +0 -6
- package/dist/client/shared/ui/form/FormSelectStrategy/FormSelectStrategy.jsx +0 -25
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.export.jsx +0 -11
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.jsx +0 -55
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.server.jsx +0 -17
- package/dist/client/widgets/translate-document/ui/TranslateDocument.jsx +0 -55
- package/dist/client/widgets/translate-document/ui/TranslateDocument.server.jsx +0 -16
- package/dist/vitest-env.d.js +0 -3
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import Loading from '../Loading';
|
|
4
|
-
import styles from './styles.module.scss';
|
|
5
|
-
const sizes = {
|
|
6
|
-
sm: {
|
|
7
|
-
height: '24px',
|
|
8
|
-
paddingInline: '0.25rem',
|
|
9
|
-
},
|
|
10
|
-
md: {
|
|
11
|
-
height: '32px',
|
|
12
|
-
paddingInline: '0.5rem',
|
|
13
|
-
},
|
|
14
|
-
lg: {
|
|
15
|
-
height: '40px',
|
|
16
|
-
paddingInline: '0.75rem',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
const Button = forwardRef(function Button({ className = '', children, $fullWidth, style, $startContent, $variant, $isLoading, $size = 'md', $isIconButton, ...props }, ref) {
|
|
20
|
-
const _style = {
|
|
21
|
-
'--button-width': $fullWidth ? '100%' : 'auto',
|
|
22
|
-
'--height': sizes[$size].height,
|
|
23
|
-
'--padding-inline': $isIconButton ? '0' : sizes[$size].paddingInline,
|
|
24
|
-
'--width': $isIconButton ? sizes[$size].height : 'auto',
|
|
25
|
-
...style,
|
|
26
|
-
};
|
|
27
|
-
const buttonClassName = $variant === 'unstyled'
|
|
28
|
-
? classNames(styles['unstyled'], className, $isIconButton && styles['icon-button'])
|
|
29
|
-
: classNames(styles['button'], className, $variant ? styles[$variant] : undefined, $isIconButton && styles['icon-button']);
|
|
30
|
-
return (<button {...props} style={_style} ref={ref} className={buttonClassName}>
|
|
31
|
-
{$startContent && <div className={styles['start-content']}>{$startContent}</div>}
|
|
32
|
-
{$isLoading ? <Loading size={$isIconButton ? 'small' : 'medium'}/> : children}
|
|
33
|
-
</button>);
|
|
34
|
-
});
|
|
35
|
-
export default Button;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
import styles from './styles.module.scss';
|
|
3
|
-
const Checkbox = forwardRef(function Checkbox({ className = '', hasError, ...props }, ref) {
|
|
4
|
-
return (<input ref={ref} type="checkbox" className={`${styles.checkbox} ${hasError ? styles['checkbox--error'] : ''} ${className}`} {...props}/>);
|
|
5
|
-
});
|
|
6
|
-
export default Checkbox;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import styles from './styles.module.scss';
|
|
3
|
-
export default function ColorIndicator({ $color, $animated, title, className }) {
|
|
4
|
-
return (<div title={title} className={classNames(styles.indicator, styles[`${$color}-indicator`], {
|
|
5
|
-
[styles.animated]: $animated,
|
|
6
|
-
}, className)}/>);
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import styles from './styles.module.scss';
|
|
2
|
-
export default function Description({ children, className = '', id, variant = 'default', ...props }) {
|
|
3
|
-
const descriptionClassName = `${styles.description} ${styles[variant]} ${className}`;
|
|
4
|
-
return (<p id={id} className={descriptionClassName} role={variant === 'error' ? 'alert' : undefined} aria-live={variant === 'error' ? 'polite' : undefined} {...props}>
|
|
5
|
-
{children}
|
|
6
|
-
</p>);
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import styles from './styles.module.scss';
|
|
4
|
-
const Divider = React.forwardRef(function Divider({ $orientation = 'horizontal', $size = 'md', $color = 'medium', className, style, ...props }, ref) {
|
|
5
|
-
return (<hr ref={ref} className={classNames(styles.divider, styles[$orientation], styles[$size], styles[$color], className)} style={style} role="separator" aria-orientation={$orientation} {...props}/>);
|
|
6
|
-
});
|
|
7
|
-
export default Divider;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
import styles from './styles.module.scss';
|
|
3
|
-
const Label = forwardRef(function Label({ children, className = '', label, ...props }, ref) {
|
|
4
|
-
return (<label ref={ref} className={`${styles.label} ${className}`} {...props}>
|
|
5
|
-
<span className={styles.label__text}>{label}</span>
|
|
6
|
-
{children}
|
|
7
|
-
</label>);
|
|
8
|
-
});
|
|
9
|
-
export default Label;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import styles from './styles.module.scss';
|
|
3
|
-
function Loading({ text, className, size = 'medium' }) {
|
|
4
|
-
return (<div className={classNames(styles['loading-overlay'], styles['loading-overlay--entering'], className)} style={{ animationDuration: '500ms' }}>
|
|
5
|
-
<div className={classNames(styles['loading-overlay__bars'], styles[`loading-overlay__bars_${size}`])}>
|
|
6
|
-
{new Array(size === 'small' ? 2 : 5).fill(null).map((_, index) => (<div key={index} className={classNames(styles['loading-overlay__bar'], styles[`loading-overlay__bar_size-${size}`])}/>))}
|
|
7
|
-
</div>
|
|
8
|
-
{text && <span className={styles['loading-overlay__text']}>{text}</span>}
|
|
9
|
-
</div>);
|
|
10
|
-
}
|
|
11
|
-
export default Loading;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as Popover from '@radix-ui/react-popover';
|
|
2
|
-
import style from './styles.module.scss';
|
|
3
|
-
function Popup({ open, children, onOpenChange, $trigger, $align, $side }) {
|
|
4
|
-
return (<Popover.Root open={open} onOpenChange={onOpenChange}>
|
|
5
|
-
<Popover.Trigger asChild>{$trigger}</Popover.Trigger>
|
|
6
|
-
<Popover.Portal>
|
|
7
|
-
<Popover.Content sideOffset={8} side={$side} align={$align} className={style.popover}>
|
|
8
|
-
{children}
|
|
9
|
-
</Popover.Content>
|
|
10
|
-
</Popover.Portal>
|
|
11
|
-
</Popover.Root>);
|
|
12
|
-
}
|
|
13
|
-
export default Popup;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import styles from './styles.module.scss';
|
|
3
|
-
export default function ProgressBar({ percentage, size = 'medium', color = 'blue', showPercentage = true, className, }) {
|
|
4
|
-
const clampedPercentage = Math.max(0, Math.min(100, percentage));
|
|
5
|
-
return (<div className={classNames(styles.container, className)}>
|
|
6
|
-
<div className={classNames(styles.track, styles[size])}>
|
|
7
|
-
<div className={classNames(styles.fill, styles[`${color}-fill`])} style={{ width: `${clampedPercentage}%` }}/>
|
|
8
|
-
</div>
|
|
9
|
-
{showPercentage && (<span className={classNames(styles.label, styles[`${size}-label`])}>{Math.round(clampedPercentage)}%</span>)}
|
|
10
|
-
</div>);
|
|
11
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import styles from './styles.module.scss';
|
|
4
|
-
const sizes = {
|
|
5
|
-
sm: {
|
|
6
|
-
height: '24px',
|
|
7
|
-
paddingInline: '0.25rem',
|
|
8
|
-
fontSize: '0.875rem',
|
|
9
|
-
},
|
|
10
|
-
md: {
|
|
11
|
-
height: '32px',
|
|
12
|
-
paddingInline: '0.5rem',
|
|
13
|
-
fontSize: '1rem',
|
|
14
|
-
},
|
|
15
|
-
lg: {
|
|
16
|
-
height: '40px',
|
|
17
|
-
paddingInline: '0.75rem',
|
|
18
|
-
fontSize: '1rem',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
const SelectOption = ({ children, ...props }) => <option {...props}>{children}</option>;
|
|
22
|
-
const SelectEmptyOption = ({ children, ...props }) => (<option value="" {...props}>
|
|
23
|
-
{children}
|
|
24
|
-
</option>);
|
|
25
|
-
const Select = forwardRef(function Select({ children, className = '', hasError = false, $size = 'lg', style, 'aria-invalid': ariaInvalid, ...props }, ref) {
|
|
26
|
-
const _style = {
|
|
27
|
-
'--height': sizes[$size].height,
|
|
28
|
-
'--padding-inline': sizes[$size].paddingInline,
|
|
29
|
-
'--font-size': sizes[$size].fontSize,
|
|
30
|
-
...style,
|
|
31
|
-
};
|
|
32
|
-
const selectClassName = classNames(styles.select, styles[`size-${$size}`], {
|
|
33
|
-
[styles.selectError]: hasError,
|
|
34
|
-
}, className);
|
|
35
|
-
return (<select ref={ref} className={selectClassName} style={_style} aria-invalid={ariaInvalid ?? hasError} {...props}>
|
|
36
|
-
{children}
|
|
37
|
-
</select>);
|
|
38
|
-
});
|
|
39
|
-
Select.SelectOption = SelectOption;
|
|
40
|
-
Select.SelectEmptyOption = SelectEmptyOption;
|
|
41
|
-
export default Select;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import StatusIndicator from '../StatusIndicator';
|
|
3
|
-
import styles from './styles.module.scss';
|
|
4
|
-
const statusColorMap = {
|
|
5
|
-
pending: 'gray',
|
|
6
|
-
running: 'blue',
|
|
7
|
-
completed: 'green',
|
|
8
|
-
failed: 'red',
|
|
9
|
-
};
|
|
10
|
-
const statusLabelMap = {
|
|
11
|
-
pending: 'В очереди',
|
|
12
|
-
running: 'В процессе',
|
|
13
|
-
completed: 'Завершено',
|
|
14
|
-
failed: 'Ошибки',
|
|
15
|
-
};
|
|
16
|
-
export default function StatusCounter({ status, count, label, animated = false, size = 'medium', className, }) {
|
|
17
|
-
const displayLabel = label || statusLabelMap[status];
|
|
18
|
-
const color = statusColorMap[status];
|
|
19
|
-
return (<div className={classNames(styles.container, styles[size], className)}>
|
|
20
|
-
<StatusIndicator $color={color} $animated={animated && status === 'running'} className={styles.indicator}/>
|
|
21
|
-
<div className={styles.content}>
|
|
22
|
-
<span className={styles.count}>{count}</span>
|
|
23
|
-
<span className={styles.label}>{displayLabel}</span>
|
|
24
|
-
</div>
|
|
25
|
-
</div>);
|
|
26
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import ColorIndicator from '../ColorIndicator';
|
|
3
|
-
import styles from './styles.module.scss';
|
|
4
|
-
export default function StatusIndicator({ $color, $animated, title, className, children }) {
|
|
5
|
-
const cardClassName = classNames(styles['status-indicator'], styles[$color], className);
|
|
6
|
-
return (<div className={cardClassName}>
|
|
7
|
-
<ColorIndicator $color={$color} $animated={$animated} title={title}/>
|
|
8
|
-
{children}
|
|
9
|
-
</div>);
|
|
10
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
3
|
-
import styles from './styles.module.scss';
|
|
4
|
-
export default function Tooltip({ children, content, side = 'top', sideOffset = 6, delayDuration = 200, }) {
|
|
5
|
-
return (<RadixTooltip.Provider delayDuration={delayDuration}>
|
|
6
|
-
<RadixTooltip.Root>
|
|
7
|
-
<RadixTooltip.Trigger asChild>{children}</RadixTooltip.Trigger>
|
|
8
|
-
<RadixTooltip.Portal>
|
|
9
|
-
<RadixTooltip.Content className={styles.content} side={side} sideOffset={sideOffset}>
|
|
10
|
-
{content}
|
|
11
|
-
<RadixTooltip.Arrow className={styles.arrow}/>
|
|
12
|
-
</RadixTooltip.Content>
|
|
13
|
-
</RadixTooltip.Portal>
|
|
14
|
-
</RadixTooltip.Root>
|
|
15
|
-
</RadixTooltip.Provider>);
|
|
16
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useId } from 'react';
|
|
2
|
-
import { useController } from 'react-hook-form';
|
|
3
|
-
import { Checkbox } from '../../Checkbox';
|
|
4
|
-
import Description from '../../Description';
|
|
5
|
-
import styles from './styles.module.scss';
|
|
6
|
-
export function FormCheckbox({ name, label, description, disabled, className }) {
|
|
7
|
-
const formControl = useController({ name });
|
|
8
|
-
const errorId = useId();
|
|
9
|
-
const descriptionId = useId();
|
|
10
|
-
const inputId = useId();
|
|
11
|
-
return (<div className={`${styles.container} ${className ?? ''}`}>
|
|
12
|
-
<label className={styles.label} htmlFor={inputId}>
|
|
13
|
-
<Checkbox id={inputId} hasError={formControl.fieldState.invalid} name={formControl.field.name} ref={formControl.field.ref} checked={formControl.field.value ?? false} onChange={formControl.field.onChange} onBlur={formControl.field.onBlur} disabled={formControl.field.disabled ||
|
|
14
|
-
formControl.formState.disabled ||
|
|
15
|
-
formControl.formState.isSubmitting ||
|
|
16
|
-
disabled} aria-describedby={`${errorId} ${descriptionId}`}/>
|
|
17
|
-
<span className={styles.label__text}>{label}</span>
|
|
18
|
-
</label>
|
|
19
|
-
{formControl.fieldState.error && (<Description variant="error" id={errorId}>
|
|
20
|
-
{formControl.fieldState.error.message}
|
|
21
|
-
</Description>)}
|
|
22
|
-
{description && <Description id={descriptionId}>{description}</Description>}
|
|
23
|
-
</div>);
|
|
24
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { FormCheckbox } from '../FormCheckbox';
|
|
2
|
-
import Tooltip from '../../Tooltip';
|
|
3
|
-
import { QuestionCircleIcon } from '../../../lib/assets/icons/QuestionCircleIcon';
|
|
4
|
-
import styles from './styles.module.scss';
|
|
5
|
-
const PUBLISH_LABEL = 'Publish after translation';
|
|
6
|
-
const PUBLISH_TOOLTIP = (<>
|
|
7
|
-
When enabled, translated documents will be published immediately.
|
|
8
|
-
<br />
|
|
9
|
-
When disabled, translated documents will be saved as drafts.
|
|
10
|
-
</>);
|
|
11
|
-
const PublishLabel = (<span className={styles.label}>
|
|
12
|
-
{PUBLISH_LABEL}
|
|
13
|
-
<Tooltip content={PUBLISH_TOOLTIP} side="bottom">
|
|
14
|
-
<span className={styles.label__icon}>
|
|
15
|
-
<QuestionCircleIcon />
|
|
16
|
-
</span>
|
|
17
|
-
</Tooltip>
|
|
18
|
-
</span>);
|
|
19
|
-
export function FormCheckboxPublish({ name, disabled, className }) {
|
|
20
|
-
return <FormCheckbox name={name} label={PublishLabel} disabled={disabled} className={className}/>;
|
|
21
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useId } from 'react';
|
|
2
|
-
import { useController } from 'react-hook-form';
|
|
3
|
-
import Description from '../../Description';
|
|
4
|
-
import Label from '../../Label';
|
|
5
|
-
import Select from '../../Select';
|
|
6
|
-
export default function FormSelect({ name, required, options, label, description, disabled, size, placeholder, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, className, }) {
|
|
7
|
-
const formControl = useController({ name, rules: { required } });
|
|
8
|
-
const errorId = useId();
|
|
9
|
-
const descriptionId = useId();
|
|
10
|
-
const getAccessibilityProps = () => {
|
|
11
|
-
if (label) {
|
|
12
|
-
return {};
|
|
13
|
-
}
|
|
14
|
-
if (ariaLabelledby) {
|
|
15
|
-
return { 'aria-labelledby': ariaLabelledby };
|
|
16
|
-
}
|
|
17
|
-
if (ariaLabel) {
|
|
18
|
-
return { 'aria-label': ariaLabel };
|
|
19
|
-
}
|
|
20
|
-
return { 'aria-label': 'Select option' };
|
|
21
|
-
};
|
|
22
|
-
const selectElement = (<Select $size={size} hasError={formControl.fieldState.invalid} required={required} name={formControl.field.name} ref={formControl.field.ref} value={formControl.field.value} onChange={formControl.field.onChange} onBlur={formControl.field.onBlur} disabled={formControl.field.disabled || formControl.formState.disabled || formControl.formState.isSubmitting || disabled} aria-describedby={`${errorId} ${descriptionId}`} {...getAccessibilityProps()}>
|
|
23
|
-
{placeholder && <Select.SelectEmptyOption>{placeholder}</Select.SelectEmptyOption>}
|
|
24
|
-
{options.map((option) => (<Select.SelectOption key={option.value} value={option.value}>
|
|
25
|
-
{option.label}
|
|
26
|
-
</Select.SelectOption>))}
|
|
27
|
-
</Select>);
|
|
28
|
-
const errorAndDescription = (<>
|
|
29
|
-
{formControl.fieldState.error && (<Description variant="error" id={errorId}>
|
|
30
|
-
{formControl.fieldState.error.message}
|
|
31
|
-
</Description>)}
|
|
32
|
-
{description && <Description id={descriptionId}>{description}</Description>}
|
|
33
|
-
</>);
|
|
34
|
-
if (!label) {
|
|
35
|
-
return (<div className={className}>
|
|
36
|
-
{selectElement}
|
|
37
|
-
{errorAndDescription}
|
|
38
|
-
</div>);
|
|
39
|
-
}
|
|
40
|
-
return (<Label className={className} label={label}>
|
|
41
|
-
{selectElement}
|
|
42
|
-
{errorAndDescription}
|
|
43
|
-
</Label>);
|
|
44
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { useLocaleOptions } from '../../../lib/payload/hooks/useLocaleOptions';
|
|
2
|
-
import FormSelect from '../FormSelect';
|
|
3
|
-
export default function FormSelectLocale({ name, required, label, description, disabled, size, className, }) {
|
|
4
|
-
const localeOptions = useLocaleOptions();
|
|
5
|
-
return (<FormSelect placeholder="-" size={size} className={className} description={description} label={label} required={required} name={name} options={localeOptions} disabled={disabled}/>);
|
|
6
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import FormSelect from '../FormSelect';
|
|
2
|
-
import Tooltip from '../../Tooltip';
|
|
3
|
-
import { QuestionCircleIcon } from '../../../lib/assets/icons/QuestionCircleIcon';
|
|
4
|
-
import styles from './styles.module.scss';
|
|
5
|
-
const STRATEGY_OPTIONS = [
|
|
6
|
-
{ value: 'overwrite', label: 'Overwrite' },
|
|
7
|
-
{ value: 'skip_existing', label: 'Skip existing' },
|
|
8
|
-
];
|
|
9
|
-
const STRATEGY_LABEL = 'Update mode';
|
|
10
|
-
const STRATEGY_TOOLTIP = (<>
|
|
11
|
-
<strong>Overwrite</strong> — translate all fields, replacing existing values
|
|
12
|
-
<br />
|
|
13
|
-
<strong>Skip existing</strong> — only translate empty fields, keep existing values
|
|
14
|
-
</>);
|
|
15
|
-
const StrategyLabel = (<span className={styles.label}>
|
|
16
|
-
{STRATEGY_LABEL}
|
|
17
|
-
<Tooltip content={STRATEGY_TOOLTIP} side="bottom">
|
|
18
|
-
<span className={styles.label__icon}>
|
|
19
|
-
<QuestionCircleIcon />
|
|
20
|
-
</span>
|
|
21
|
-
</Tooltip>
|
|
22
|
-
</span>);
|
|
23
|
-
export function FormSelectStrategy({ name, required, description, disabled, size, className, }) {
|
|
24
|
-
return (<FormSelect size={size} className={className} description={description} label={StrategyLabel} required={required} name={name} options={[...STRATEGY_OPTIONS]} disabled={disabled}/>);
|
|
25
|
-
}
|
package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.export.jsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AnyAccessGuard } from '../../../../server/shared';
|
|
2
|
-
import { clientComponentPath } from '../../../shared/utils/componentPath';
|
|
3
|
-
export class BulkDocumentTranslationDashboard {
|
|
4
|
-
access;
|
|
5
|
-
serverProps;
|
|
6
|
-
constructor(access = new AnyAccessGuard()) {
|
|
7
|
-
this.access = access;
|
|
8
|
-
this.serverProps = { access };
|
|
9
|
-
}
|
|
10
|
-
path = clientComponentPath('widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.server');
|
|
11
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { toast, useLocale, useSelection } from '@payloadcms/ui';
|
|
3
|
-
import { SelectAllStatus } from '@payloadcms/ui/providers/Selection';
|
|
4
|
-
import { useEffect, useMemo } from 'react';
|
|
5
|
-
import { TranslationsApi } from '../../../entities/translation';
|
|
6
|
-
import { CollectionTranslationForm, FORM_FIELDS } from '../../../features/collection-translation-form';
|
|
7
|
-
import { CollectionTranslationFormModel } from '../../../features/collection-translation-form/index.client';
|
|
8
|
-
import CollectionTranslationPopup from '../../../features/collection-translation-popup';
|
|
9
|
-
import { CollectionTranslationProgress } from '../../../features/collection-translation-progress';
|
|
10
|
-
import { handleFormError } from '../../../shared/lib/forms/handle-form-error';
|
|
11
|
-
import { useCollectionDashboardUrlParams } from '../../../shared/lib/payload/hooks/useCollectionDashboardUrlParams';
|
|
12
|
-
export default function BulkTranslationDashboard({ hasDrafts }) {
|
|
13
|
-
const locale = useLocale();
|
|
14
|
-
const { collection } = useCollectionDashboardUrlParams();
|
|
15
|
-
const documentsSelection = useSelection();
|
|
16
|
-
const queueTranslationApi = TranslationsApi.useQueueDocumentTranslation();
|
|
17
|
-
const collectionTranslationApi = TranslationsApi.useCollectionTranslationStatus({ collection });
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (collectionTranslationApi.error) {
|
|
20
|
-
toast.error(collectionTranslationApi.error.message);
|
|
21
|
-
}
|
|
22
|
-
}, [collectionTranslationApi.error]);
|
|
23
|
-
const initialValues = useMemo(() => ({
|
|
24
|
-
[FORM_FIELDS.SOURCE_LNG]: locale.code,
|
|
25
|
-
[FORM_FIELDS.HIDDEN_COLLECTION_SLUG]: collection,
|
|
26
|
-
}), [locale.code, collection]);
|
|
27
|
-
const { form } = CollectionTranslationFormModel.useForm({
|
|
28
|
-
initialValues,
|
|
29
|
-
disabled: collectionTranslationApi.isLoading,
|
|
30
|
-
});
|
|
31
|
-
const selectAll = documentsSelection.selectAll === SelectAllStatus.AllAvailable;
|
|
32
|
-
const selectedCount = selectAll ? documentsSelection.totalDocs : documentsSelection.count;
|
|
33
|
-
const translationInProgress = !!(collectionTranslationApi.data?.pending.length || collectionTranslationApi.data?.running.length);
|
|
34
|
-
const handleSubmit = async (formData) => {
|
|
35
|
-
try {
|
|
36
|
-
await queueTranslationApi.mutateAsync({
|
|
37
|
-
...formData,
|
|
38
|
-
collection_id: documentsSelection.selectedIDs,
|
|
39
|
-
select_all: selectAll,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
handleFormError(e, form);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
return (<CollectionTranslationPopup translationInProgress={translationInProgress} selectedCount={selectedCount}>
|
|
47
|
-
<h3>Bulk Translation Dashboard</h3>
|
|
48
|
-
<p>
|
|
49
|
-
Translate multiple documents at once using AI. Select the records you want to translate on the collection
|
|
50
|
-
dashboard, then configure your translation settings here.
|
|
51
|
-
</p>
|
|
52
|
-
<CollectionTranslationForm form={form} onSubmit={handleSubmit} selectedCount={selectedCount} hasDrafts={hasDrafts}/>
|
|
53
|
-
<CollectionTranslationProgress collection={collection} data={collectionTranslationApi.data} isPending={collectionTranslationApi.isPending}/>
|
|
54
|
-
</CollectionTranslationPopup>);
|
|
55
|
-
}
|
package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.server.jsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { headers as getHeaders } from 'next/headers';
|
|
2
|
-
import { collectionHasDrafts } from '../../../../server/shared/guards';
|
|
3
|
-
import BulkTranslationDashboard from './BulkTranslationDashboard';
|
|
4
|
-
const BulkTranslationDashboardServer = async (props) => {
|
|
5
|
-
const headers = await getHeaders();
|
|
6
|
-
const hasAccess = await props.access.check({
|
|
7
|
-
req: { user: props.user, headers, payload: props.payload },
|
|
8
|
-
});
|
|
9
|
-
if (!hasAccess)
|
|
10
|
-
return null;
|
|
11
|
-
if (!props.collectionSlug)
|
|
12
|
-
return null;
|
|
13
|
-
const collection = props.payload.collections[props.collectionSlug]?.config;
|
|
14
|
-
const hasDrafts = collection ? collectionHasDrafts(collection) : false;
|
|
15
|
-
return <BulkTranslationDashboard hasDrafts={hasDrafts}/>;
|
|
16
|
-
};
|
|
17
|
-
export default BulkTranslationDashboardServer;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { toast, useLocale } from '@payloadcms/ui';
|
|
3
|
-
import { useEffect, useMemo } from 'react';
|
|
4
|
-
import { CompletedTranslationStatus, TranslationsApi } from '../../../entities/translation';
|
|
5
|
-
import { OpenDocumentTranslationPopup } from '../../../features/open-document-translation-popup';
|
|
6
|
-
import { DocumentTranslationForm, FORM_FIELDS } from '../../../features/translate-document-form';
|
|
7
|
-
import { DocumentTranslationFormModel } from '../../../features/translate-document-form/index.client';
|
|
8
|
-
import { handleFormError } from '../../../shared/lib/forms/handle-form-error';
|
|
9
|
-
import { useCollectionDocumentUrlParams } from '../../../shared/lib/payload/hooks/useCollectionDocumentUrlParams';
|
|
10
|
-
import { DocumentTranslationProgressFailed } from '../../../features/document-translation-progress-failed';
|
|
11
|
-
import { DocumentTranslationProgressRunning } from '../../../features/document-translation-progress-running';
|
|
12
|
-
import { DocumentTranslationProgressPending } from '../../../features/document-translation-progress-pending';
|
|
13
|
-
const TranslateDocument = ({ hasDrafts }) => {
|
|
14
|
-
const locale = useLocale();
|
|
15
|
-
const params = useCollectionDocumentUrlParams();
|
|
16
|
-
const queueTranslationApi = TranslationsApi.useQueueDocumentTranslation();
|
|
17
|
-
const { data, error, isLoading } = TranslationsApi.useDocumentTranslation(params);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (error) {
|
|
20
|
-
toast.error(error.message);
|
|
21
|
-
}
|
|
22
|
-
}, [error]);
|
|
23
|
-
const initialValues = useMemo(() => ({
|
|
24
|
-
[FORM_FIELDS.SOURCE_LNG]: locale.code,
|
|
25
|
-
[FORM_FIELDS.HIDDEN_COLLECTION_SLUG]: params.collection,
|
|
26
|
-
[FORM_FIELDS.HIDDEN_COLLECTION_ID]: params.id,
|
|
27
|
-
}), [locale.code, params.collection, params.id]);
|
|
28
|
-
const { form } = DocumentTranslationFormModel.useForm({ initialValues });
|
|
29
|
-
const handleSubmit = async (formData, onSuccess) => {
|
|
30
|
-
try {
|
|
31
|
-
await queueTranslationApi.mutateAsync({
|
|
32
|
-
...formData,
|
|
33
|
-
collection_id: [formData[FORM_FIELDS.HIDDEN_COLLECTION_ID]],
|
|
34
|
-
});
|
|
35
|
-
onSuccess?.();
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
handleFormError(e, form);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
return (<>
|
|
42
|
-
<OpenDocumentTranslationPopup isLoading={isLoading}>
|
|
43
|
-
{({ close }) => (<>
|
|
44
|
-
<h4>Document Translation</h4>
|
|
45
|
-
<DocumentTranslationForm form={form} onSubmit={(data) => handleSubmit(data, close)} hasDrafts={hasDrafts}/>
|
|
46
|
-
</>)}
|
|
47
|
-
</OpenDocumentTranslationPopup>
|
|
48
|
-
|
|
49
|
-
{data?.status === 'completed' && (<CompletedTranslationStatus sourceLocale={data.input.source_lng} targetLocale={data.input.target_lng} completed_at={data.completed_at}/>)}
|
|
50
|
-
{data?.status === 'failed' && <DocumentTranslationProgressFailed data={data}/>}
|
|
51
|
-
{data?.status === 'running' && <DocumentTranslationProgressRunning data={data}/>}
|
|
52
|
-
{data?.status === 'pending' && <DocumentTranslationProgressPending data={data}/>}
|
|
53
|
-
</>);
|
|
54
|
-
};
|
|
55
|
-
export default TranslateDocument;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { headers as getHeaders } from 'next/headers';
|
|
2
|
-
import { collectionHasDrafts } from '../../../../server/shared/guards';
|
|
3
|
-
import TranslateDocument from './TranslateDocument';
|
|
4
|
-
async function TranslateDocumentServer(props) {
|
|
5
|
-
const headers = await getHeaders();
|
|
6
|
-
const hasAccess = await props.access.check({
|
|
7
|
-
req: { user: props.user, headers, payload: props.payload },
|
|
8
|
-
});
|
|
9
|
-
if (!hasAccess)
|
|
10
|
-
return null;
|
|
11
|
-
if (!props.id)
|
|
12
|
-
return null;
|
|
13
|
-
const hasDrafts = collectionHasDrafts(props.collection);
|
|
14
|
-
return <TranslateDocument hasDrafts={hasDrafts}/>;
|
|
15
|
-
}
|
|
16
|
-
export default TranslateDocumentServer;
|
package/dist/vitest-env.d.js
DELETED