Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Empty state #946

Merged
merged 25 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5146b91
Created Empty screen heading and image
Ananddubey01 Feb 10, 2023
22f3565
Empty Screen: Added upload buttons
Ananddubey01 Feb 10, 2023
a525530
made empty state for instances of only incoming share files
Ananddubey01 Feb 13, 2023
f084643
Changed empty state image
Ananddubey01 Feb 13, 2023
3a02b65
Empty State: Implemented download button section
Ananddubey01 Feb 13, 2023
59e076f
Empty Screen: Changed Icons
Ananddubey01 Feb 13, 2023
4cbec90
Empty screen: fixed github hyperlink
Ananddubey01 Feb 13, 2023
bcfc2db
Empty screen: removed drag feature from images
Ananddubey01 Feb 13, 2023
b25d2ef
Empty Screen: Implemented upload/import button functionalities
Ananddubey01 Feb 15, 2023
0ade128
Fixed issues
Ananddubey01 Feb 15, 2023
ac8f083
update lintstagedrc to only run on files inside src folder
abhinavkgrd Feb 17, 2023
fa77ae8
merge main into empty-state
abhinavkgrd Feb 17, 2023
83a1fe5
changed logic of personal files check from incoming shared files to d…
Ananddubey01 Feb 21, 2023
ef3499a
changed ente_duck size image
Ananddubey01 Feb 21, 2023
c630476
empty screen: changed to top alignment
Ananddubey01 Feb 21, 2023
bc4dcba
move setHasPersonalFiles to setDerivativeState
abhinavkgrd Feb 21, 2023
3ac9a0e
fix dedupe text appearing on top of screen
abhinavkgrd Feb 21, 2023
f6e9363
move cursor style to upload buttons
abhinavkgrd Feb 21, 2023
a041226
add check for if new upload are allowed before opening uploadTypeSele…
abhinavkgrd Feb 21, 2023
624ec08
remove unneeded properties from empty screen wrapper
abhinavkgrd Feb 21, 2023
05adbbc
fix navbar UploadButton showing import instead of upload
abhinavkgrd Feb 21, 2023
9f2c5ff
use uploadTypeSelectorIntent as collectPhotos for shared-albums
abhinavkgrd Feb 21, 2023
41967e0
changed to ente Logo in welcome message
Ananddubey01 Feb 23, 2023
bc8196b
Empty Screen: Removed bottom download buttons
Ananddubey01 Feb 23, 2023
384545a
Removed download bottom download files images
Ananddubey01 Feb 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ const buildPrettierCommand = (filenames) =>
`yarn prettier --write --ignore-unknown ${filenames.join(' ')}`;

module.exports = {
'*.{js,jsx,ts,tsx}': [buildEslintCommand, buildPrettierCommand],
'src/**/*.{js,jsx,ts,tsx}': [buildEslintCommand, buildPrettierCommand],
};
Binary file added public/images/empty-state/ente_duck.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/empty-state/ente_duck@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/empty-state/ente_duck@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 88 additions & 41 deletions src/components/EmptyScreen.tsx
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>
);
}
1 change: 1 addition & 0 deletions src/components/EnteLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { styled } from '@mui/material';

const LogoImage = styled('img')`
margin: 3px 0;
pointer-events: none;
`;

