Skip to content

armgit / ente

Public Imported from GitHub
0

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

Ignore button taps

Manav Rathi35c8970d2095
diff --git a/web/apps/photos/src/pages/index.tsx b/web/apps/photos/src/pages/index.tsx
index b532d2262b..48de2c184e 100644
--- a/web/apps/photos/src/pages/index.tsx
+++ b/web/apps/photos/src/pages/index.tsx
@@ -159,20 +159,34 @@ const Container: React.FC<React.PropsWithChildren> = ({ children }) => {
const [tapCount, setTapCount] = useState(0);
const [showDevSettings, setShowDevSettings] = useState(false);
- const handleClick = () => {
+ const handleClick: React.MouseEventHandler = (event) => {
+ console.log("click", tapCount, event, event.target);
+
+ // Ignore clicks on buttons when counting up towards 7.
+ if (event.target instanceof HTMLButtonElement) return;
+
+ // Otherwise increase the tap count,
setTapCount(tapCount + 1);
+ // And show the dev settings dialog when it reaches 7.
if (tapCount + 1 == 7) {
setTapCount(0);
setShowDevSettings(true);
}
};
+ const handleDevSettingsClose = () => {
+ // Reset the count again to ignore any taps when we were open.
+ setTapCount(0);
+ // Hide the dialog.
+ setShowDevSettings(false);
+ };
+
return (
<Container_ onClick={handleClick}>
<>
<DevSettings
open={showDevSettings}
- onClose={() => setShowDevSettings(false)}
+ onClose={handleDevSettingsClose}
/>
{children}
</>