diff --git a/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx b/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx index 2869846d1..ffdbb93d3 100644 --- a/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx +++ b/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx @@ -1,4 +1,5 @@ import { Box, HStack, VStack } from './../../elements/LayoutPrimitives' +import Dropzone from 'react-dropzone' import type { LibraryItem, LibraryItemsQueryInput, @@ -702,6 +703,11 @@ function HomeFeedGrid(props: HomeFeedContentProps): JSX.Element { setShowUnsubscribeConfirmation(false) } + const [fileNames, setFileNames] = useState([]) + + const handleDrop = (acceptedFiles: any) => + setFileNames(acceptedFiles.map((file: { name: any }) => file.name)) + return ( <> + {props.isValidating && props.items.length == 0 && } + {viewerData?.me && ( )} - {!props.isValidating && props.items.length == 0 ? ( - { - props.setShowAddLinkModal(true) - }} - /> - ) : ( - - {props.items.map((linkedItem) => ( - div': { - bg: '$grayBg', - }, - '&:focus': { - '> div': { - bg: '$grayBgActive', - }, - }, - '&:hover': { - '> div': { - bg: '$grayBgActive', - }, - }, - }} - > - {viewerData?.me && ( - { - if (action === 'delete') { - setShowRemoveLinkConfirmation(true) - props.setLinkToRemove(linkedItem) - } else if (action === 'editTitle') { - props.setShowEditTitleModal(true) - props.setLinkToEdit(linkedItem) - } else if (action == 'unsubscribe') { - setShowUnsubscribeConfirmation(true) - props.setLinkToUnsubscribe(linkedItem) - } else { - props.actionHandler(action, linkedItem) - } - }} - /> - )} - - ))} - - )} - - {props.hasMore ? ( - - ) : ( - + {({ getRootProps, getInputProps, acceptedFiles, fileRejections }) => ( +
+

Drag n drop files anywhere below

+ + {!props.isValidating && props.items.length == 0 ? ( + { + props.setShowAddLinkModal(true) + }} + /> + ) : ( + + {props.items.map((linkedItem) => ( + div': { + bg: '$grayBg', + }, + '&:focus': { + '> div': { + bg: '$grayBgActive', + }, + }, + '&:hover': { + '> div': { + bg: '$grayBgActive', + }, + }, + }} + > + {viewerData?.me && ( + { + if (action === 'delete') { + setShowRemoveLinkConfirmation(true) + props.setLinkToRemove(linkedItem) + } else if (action === 'editTitle') { + props.setShowEditTitleModal(true) + props.setLinkToEdit(linkedItem) + } else if (action == 'unsubscribe') { + setShowUnsubscribeConfirmation(true) + props.setLinkToUnsubscribe(linkedItem) + } else { + props.actionHandler(action, linkedItem) + } + }} + /> + )} + + ))} + + )} + + {props.hasMore ? ( + + ) : ( + + )} + +
)} -
+
+ + {/* Temporary code */} +
+ Files: + +
{/* Temporary code */} + {props.showAddLinkModal && ( props.setShowAddLinkModal(false)} /> )} diff --git a/packages/web/components/templates/library/LibraryList.tsx b/packages/web/components/templates/library/LibraryList.tsx index 7a6fde87c..1ced0a1b2 100644 --- a/packages/web/components/templates/library/LibraryList.tsx +++ b/packages/web/components/templates/library/LibraryList.tsx @@ -30,7 +30,7 @@ export function LibraryList(props: LibraryListProps): JSX.Element { const [fileNames, setFileNames] = useState([]) - const handleDrop = (acceptedFiles) => + const handleDrop = (acceptedFiles: any) => setFileNames(acceptedFiles.map((file: { name: any }) => file.name)) const libraryItems = useMemo(() => { @@ -57,7 +57,7 @@ export function LibraryList(props: LibraryListProps): JSX.Element { {({ getRootProps, getInputProps, acceptedFiles, fileRejections }) => (
-

Drag n drop files, or click to select files

+

Drag n drop files anywhere below

{fileName} ))} -
+ {/* Temporary code */} {/* Extra padding at bottom to give space for scrolling */}