diff --git a/package.json b/package.json index 326119b..bfcf27e 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-hot-toast": "^2.4.1", - "tiny-server-timing": "^0.1.5", - "zustand": "^4.5.0" + "tiny-server-timing": "^0.1.5" }, "devDependencies": { "@types/js-cookie": "^3.0.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e8991fe..940b879 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,9 +50,6 @@ dependencies: tiny-server-timing: specifier: ^0.1.5 version: 0.1.5 - zustand: - specifier: ^4.5.0 - version: 4.5.0(@types/react@18.2.48)(react@18.2.0) devDependencies: '@types/js-cookie': @@ -834,6 +831,7 @@ packages: /@types/prop-types@15.7.5: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} + dev: true /@types/react@18.2.48: resolution: {integrity: sha512-qboRCl6Ie70DQQG9hhNREz81jqC1cs9EVNcjQ1AU+jH6NFfSAhVVbrrY/+nSF+Bsk4AOwm9Qa61InvMCyV+H3w==} @@ -841,9 +839,11 @@ packages: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.3 csstype: 3.1.3 + dev: true /@types/scheduler@0.16.3: resolution: {integrity: sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==} + dev: true /@types/semver@7.3.12: resolution: {integrity: sha512-WwA1MW0++RfXmCr12xeYOOC5baSC9mSb0ZqCquFzKhcoF4TvHu5MKOuXsncgZcpVFhB1pXd5hZmM0ryAoCp12A==} @@ -4467,14 +4467,6 @@ packages: punycode: 2.3.0 dev: true - /use-sync-external-store@1.2.0(react@18.2.0): - resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - dependencies: - react: 18.2.0 - dev: false - /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: true @@ -4650,23 +4642,3 @@ packages: /yoga-wasm-web@0.3.3: resolution: {integrity: sha512-N+d4UJSJbt/R3wqY7Coqs5pcV0aUj2j9IaQ3rNj9bVCLld8tTGKRa2USARjnvZJWVx1NDmQev8EknoczaOQDOA==} dev: false - - /zustand@4.5.0(@types/react@18.2.48)(react@18.2.0): - resolution: {integrity: sha512-zlVFqS5TQ21nwijjhJlx4f9iGrXSL0o/+Dpy4txAP22miJ8Ti6c1Ol1RLNN98BMib83lmDH/2KmLwaNXpjrO1A==} - engines: {node: '>=12.7.0'} - peerDependencies: - '@types/react': '>=16.8' - immer: '>=9.0.6' - react: '>=16.8' - peerDependenciesMeta: - '@types/react': - optional: true - immer: - optional: true - react: - optional: true - dependencies: - '@types/react': 18.2.48 - react: 18.2.0 - use-sync-external-store: 1.2.0(react@18.2.0) - dev: false diff --git a/src/components/GitHubTokenModal.tsx b/src/components/GitHubTokenModal.tsx deleted file mode 100644 index 43ff756..0000000 --- a/src/components/GitHubTokenModal.tsx +++ /dev/null @@ -1,112 +0,0 @@ -import { useTokenStore } from "@/stores/useTokenStore"; -import { Dialog } from "@headlessui/react"; -import { XIcon } from "@heroicons/react/outline"; -import { FormEvent, Fragment, useRef, useState } from "react"; -import { Button } from "./Button"; -import { Input } from "./Input"; - -interface Props { - onClose: () => void; -} - -export function GitHubTokenModal({ onClose }: Props) { - const { token, setToken, removeToken } = useTokenStore(); - const [newToken, setNewToken] = useState(token); - const closeButtonRef = useRef(null); - - const handleSubmit = (event: FormEvent) => { - event.preventDefault(); - - if (newToken) { - setToken(newToken); - } else { - removeToken(); - } - - onClose(); - }; - - return ( - -
- - -
-
- - Add GitHub Access Token - - -
- -

- You can provide{" "} - - personal access token - {" "} - to increase{" "} - - GitHub API rate limit. - -

- -

- If you don't have one you need to{" "} - - create it - {" "} - first. No personal scopes are required. -

- -
- - -
- setNewToken(e.target.value)} - /> - - -
-
-
-
-
- ); -} diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index fecf454..47f38d0 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -14,10 +14,6 @@ import { ReactNode, useState } from "react"; import { FirefoxIcon } from "../icons/FirefoxIcon"; import { track } from "@vercel/analytics"; -const GitHubTokenModal = dynamic(() => - import("../GitHubTokenModal").then(mod => mod.GitHubTokenModal), -); - type Props = { className?: string; }; @@ -54,20 +50,6 @@ export const Header = ({ className }: Props) => { {theme === Theme.light ? : } - {/* */} - {/* */} - {/* {isTokenModalOpen && ( */} - {/* setIsTokenModalOpen(false)} */} - {/* /> */} - {/* )} */} - {/* */} { - const { token } = useTokenStore.getState(); - - if (!token) { - return {}; - } - - return { - Authorization: `token ${token}`, - }; -} - export function getRawGitHubUrl({ owner, repo, diff --git a/src/stores/useTokenStore.ts b/src/stores/useTokenStore.ts deleted file mode 100644 index e47aa4e..0000000 --- a/src/stores/useTokenStore.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { create } from "zustand"; -import { persist } from "zustand/middleware"; - -type Store = { - token?: string; - setToken: (token: string) => void; - removeToken: () => void; -}; - -export const useTokenStore = create()( - persist( - set => ({ - token: undefined, - setToken: (token: string) => set({ token }), - removeToken: () => set({ token: undefined }), - }), - { name: "ghloc.token" }, - ), -);