From e9178303f59a9709e56034981dade3919373844f Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 9 Mar 2021 12:29:18 +0530 Subject: [PATCH 01/11] re-enabled web signups --- src/pages/index.tsx | 145 +++++++++++-------------- src/utils/strings/englishConstants.tsx | 9 -- 2 files changed, 64 insertions(+), 90 deletions(-) diff --git a/src/pages/index.tsx b/src/pages/index.tsx index ecfa9d845..66e7e7dcc 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -10,8 +10,6 @@ import * as Yup from 'yup'; import { getOtt } from 'services/userService'; import Container from 'components/Container'; import { setData, LS_KEYS, getData } from 'utils/storage/localStorage'; -import { Alert } from 'react-bootstrap'; - interface formValues { email: string; } @@ -19,7 +17,6 @@ interface formValues { export default function Home() { const [loading, setLoading] = useState(false); const router = useRouter(); - const [showMessage, setShowMessage] = useState(false); useEffect(() => { router.prefetch('/verify'); @@ -40,92 +37,78 @@ export default function Home() { setData(LS_KEYS.USER, { email }); router.push('/verify'); } catch (e) { - if (e.response.status == 403) { - setFieldError('email', `${constants.USER_DOES_NOT_EXIST}`); - } else { - setFieldError( - 'email', - `${constants.UNKNOWN_ERROR} ${e.message}` - ); - } + setFieldError('email', `${constants.UNKNOWN_ERROR} ${e.message}`); } setLoading(false); }; const register = () => { - setShowMessage(true); - setTimeout(() => setShowMessage(false), 15000); + router.push('/signup'); }; return ( - <> -
- {constants.WEB_SIGNUPS_DISABLED()} -
- - - - - - {constants.LOGIN} - - - initialValues={{ email: '' }} - validationSchema={Yup.object().shape({ - email: Yup.string() - .email(constants.EMAIL_ERROR) - .required(constants.REQUIRED), - })} - onSubmit={loginUser} - > - {({ - values, - errors, - touched, - handleChange, - handleBlur, - handleSubmit, - }) => ( -
- - - - {errors.email} - - - -
- )} - - - {constants.NO_ACCOUNT} - -
-
-
- + /> + + {errors.email} + + + + + )} + + + {constants.NO_ACCOUNT} + + + + ); } diff --git a/src/utils/strings/englishConstants.tsx b/src/utils/strings/englishConstants.tsx index f01f35558..269d48d9f 100644 --- a/src/utils/strings/englishConstants.tsx +++ b/src/utils/strings/englishConstants.tsx @@ -63,15 +63,6 @@ const englishConstants = { STORAGE_QUOTA_EXCEEDED: 'you have exceeded your storage quota, please upgrade your plan from the mobile app', INITIAL_LOAD_DELAY_WARNING: 'the first load may take some time', - - WEB_SIGNUPS_DISABLED: () => ( -
- sorry signups are possibly only on the{' '} - - mobile app - -
- ), USER_DOES_NOT_EXIST: 'sorry, could not find a user with that email', UPLOAD_BUTTON_TEXT: 'upload', NO_ACCOUNT: "don't have an account?", From 3d8bd2032903cf4c3a7519b97d3b043b8e67e074 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 9 Mar 2021 12:35:46 +0530 Subject: [PATCH 02/11] removed duplicate p tag --- src/pages/generate/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/generate/index.tsx b/src/pages/generate/index.tsx index c83d947ba..cfdab5651 100644 --- a/src/pages/generate/index.tsx +++ b/src/pages/generate/index.tsx @@ -114,7 +114,7 @@ export default function Generate() {

{constants.ENTER_ENC_PASSPHRASE}

-

{constants.PASSPHRASE_DISCLAIMER()}

+ {constants.PASSPHRASE_DISCLAIMER()}
initialValues={{ passphrase: '', confirm: '' }} From 692d3468b8b7e689a974c2692ec82a3cae5337d7 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 9 Mar 2021 13:11:52 +0530 Subject: [PATCH 03/11] added jumbotron styles --- src/pages/_app.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 0cce7b6af..5e2c9e551 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -115,7 +115,7 @@ const GlobalStyles = createGlobalStyle` background-size: cover; border: none; } - .btn-primary { + .btn-primary ,.btn:focus { background: #2dc262; border-color: #29a354; padding: 8px; @@ -134,6 +134,12 @@ const GlobalStyles = createGlobalStyle` color: #fff; border-radius: 12px; } + .jumbotron{ + background-color: #242424; + color: #fff; + text-align:center; + margin-top:50px; + } `; const Image = styled.img` @@ -205,7 +211,11 @@ export default function App({ Component, pageProps }) { )} - logo + logo {uploadButtonView && ( From 325684c52455416654522a9f56606d0ed4aac028 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 9 Mar 2021 13:29:45 +0530 Subject: [PATCH 04/11] added jumbotron when no photos --- src/pages/gallery/index.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 1f916fb5f..0f3010d33 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -23,7 +23,7 @@ import { } from 'services/collectionService'; import constants from 'utils/strings/constants'; import AlertBanner from './components/AlertBanner'; -import { Alert } from 'react-bootstrap'; +import { Alert, Button, Jumbotron } from 'react-bootstrap'; const DATE_CONTAINER_HEIGHT = 45; const IMAGE_CONTAINER_HEIGHT = 200; @@ -340,7 +340,23 @@ export default function Gallery(props) { refetchData={syncWithRemote} setBannerErrorCode={setBannerErrorCode} /> - {filteredData.length ? ( + {!isFirstLoad && data.length == 0 ? ( + +

Welcome to ente!

+

+ you don't seem to have any photo uploaded , click on + upload to start preserving your memories +

+

+ +

+
+ ) : filteredData.length ? ( {({ height, width }) => { From a433e30ec1015a1a4f574c836c7f91eeb0b4f1e6 Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Tue, 9 Mar 2021 13:33:18 +0530 Subject: [PATCH 05/11] extracted string to constant --- src/pages/gallery/index.tsx | 7 ++----- src/utils/strings/englishConstants.tsx | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 0f3010d33..ba8a09454 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -342,11 +342,8 @@ export default function Gallery(props) { /> {!isFirstLoad && data.length == 0 ? ( -

Welcome to ente!

-

- you don't seem to have any photo uploaded , click on - upload to start preserving your memories -

+

{constants.WELCOME}

+

{constants.UPLOAD_FIRST_PHOTO}

From 4fc5d450464ae0cc295924fc5d2f3d00667cbdad Mon Sep 17 00:00:00 2001 From: Vishnu Mohandas Date: Tue, 9 Mar 2021 15:44:34 +0530 Subject: [PATCH 08/11] Hide chips if there are no collections to display --- src/pages/gallery/components/Collections.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/gallery/components/Collections.tsx b/src/pages/gallery/components/Collections.tsx index b1c67e018..639f36fe4 100644 --- a/src/pages/gallery/components/Collections.tsx +++ b/src/pages/gallery/components/Collections.tsx @@ -54,7 +54,9 @@ const Chip = styled.button<{ active: boolean }>` export default function Collections(props: CollectionProps) { const { selected, collections, selectCollection } = props; const clickHandler = (id?: number) => () => selectCollection(id); - + if (collections.length == 0) { + return ; + } return ( From ac97caab38916cd33ffe6063344aa2cc85f73465 Mon Sep 17 00:00:00 2001 From: Vishnu Mohandas Date: Tue, 9 Mar 2021 15:52:09 +0530 Subject: [PATCH 09/11] Update empty state --- src/pages/gallery/index.tsx | 35 +++++++++++++++----------- src/utils/strings/englishConstants.tsx | 7 +++--- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 9b65f00cd..b8614cb1b 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -95,6 +95,16 @@ const ListContainer = styled.div<{ columns: number }>` } `; +const Image = styled.img` + width: 200px; + max-width: 100%; + display: block; + text-align: center; + margin-left: auto; + margin-right: auto; + margin-bottom: 20px; +`; + const DateContainer = styled.div` padding-top: 15px; `; @@ -342,16 +352,13 @@ export default function Gallery(props) { /> {!isFirstLoad && data.length == 0 ? ( -

{constants.WELCOME}

-

{constants.UPLOAD_FIRST_PHOTO}

-

- -

+ vault +
) : filteredData.length ? ( @@ -426,7 +433,7 @@ export default function Gallery(props) { timeStampList[index].itemType === - ITEM_TYPE.TIME + ITEM_TYPE.TIME ? DATE_CONTAINER_HEIGHT : IMAGE_CONTAINER_HEIGHT } @@ -443,14 +450,14 @@ export default function Gallery(props) { columns={ timeStampList[index] .itemType === - ITEM_TYPE.TIME + ITEM_TYPE.TIME ? 1 : columns } > {timeStampList[index] .itemType === - ITEM_TYPE.TIME ? ( + ITEM_TYPE.TIME ? ( { timeStampList[ @@ -469,7 +476,7 @@ export default function Gallery(props) { index ] .itemStartIndex + - idx + idx ); } ) diff --git a/src/utils/strings/englishConstants.tsx b/src/utils/strings/englishConstants.tsx index 040e5ae0f..702223928 100644 --- a/src/utils/strings/englishConstants.tsx +++ b/src/utils/strings/englishConstants.tsx @@ -76,19 +76,18 @@ const englishConstants = { NO_INTERNET_CONNECTION: 'please check your internet connection and try again', TITLE: 'ente.io | encrypted photo storage', - WELCOME: 'welcome to ente!', UPLOAD_FIRST_PHOTO: 'backup your first photo', INSTALL_MOBILE_APP: () => (
install our{' '} - + android {' '} or{' '} - + ios app{' '} - to automatically backup all your photos and videos + to automatically backup all your photos
), LOGOUT: 'logout', From c5bebb528956b453348d6b5a08535461fbcc4695 Mon Sep 17 00:00:00 2001 From: Vishnu Mohandas Date: Tue, 9 Mar 2021 16:06:13 +0530 Subject: [PATCH 10/11] Extract string --- src/pages/gallery/components/UploadProgress.tsx | 2 +- src/utils/strings/englishConstants.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/gallery/components/UploadProgress.tsx b/src/pages/gallery/components/UploadProgress.tsx index abb7a38b5..3bedb3c85 100644 --- a/src/pages/gallery/components/UploadProgress.tsx +++ b/src/pages/gallery/components/UploadProgress.tsx @@ -20,7 +20,7 @@ export default function UploadProgress({ > - Uploading Files + {constants.UPLOADING_FILES} diff --git a/src/utils/strings/englishConstants.tsx b/src/utils/strings/englishConstants.tsx index 702223928..f2af9fd2e 100644 --- a/src/utils/strings/englishConstants.tsx +++ b/src/utils/strings/englishConstants.tsx @@ -57,6 +57,7 @@ const englishConstants = { 2: 'uploading your files', 3: 'files uploaded successfully!', }, + UPLOADING_FILES: `uploading files`, OF: 'of', SUBSCRIPTION_EXPIRED: 'your subscription has expired, please renew it form the mobile app', From e70b8b3f246b56b04b68d4b47ea24228523d5298 Mon Sep 17 00:00:00 2001 From: Vishnu Mohandas Date: Tue, 9 Mar 2021 16:06:23 +0530 Subject: [PATCH 11/11] Add styles for the alert --- src/pages/_app.tsx | 12 +++++++++--- src/pages/gallery/index.tsx | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index fd8f789b7..c53740ae6 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -136,10 +136,16 @@ const GlobalStyles = createGlobalStyle` border-radius: 12px; } .jumbotron{ - background-color: #242424; + background-color: #191919; color: #fff; - text-align:center; - margin-top:50px; + text-align: center; + margin-top: 50px; + } + .alert-success { + background-color: #c4ffd6; + } + .alert-primary { + background-color: #c4ffd6; } `; diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index b8614cb1b..09a1fbe4f 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -330,7 +330,7 @@ export default function Gallery(props) { {isFirstLoad && (
- + {constants.INITIAL_LOAD_DELAY_WARNING}
@@ -507,8 +507,8 @@ export default function Gallery(props) { )} {data.length < 30 && ( {constants.INSTALL_MOBILE_APP()}