This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #946 from ente-io/empty-state
Empty state
- Loading branch information
Showing
14 changed files
with
165 additions
and
71 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,103 @@ | ||
import React, { useContext } from 'react'; | ||
import { Button, styled, Typography } from '@mui/material'; | ||
import { Button, Stack, styled, Typography } from '@mui/material'; | ||
import constants from 'utils/strings/constants'; | ||
import { DeduplicateContext } from 'pages/deduplicate'; | ||
import VerticallyCentered from './Container'; | ||
import VerticallyCentered, { FlexWrapper } from './Container'; | ||
import { Box } from '@mui/material'; | ||
import uploadManager from 'services/upload/uploadManager'; | ||
import AddPhotoAlternateIcon from '@mui/icons-material/AddPhotoAlternateOutlined'; | ||
import FolderIcon from '@mui/icons-material/FolderOutlined'; | ||
import { UploadTypeSelectorIntent } from 'types/gallery'; | ||
|
||
const Wrapper = styled(VerticallyCentered)` | ||
& > svg { | ||
filter: drop-shadow(3px 3px 5px rgba(45, 194, 98, 0.5)); | ||
} | ||
const Wrapper = styled(Box)` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
text-align: center; | ||
`; | ||
const NonDraggableImage = styled('img')` | ||
pointer-events: none; | ||
`; | ||
|
||
export default function EmptyScreen({ openUploader }) { | ||
const deduplicateContext = useContext(DeduplicateContext); | ||
return ( | ||
return deduplicateContext.isOnDeduplicatePage ? ( | ||
<VerticallyCentered> | ||
<div | ||
style={{ | ||
color: '#a6a6a6', | ||
fontSize: '18px', | ||
}}> | ||
{constants.NO_DUPLICATES_FOUND} | ||
</div> | ||
</VerticallyCentered> | ||
) : ( | ||
<Wrapper> | ||
{deduplicateContext.isOnDeduplicatePage ? ( | ||
<div | ||
<Stack | ||
sx={{ | ||
flex: 'none', | ||
pt: 1.5, | ||
pb: 1.5, | ||
}}> | ||
<VerticallyCentered sx={{ flex: 'none' }}> | ||
{constants.WELCOME_TO_ENTE()} | ||
</VerticallyCentered> | ||
<Typography variant="body1" mt={3.5} color="text.secondary"> | ||
{constants.WHERE_YOUR_BEST_PHOTOS_LIVE} | ||
</Typography> | ||
</Stack> | ||
<NonDraggableImage | ||
height={287.57} | ||
src="/images/empty-state/ente_duck.png" | ||
srcSet="/images/empty-state/ente_duck@2x.png, | ||
/images/empty-state/ente_duck@3x.png" | ||
/> | ||
|
||
<VerticallyCentered paddingTop={1.5} paddingBottom={1.5}> | ||
<Button | ||
style={{ | ||
color: '#a6a6a6', | ||
fontSize: '18px', | ||
cursor: | ||
!uploadManager.shouldAllowNewUpload() && | ||
'not-allowed', | ||
}} | ||
color="accent" | ||
onClick={() => | ||
openUploader(UploadTypeSelectorIntent.normalUpload) | ||
} | ||
disabled={!uploadManager.shouldAllowNewUpload()} | ||
sx={{ | ||
mt: 1.5, | ||
p: 1, | ||
width: 320, | ||
borderRadius: 0.5, | ||
}}> | ||
{constants.NO_DUPLICATES_FOUND} | ||
</div> | ||
) : ( | ||
<> | ||
<img | ||
height={150} | ||
src="/images/gallery-locked/1x.png" | ||
srcSet="/images/gallery-locked/2x.png 2x, | ||
/images/gallery-locked/3x.png 3x" | ||
/> | ||
<Typography color="text.secondary" mt={2}> | ||
{constants.UPLOAD_FIRST_PHOTO_DESCRIPTION()} | ||
</Typography> | ||
|
||
<span | ||
style={{ | ||
cursor: | ||
!uploadManager.shouldAllowNewUpload() && | ||
'not-allowed', | ||
}}> | ||
<Button | ||
color="accent" | ||
onClick={openUploader} | ||
disabled={!uploadManager.shouldAllowNewUpload()} | ||
sx={{ mt: 4 }}> | ||
{constants.UPLOAD_FIRST_PHOTO} | ||
</Button> | ||
</span> | ||
</> | ||
)} | ||
<FlexWrapper sx={{ gap: 1 }} justifyContent="center"> | ||
<AddPhotoAlternateIcon /> | ||
{constants.UPLOAD_FIRST_PHOTO} | ||
</FlexWrapper> | ||
</Button> | ||
<Button | ||
style={{ | ||
cursor: | ||
!uploadManager.shouldAllowNewUpload() && | ||
'not-allowed', | ||
}} | ||
onClick={() => | ||
openUploader(UploadTypeSelectorIntent.import) | ||
} | ||
disabled={!uploadManager.shouldAllowNewUpload()} | ||
sx={{ | ||
mt: 1.5, | ||
p: 1, | ||
width: 320, | ||
borderRadius: 0.5, | ||
}}> | ||
<FlexWrapper sx={{ gap: 1 }} justifyContent="center"> | ||
<FolderIcon /> | ||
{constants.IMPORT_YOUR_FOLDERS} | ||
</FlexWrapper> | ||
</Button> | ||
</VerticallyCentered> | ||
</Wrapper> | ||
); | ||
} |
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
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
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
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
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
Oops, something went wrong.