diff --git a/website/src/components/ReviewPage/ReviewPage.tsx b/website/src/components/ReviewPage/ReviewPage.tsx index 5ecba016bd..11a74b92ee 100644 --- a/website/src/components/ReviewPage/ReviewPage.tsx +++ b/website/src/components/ReviewPage/ReviewPage.tsx @@ -17,10 +17,15 @@ import { type SequenceEntryStatus, } from '../../types/backend.ts'; import { type ClientConfig } from '../../types/runtimeConfig.ts'; +import { dateTimeInMonths } from '../../utils/DateTimeInMonths.tsx'; import { displayConfirmationDialog } from '../ConfirmationDialog.tsx'; +import { DateChangeModal } from '../Submission/DateChangeModal.tsx'; import { ManagedErrorFeedback, useErrorFeedbackState } from '../common/ManagedErrorFeedback.tsx'; import { withQueryProvider } from '../common/withQueryProvider.tsx'; +import BiPencil from '~icons/bi/pencil'; import BiTrash from '~icons/bi/trash'; +import Locked from '~icons/fluent-emoji-high-contrast/locked'; +import Unlocked from '~icons/fluent-emoji-high-contrast/unlocked'; import IwwaArrowDown from '~icons/iwwa/arrow-down'; import WpfPaperPlane from '~icons/wpf/paper-plane'; const menuItemClassName = `group flex rounded-md items-center w-full px-2 py-2 text-sm @@ -38,6 +43,8 @@ const InnerReviewPage: FC = ({ clientConfig, organism, accessTo const { errorMessage, isErrorOpen, openErrorFeedback, closeErrorFeedback } = useErrorFeedbackState(); const [showErrors, setShowErrors] = useState(true); const [pageQuery, setPageQuery] = useState({ page: 1, size: pageSizeOptions[2] }); + const [dateChangeModalOpen, setDateChangeModalOpen] = useState(false); + const [restrictedUntil, setRestrictedUntil] = useState(dateTimeInMonths(6)); const hooks = useSubmissionOperations(organism, clientConfig, accessToken, openErrorFeedback, pageQuery); @@ -71,6 +78,26 @@ const InnerReviewPage: FC = ({ clientConfig, organism, accessTo const sequences: SequenceEntryStatus[] = hooks.getSequences.data.sequenceEntries; + const dataUseTermsCounts = sequences.reduce( + (counts, seq) => { + counts.open += seq.dataUseTerms.type === "OPEN" ? 1 : 0; + counts.restricted += seq.dataUseTerms.type === "RESTRICTED" ? 1 : 0; + return counts; + }, + { open: 0, restricted: 0 }, + ); + + const onRestrictedDateChange = (value) => { + setRestrictedUntil(value); + displayConfirmationDialog({ + dialogText: `Are you sure you want to restrict access to all sequences until ${restrictedUntil.toFormat('yyyy-MM-dd')}?`, + onConfirmation: () => { + // TODO: send request + console.log("restricting access!"); + }, + }); + }; + const controlPanel = (
@@ -118,6 +145,43 @@ const InnerReviewPage: FC = ({ clientConfig, organism, accessTo const bulkActionButtons = (
{finishedCount > 0 && ( + <> + + + + Modify Terms of Use + + + +
+ {dataUseTermsCounts.restricted > 0 && ( + + + + )} + {dataUseTermsCounts.open > 0 && ( + + + + )} +
+
+
@@ -168,6 +232,7 @@ const InnerReviewPage: FC = ({ clientConfig, organism, accessTo
+ )} {processedCount + revocationCount > 0 && (