From 17b795cfb1719ee0cb4ddf00649aaf00e1fde373 Mon Sep 17 00:00:00 2001 From: Jordan Lawrence Date: Mon, 9 Dec 2024 19:12:45 +0000 Subject: [PATCH 01/26] feat: showing documents in archived and published releases --- .../sanity/src/core/releases/tool/detail/useBundleDocuments.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts b/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts index 9da71d61964..da4a2f21ffc 100644 --- a/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts +++ b/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts @@ -1,5 +1,6 @@ import {isValidationErrorMarker, type SanityDocument} from '@sanity/types' import {uuid} from '@sanity/uuid' +import {isBefore} from 'date-fns' import {useMemo} from 'react' import {useObservable} from 'react-rx' import {combineLatest, from, of} from 'rxjs' From aeae15032fb4472c4d2d02af3f8cd00cfb7d1956 Mon Sep 17 00:00:00 2001 From: Jordan Lawrence Date: Tue, 10 Dec 2024 11:10:45 +0000 Subject: [PATCH 02/26] refactor: removing check for existing document in published --- .../sanity/src/core/releases/tool/detail/useBundleDocuments.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts b/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts index da4a2f21ffc..9da71d61964 100644 --- a/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts +++ b/packages/sanity/src/core/releases/tool/detail/useBundleDocuments.ts @@ -1,6 +1,5 @@ import {isValidationErrorMarker, type SanityDocument} from '@sanity/types' import {uuid} from '@sanity/uuid' -import {isBefore} from 'date-fns' import {useMemo} from 'react' import {useObservable} from 'react-rx' import {combineLatest, from, of} from 'rxjs' From 14859feba8614a898283b16865d628369b656196 Mon Sep 17 00:00:00 2001 From: Jordan Lawrence Date: Tue, 10 Dec 2024 14:04:01 +0000 Subject: [PATCH 03/26] feat: showing revert release button on published releases --- .../releaseCTAButtons/ReleaseRevertButton.tsx | 44 +++++++++++++++++++ .../tool/detail/ReleaseDashboardFooter.tsx | 7 +++ 2 files changed, 51 insertions(+) create mode 100644 packages/sanity/src/core/releases/tool/components/releaseCTAButtons/ReleaseRevertButton.tsx diff --git a/packages/sanity/src/core/releases/tool/components/releaseCTAButtons/ReleaseRevertButton.tsx b/packages/sanity/src/core/releases/tool/components/releaseCTAButtons/ReleaseRevertButton.tsx new file mode 100644 index 00000000000..d3f9358b47a --- /dev/null +++ b/packages/sanity/src/core/releases/tool/components/releaseCTAButtons/ReleaseRevertButton.tsx @@ -0,0 +1,44 @@ +import {RestoreIcon} from '@sanity/icons' + +import {Button} from '../../../../../ui-components/button/Button' +import {type ReleaseDocument} from '../../../store/types' +import {type DocumentInRelease} from '../../detail/useBundleDocuments' + +interface ReleasePublishAllButtonProps { + release: ReleaseDocument + documents: DocumentInRelease[] + disabled?: boolean +} + +const fetchAndParseAll = async () => { + if (!versionIds) return + if (!releaseId) return + const transactions: TransactionLogEventWithEffects[] = [] + const stream = await getJsonStream(transactionsUrl, token) + const reader = stream.getReader() + let result + for (;;) { + result = await reader.read() + if (result.done) { + break + } + if ('error' in result.value) { + throw new Error(result.value.error.description || result.value.error.type) + } + transactions.push(result.value) + } +} + +const useAdjacentTransactions = (documents: DocumentInRelease[]) => { + const transactionId = documents[0]?.document._rev +} + +export const ReleaseRevertButton = ({release, documents, disabled}) => { + const getAdjacentTransactions = useAdjacentTransactions(documents) + + return ( + <> +