This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const imageIndex = { | |
viewableBy: userId, | |
image, | |
textContent: texts[index] | |
} | |
index.addObject(imageIndex) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install react-instantserach-dom --prefix client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const params = createUploadParams(file) // The above function | |
s3.upload(params).promise() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<InstantSearch searchClient={searchClient} indexName='prod_USERS'> | |
<Hits | |
hitComponent={({ hit }) => <img alt='Search Result' src={isImageLoaded ? hit.image : placeholderImage}/>} | |
/> | |
</InstantSearch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index.setSettings({ | |
searchableAttributes: ['textContent'], | |
attributesForFaceting: ['filterOnly(viewableBy)'] | |
}) | |
const publicSearchKey = client.generateSecuredApiKey( | |
process.env.ALGOLIA_SEARCH_KEY, | |
{ filters: `viewableBy:${userId}` } | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Tesseract = require('tesseract.js') | |
Tesseract.recognize(buffer, 'eng')) // Here buffer represents the image itself |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ReactDOM.createPortal( | |
<PortalContainer onClick={event => !event.target.closest("img") ? onClick() : null}> | |
<React.Fragment> | |
<BackButton onClick={onClick}> | |
<LeftIcon /> | |
</BackButton> | |
{children} | |
</React.Fragment> | |
</PortalContainer>, | |
modalElement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const modalElement = document.getElementById('modal') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { getRootProps, getInputProps, isDragActive, isDragAccept, isDragReject } = useDropzone({ | |
multiple: true, | |
accept: 'image/jpeg, image/png', | |
maxSize: 1024 * 1024 * 2, | |
minSize: 0, | |
onDrop: acceptedFiles => { | |
setFiles([ | |
...acceptedFiles.slice( | |
0, | |
acceptedFiles.length > 2 ? 2 : acceptedFiles.length |
OlderNewer