Skip to content

Commit

Permalink
update to react-router v7
Browse files Browse the repository at this point in the history
  • Loading branch information
AmruthPillai committed Jan 12, 2025
1 parent db6e7a7 commit 7fb0226
Show file tree
Hide file tree
Showing 45 changed files with 112 additions and 106 deletions.
7 changes: 0 additions & 7 deletions apps/artboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,5 @@

<!-- Phosphor Icons -->
<script src="https://unpkg.com/@phosphor-icons/web"></script>

<!-- Simple Icons -->
<link
type="text/css"
rel="stylesheet"
href="https://unpkg.com/simple-icons-font@v14/font/simple-icons.min.css"
/>
</body>
</html>
6 changes: 2 additions & 4 deletions apps/artboard/src/components/brand-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { cn } from "@reactive-resume/utils";

type BrandIconProps = {
slug: string;
};
Expand All @@ -8,12 +6,12 @@ export const BrandIcon = ({ slug }: BrandIconProps) => {
if (slug === "linkedin") {
return (
<img
alt="LinkedIn"
alt="linkedin"
className="size-4"
src={`${window.location.origin}/support-logos/linkedin.svg`}
/>
);
}

return <i className={cn("si si--color text-[1rem]", `si-${slug}`)} />;
return <img alt={slug} className="size-4" src={`https://cdn.simpleicons.org/${slug}`} />;
};
2 changes: 1 addition & 1 deletion apps/artboard/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StrictMode } from "react";
import * as ReactDOM from "react-dom/client";
import { RouterProvider } from "react-router-dom";
import { RouterProvider } from "react-router";

import { router } from "./router";

Expand Down
2 changes: 1 addition & 1 deletion apps/artboard/src/pages/artboard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useMemo } from "react";
import { Outlet } from "react-router-dom";
import { Outlet } from "react-router";
import webfontloader from "webfontloader";

import { useArtboardStore } from "../store/artboard";
Expand Down
2 changes: 1 addition & 1 deletion apps/artboard/src/providers/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect } from "react";
import { Outlet } from "react-router-dom";
import { Outlet } from "react-router";

import { useArtboardStore } from "../store/artboard";

Expand Down
4 changes: 2 additions & 2 deletions apps/artboard/src/router/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createBrowserRouter, createRoutesFromChildren, Route } from "react-router-dom";
import { createBrowserRouter, createRoutesFromChildren, Route } from "react-router";

import { ArtboardPage } from "../pages/artboard";
import { BuilderLayout } from "../pages/builder";
import { PreviewLayout } from "../pages/preview";
import { Providers } from "../providers";

export const routes = createRoutesFromChildren(
<Route element={<Providers />}>
<Route element={<Providers />} hydrateFallbackElement={<div>Loading...</div>}>
<Route path="artboard" element={<ArtboardPage />}>
<Route path="builder" element={<BuilderLayout />} />
<Route path="preview" element={<PreviewLayout />} />
Expand Down
7 changes: 0 additions & 7 deletions apps/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,5 @@

<!-- Phosphor Icons -->
<script src="https://unpkg.com/@phosphor-icons/web"></script>

<!-- Simple Icons -->
<link
type="text/css"
rel="stylesheet"
href="https://unpkg.com/simple-icons-font@v14/font/simple-icons.min.css"
/>
</body>
</html>
4 changes: 2 additions & 2 deletions apps/client/src/components/user-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
DropdownMenuTrigger,
KeyboardShortcut,
} from "@reactive-resume/ui";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";

import { useLogout } from "../services/auth";

Expand All @@ -26,7 +26,7 @@ export const UserOptions = ({ children }: Props) => {
<DropdownMenuContent side="top" align="start" className="w-48">
<DropdownMenuItem
onClick={() => {
navigate("/dashboard/settings");
void navigate("/dashboard/settings");
}}
>
{t`Settings`}
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/libs/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { t } from "@lingui/macro";
import { deepSearchAndParseDates, ErrorMessage } from "@reactive-resume/utils";
import _axios from "axios";
import createAuthRefreshInterceptor from "axios-auth-refresh";
import { redirect } from "react-router-dom";
import { redirect } from "react-router";

import { refreshToken } from "@/client/services/auth";

Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StrictMode } from "react";
import * as ReactDOM from "react-dom/client";
import { RouterProvider } from "react-router-dom";
import { RouterProvider } from "react-router";

import { router } from "./router";

Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/pages/auth/backup-otp/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { useRef } from "react";
import { Helmet } from "react-helmet-async";
import { useForm } from "react-hook-form";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";
import { z } from "zod";

