diff --git a/packages/web/components/templates/UploadModal.tsx b/packages/web/components/templates/UploadModal.tsx index 8c0422f94..ec8b296c1 100644 --- a/packages/web/components/templates/UploadModal.tsx +++ b/packages/web/components/templates/UploadModal.tsx @@ -122,7 +122,7 @@ export function UploadModal(props: UploadModalProps): JSX.Element { const uploadSignedUrlForFile = async ( file: UploadingFile ): Promise => { - let { contentType } = file; + let { contentType } = file if ( contentType == 'application/vnd.ms-excel' && file.name.endsWith('.csv') @@ -135,6 +135,12 @@ export function UploadModal(props: UploadModalProps): JSX.Element { try { const csvData = await validateCsvFile(file.file) urlCount = csvData.data.length + if (urlCount > 500) { + return { + message: + 'Due to an increase in traffic we are limiting CSV imports to 500 items.', + } + } if (csvData.inValidData.length > 0) { return { message: csvData.inValidData[0].message, @@ -185,7 +191,7 @@ export function UploadModal(props: UploadModalProps): JSX.Element { } } return { - message: `Invalid content type: ${contentType}` + message: `Invalid content type: ${contentType}`, } } @@ -215,8 +221,9 @@ export function UploadModal(props: UploadModalProps): JSX.Element { const uploadInfo = await uploadSignedUrlForFile(file) if (!uploadInfo.uploadSignedUrl) { const message = uploadInfo.message || 'No upload URL available' - // close after 5 seconds - showErrorToast(message, { duration: 5000 }) + showErrorToast(message, { duration: 10000 }) + file.status = 'error' + setUploadFiles([...allFiles]) return } diff --git a/packages/web/pages/[username]/[slug]/index.tsx b/packages/web/pages/[username]/[slug]/index.tsx index 2acd23610..f6ab12ece 100644 --- a/packages/web/pages/[username]/[slug]/index.tsx +++ b/packages/web/pages/[username]/[slug]/index.tsx @@ -79,30 +79,30 @@ export default function Home(): JSX.Element { }, [articleData?.article.article]) const goNextOrHome = useCallback(() => { - const listStr = localStorage.getItem('library-slug-list') - if (article && listStr && viewerData?.me) { - const libraryList = JSON.parse(listStr) as string[] - const idx = libraryList.findIndex((slug) => slug == article.slug) - if (idx != -1 && idx < libraryList.length - 1) { - const nextSlug = libraryList[idx + 1] as string - router.push(`/${viewerData?.me.profile.username}/${nextSlug}`) - return - } - } + // const listStr = localStorage.getItem('library-slug-list') + // if (article && listStr && viewerData?.me) { + // const libraryList = JSON.parse(listStr) as string[] + // const idx = libraryList.findIndex((slug) => slug == article.slug) + // if (idx != -1 && idx < libraryList.length - 1) { + // const nextSlug = libraryList[idx + 1] as string + // router.push(`/${viewerData?.me.profile.username}/${nextSlug}`) + // return + // } + // } router.push(`/home`) }, [router, viewerData, article]) const goPreviousOrHome = useCallback(() => { - const listStr = localStorage.getItem('library-slug-list') - if (article && listStr && viewerData?.me) { - const libraryList = JSON.parse(listStr) as string[] - const idx = libraryList.findIndex((slug) => slug == article.slug) - if (idx > 0) { - const previousSlug = libraryList[idx - 1] as string - router.push(`/${viewerData?.me.profile.username}/${previousSlug}`) - return - } - } + // const listStr = localStorage.getItem('library-slug-list') + // if (article && listStr && viewerData?.me) { + // const libraryList = JSON.parse(listStr) as string[] + // const idx = libraryList.findIndex((slug) => slug == article.slug) + // if (idx > 0) { + // const previousSlug = libraryList[idx - 1] as string + // router.push(`/${viewerData?.me.profile.username}/${previousSlug}`) + // return + // } + // } router.push(`/home`) }, [router, viewerData, article]) @@ -418,24 +418,24 @@ export default function Home(): JSX.Element { shortcut: ['i'], perform: () => setShowEditModal(true), }, - { - id: 'go_previous', - section: 'Article', - name: 'Go to Previous', - shortcut: ['g', 'p'], - perform: () => { - document.dispatchEvent(new Event('goPreviousOrHome')) - }, - }, - { - id: 'go_next', - section: 'Article', - name: 'Go to Next', - shortcut: ['g', 'n'], - perform: () => { - document.dispatchEvent(new Event('goNextOrHome')) - }, - }, + // { + // id: 'go_previous', + // section: 'Article', + // name: 'Go to Previous', + // shortcut: ['g', 'p'], + // perform: () => { + // document.dispatchEvent(new Event('goPreviousOrHome')) + // }, + // }, + // { + // id: 'go_next', + // section: 'Article', + // name: 'Go to Next', + // shortcut: ['g', 'n'], + // perform: () => { + // document.dispatchEvent(new Event('goNextOrHome')) + // }, + // }, ], [readerSettings, showHighlightsModal] )