diff --git a/catalog/app/components/Preview/loaders/Genbank.js b/catalog/app/components/Preview/loaders/Genbank.js deleted file mode 100644 index d986da3eed1..00000000000 --- a/catalog/app/components/Preview/loaders/Genbank.js +++ /dev/null @@ -1,16 +0,0 @@ -import * as R from 'ramda' - -import { PreviewData } from '../types' -import * as utils from './utils' - -export const detect = R.pipe(utils.stripCompression, utils.extIs('.gb')) - -export const Loader = function GenbankLoader({ handle, children }) { - const data = utils.usePreview({ type: 'gb', handle }) - const processed = utils.useProcessing(data.result, (json) => - PreviewData.Genbank({ - src: json.info.data, - }), - ) - return children(utils.useErrorHandling(processed, { handle, retry: data.fetch })) -} diff --git a/catalog/app/components/Preview/loaders/Genbank.tsx b/catalog/app/components/Preview/loaders/Genbank.tsx new file mode 100644 index 00000000000..bb05deb160a --- /dev/null +++ b/catalog/app/components/Preview/loaders/Genbank.tsx @@ -0,0 +1,33 @@ +import * as R from 'ramda' + +import type * as Model from 'model' + +import { PreviewData } from '../types' + +import * as utils from './utils' + +export const detect = R.pipe(utils.stripCompression, utils.extIs('.gb')) + +interface PreviewResult { + html: string + info: { + data: string + note?: string + warnings?: string + } +} + +interface GenbankLoaderProps { + children: (result: $TSFixMe) => React.ReactNode + handle: Model.S3.S3ObjectLocation +} + +export const Loader = function GenbankLoader({ handle, children }: GenbankLoaderProps) { + const data = utils.usePreview({ type: 'gb', handle, query: undefined }) + const processed = utils.useProcessing(data.result, (json: PreviewResult) => + PreviewData.Genbank({ + src: json.info.data, + }), + ) + return children(utils.useErrorHandling(processed, { handle, retry: data.fetch })) +}