From a8103a40ac82022451a03676d9f226244be6f2f1 Mon Sep 17 00:00:00 2001 From: Stephen Fraser Date: Thu, 21 Dec 2023 11:31:57 +0000 Subject: [PATCH 1/2] MAD-1455 - improved descriptions on configuration --- .../projects/new-project-from-template.tsx | 2 +- .../admin/pages/crowdsourcing/projects/project.tsx | 1 + .../madoc-ts/stories/admin/project-config.stories.tsx | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/services/madoc-ts/src/frontend/admin/pages/crowdsourcing/projects/new-project-from-template.tsx b/services/madoc-ts/src/frontend/admin/pages/crowdsourcing/projects/new-project-from-template.tsx index 878122465..374d65858 100644 --- a/services/madoc-ts/src/frontend/admin/pages/crowdsourcing/projects/new-project-from-template.tsx +++ b/services/madoc-ts/src/frontend/admin/pages/crowdsourcing/projects/new-project-from-template.tsx @@ -51,7 +51,7 @@ export const NewProjectFromTemplate: React.FC = () => { try { return await api.createProject(config); } catch (e) { - return { error: e.message }; + return { error: (e as any).message }; } }); const isError = !!data?.error; diff --git a/services/madoc-ts/src/frontend/admin/pages/crowdsourcing/projects/project.tsx b/services/madoc-ts/src/frontend/admin/pages/crowdsourcing/projects/project.tsx index fd2b51238..b40af951f 100644 --- a/services/madoc-ts/src/frontend/admin/pages/crowdsourcing/projects/project.tsx +++ b/services/madoc-ts/src/frontend/admin/pages/crowdsourcing/projects/project.tsx @@ -66,6 +66,7 @@ export const Project: UniversalComponent = createUniversalComponent ) : (
+ {t('Custom project')} |{' '} Duplicate project → diff --git a/services/madoc-ts/stories/admin/project-config.stories.tsx b/services/madoc-ts/stories/admin/project-config.stories.tsx index caaf81864..71b025108 100644 --- a/services/madoc-ts/stories/admin/project-config.stories.tsx +++ b/services/madoc-ts/stories/admin/project-config.stories.tsx @@ -22,7 +22,7 @@ export const defaultStory = () => { } maxHeight={false} > @@ -34,7 +34,7 @@ export const defaultStory = () => { } maxHeight={false} > @@ -46,7 +46,7 @@ export const defaultStory = () => { } maxHeight={false} > @@ -62,7 +62,7 @@ export const defaultStory = () => { } maxHeight={false} > @@ -71,7 +71,7 @@ export const defaultStory = () => {
- } maxHeight={false}> + } maxHeight={false}>
From 63f89421c4ad24524727aa147241c290a140d013 Mon Sep 17 00:00:00 2001 From: Stephen Fraser Date: Fri, 5 Jan 2024 12:09:15 +0000 Subject: [PATCH 2/2] Unassign button to reviews --- .../src/frontend/shared/layout/EmptyState.tsx | 5 +- .../tasks/review-listing/single-review.tsx | 74 +++++++++++++++++-- services/madoc-ts/translations/en/madoc.json | 9 +++ 3 files changed, 79 insertions(+), 9 deletions(-) diff --git a/services/madoc-ts/src/frontend/shared/layout/EmptyState.tsx b/services/madoc-ts/src/frontend/shared/layout/EmptyState.tsx index 58eed07fe..0530e8ab3 100644 --- a/services/madoc-ts/src/frontend/shared/layout/EmptyState.tsx +++ b/services/madoc-ts/src/frontend/shared/layout/EmptyState.tsx @@ -29,8 +29,9 @@ export const EmptyState = styled.div<{ $box?: boolean; $noMargin?: boolean }>` svg { margin-bottom: 1.5em; } - - span { + + > span, + > div { font-size: 0.8em; width: 400px; margin-top: 1em; diff --git a/services/madoc-ts/src/frontend/site/pages/tasks/review-listing/single-review.tsx b/services/madoc-ts/src/frontend/site/pages/tasks/review-listing/single-review.tsx index 8b9628169..4911877e0 100644 --- a/services/madoc-ts/src/frontend/site/pages/tasks/review-listing/single-review.tsx +++ b/services/madoc-ts/src/frontend/site/pages/tasks/review-listing/single-review.tsx @@ -1,4 +1,5 @@ import React, { useRef, useState } from 'react'; +import { useMutation } from 'react-query'; import { useParams } from 'react-router-dom'; import { CrowdsourcingReview } from '../../../../../gateway/tasks/crowdsourcing-review'; import { CrowdsourcingTask } from '../../../../../gateway/tasks/crowdsourcing-task'; @@ -12,7 +13,9 @@ import { CanvasViewerEditorStyleReset, CanvasViewerGrid, } from '../../../../shared/atoms/CanvasViewerGrid'; +import { useApi } from '../../../../shared/hooks/use-api'; import { useData } from '../../../../shared/hooks/use-data'; +import { CloseIcon } from '../../../../shared/icons/CloseIcon'; import { PreviewIcon } from '../../../../shared/icons/PreviewIcon'; import { EmptyState } from '../../../../shared/layout/EmptyState'; import { @@ -24,6 +27,7 @@ import { serverRendererFor } from '../../../../shared/plugins/external/server-re import { HrefLink } from '../../../../shared/utility/href-link'; import { RefetchProvider, useRefetch } from '../../../../shared/utility/refetch-context'; import { useCrowdsourcingTaskDetails } from '../../../hooks/use-crowdsourcing-task-details'; +import { useRelativeLinks } from '../../../hooks/use-relative-links'; import { ApproveSubmission } from '../actions/approve-submission'; import { RejectSubmission } from '../actions/reject-submission'; import { RequestChanges } from '../actions/request-changes'; @@ -31,7 +35,7 @@ import { LocaleString } from '../../../../shared/components/LocaleString'; import { useTaskMetadata } from '../../../hooks/use-task-metadata'; import { SubjectSnippet } from '../../../../../extensions/tasks/resolvers/subject-resolver'; import { SimpleStatus } from '../../../../shared/atoms/SimpleStatus'; -import { Button } from '../../../../shared/navigation/Button'; +import { Button, ButtonRow } from '../../../../shared/navigation/Button'; import useDropdownMenu from 'react-accessible-dropdown-menu-hook'; import { EditIcon } from '../../../../shared/icons/EditIcon'; import { DirectEditButton } from '../../../../shared/capture-models/new/components/DirectEditButton'; @@ -191,6 +195,7 @@ function ViewSingleReview({ } = useCrowdsourcingTaskDetails(task); const refetch = useRefetch(); + const createLink = useRelativeLinks(); const metadata = useTaskMetadata<{ subject?: SubjectSnippet }>(task); const [isEditing, setIsEditing] = useState(false); // const isLocked = props.lockedTasks && props.lockedTasks.indexOf(props.task.id) !== -1; @@ -214,6 +219,18 @@ function ViewSingleReview({ const gridRef = useRef(); const runtime = useRef(); const annotationTheme = useProjectAnnotationStyles(); + const api = useApi(); + const [unassignUser] = useMutation( + async () => { + if (task) { + await api.updateTask(task.id, { status: -1, status_text: 'unassigned' }); + await refetch(); + } + }, + { + throwOnError: true, + } + ); const goHome = () => { if (runtime.current) { @@ -234,6 +251,44 @@ function ViewSingleReview({ }; if (!review) { + if (task.status === -1) { + // Task has been rejected + return ( + <> + + + + + {metadata.subject && metadata.subject.parent && ( + + {metadata.subject.parent.label} + + )} + + + + + + + {t('This task has been rejected.')} +
+ + {t('View task')} + +
+
+ + ); + } + return ( <> @@ -253,8 +308,13 @@ function ViewSingleReview({ - This task is not yet ready for review. - This means this task has been assigned or is in progress, but nothing has been submitted + {t('This task is not yet ready for review.')} + {t('This means this task has been assigned or is in progress, but nothing has been submitted')} +
+ + + +
); @@ -315,7 +375,7 @@ function ViewSingleReview({ - {isEditing ? 'Exit Correction' : 'Make Correction'} + {isEditing ? t('Exit Correction') : t('Make Correction')} <> @@ -371,7 +431,7 @@ function ViewSingleReview({ - View resource + {t('View resource')} ) : null} {manifestLink ? ( @@ -379,7 +439,7 @@ function ViewSingleReview({ - View manifest + {t('View manifest')} ) : null} diff --git a/services/madoc-ts/translations/en/madoc.json b/services/madoc-ts/translations/en/madoc.json index 563f14c7d..9b134848d 100644 --- a/services/madoc-ts/translations/en/madoc.json +++ b/services/madoc-ts/translations/en/madoc.json @@ -1,4 +1,5 @@ { + "...": "...", "A longer description for your form field, appears under the label (like this)": "A longer description for your form field, appears under the label (like this)", "A longer description for your transcription form field, appears under the label (like this)": "A longer description for your transcription form field, appears under the label (like this)", "A short bio about yourself": "A short bio about yourself", @@ -263,6 +264,7 @@ "Current translations": "Current translations", "Currently assigned": "Currently assigned", "Custom button label": "Custom button label", + "Custom project": "Custom project", "Custom reviewer (numeric id)": "Custom reviewer (numeric id)", "Customise site pages": "Customise site pages", "Dark": "Dark", @@ -551,6 +553,7 @@ "Logout": "Logout", "Long expiry time (minutes)": "Long expiry time (minutes)", "Lost connection to server, retrying...": "Lost connection to server, retrying...", + "Make Correction": "Make Correction", "Make initial search": "Make initial search", "Manage collections": "Manage collections", "Manage collections_plural": "Manage collections", @@ -914,10 +917,13 @@ "This manifest is complete": "This manifest is complete", "This manifest is currently in review": "This manifest is currently in review", "This manifest is not available to browse": "This manifest is not available to browse", + "This means this task has been assigned or is in progress, but nothing has been submitted": "This means this task has been assigned or is in progress, but nothing has been submitted", "This merge may be corrupted": "This merge may be corrupted. Would you like to remove it?", "This page is complete": "This page is complete", + "This task has been rejected.": "This task has been rejected.", "This task is complete.": "This task is complete.", "This task is complete. You can make another contribution from the": "This task is complete. You can make another contribution from the", + "This task is not yet ready for review.": "This task is not yet ready for review.", "This tasks parent is complete, you can no longer edit or submit this task": "This tasks parent is complete, you can no longer edit or submit this task", "Thumbnail background": "Thumbnail background", "Thumbnail layout": "Thumbnail layout", @@ -987,6 +993,7 @@ "View new terms": "View new terms", "View on admin dashboard": "View on admin dashboard", "View on site": "View on site", + "View options": "View options", "View options for the contributions page": "View options for the contributions page", "View options for the contributions pnnel": "View options for the contributions pnnel", "View options for the global site navigation": "View options for the global site navigation", @@ -995,10 +1002,12 @@ "View options for the menu": "View options for the menu", "View options for the project landing page": "View options for the project landing page", "View project dashboard": "View project dashboard", + "View resource": "View resource", "View site": "View site", "View style": "View style", "View submission": "View submission", "View submissions": "View submissions", + "View task": "View task", "Waiting for resource": "Waiting for resource", "Webhooks": "Webhooks", "Welcome back {{user}}": "Welcome back {{user}}",