import { useBackupOtp } from "@/client/services/auth";
Expand All @@ -39,7 +39,7 @@ export const BackupOtpPage = () => {
try {
await backupOtp(data);

navigate("/dashboard");
void navigate("/dashboard");
} catch {
form.reset();
}
Expand Down Expand Up @@ -92,7 +92,7 @@ export const BackupOtpPage = () => {
variant="link"
className="px-5"
onClick={() => {
navigate(-1);
void navigate(-1);
}}
>
<ArrowLeft size={14} className="mr-2" />
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/pages/auth/forgot-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { useState } from "react";
import { Helmet } from "react-helmet-async";
import { useForm } from "react-hook-form";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";
import { z } from "zod";

import { useForgotPassword } from "@/client/services/auth";
Expand Down Expand Up @@ -93,7 +93,7 @@ export const ForgotPasswordPage = () => {
variant="link"
className="px-5"
onClick={() => {
navigate(-1);
void navigate(-1);
}}
>
<ArrowLeft size={14} className="mr-2" />
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/auth/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { t } from "@lingui/macro";
import { cn } from "@reactive-resume/utils";
import { useMemo } from "react";
import { Link, matchRoutes, Outlet, useLocation } from "react-router-dom";
import { Link, matchRoutes, Outlet, useLocation } from "react-router";

import { LocaleSwitch } from "@/client/components/locale-switch";
import { Logo } from "@/client/components/logo";
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/auth/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { cn } from "@reactive-resume/utils";
import { useRef } from "react";
import { Helmet } from "react-helmet-async";
import { useForm } from "react-hook-form";
import { Link } from "react-router-dom";
import { Link } from "react-router";
import { z } from "zod";

import { useLogin } from "@/client/services/auth";
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/pages/auth/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { cn } from "@reactive-resume/utils";
import { useRef } from "react";
import { Helmet } from "react-helmet-async";
import { useForm } from "react-hook-form";
import { Link, useNavigate } from "react-router-dom";
import { Link, useNavigate } from "react-router";
import { z } from "zod";

import { useRegister } from "@/client/services/auth";
Expand Down Expand Up @@ -51,7 +51,7 @@ export const RegisterPage = () => {
try {
await register(data);

navigate("/auth/verify-email");
void navigate("/auth/verify-email");
} catch {
form.reset();
}
Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/pages/auth/reset-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { useEffect, useRef } from "react";
import { Helmet } from "react-helmet-async";
import { useForm } from "react-hook-form";
import { useNavigate, useSearchParams } from "react-router-dom";
import { useNavigate, useSearchParams } from "react-router";
import { z } from "zod";

import { useResetPassword } from "@/client/services/auth";
Expand All @@ -42,15 +42,15 @@ export const ResetPasswordPage = () => {
try {
await resetPassword(data);

navigate("/auth/login");
void navigate("/auth/login");
} catch {
form.reset();
}
};

// Redirect the user to the forgot password page if the token is not present.
useEffect(() => {
if (!token) navigate("/auth/forgot-password");
if (!token) void navigate("/auth/forgot-password");
}, [token, navigate]);

return (
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/pages/auth/verify-email/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ArrowRight, Info, SealCheck } from "@phosphor-icons/react";
import { Alert, AlertDescription, AlertTitle, Button } from "@reactive-resume/ui";
import { useEffect } from "react";
import { Helmet } from "react-helmet-async";
import { Link, useNavigate, useSearchParams } from "react-router-dom";
import { Link, useNavigate, useSearchParams } from "react-router";

import { useToast } from "@/client/hooks/use-toast";
import { queryClient } from "@/client/libs/query-client";
Expand All @@ -28,7 +28,7 @@ export const VerifyEmailPage = () => {
title: t`Your email address has been verified successfully.`,
});

navigate("/dashboard/resumes", { replace: true });
void navigate("/dashboard/resumes", { replace: true });
};

if (!token) return;
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/pages/auth/verify-otp/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { useRef } from "react";
import { Helmet } from "react-helmet-async";
import { useForm } from "react-hook-form";
import { Link, useNavigate } from "react-router-dom";
import { Link, useNavigate } from "react-router";
import { z } from "zod";

import { useVerifyOtp } from "@/client/services/auth";
Expand All @@ -39,7 +39,7 @@ export const VerifyOtpPage = () => {
try {
await verifyOtp(data);

navigate("/dashboard");
void navigate("/dashboard");
} catch {
form.reset();
}
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/builder/_components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { t } from "@lingui/macro";
import { HouseSimple, Lock, SidebarSimple } from "@phosphor-icons/react";
import { Button, Tooltip } from "@reactive-resume/ui";
import { cn } from "@reactive-resume/utils";
import { Link } from "react-router-dom";
import { Link } from "react-router";

import { useBuilderStore } from "@/client/stores/builder";
import { useResumeStore } from "@/client/stores/resume";
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/builder/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useBreakpoint } from "@reactive-resume/hooks";
import { Panel, PanelGroup, PanelResizeHandle, Sheet, SheetContent } from "@reactive-resume/ui";
import { cn } from "@reactive-resume/utils";
import { Outlet } from "react-router-dom";
import { Outlet } from "react-router";

import { useBuilderStore } from "@/client/stores/builder";

Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/builder/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { t } from "@lingui/macro";
import { ResumeDto } from "@reactive-resume/dto";
import { useCallback, useEffect } from "react";
import { Helmet } from "react-helmet-async";
import { LoaderFunction, redirect } from "react-router-dom";
import { LoaderFunction, redirect } from "react-router";

import { queryClient } from "@/client/libs/query-client";
import { findResumeById } from "@/client/services/resume";
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/builder/sidebars/left/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from "@reactive-resume/schema";
import { Button, ScrollArea, Separator } from "@reactive-resume/ui";
import { Fragment, useRef } from "react";
import { Link } from "react-router-dom";
import { Link } from "react-router";

import { Icon } from "@/client/components/icon";
import { UserAvatar } from "@/client/components/user-avatar";
Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/pages/dashboard/_components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FadersHorizontal, ReadCvLogo } from "@phosphor-icons/react";
import { Button, KeyboardShortcut, Separator } from "@reactive-resume/ui";
import { cn } from "@reactive-resume/utils";
import { motion } from "framer-motion";
import { Link, useLocation, useNavigate } from "react-router-dom";
import { Link, useLocation, useNavigate } from "react-router";
import useKeyboardShortcut from "use-keyboard-shortcut";

import { Copyright } from "@/client/components/copyright";
Expand Down Expand Up @@ -71,12 +71,12 @@ export const Sidebar = ({ setOpen }: SidebarProps) => {
const navigate = useNavigate();

useKeyboardShortcut(["shift", "r"], () => {
navigate("/dashboard/resumes");
void navigate("/dashboard/resumes");
setOpen?.(false);
});

useKeyboardShortcut(["shift", "s"], () => {
navigate("/dashboard/settings");
void navigate("/dashboard/settings");
setOpen?.(false);
});

Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/pages/dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SidebarSimple } from "@phosphor-icons/react";
import { Button, Sheet, SheetClose, SheetContent, SheetTrigger } from "@reactive-resume/ui";
import { motion } from "framer-motion";
import { useState } from "react";
import { Outlet } from "react-router-dom";
import { Outlet } from "react-router";

import { Sidebar } from "./_components/sidebar";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { useCreateResume, useDeleteResume, useUpdateResume } from "@/client/serv
import { useImportResume } from "@/client/services/resume/import";
import { useDialog } from "@/client/stores/dialog";

const formSchema = createResumeSchema.extend({ id: idSchema.optional() });
const formSchema = createResumeSchema.extend({ id: idSchema.optional(), slug: z.string() });

type FormValues = z.infer<typeof formSchema>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { cn } from "@reactive-resume/utils";
import dayjs from "dayjs";
import { AnimatePresence, motion } from "framer-motion";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";

import { useDialog } from "@/client/stores/dialog";

Expand All @@ -37,7 +37,7 @@ export const ResumeCard = ({ resume }: Props) => {
const lastUpdated = dayjs().to(resume.updatedAt);

const onOpen = () => {
navigate(`/builder/${resume.id}`);
void navigate(`/builder/${resume.id}`);
};

const onUpdate = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
DropdownMenuTrigger,
} from "@reactive-resume/ui";
import dayjs from "dayjs";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";

import { useDialog } from "@/client/stores/dialog";

Expand All @@ -40,7 +40,7 @@ export const ResumeListItem = ({ resume }: Props) => {
const lastUpdated = dayjs().to(resume.updatedAt);

const onOpen = () => {
navigate(`/builder/${resume.id}`);
void navigate(`/builder/${resume.id}`);
};

const onUpdate = () => {
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/pages/dashboard/settings/_sections/danger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Input,
} from "@reactive-resume/ui";
import { useForm } from "react-hook-form";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";
import { useCounter } from "usehooks-ts";
import { z } from "zod";

Expand Down Expand Up @@ -52,7 +52,7 @@ export const DangerZoneSettings = () => {
title: t`Your account and all your data has been deleted successfully. Goodbye!`,
});

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

Expand Down
Loading

0 comments on commit 7fb0226

Please sign in to comment.