Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy_devresults-xdev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version: "18.x"
node-version: "20.x"

- uses: pnpm/action-setup@v3
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ test-results
typings
yarn-debug.log*
yarn-error.log*
.copilotcontext
.copilotcontext
.react-router/
2 changes: 1 addition & 1 deletion app/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRouteError } from "@remix-run/react"
import { useRouteError } from "react-router"
import { ErrorScreen } from "ui/ErrorScreen"

export function ErrorBoundary() {
Expand Down
6 changes: 3 additions & 3 deletions app/context/Auth/AuthContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Repo } from "@automerge/automerge-repo"
import { RepoContext } from "@automerge/automerge-repo-react-hooks"
import type * as Auth from "@localfirst/auth"
import { type AuthProvider } from "@localfirst/auth-provider-automerge-repo"
import { useNavigate } from "@remix-run/react"
import { useNavigate } from "react-router"
import { initializeAuthRepo } from "context/Auth/initializeAuthRepo"
import { useLocalState } from "hooks/useLocalState"
import { useSignOut } from "hooks/useSignOut"
Expand Down Expand Up @@ -42,7 +42,7 @@ export function AuthContextProvider({ children }: { children: React.ReactNode })
switch (scenario) {
case "FIRST_LOAD": {
// start the auth flow
navigate("/auth/begin")
void navigate("/auth/begin")
break
}

Expand All @@ -66,7 +66,7 @@ export function AuthContextProvider({ children }: { children: React.ReactNode })
const signOutIfNotAMember = (team: Auth.Team) => {
if (user && team.memberWasRemoved(user.userId)) {
signOut()
navigate("/")
void navigate("/")
}
}

Expand Down
7 changes: 0 additions & 7 deletions app/entry.client.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions app/entry.server.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions app/hooks/useNavigationHotkey.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useNavigate } from "@remix-run/react"
import { useNavigate } from "react-router"
import { useHotkeys } from "react-hotkeys-hook"

export function useNavigationHotkey(keys: string, path: string) {
const navigate = useNavigate()
useHotkeys(keys, e => {
e.preventDefault()
navigate(path, { relative: "path" })
void navigate(path, { relative: "path" })
})
}
6 changes: 3 additions & 3 deletions app/hooks/useRedirect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ // state is any

import { useLocation, useNavigate } from "@remix-run/react"
import { useLocation, useNavigate } from "react-router"
import { useEffect } from "react"

export function useRedirect({ from, to, condition = true }: Params) {
Expand All @@ -10,11 +10,11 @@ export function useRedirect({ from, to, condition = true }: Params) {
if (!condition) return
if (typeof from === "string" && pathname === from) {
console.log(`redirecting from ${from} to ${to}`)
navigate(to, { state })
void navigate(to, { state })
} else if (from instanceof RegExp && from.test(pathname)) {
const newTo = pathname.replace(from, to)
console.log(`redirecting from ${from} to ${newTo}`)
navigate(newTo, { state })
void navigate(newTo, { state })
}
}, [pathname])
}
Expand Down
2 changes: 1 addition & 1 deletion app/hooks/useSelectedWeek.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LocalDate } from "@js-joda/core"
import { useParams } from "@remix-run/react"
import { useParams } from "react-router"
import { getWeek } from "lib/getWeek"

export function useSelectedWeek() {
Expand Down
2 changes: 1 addition & 1 deletion app/hooks/useSelectedYear.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useParams } from "react-router-dom"
import { useParams } from "react-router"
import { getCurrentYear } from "lib/getCurrentYear"
import { yearFromString } from "lib/yearFromString"

Expand Down
16 changes: 0 additions & 16 deletions app/index.html

This file was deleted.

25 changes: 19 additions & 6 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "@ibm/plex/css/ibm-plex.css"
import { Links, Outlet, Scripts, ScrollRestoration } from "@remix-run/react"
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "react-router"
import { Loading } from "ui/Loading"
import "./index.css"

