diff --git a/packages/api/src/resolvers/integrations/index.ts b/packages/api/src/resolvers/integrations/index.ts index a893c3e79..988cfca0e 100644 --- a/packages/api/src/resolvers/integrations/index.ts +++ b/packages/api/src/resolvers/integrations/index.ts @@ -219,47 +219,47 @@ export const importFromIntegrationResolver = authorized< ImportFromIntegrationError, MutationImportFromIntegrationArgs >(async (_, { integrationId }, { claims: { uid }, log }) => { - const integration = await findIntegration({ id: integrationId }, uid) - - if (!integration) { - return { - errorCodes: [ImportFromIntegrationErrorCode.Unauthorized], - } - } - - const authToken = await createIntegrationToken({ - uid: integration.user.id, - token: integration.token, - }) - if (!authToken) { - return { - errorCodes: [ImportFromIntegrationErrorCode.BadRequest], - } - } - - // create a task to import all the pages - const taskName = await enqueueImportFromIntegration( - integration.id, - integration.name, - integration.syncedAt?.getTime() || 0, - authToken, - integration.importItemState || ImportItemState.Unarchived - ) - log.info('task created', taskName) - // // update task name in integration - // await updateIntegration(integration.id, { taskName }, uid) - - analytics.capture({ - distinctId: uid, - event: 'integration_import', - properties: { - integrationId, - }, - }) + // const integration = await findIntegration({ id: integrationId }, uid) + // if (!integration) { return { - success: true, + errorCodes: [ImportFromIntegrationErrorCode.Unauthorized], } + // } + + // const authToken = await createIntegrationToken({ + // uid: integration.user.id, + // token: integration.token, + // }) + // if (!authToken) { + // return { + // errorCodes: [ImportFromIntegrationErrorCode.BadRequest], + // } + // } + + // // create a task to import all the pages + // const taskName = await enqueueImportFromIntegration( + // integration.id, + // integration.name, + // integration.syncedAt?.getTime() || 0, + // authToken, + // integration.importItemState || ImportItemState.Unarchived + // ) + // log.info('task created', taskName) + // // // update task name in integration + // // await updateIntegration(integration.id, { taskName }, uid) + + // analytics.capture({ + // distinctId: uid, + // event: 'integration_import', + // properties: { + // integrationId, + // }, + // }) + + // return { + // success: true, + // } }) export const exportToIntegrationResolver = authorized< diff --git a/packages/web/components/templates/AddLinkModal.tsx b/packages/web/components/templates/AddLinkModal.tsx index c2be2e6a0..309bf2024 100644 --- a/packages/web/components/templates/AddLinkModal.tsx +++ b/packages/web/components/templates/AddLinkModal.tsx @@ -62,17 +62,17 @@ export function AddLinkModal(props: AddLinkModalProps): JSX.Element { }} > - + /> */} {selectedTab == 'link' && } - {selectedTab == 'feed' && } + {/* {selectedTab == 'feed' && } {selectedTab == 'opml' && } {selectedTab == 'pdf' && } - {selectedTab == 'import' && } + {selectedTab == 'import' && } */} @@ -531,52 +531,52 @@ const UploadPad = (props: UploadPadProps): JSX.Element => { const allFiles = [...uploadFiles, ...addedFiles] setUploadFiles(allFiles) - ; (async () => { - for (const file of addedFiles) { - try { - const uploadInfo = await uploadSignedUrlForFile(file) - if (!uploadInfo.uploadSignedUrl) { - const message = uploadInfo.message || 'No upload URL available' - showErrorToast(message, { duration: 10000 }) - file.status = 'error' - setUploadFiles([...allFiles]) - return - } - - const uploadResult = await axios.request({ - method: 'PUT', - url: uploadInfo.uploadSignedUrl, - data: file.file, - withCredentials: false, - headers: { - 'Content-Type': file.file.type, - }, - onUploadProgress: (p) => { - if (!p.total) { - console.warn('No total available for upload progress') - return - } - const progress = (p.loaded / p.total) * 100 - file.progress = progress - - setUploadFiles([...allFiles]) - }, - }) - - file.progress = 100 - file.status = 'success' - file.openUrl = uploadInfo.requestId - ? `/article/sr/${uploadInfo.requestId}` - : undefined - file.message = uploadInfo.message - - setUploadFiles([...allFiles]) - } catch (error) { + ;(async () => { + for (const file of addedFiles) { + try { + const uploadInfo = await uploadSignedUrlForFile(file) + if (!uploadInfo.uploadSignedUrl) { + const message = uploadInfo.message || 'No upload URL available' + showErrorToast(message, { duration: 10000 }) file.status = 'error' setUploadFiles([...allFiles]) + return } + + const uploadResult = await axios.request({ + method: 'PUT', + url: uploadInfo.uploadSignedUrl, + data: file.file, + withCredentials: false, + headers: { + 'Content-Type': file.file.type, + }, + onUploadProgress: (p) => { + if (!p.total) { + console.warn('No total available for upload progress') + return + } + const progress = (p.loaded / p.total) * 100 + file.progress = progress + + setUploadFiles([...allFiles]) + }, + }) + + file.progress = 100 + file.status = 'success' + file.openUrl = uploadInfo.requestId + ? `/article/sr/${uploadInfo.requestId}` + : undefined + file.message = uploadInfo.message + + setUploadFiles([...allFiles]) + } catch (error) { + file.status = 'error' + setUploadFiles([...allFiles]) } - })() + } + })() }, [uploadFiles] ) @@ -681,7 +681,14 @@ const UploadPad = (props: UploadPadProps): JSX.Element => { - + {uploadFiles.map((file) => { return ( { padding: '15px', gap: '10px', color: '$thTextContrast', - overflow: "hidden" + overflow: 'hidden', }} alignment="center" distribution="start" diff --git a/packages/web/components/templates/UploadModal.tsx b/packages/web/components/templates/UploadModal.tsx index a3dc64937..26fb49a2c 100644 --- a/packages/web/components/templates/UploadModal.tsx +++ b/packages/web/components/templates/UploadModal.tsx @@ -293,7 +293,8 @@ export function UploadModal(props: UploadModalProps): JSX.Element { title="Upload file" onOpenChange={props.onOpenChange} /> - { setInDragOperation(true) @@ -447,7 +448,7 @@ export function UploadModal(props: UploadModalProps): JSX.Element { )} - + */} diff --git a/packages/web/pages/settings/integrations.tsx b/packages/web/pages/settings/integrations.tsx index 91c9d6b4f..a1b9eeb08 100644 --- a/packages/web/pages/settings/integrations.tsx +++ b/packages/web/pages/settings/integrations.tsx @@ -237,42 +237,42 @@ export default function Integrations(): JSX.Element { }, }, }, - { - icon: '/static/icons/pocket.svg', - title: 'Pocket', - subText: - 'Pocket is a place to save articles, videos, and more. Our Pocket integration allows importing your Pocket library to Omnivore. Once connected we will asyncronously import all your Pocket articles into Omnivore, as this process is resource intensive it can take some time. You will receive an email when the process is completed. Limit 20k articles per import. The import is a one-time process and can only be performed once per-account.', - button: { - text: pocket ? 'Disconnect' : 'Import', - icon: isImporting(pocket) ? ( - - ) : ( - - ), - style: pocket ? 'ctaWhite' : 'ctaDarkYellow', - action: () => { - pocket - ? deleteIntegration(pocket.id) - : redirectToIntegration('POCKET', ImportItemState.Unarchived) - }, - disabled: isImporting(pocket), - isDropdown: !pocket, - dropdownOptions: [ - { - text: 'Import All', - action: () => { - redirectToIntegration('POCKET', ImportItemState.All) - }, - }, - { - text: 'Import Unarchived', - action: () => { - redirectToIntegration('POCKET', ImportItemState.Unarchived) - }, - }, - ], - }, - }, + // { + // icon: '/static/icons/pocket.svg', + // title: 'Pocket', + // subText: + // 'Pocket is a place to save articles, videos, and more. Our Pocket integration allows importing your Pocket library to Omnivore. Once connected we will asyncronously import all your Pocket articles into Omnivore, as this process is resource intensive it can take some time. You will receive an email when the process is completed. Limit 20k articles per import. The import is a one-time process and can only be performed once per-account.', + // button: { + // text: pocket ? 'Disconnect' : 'Import', + // icon: isImporting(pocket) ? ( + // + // ) : ( + // + // ), + // style: pocket ? 'ctaWhite' : 'ctaDarkYellow', + // action: () => { + // pocket + // ? deleteIntegration(pocket.id) + // : redirectToIntegration('POCKET', ImportItemState.Unarchived) + // }, + // disabled: isImporting(pocket), + // isDropdown: !pocket, + // dropdownOptions: [ + // { + // text: 'Import All', + // action: () => { + // redirectToIntegration('POCKET', ImportItemState.All) + // }, + // }, + // { + // text: 'Import Unarchived', + // action: () => { + // redirectToIntegration('POCKET', ImportItemState.Unarchived) + // }, + // }, + // ], + // }, + // }, // { // icon: '/static/icons/webhooks.svg', @@ -301,22 +301,22 @@ export default function Integrations(): JSX.Element { }, }, }, - { - icon: '/static/icons/notion.png', - title: 'Notion', - subText: - 'Notion is an all-in-one workspace. Use our Notion integration to sync your Omnivore items to Notion.', - button: { - text: notion ? 'Settings' : 'Connect', - icon: , - style: notion ? 'ctaWhite' : 'ctaDarkYellow', - action: () => { - notion - ? router.push('/settings/integrations/notion') - : redirectToIntegration('NOTION') - }, - }, - }, + // { + // icon: '/static/icons/notion.png', + // title: 'Notion', + // subText: + // 'Notion is an all-in-one workspace. Use our Notion integration to sync your Omnivore items to Notion.', + // button: { + // text: notion ? 'Settings' : 'Connect', + // icon: , + // style: notion ? 'ctaWhite' : 'ctaDarkYellow', + // action: () => { + // notion + // ? router.push('/settings/integrations/notion') + // : redirectToIntegration('NOTION') + // }, + // }, + // }, ] setIntegrationsArray(integrationsArray)