Skip to content

Commit

Permalink
next build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yk committed Nov 25, 2023
1 parent ca7dc79 commit e1769c1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
7 changes: 0 additions & 7 deletions website/src/pages/chat/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import { get } from "src/lib/api";
import { ModelInfo, PluginEntry } from "src/types/Chat";
export { getServerSideProps } from "src/lib/defaultServerSideProps";
import useSWRImmutable from "swr/immutable";
import { useBrowserConfig } from "src/hooks/env/BrowserEnv";

const Chat = () => {
const { BYE } = useBrowserConfig();
const router = useRouter();
const { query } = router;
const id = query.id as string;
Expand All @@ -23,11 +21,6 @@ const Chat = () => {
keepPreviousData: true,
});

if (BYE) {
router.push("/bye");
return null;
}

return (
<>
<Head>
Expand Down
10 changes: 10 additions & 0 deletions website/src/pages/chat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import Head from "next/head";
import { useRouter } from "next/router";
import { useTranslation } from "next-i18next";
import React from "react";
import { ChatListBase } from "src/components/Chat/ChatListBase";
import { DashboardLayout } from "src/components/Layout";
export { getStaticProps } from "src/lib/defaultServerSideProps";
import { useBrowserConfig } from "src/hooks/env/BrowserEnv";

const ChatList = () => {
const { t } = useTranslation();
const { BYE } = useBrowserConfig();
const router = useRouter();

React.useEffect(() => {
if (BYE) {
router.push("/bye");
}
}, [router, BYE]);

return (
<>
Expand Down
6 changes: 5 additions & 1 deletion website/src/pages/contributors.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { useRouter } from "next/router";
import { useEffect } from "react";

const ContributorsPage = () => {
const router = useRouter();
router.push("https://ykilcher.com/oa-contributors");
useEffect(() => {
router.push("https://ykilcher.com/oa-contributors");
}, [router]);

return null;
};

Expand Down
13 changes: 7 additions & 6 deletions website/src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Button, Card, CardBody, Flex, Heading } from "@chakra-ui/react";
import Head from "next/head";
import { useRouter } from "next/router";
import { useTranslation } from "next-i18next";
import { useMemo } from "react";
import { useEffect, useMemo } from "react";
import { LeaderboardWidget, TaskOption, WelcomeCard } from "src/components/Dashboard";
import { DashboardLayout } from "src/components/Layout";
import { get } from "src/lib/api";
Expand All @@ -14,7 +15,6 @@ import { useBrowserConfig } from "src/hooks/env/BrowserEnv";
import { useCurrentLocale } from "src/hooks/locale/useCurrentLocale";
import { API_ROUTES } from "src/lib/routes";
import useSWR from "swr";
import { useRouter } from "next/router";

const Dashboard = () => {
const { t } = useTranslation(["dashboard", "common", "tasks"]);
Expand Down Expand Up @@ -57,10 +57,11 @@ const Dashboard = () => {
},
};

if (BYE) {
router.push("/bye");
return null;
}
useEffect(() => {
if (BYE) {
router.push("/bye");
}
}, [BYE, router]);

return (
<>
Expand Down
11 changes: 5 additions & 6 deletions website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ const Home = () => {
const { status } = useSession();
const { t } = useTranslation();
useEffect(() => {
if (BYE) {
router.push("/bye");
}

if (status === "authenticated") {
router.push("/dashboard");
}
}, [router, status]);

if (BYE) {
router.push("/bye");
return null;
}
}, [router, status, BYE]);

return (
<>
Expand Down

0 comments on commit e1769c1

Please sign in to comment.