Expand All @@ -14,11 +14,24 @@ export default function App() {

export function Layout({ children }: { children: React.ReactNode }) {
return (
<>
{children}
<Scripts />
<ScrollRestoration />
</>
<html lang="en" className="h-full bg-white">
<head>
<meta name="msapplication-TileColor" content="#000000" />
<meta name="theme-color" content="#000000" />
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/local-maskable-192x192.png" />
<link rel="mask-icon" href="/favicon.ico" color="#000000" />
<Meta />
<Links />
</head>
<body className="h-full">
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
)
}

Expand Down
16 changes: 16 additions & 0 deletions app/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { remixRoutesOptionAdapter } from "@react-router/remix-routes-option-adapter"
import { flatRoutes } from "remix-flat-routes"

const routes = remixRoutesOptionAdapter(defineRoutes => {
return flatRoutes("routes", defineRoutes, {
ignoredRouteFiles: ["**/.*"], // Ignore dot files (like .DS_Store)
// appDir: 'app',
// routeDir: 'routes',
// basePath: '/',
// paramPrefixChar: '$',
// nestedDirectoryChar: '+',
// routeRegex: /((\${nestedDirectoryChar}[\/\\][^\/\\:?*]+)|[\/\\]((index|route|layout|page)|(_[^\/\\:?*]+)|([^\/\\:?*]+\.route)))\.(ts|tsx|js|jsx|md|mdx)$$/,
})
})

export default routes
2 changes: 1 addition & 1 deletion app/routes/_private+/_private.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "@remix-run/react"
import { Outlet } from "react-router"
import { AuthContextProvider } from "context/Auth/AuthContextProvider"
import { DatabaseContextProvider } from "context/Database/DatabaseContextProvider"
import { useTeam } from "hooks/useTeam"
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_private+/devtools+/_devtools.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "react-router-dom"
import { Outlet } from "react-router"
import { PageLayout } from "ui/layouts/PageLayout"
import { SecondaryNav } from "ui/SecondaryNav"

Expand Down
2 changes: 1 addition & 1 deletion app/routes/_private+/dones+/_dones.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "@remix-run/react"
import { Outlet } from "react-router"
import { useRedirect } from "hooks/useRedirect"
import { getSunday } from "lib/getSunday"

Expand Down
2 changes: 1 addition & 1 deletion app/routes/_private+/hours+/_hours.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "@remix-run/react"
import { Outlet } from "react-router"
import { useRedirect } from "hooks/useRedirect"
import { getCurrentYear } from "lib/getCurrentYear"

Expand Down
2 changes: 1 addition & 1 deletion app/routes/_private+/myweek+/_myweek.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "@remix-run/react"
import { Outlet } from "react-router"
import { useRedirect } from "hooks/useRedirect"
import { getSunday } from "lib/getSunday"

Expand Down
2 changes: 1 addition & 1 deletion app/routes/_private+/settings+/_settings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "react-router-dom"
import { Outlet } from "react-router"
import { SecondaryNav } from "ui/SecondaryNav"
import { PageLayout } from "ui/layouts/PageLayout"

Expand Down
2 changes: 1 addition & 1 deletion app/routes/_private+/settings+/devices+/_devices.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTeam } from "hooks/useTeam"
import { Outlet } from "react-router-dom"
import { Outlet } from "react-router"
import { Devices } from "ui/Devices"

export default function DevicesPage() {
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_private+/settings+/devices+/invite.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useNavigate } from "@remix-run/react"
import { useNavigate } from "react-router"
import { useDeviceInvitationGenerator } from "hooks/useDeviceInvitationGenerator"
import { useTeam } from "hooks/useTeam"
import { InviteDeviceDialog } from "ui/InviteDeviceDialog"
Expand All @@ -15,7 +15,7 @@ export default function DevicesInvitePage() {
return (
<InviteDeviceDialog
defaultOpen={true}
onClose={() => navigate("..")}
onClose={async () => navigate("..")}
invitationCode={invitationCode}
/>
)
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_private+/team+/_team.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "react-router-dom"
import { Outlet } from "react-router"
import { SecondaryNav } from "ui/SecondaryNav"
import { PageLayout } from "ui/layouts/PageLayout"

Expand Down
2 changes: 1 addition & 1 deletion app/routes/_private+/team+/members+/_members.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTeam } from "hooks/useTeam"
import { Outlet } from "react-router-dom"
import { Outlet } from "react-router"
import { Members } from "ui/Members"

export default function MembersPage() {
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_private+/team+/members+/invite.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useDatabase } from "hooks/useDatabase"
import { useMemberInvitationGenerator } from "hooks/useMemberInvitationGenerator"
import { useTeam } from "hooks/useTeam"
import { useLocation, useNavigate } from "react-router-dom"
import { useLocation, useNavigate } from "react-router"
import { type ContactId } from "schema/Contact"
import { InviteMemberDialog } from "ui/InviteMemberDialog"

