Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Sketch

Manav Rathi306430d67d32
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index 8abad43975..26a4e64b3d 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -1,3 +1,4 @@
+import { DevSettings } from "@/new/photos/components/DevSettings";
import log from "@/next/log";
import { Login } from "@ente/accounts/components/Login";
import { SignUp } from "@ente/accounts/components/SignUp";
@@ -26,10 +27,12 @@ import { useAppContext } from "./_app";
export default function LandingPage() {
const { appName, showNavBar, setDialogMessage } = useAppContext();
- const router = useRouter();
+
const [loading, setLoading] = useState(true);
const [showLogin, setShowLogin] = useState(true);
+ const router = useRouter();
+
useEffect(() => {
showNavBar(false);
const currentURL = new URL(window.location.href);
@@ -145,7 +148,36 @@ export default function LandingPage() {
);
}
-const Container = styled("div")`
+const Container: React.FC<React.PropsWithChildren> = ({ children }) => {
+ // [Note: Configuring custom server]
+ //
+ // Allow the user to tap 7 times anywhere on the onboarding screen to bring
+ // up a page where they can configure the endpoint that the app should
+ // connect to.
+ //
+ // See: https://help.ente.io/self-hosting/guides/custom-server/
+ const [tapCount, setTapCount] = useState(0);
+ const [showDevSettings, setShowDevSettings] = useState(false);
+
+ const handleClick = () => {
+ setTapCount(tapCount + 1);
+ if (tapCount + 1 == 7) setShowDevSettings(true);
+ };
+
+ return (
+ <Container_ onClick={handleClick}>
+ <>
+ <DevSettings
+ open={showDevSettings}
+ onClose={() => setShowDevSettings(false)}
+ />
+ {children}
+ </>
+ </Container_>
+ );
+};
+
+const Container_ = styled("div")`
display: flex;
flex: 1;
align-items: center;
diff --git a/web/packages/new/photos/components/DevSettings.tsx b/web/packages/new/photos/components/DevSettings.tsx
new file mode 100644
index 0000000000..926d339993
--- /dev/null
+++ b/web/packages/new/photos/components/DevSettings.tsx
@@ -0,0 +1,67 @@
+import ArrowForward from "@mui/icons-material/ArrowForward";
+import {
+ Button,
+ Dialog,
+ DialogActions,
+ DialogContent,
+ DialogContentText,
+ DialogTitle,
+ styled,
+ useMediaQuery,
+} from "@mui/material";
+import React from "react";
+import { SlideTransition } from "./SlideTransition";
+
+interface DevSettingsProps {
+ /** If `true`, then the dialog is shown. */
+ open: boolean;
+ /** Called when the dialog wants to be closed. */
+ onClose: () => void;
+}
+
+/**
+ * A dialog allowing the user to set the API origin that the app connects to.
+ * See: [Note: Configuring custom server].
+ */
+export const DevSettings: React.FC<DevSettingsProps> = ({ open, onClose }) => {
+ const fullScreen = useMediaQuery("(max-width: 428px)");
+
+ return (
+ <Dialog
+ {...{ open, fullScreen }}
+ TransitionComponent={SlideTransition}
+ maxWidth="xs"
+ >
+ <DialogTitle>{"Developer settings"}</DialogTitle>
+ <DialogContent>
+ <DialogContentText>WIP</DialogContentText>
+ </DialogContent>
+ <DialogActions>
+ <StyledButton
+ onClick={onClose}
+ color="accent"
+ fullWidth
+ disableRipple
+ endIcon={<ArrowForward />}
+ >
+ <ButtonContents>{"Continue"}</ButtonContents>
+ </StyledButton>
+ </DialogActions>
+ </Dialog>
+ );
+};
+
+const StyledButton = styled(Button)`
+ /* Show an outline when the button gains keyboard focus, e.g. when the user
+ tabs to it. */
+ &.Mui-focusVisible {
+ outline: 1px solid #aaa;
+ }
+`;
+
+const ButtonContents = styled("div")`
+ /* Make the button text fill the entire space so the endIcon shows at the
+ trailing edge of the button. */
+ width: 100%;
+ text-align: left;
+`;
diff --git a/web/packages/new/photos/components/SlideTransition.tsx b/web/packages/new/photos/components/SlideTransition.tsx
new file mode 100644
index 0000000000..d5d2fda5c0
--- /dev/null
+++ b/web/packages/new/photos/components/SlideTransition.tsx
@@ -0,0 +1,16 @@
+import Slide from "@mui/material/Slide";
+import type { TransitionProps } from "@mui/material/transitions";
+import React from "react";
+
+/**
+ * A React component that can be passed as the `TransitionComponent` props to a
+ * MUI {@link Dialog} to get it to use a slide transition (default is fade).
+ */
+export const SlideTransition = React.forwardRef(function Transition(
+ props: TransitionProps & {
+ children: React.ReactElement;
+ },
+ ref: React.Ref<unknown>,
+) {
+ return <Slide direction="up" ref={ref} {...props} />;
+});
diff --git a/web/packages/new/photos/components/WhatsNew.tsx b/web/packages/new/photos/components/WhatsNew.tsx
index 9a98ee5e48..76a81e7b70 100644
--- a/web/packages/new/photos/components/WhatsNew.tsx
+++ b/web/packages/new/photos/components/WhatsNew.tsx
@@ -10,21 +10,20 @@ import {
styled,
useMediaQuery,
} from "@mui/material";
-import Slide from "@mui/material/Slide";
-import type { TransitionProps } from "@mui/material/transitions";
import React, { useEffect } from "react";
import { didShowWhatsNew } from "../services/changelog";
+import { SlideTransition } from "./SlideTransition";
interface WhatsNewProps {
/** If `true`, then the dialog is shown. */
open: boolean;
- /** Callback to invoke when the dialog wants to be closed. */
+ /** Called when the dialog wants to be closed. */
onClose: () => void;
}
/**
- * Show a dialog showing a short summary of interesting-for-the-user things
- * since the last time this dialog was shown.
+ * A dialog showing a short summary of interesting-for-the-user things since the
+ * last time this dialog was shown.
*/
export const WhatsNew: React.FC<WhatsNewProps> = ({ open, onClose }) => {
const fullScreen = useMediaQuery("(max-width: 428px)");
@@ -60,15 +59,6 @@ export const WhatsNew: React.FC<WhatsNewProps> = ({ open, onClose }) => {
);
};
-const SlideTransition = React.forwardRef(function Transition(
- props: TransitionProps & {
- children: React.ReactElement;
- },
- ref: React.Ref<unknown>,
-) {
- return <Slide direction="up" ref={ref} {...props} />;
-});
-
const ChangelogContent: React.FC = () => {
// NOTE: Remember to update changelogVersion when changing the content
// below.