export function EnteLogo(props) {
Expand Down
5 changes: 3 additions & 2 deletions src/components/PhotoFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ interface Props {
) => void;
selected: SelectedState;
isFirstLoad?;
hasPersonalFiles?;
openUploader?;
isInSearchMode?: boolean;
search?: Search;
Expand All @@ -79,6 +80,7 @@ const PhotoFrame = ({
setSelected,
selected,
isFirstLoad,
hasPersonalFiles,
openUploader,
isInSearchMode,
search,
Expand Down Expand Up @@ -109,7 +111,6 @@ const PhotoFrame = ({
const updateRequired = useRef(false);

const [filteredData, setFilteredData] = useState<EnteFile[]>([]);

useEffect(() => {
const user: User = getData(LS_KEYS.USER);
setUser(user);
Expand Down Expand Up @@ -654,7 +655,7 @@ const PhotoFrame = ({
return (
<>
{!isFirstLoad &&
files.length === 0 &&
!hasPersonalFiles &&
!isInSearchMode &&
activeCollection === ALL_SECTION ? (
<EmptyScreen openUploader={openUploader} />
Expand Down
9 changes: 6 additions & 3 deletions src/components/Upload/UploadButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import FileUploadOutlinedIcon from '@mui/icons-material/FileUploadOutlined';
import { Button } from '@mui/material';
import constants from 'utils/strings/constants';
import uploadManager from 'services/upload/uploadManager';
import { UploadTypeSelectorIntent } from 'types/gallery';

const Wrapper = styled('div')<{ $disableShrink: boolean }>`
display: flex;
Expand All @@ -27,7 +28,7 @@ const Wrapper = styled('div')<{ $disableShrink: boolean }>`
`;

interface Iprops {
openUploader: () => void;
openUploader: (intent?: UploadTypeSelectorIntent) => void;
text?: string;
color?: ButtonProps['color'];
disableShrink?: boolean;
Expand All @@ -40,14 +41,16 @@ function UploadButton({
disableShrink,
icon,
}: Iprops) {
const onClickHandler = () => openUploader();

return (
<Wrapper
$disableShrink={disableShrink}
style={{
cursor: !uploadManager.shouldAllowNewUpload() && 'not-allowed',
}}>
<Button
onClick={openUploader}
onClick={onClickHandler}
disabled={!uploadManager.shouldAllowNewUpload()}
className="desktop-button"
color={color ?? 'secondary'}
Expand All @@ -56,7 +59,7 @@ function UploadButton({
</Button>

<IconButton
onClick={openUploader}
onClick={onClickHandler}
disabled={!uploadManager.shouldAllowNewUpload()}
className="mobile-button">
<FileUploadOutlinedIcon />
Expand Down
28 changes: 18 additions & 10 deletions src/components/Upload/UploadTypeSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import DialogTitleWithCloseButton, {
import { Box, Dialog, Stack, Typography } from '@mui/material';
import { PublicCollectionGalleryContext } from 'utils/publicCollectionGallery';
import { isMobileOrTable } from 'utils/common/deviceDetection';

import { UploadTypeSelectorIntent } from 'types/gallery';
interface Iprops {
onClose: () => void;
show: boolean;
uploadFiles: () => void;
uploadFolders: () => void;
uploadGoogleTakeoutZips: () => void;
hideZipUploadOption?: boolean;
uploadTypeSelectorIntent: UploadTypeSelectorIntent;
}
export default function UploadTypeSelector({
onClose,
show,
uploadFiles,
uploadFolders,
uploadGoogleTakeoutZips,
hideZipUploadOption,
uploadTypeSelectorIntent,
}: Iprops) {
const publicCollectionGalleryContext = useContext(
PublicCollectionGalleryContext
Expand Down Expand Up @@ -55,23 +55,31 @@ export default function UploadTypeSelector({
}}
onClose={dialogCloseHandler({ onClose })}>
<DialogTitleWithCloseButton onClose={onClose}>
{publicCollectionGalleryContext.accessedThroughSharedURL
{uploadTypeSelectorIntent ===
UploadTypeSelectorIntent.collectPhotos
? constants.SELECT_PHOTOS
: uploadTypeSelectorIntent ===
UploadTypeSelectorIntent.import
? constants.IMPORT
: constants.UPLOAD}
</DialogTitleWithCloseButton>
<Box p={1.5} pt={0.5}>
<Stack spacing={0.5}>
<UploadTypeOption
onClick={uploadFiles}
startIcon={<FileUploadIcon />}>
{constants.UPLOAD_FILES}
</UploadTypeOption>
{uploadTypeSelectorIntent !==
UploadTypeSelectorIntent.import && (
<UploadTypeOption
onClick={uploadFiles}
startIcon={<FileUploadIcon />}>
{constants.UPLOAD_FILES}
</UploadTypeOption>
)}
<UploadTypeOption
onClick={uploadFolders}
startIcon={<FolderUploadIcon />}>
{constants.UPLOAD_DIRS}
</UploadTypeOption>
{!hideZipUploadOption && (
{uploadTypeSelectorIntent !==
UploadTypeSelectorIntent.collectPhotos && (
<UploadTypeOption
onClick={uploadGoogleTakeoutZips}
startIcon={<GoogleIcon />}>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Upload/Uploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import {
getPublicCollectionUploaderName,
savePublicCollectionUploaderName,
} from 'services/publicCollectionService';

import { UploadTypeSelectorIntent } from 'types/gallery';
const FIRST_ALBUM_NAME = 'My First Album';

interface Props {
Expand All @@ -81,8 +81,8 @@ interface Props {
webFolderSelectorFiles: File[];
webFileSelectorFiles: File[];
dragAndDropFiles: File[];
zipUploadDisabled?: boolean;
uploadCollection?: Collection;
uploadTypeSelectorIntent: UploadTypeSelectorIntent;
}

export default function Uploader(props: Props) {
Expand Down Expand Up @@ -752,7 +752,7 @@ export default function Uploader(props: Props) {
uploadFiles={handleFileUpload}
uploadFolders={handleFolderUpload}
uploadGoogleTakeoutZips={handleZipUpload}
hideZipUploadOption={props.zipUploadDisabled}
uploadTypeSelectorIntent={props.uploadTypeSelectorIntent}
/>
<UploadProgress
open={uploadProgressView}
Expand Down
Loading