Skip to content

Commit

Permalink
fix(profile): remove userContext
Browse files Browse the repository at this point in the history
  • Loading branch information
nullchilly committed Dec 28, 2023
1 parent 9e962f5 commit d402251
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import PlayBotPoster from "@/components/icons/PlayBotPoster";
import PlayHumanPoster from "@/components/icons/PlayHumanPoster";
import PlayPuzzlePoster from "@/components/icons/PlayPuzzlePoster";
import ModalPlayBot from "@/components/Modal/ModalPlayBot";
import {withUserContext} from "@/context/UserContext";

const Home = () => {
const [isModalPlayBotOpen, setIsModalPlayBotOpen] = React.useState(false);
Expand Down
2 changes: 1 addition & 1 deletion src/app/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FastChessLogo from "@/components/icons/FastChessLogo";
import SlowChessLogo from "@/components/icons/SlowChessLogo";
import PuzzleLogo from "@/components/icons/PuzzleLogo";
import Star from "@/components/icons/Star";
import {UserContext, withUserContext} from "@/context/UserContext";
import {UserContext} from "@/context/UserContext";
import {useContext, useEffect} from "react";
import {useRouter} from "next/navigation";

Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { MenuProps } from "antd";
import Link from "next/link";
import ModalPlayBot from "../Modal/ModalPlayBot";
import Icon, {BulbOutlined, SettingOutlined} from "@ant-design/icons";
import {UserContext, withUserContext} from "@/context/UserContext";
import {UserContext} from "@/context/UserContext";

type MenuItem = Required<MenuProps>["items"][number];

Expand Down
12 changes: 1 addition & 11 deletions src/context/UserContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,4 @@ const UserProvider: React.FC<Props> = (props) => {
)
}

function withUserContext<T extends {}> (Component: ComponentType<T>, token: string) {
return (props: T) => {
return (
<UserProvider>
<Component {...props}/>
</UserProvider>
)
}
}

export {withUserContext, UserContext, UserProvider}
export {UserContext, UserProvider}

0 comments on commit d402251

Please sign in to comment.