Skip to content

Commit 93479de

Browse files
authored
refactor: move stores and hooks directory to lib directory (#27)
This pull request refactor the file system by moving the `stores` and `hooks` directory into `lib` directory. Cleaning the `src` folder and making it less clumped up. ### Changes Made - Moved the following directory to the `lib` directory - `stores` - the directory that holds all our application state - `hooks` - the directory that house all the custom hook that we consume in our `island` (react integrations) - Modifies paths to the newly moved directory across board, affecting the following files.. - src/components/islands/recent-searches.jsx - src/components/islands/search.jsx - src/components/islands/word-editor.jsx - src/layouts/base.astro - src/layouts/word.astro - src/lib/actions/do-auth.js - src/pages/editor/index.astro - src/pages/index.astro 📖
1 parent a71a114 commit 93479de

15 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/components/islands/recent-searches.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect } from "react";
22
import { useStore } from "@nanostores/react";
3-
import { $recentSearches } from "../../stores/search.js";
3+
import { $recentSearches } from "../../lib/stores/search.js";
44

55
/**
66
* @todo implement a default list instead of `null` when no `$recentSearch` is found

src/components/islands/search.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Flexsearch from "flexsearch";
22
import { useEffect, useState } from "react";
33
import { useStore } from "@nanostores/react";
4-
import { $isSearchOpen } from "../../stores/search.js";
5-
import useRouter from "../../hooks/use-router.js";
6-
import useIsMacOS from "../../hooks/use-is-mac-os.js";
7-
import useLockBody from "../../hooks/use-lock-body.js";
8-
import { $addToRecentSearchesFn } from "../../stores/search.js";
4+
import { $isSearchOpen } from "../../lib/stores/search.js";
5+
import useRouter from "../../lib/hooks/use-router.js";
6+
import useIsMacOS from "../../lib/hooks/use-is-mac-os.js";
7+
import useLockBody from "../../lib/hooks/use-lock-body.js";
8+
import { $addToRecentSearchesFn } from "../../lib/stores/search.js";
99

1010
// Create Search Index
1111
const searchIndex = new Flexsearch.Document({

src/components/islands/word-editor.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect } from "react";
22
import Markdown from "react-markdown";
3-
import useWordEditor from "../../hooks/use-word-editor.js";
3+
import useWordEditor from "../../lib/hooks/use-word-editor.js";
44

55
export default function WordEditor({ title = "", content = "" }) {
66
return (

src/layouts/base.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import "@fontsource/inter";
33
import "@fontsource/ibm-plex-mono";
44
import "../base.css";
5-
import { $dictionary } from "../stores/dictionary.js";
5+
import { $dictionary } from "../lib/stores/dictionary.js";
66
77
const { pageTitle, class:list } = Astro.props;
88
const dictionary = await Astro.glob("../pages/browse/*.mdx");

src/layouts/word.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import BaseLayout from "./base.astro";
33
import Navbar from "../components/navbar.astro";
44
import Search from "../components/islands/search.jsx";
5-
import { $dictionary } from "../stores/dictionary.js";
5+
import { $dictionary } from "../lib/stores/dictionary.js";
66
77
const { frontmatter } = Astro.props;
88
---

src/lib/actions/do-auth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import app from "../../lib/octokit/app.js";
1+
import app from "../octokit/app.js";
22
import { decrypt, encrypt } from "../utils/crypto.js";
33
import { GET } from "../../pages/api/github/oauth/authorize.js";
4-
import { resolveCookieExpiryDate } from "../../lib/utils/index.js";
4+
import { resolveCookieExpiryDate } from "../utils/index.js";
55

66
/**
77
* Authentication action with GitHub OAuth

0 commit comments

Comments
 (0)