diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 0000000..d06a803 --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,3 @@ +## 2024-05-24 - Semantic Buttons for Language Switcher +**Learning:** The app's `LanguageSwitcher` used `` tags with `onClick` handlers for interactive elements. This is an accessibility anti-pattern as it lacks keyboard focusability and screen reader semantics. +**Action:** Always verify custom interactive toggles and switchers use semantic ` diff --git a/src/components/ui/GmapsButton.tsx b/src/components/ui/GmapsButton.tsx index 1d7f402..20ab367 100644 --- a/src/components/ui/GmapsButton.tsx +++ b/src/components/ui/GmapsButton.tsx @@ -3,8 +3,8 @@ import {Button} from "@/components/ui/button" import {useT} from "@/i18n/useT" interface Props { - latitude: Number - longitude: Number + latitude: number + longitude: number } export const GmapsButton: React.FC = ({latitude, longitude}) => { diff --git a/src/components/ui/LanguageSwitcher.tsx b/src/components/ui/LanguageSwitcher.tsx index c9e1b52..7627b99 100644 --- a/src/components/ui/LanguageSwitcher.tsx +++ b/src/components/ui/LanguageSwitcher.tsx @@ -8,9 +8,22 @@ export const LanguageSwitcher: React.FC = () => { } return ( -
- handleLanguageChange('en')}>EN / - handleLanguageChange('es')}>ES +
+ + +
) } diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts index 3c90a99..372790e 100644 --- a/src/routeTree.gen.ts +++ b/src/routeTree.gen.ts @@ -10,70 +10,37 @@ import { createFileRoute } from '@tanstack/react-router' -// Import Routes +import { Route as rootRouteImport } from './routes/__root' -import { Route as rootRoute } from './routes/__root' +const IndexLazyRouteImport = createFileRoute('/')() +const NetworkNetworkIdLazyRouteImport = createFileRoute('/network/$networkId')() -// Create Virtual Routes - -const IndexLazyImport = createFileRoute('/')() -const NetworkNetworkIdLazyImport = createFileRoute('/network/$networkId')() - -// Create/Update Routes - -const IndexLazyRoute = IndexLazyImport.update({ +const IndexLazyRoute = IndexLazyRouteImport.update({ id: '/', path: '/', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any).lazy(() => import('./routes/index.lazy').then((d) => d.Route)) - -const NetworkNetworkIdLazyRoute = NetworkNetworkIdLazyImport.update({ +const NetworkNetworkIdLazyRoute = NetworkNetworkIdLazyRouteImport.update({ id: '/network/$networkId', path: '/network/$networkId', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any).lazy(() => import('./routes/network/$networkId.lazy').then((d) => d.Route), ) -// Populate the FileRoutesByPath interface - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexLazyImport - parentRoute: typeof rootRoute - } - '/network/$networkId': { - id: '/network/$networkId' - path: '/network/$networkId' - fullPath: '/network/$networkId' - preLoaderRoute: typeof NetworkNetworkIdLazyImport - parentRoute: typeof rootRoute - } - } -} - -// Create and export the route tree - export interface FileRoutesByFullPath { '/': typeof IndexLazyRoute '/network/$networkId': typeof NetworkNetworkIdLazyRoute } - export interface FileRoutesByTo { '/': typeof IndexLazyRoute '/network/$networkId': typeof NetworkNetworkIdLazyRoute } - export interface FileRoutesById { - __root__: typeof rootRoute + __root__: typeof rootRouteImport '/': typeof IndexLazyRoute '/network/$networkId': typeof NetworkNetworkIdLazyRoute } - export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath fullPaths: '/' | '/network/$networkId' @@ -82,37 +49,34 @@ export interface FileRouteTypes { id: '__root__' | '/' | '/network/$networkId' fileRoutesById: FileRoutesById } - export interface RootRouteChildren { IndexLazyRoute: typeof IndexLazyRoute NetworkNetworkIdLazyRoute: typeof NetworkNetworkIdLazyRoute } +declare module '@tanstack/react-router' { + interface FileRoutesByPath { + '/': { + id: '/' + path: '/' + fullPath: '/' + preLoaderRoute: typeof IndexLazyRouteImport + parentRoute: typeof rootRouteImport + } + '/network/$networkId': { + id: '/network/$networkId' + path: '/network/$networkId' + fullPath: '/network/$networkId' + preLoaderRoute: typeof NetworkNetworkIdLazyRouteImport + parentRoute: typeof rootRouteImport + } + } +} + const rootRouteChildren: RootRouteChildren = { IndexLazyRoute: IndexLazyRoute, NetworkNetworkIdLazyRoute: NetworkNetworkIdLazyRoute, } - -export const routeTree = rootRoute +export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) ._addFileTypes() - -/* ROUTE_MANIFEST_START -{ - "routes": { - "__root__": { - "filePath": "__root.tsx", - "children": [ - "/", - "/network/$networkId" - ] - }, - "/": { - "filePath": "index.lazy.tsx" - }, - "/network/$networkId": { - "filePath": "network/$networkId.lazy.tsx" - } - } -} -ROUTE_MANIFEST_END */