Expand All @@ -26,7 +26,7 @@ export default function MembersInvitePage() {
return (
<InviteMemberDialog
defaultOpen={true}
onClose={() => navigate("..")}
onClose={async () => navigate("..")}
contact={contact}
invitationCode={invitationCode}
/>
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_private+/team+/members+/remove.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useDatabase } from "hooks/useDatabase"
import { useTeam } from "hooks/useTeam"
import { useLocation, useNavigate } from "react-router-dom"
import { useLocation, useNavigate } from "react-router"
import type { ContactId } from "schema/Contact"
import { RemoveMemberDialog } from "ui/RemoveMemberDialog"

Expand All @@ -21,7 +21,7 @@ export default function RemovePage() {
return (
<RemoveMemberDialog
defaultOpen={true}
onClose={() => navigate("..")}
onClose={async () => navigate("..")}
contact={contact}
remove={() => {
team.remove(contact.id)
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_private+/team+/members+/revoke.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useInvitation } from "hooks/useInvitation"
import { useTeam } from "hooks/useTeam"
import { useLocation, useNavigate } from "react-router-dom"
import { useLocation, useNavigate } from "react-router"
import type { ContactId } from "schema/Contact"
import { RevokeInvitationDialog } from "ui/RevokeInvitationDialog"

Expand All @@ -23,7 +23,7 @@ export default function RevokeInvitationPage() {
return (
<RevokeInvitationDialog
defaultOpen={true}
onClose={() => navigate("..")}
onClose={async () => navigate("..")}
contact={contact}
invitation={invitation}
revoke={revoke}
Expand Down
2 changes: 1 addition & 1 deletion app/routes/auth+/_auth.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "react-router-dom"
import { Outlet } from "react-router"
import { CenteredLayout } from "ui/layouts/CenteredLayout"

export default function AuthLayout() {
Expand Down
4 changes: 2 additions & 2 deletions app/routes/auth+/begin.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useNavigate } from "@remix-run/react"
import { useNavigate } from "react-router"
import { useLocalState } from "hooks/useLocalState"
import { UserNameForm } from "ui/UserNameForm"

Expand All @@ -11,7 +11,7 @@ export default function AuthBeginPage() {
userName={userName}
onSubmit={({ n: userName }) => {
update({ userName })
navigate("/auth/setup")
void navigate("/auth/setup")
}}
/>
)
Expand Down
6 changes: 3 additions & 3 deletions app/routes/auth+/setup+/_.create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { createUser } from "@localfirst/auth"
import { getShareId } from "@localfirst/auth-provider-automerge-repo"
import { useNavigate } from "@remix-run/react"
import { useNavigate } from "react-router"
import { createDevice, type UserInfo } from "context/Auth/createDevice"
import { getInitialContacts } from "context/Auth/getInitialContacts"
import { initializeAuthRepo } from "context/Auth/initializeAuthRepo"
Expand All @@ -26,7 +26,7 @@ export default function AuthCreatePage() {
// hooks ↑

if (!userName) {
navigate("/auth/begin")
void navigate("/auth/begin")
return null
}

Expand Down Expand Up @@ -68,7 +68,7 @@ export default function AuthCreatePage() {
update({ user, device, rootDocumentId, shareId })

// Navigate to the app
navigate("/")
void navigate("/")
}}
/>
)
Expand Down
4 changes: 2 additions & 2 deletions app/routes/auth+/setup+/_.join.($code).tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { eventPromise } from "@herbcaudill/eventemitter42"
import * as Auth from "@localfirst/auth"
import { createUser } from "@localfirst/auth"
import { type AuthErrorType } from "@localfirst/auth-provider-automerge-repo"
import { useNavigate, useParams } from "@remix-run/react"
import { useNavigate, useParams } from "react-router"
import { createDevice, type UserInfo } from "context/Auth/createDevice"
import { getRootDocumentIdFromTeam } from "context/Auth/getRootDocumentIdFromTeam"
import { initializeAuthRepo } from "context/Auth/initializeAuthRepo"
Expand Down Expand Up @@ -95,7 +95,7 @@ export default function AuthJoinPage() {
// Save our user info etc. to local storage
update({ user, device, rootDocumentId, shareId })

navigate("/")
void navigate("/")
}

return invitationCodeFromUrl ?
Expand Down
Loading
Loading