From 89e2139c09fc12cb6c3a6dc08b0632f11abde149 Mon Sep 17 00:00:00 2001 From: Noam Levi Date: Mon, 2 Sep 2024 15:27:53 +0300 Subject: [PATCH] added tanstank-react-router and close sidebar onSwipeLeft --- bun.lockb | Bin 126919 -> 136712 bytes package.json | 2 + src/App.tsx | 49 ------------ src/components/Sidebar/index.tsx | 45 +++++++++-- src/hooks/index.ts | 1 + src/hooks/swipe.ts | 60 ++++++++++++++ src/index.css | 6 ++ src/main.tsx | 45 ++--------- src/routeTree.gen.ts | 74 ++++++++++++++++++ src/router.ts | 17 ++++ src/routes/__root.tsx | 42 ++++++++++ src/routes/helper.tsx | 14 ++++ .../index.module.scss} | 0 src/routes/index.tsx | 25 ++++++ src/theme.ts | 44 +++++++++++ vite.config.ts | 5 +- 16 files changed, 335 insertions(+), 94 deletions(-) delete mode 100644 src/App.tsx create mode 100644 src/hooks/swipe.ts create mode 100644 src/routeTree.gen.ts create mode 100644 src/router.ts create mode 100644 src/routes/__root.tsx create mode 100644 src/routes/helper.tsx rename src/{App.module.scss => routes/index.module.scss} (100%) create mode 100644 src/routes/index.tsx create mode 100644 src/theme.ts diff --git a/bun.lockb b/bun.lockb index 73ee5cd1d3270188639f54c8301cdb554d2c116a..cf30ef246b0d402fef9965505f8a39644093f5c4 100755 GIT binary patch delta 24284 zcmeHvcU)9Q_xGKZ6;?q(DIzE$Hbi<^6lE=_5wZ8q0;?`nSx~Vpw%F@6j)^gvSQ2cB zF~-0x>ia#nuxnzT=Xrmh=l%WjKKH}fGv~~iGiPSboICgKa`s(z zoV3bmR!Csrveb=p8(bY4?{iC)>4At2Al<40XP-7 z46xKL*lg(vn)K#Cp4#cPGVTMqf)$MVD3k-P2TX!Dt10he?ieAbB=UFn%DKLCLXp+kTrglAnJ%F7dM6!jYP$1k4AJkzNMNw*| zWf;v%Gte}$n;0(PqrjfPqhKv5JOE5HkY`LuF{Wgiwqu0UVM`2%^#e$97`UAgu2j5Gg1whrZn4_onuZD1d}Bt-<+8y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e..dced768 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -1,15 +1,32 @@ -import { Button, Code, Divider, Drawer, DrawerProps, Stack, Switch, Text, Title, useMantineColorScheme } from '@mantine/core' +import { Button, Code, Divider, Drawer, DrawerProps, NavLink, NavLinkProps, Stack, Switch, Text, Title, useMantineColorScheme } from '@mantine/core' +import { Link, LinkProps, useMatchRoute } from '@tanstack/react-router' import { MoonStarsIcon, SunIcon } from '@/assets' -import { useWordleStore } from '@/hooks' +import { useSwipe, useWordleStore } from '@/hooks' import { secondsToHms } from '@/utils' interface SidebarProps extends DrawerProps { } +const NavRouterLink = ({ label, to, ...props }: LinkProps & NavLinkProps) => { + const matchRoute = useMatchRoute() + + return ( + {'>'} + } + {...props} + /> + ) +} + const Sidebar = ({ opened, onClose, ...props }: SidebarProps) => { - const { colorScheme, toggleColorScheme } = useMantineColorScheme() const [ resetStore, time, @@ -17,6 +34,11 @@ const Sidebar = ({ opened, onClose, ...props }: SidebarProps) => { state.resetStore, state.time, ]) + const { colorScheme, toggleColorScheme } = useMantineColorScheme() + + useSwipe({ + left: onClose + }) const handleResetStore = () => { resetStore() @@ -35,8 +57,6 @@ const Sidebar = ({ opened, onClose, ...props }: SidebarProps) => { Session Time: {secondsToHms(time)} - - { offLabel={} /> + + + + + + + + + diff --git a/src/hooks/index.ts b/src/hooks/index.ts index 8720608..6239385 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -1 +1,2 @@ export { default as useWordleStore } from './store' +export { useSwipe } from './swipe' diff --git a/src/hooks/swipe.ts b/src/hooks/swipe.ts new file mode 100644 index 0000000..55d0287 --- /dev/null +++ b/src/hooks/swipe.ts @@ -0,0 +1,60 @@ +import { useEffect, useRef } from 'react' + +interface SwipeOptions { + left?: () => void + right?: () => void + up?: () => void + down?: () => void +} + +const useSwipe = ({ left, right, up, down }: SwipeOptions = {}) => { + const touchCoordsRef = useRef({ touchStart: { x: 0, y: 0, time: Date.now() } }) + const fnsRef = useRef({ up, down, left, right }) + fnsRef.current = { + up, + left, + down, + right, + } + useEffect(() => { + const handleTouchStart = (e: TouchEvent) => { + touchCoordsRef.current.touchStart.x = e.targetTouches[0].clientX + touchCoordsRef.current.touchStart.y = e.targetTouches[0].clientY + touchCoordsRef.current.touchStart.time = Date.now() + } + const handleTouchEnd = (e: TouchEvent) => { + const threshold = 150 + const swipeSpeed = 1 // sec; + const touchEndX = e.changedTouches[0].clientX + const touchEndY = e.changedTouches[0].clientY + const touchStartX = touchCoordsRef.current.touchStart.x + const touchStartY = touchCoordsRef.current.touchStart.y + const elapsedTime = (Date.now() - touchCoordsRef.current.touchStart.time) / 1000 + if (elapsedTime > swipeSpeed) { + return + } + const xDistance = touchStartX - touchEndX + const yDistance = touchStartY - touchEndY + + if (Math.abs(xDistance) < threshold && Math.abs(yDistance) < threshold) { + return + } + + if (Math.abs(xDistance) >= Math.abs(yDistance)) { + xDistance > 0 ? fnsRef.current.left?.() : fnsRef.current.right?.() + } else { + yDistance > 0 ? fnsRef.current.down?.() : fnsRef.current.up?.() + } + } + window.addEventListener('touchstart', handleTouchStart) + window.addEventListener('touchend', handleTouchEnd) + return () => { + window.removeEventListener('touchstart', handleTouchStart) + window.removeEventListener('touchend', handleTouchEnd) + } + }) +} + +export { + useSwipe +} diff --git a/src/index.css b/src/index.css index c21b0fe..b639d48 100644 --- a/src/index.css +++ b/src/index.css @@ -8,3 +8,9 @@ body { touch-action: pan-x pan-y; padding: 0 0; } + +.mantine-NavLink-root[data-active] { + border-left: 1px solid var(--mantine-primary-color-light-color); + font-weight: 500; + color: var(--mantine-color-default-color); +} diff --git a/src/main.tsx b/src/main.tsx index 82dd26d..29ecb93 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,49 +1,16 @@ import '@mantine/core/styles.css' import '@mantine/notifications/styles.css' +import './index.css' -import { CSSVariablesResolver, MantineProvider, createTheme, localStorageColorSchemeManager } from '@mantine/core' +import { MantineProvider } from '@mantine/core' import { Notifications } from '@mantine/notifications' +import { RouterProvider } from '@tanstack/react-router' import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' -import App from './App.tsx' -import './index.css' - -const colorSchemeManager = localStorageColorSchemeManager({ - key: 'better-wordle-color-scheme', -}) - -const cssResolver: CSSVariablesResolver = (theme) => ({ - variables: { - '--color-letter-state-perfect': theme.colors.green[9], - '--color-letter-state-correct': theme.colors.yellow[9], - '--color-letter-state-incorrect': theme.colors.gray[8], - '--color-letter-state-incorrect-light': 'var(--mantine-color-dimmed)', - }, - - light: { - '--mantine-color-body': theme.colors.gray[1], - '--color-letter-state-incorrect': theme.colors.gray[7], - '--color-letter-filled-border': 'color-mix(in srgb, var(--mantine-color-default-border), #000 20%)', - '--color-letter-selected': theme.colors.gray[3], - }, - - dark: { - '--color-letter-filled-border': 'color-mix(in srgb, var(--mantine-color-default-border), #fff 20%)', - '--color-letter-selected': theme.colors.gray[7], - }, -}) +import router from './router' +import { colorSchemeManager, cssResolver, theme } from './theme' -const theme = createTheme({ - components: { - Code: { - defaultProps: { - bg: 'gray', - c: 'var(--mantine-primary-color-contrast)', - } - } - } -}) createRoot(document.getElementById('root')!).render( @@ -57,7 +24,7 @@ createRoot(document.getElementById('root')!).render( autoClose={3000} limit={2} /> - + ) diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts new file mode 100644 index 0000000..aede992 --- /dev/null +++ b/src/routeTree.gen.ts @@ -0,0 +1,74 @@ +/* prettier-ignore-start */ + +/* eslint-disable */ + +// @ts-nocheck + +// noinspection JSUnusedGlobalSymbols + +// This file is auto-generated by TanStack Router + +// Import Routes + +import { Route as rootRoute } from './routes/__root' +import { Route as HelperImport } from './routes/helper' +import { Route as IndexImport } from './routes/index' + +// Create/Update Routes + +const HelperRoute = HelperImport.update({ + path: '/helper', + getParentRoute: () => rootRoute, +} as any) + +const IndexRoute = IndexImport.update({ + path: '/', + getParentRoute: () => rootRoute, +} as any) + +// Populate the FileRoutesByPath interface + +declare module '@tanstack/react-router' { + interface FileRoutesByPath { + '/': { + id: '/' + path: '/' + fullPath: '/' + preLoaderRoute: typeof IndexImport + parentRoute: typeof rootRoute + } + '/helper': { + id: '/helper' + path: '/helper' + fullPath: '/helper' + preLoaderRoute: typeof HelperImport + parentRoute: typeof rootRoute + } + } +} + +// Create and export the route tree + +export const routeTree = rootRoute.addChildren({ IndexRoute, HelperRoute }) + +/* prettier-ignore-end */ + +/* ROUTE_MANIFEST_START +{ + "routes": { + "__root__": { + "filePath": "__root.tsx", + "children": [ + "/", + "/helper" + ] + }, + "/": { + "filePath": "index.tsx" + }, + "/helper": { + "filePath": "helper.tsx" + } + } +} +ROUTE_MANIFEST_END */ diff --git a/src/router.ts b/src/router.ts new file mode 100644 index 0000000..9ba1800 --- /dev/null +++ b/src/router.ts @@ -0,0 +1,17 @@ +import { createRouter } from '@tanstack/react-router' +import { routeTree } from './routeTree.gen' + + +const router = createRouter({ + routeTree, + basepath: '/better-wordle', + trailingSlash: 'never', +}) + +declare module '@tanstack/react-router' { + interface Register { + router: typeof router + } +} + +export default router \ No newline at end of file diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx new file mode 100644 index 0000000..af39d21 --- /dev/null +++ b/src/routes/__root.tsx @@ -0,0 +1,42 @@ +import { Box, Burger, useComputedColorScheme } from '@mantine/core' +import { useDisclosure } from '@mantine/hooks' +import { Outlet, createRootRoute } from '@tanstack/react-router' +import { TanStackRouterDevtools } from '@tanstack/router-devtools' +import { Helmet } from 'react-helmet' + +import { Sidebar } from '@/components' + +export const Route = createRootRoute({ + component: () => { + const colorScheme = useComputedColorScheme() + const [isSidebarOpened, { toggle: toggleSidebar, close: closeSidebar }] = useDisclosure(false) + + return ( + <> + + + + + + + + + + + + + + ) + }, +}) diff --git a/src/routes/helper.tsx b/src/routes/helper.tsx new file mode 100644 index 0000000..38befc2 --- /dev/null +++ b/src/routes/helper.tsx @@ -0,0 +1,14 @@ +import { Center } from '@mantine/core' +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/helper')({ + component: HelperPage, +}) + +function HelperPage() { + return ( +

    +

    TBD

    +
    + ) +} diff --git a/src/App.module.scss b/src/routes/index.module.scss similarity index 100% rename from src/App.module.scss rename to src/routes/index.module.scss diff --git a/src/routes/index.tsx b/src/routes/index.tsx new file mode 100644 index 0000000..1229f26 --- /dev/null +++ b/src/routes/index.tsx @@ -0,0 +1,25 @@ +import { Box, Stack } from '@mantine/core' +import { useMediaQuery } from '@mantine/hooks' +import { createFileRoute } from '@tanstack/react-router' + +import { FloatingKeyboard, WordsGuesser } from '@/components' + +import classes from './index.module.scss' + +export const Route = createFileRoute('/')({ + component: BetterWordlePage, +}) + +function BetterWordlePage() { + const isXs = useMediaQuery('(max-width: 400px)') + + return ( + + + + + + + + ) +} diff --git a/src/theme.ts b/src/theme.ts new file mode 100644 index 0000000..7dc8fb1 --- /dev/null +++ b/src/theme.ts @@ -0,0 +1,44 @@ +import { CSSVariablesResolver, createTheme, localStorageColorSchemeManager } from '@mantine/core' + + +const colorSchemeManager = localStorageColorSchemeManager({ + key: 'better-wordle-color-scheme', +}) + +const cssResolver: CSSVariablesResolver = (theme) => ({ + variables: { + '--color-letter-state-perfect': theme.colors.green[9], + '--color-letter-state-correct': theme.colors.yellow[9], + '--color-letter-state-incorrect': theme.colors.gray[8], + '--color-letter-state-incorrect-light': 'var(--mantine-color-dimmed)', + }, + + light: { + '--mantine-color-body': theme.colors.gray[1], + '--color-letter-state-incorrect': theme.colors.gray[7], + '--color-letter-filled-border': 'color-mix(in srgb, var(--mantine-color-default-border), #000 20%)', + '--color-letter-selected': theme.colors.gray[3], + }, + + dark: { + '--color-letter-filled-border': 'color-mix(in srgb, var(--mantine-color-default-border), #fff 20%)', + '--color-letter-selected': theme.colors.gray[7], + }, +}) + +const theme = createTheme({ + components: { + Code: { + defaultProps: { + bg: 'gray', + c: 'var(--mantine-primary-color-contrast)', + } + } + } +}) + +export { + colorSchemeManager, + cssResolver, + theme +} diff --git a/vite.config.ts b/vite.config.ts index 2ebdb36..2421d67 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,11 +1,13 @@ +import { TanStackRouterVite } from '@tanstack/router-plugin/vite' import react from '@vitejs/plugin-react-swc' import path from 'path' import { defineConfig } from 'vite' import svgr from "vite-plugin-svgr" + // https://vitejs.dev/config/ export default defineConfig({ - base: '/better-wordle/', + base: '/better-wordle', resolve: { alias: { '@': path.resolve(__dirname, './src'), @@ -17,6 +19,7 @@ export default defineConfig({ }, plugins: [ react(), + TanStackRouterVite(), svgr(), ], })