diff --git a/public/img/google_play_badge_english.png b/public/img/google_play_badge_english.png new file mode 100644 index 0000000..7a06997 Binary files /dev/null and b/public/img/google_play_badge_english.png differ diff --git a/src/components/general/OpenInAppDialog.tsx b/src/components/general/OpenInAppDialog.tsx new file mode 100644 index 0000000..bc5dd76 --- /dev/null +++ b/src/components/general/OpenInAppDialog.tsx @@ -0,0 +1,73 @@ +import React, { useEffect, useRef } from "react"; +import useOnMobile from "@/components/general/hooks/useOnMobile"; +import { useRouter } from "next/router"; +import { Anchor, Button, Divider, Drawer, Image, Stack } from "@mantine/core"; +import { useDisclosure, useSessionStorage } from "@mantine/hooks"; + +/** + * Component that shows an 'open in app' dialog for mobile users. + * @constructor + */ +const OpenInAppDialog = () => { + const router = useRouter(); + const onMobile = useOnMobile(); + + const [hasBeenClosed, setHasBeenClosed] = useSessionStorage({ + key: "open-in-app-dialog-closed", + defaultValue: false, + getInitialValueInEffect: false, + }); + + const [opened, { close, open }] = useDisclosure(); + + useEffect(() => { + if (onMobile && router.pathname !== "/" && !hasBeenClosed) { + open(); + } + }, [hasBeenClosed, onMobile, open, router.pathname, setHasBeenClosed]); + + return ( + { + close(); + setHasBeenClosed(true); + }} + withCloseButton + size="30vh" + radius="md" + position={"bottom"} + title={"GameNode is (even) better in the app!"} + > + + + + + + + {"Get + + + + ); +}; + +export default OpenInAppDialog; diff --git a/src/components/general/RouterTransition.tsx b/src/components/general/RouterTransition.tsx index c908434..ceefc29 100755 --- a/src/components/general/RouterTransition.tsx +++ b/src/components/general/RouterTransition.tsx @@ -23,5 +23,5 @@ export function RouterTransition() { }; }, [router]); - return ; + return ; } diff --git a/src/components/globals.css b/src/components/globals.css index 679f20a..3c2979e 100755 --- a/src/components/globals.css +++ b/src/components/globals.css @@ -24,4 +24,4 @@ Styling for tiptap mentions .tiptap span.mention { background-color: rgb(241 81 38 / 1); border-radius: var(--mantine-radius-xs); -} +} \ No newline at end of file diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 12b8d39..dbbabc6 100755 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -33,6 +33,7 @@ import { theme } from "@/util/theme"; import NotificationsManager from "@/components/general/NotificationsManager"; import { useMatomoTracker } from "@/components/general/hooks/useMatomoTracker"; import MatomoWrapper from "@/components/general/MatomoWrapper"; +import OpenInAppDialog from "@/components/general/OpenInAppDialog"; /** * Basic configuration for wrapper services @@ -78,6 +79,7 @@ export default function App({ + - - + + Play. Review. Share. - - - - - - - Games metadata are a courtesy of{" "} - + + + + + - IGDB - - . - - + {"Get + + + GameNode is free (and ad-free!). + + Games metadata are a courtesy of{" "} + + IGDB + + . +