From 8ac4ff246f0c47e08f62cdc04fb0b497cd2ebf70 Mon Sep 17 00:00:00 2001 From: Olabode Lawal-Shittabey Date: Wed, 29 May 2024 17:23:18 +0100 Subject: [PATCH] chore: implement feedback/nits from beta testing (#66) ### Description This PR commits some fixes to bugs and improvement suggestions received as feedback from the whirl version of jargons.dev. #### Changes Made - Added missing `default_branch_only` property to `fork` script, to allow forking of only the project's default branch. - Replaced implementation of `javascript:history.back()` on `editor/new` page return navigation wih=th navigation back to `/editor` page - Updated repo git link in README.md clone repo step to `git clone https://github.com/jargons-dev/jargons.dev.git` following org transfer - Updated hey.new link to hi.new in CODE_OF_CONDUCT.md support contact and in `ISSUE_TEMPLATE/config.yml` `contact_link` url - Added `browse words` link to homepage under the search trigger - Wrote login page message (Fixes https://github.com/devjargons/jargons.dev/issues/12) - Made jargons editor mobile responsiveness (Related to https://github.com/devjargons/jargons.dev/issues/9) - Implemented temporary workaround for handling deletion of existing reference/branch (Related to #52) - Added `jargons.dev` logo/sticker to README.md - Addressed some todos - todo: deprecated the `options` params in the `word-editor` script ### Related Issue - Fixes https://github.com/devjargons/jargons.dev/issues/12 - Related to https://github.com/devjargons/jargons.dev/issues/9 - Related to #52 ### Screenshots/Screencasts ![image](https://github.com/devjargons/jargons.dev/assets/25631971/9e50d713-87a7-41e9-99dc-b295f0cf8dfb) ### Notes to Reviewer NA --- .github/ISSUE_TEMPLATE/config.yml | 4 +- CODE_OF_CONDUCT.md | 4 +- README.md | 9 +- dev/setup.js | 4 +- src/components/islands/recent-searches.jsx | 12 +- src/components/islands/search.jsx | 4 - src/components/islands/word-editor.jsx | 52 ++++++- src/components/navbar.astro | 8 +- src/lib/actions/do-contribution-stats.js | 2 +- src/lib/branch.js | 27 +++- src/lib/fork.js | 1 + src/lib/stores/dictionary.js | 4 +- src/lib/word-editor.js | 24 +-- src/pages/api/dictionary.js | 172 ++++++++++++++------- src/pages/api/v1/browse/[...slug].js | 3 +- src/pages/api/v1/browse/index.js | 1 + src/pages/editor/edit/[word].astro | 7 +- src/pages/editor/new/index.astro | 9 +- src/pages/index.astro | 9 +- src/pages/login.astro | 21 ++- 20 files changed, 253 insertions(+), 124 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 081b401..75c163e 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: true contact_links: - name: Project Security Vulnerabilities - url: https://hey.new/ola - about: Please report security vulnerabilities privately here. \ No newline at end of file + url: https://hi.new/ola + about: Please report security vulnerabilities privately here. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index ac891fa..38666f5 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -57,7 +57,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at [hey.new/ola](https://hey.new/ola). All +reported by contacting the project team at [hi.new/ola](https://hi.new/ola). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. @@ -75,4 +75,4 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq \ No newline at end of file +https://www.contributor-covenant.org/faq diff --git a/README.md b/README.md index 716b545..af8c6f1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@
- jargons.dev + jargons.dev -

jargons.dev

The Software Engineering Dictionary

@@ -34,7 +33,7 @@ To get set-up follow these steps: 1. Clone the repository: ```sh - git clone https://github.com/babblebey/jargons.dev.git + git clone https://github.com/devjargons/jargons.dev.git ``` 2. Navigate to the project directory: @@ -73,10 +72,10 @@ We welcome contributions to jargons.dev! There are two main ways you can contrib This includes adding new words to the dictionary or editing existing word entries. We highly recommend using our Jargons Editor at [jargons.dev/editor](https://jargons.dev/editor) for this purpose. This user-friendly interface streamlines your contribution allowing it end up as a pull request. 2. **Other Contributions:** - Theses are contributions other than adding or editing words in the dictionary, feel free to contribute in other ways such as code improvements, bug fixes, or feature enhancements. + These are contributions other than adding or editing words in the dictionary, feel free to contribute in other ways such as issue reporting/triaging, code/documentation improvements, bug fixes, or feature enhancements. To get started with contributing, please refer to our [Contribution Guide](./CONTRIBUTING.md). Thank you for contributing to the jargons.dev project! ## Support -Do leave the project a star ⭐️ \ No newline at end of file +Do leave the project a star ⭐️ diff --git a/dev/setup.js b/dev/setup.js index 230ffc7..66ade17 100644 --- a/dev/setup.js +++ b/dev/setup.js @@ -6,7 +6,7 @@ import registerGitHubApp from "./lib/register-github-app/index.js"; const appCredentials = await registerGitHubApp({ // name of your app name: "jargons.dev-app-for-", - url: "https://github.com/babblebey/jargons.dev/CONTRIBUTING.md", + url: "https://github.com/devjargons/jargons.dev/CONTRIBUTING.md", default_permissions: { issues: "write", } @@ -26,4 +26,4 @@ const envFileTemp = await fs.readFile(".env.example", "utf-8"); const newEnvFileContent = envFileTemp .replace(/^GITHUB_APP_ID=.*$/m, `GITHUB_APP_ID=${appCredentials.id}`) .replace(/^GITHUB_APP_PRIVATE_KEY=.*$/m, `GITHUB_APP_PRIVATE_KEY="${singleLinePrivateKey}"`) -await fs.writeFile(".env", newEnvFileContent); \ No newline at end of file +await fs.writeFile(".env", newEnvFileContent); diff --git a/src/components/islands/recent-searches.jsx b/src/components/islands/recent-searches.jsx index ca13890..fcb4006 100644 --- a/src/components/islands/recent-searches.jsx +++ b/src/components/islands/recent-searches.jsx @@ -5,7 +5,7 @@ import { $recentSearches } from "../../lib/stores/search.js"; /** * Recent Searches Component - An Island that displays a user's last 5 searches * - * @todo implement a default list instead of `null` (now browse-word link) when no `$recentSearch` is found + * @todo implement a default list instead of `null` when no `$recentSearch` is found * @todo implement loading component to avoid flickering UI */ export default function RecentSearches() { @@ -16,7 +16,7 @@ export default function RecentSearches() { }, []); return Object.values(recentSearches).length ? ( -
+

Recent

    {Object.values(recentSearches).slice(0, 5).map((item, i) => ( @@ -28,11 +28,5 @@ export default function RecentSearches() { ))}
- ) : ( -
- - Browse Words - -
- ); + ) : null; } \ No newline at end of file diff --git a/src/components/islands/search.jsx b/src/components/islands/search.jsx index 58a1e4a..624bd37 100644 --- a/src/components/islands/search.jsx +++ b/src/components/islands/search.jsx @@ -59,10 +59,6 @@ function SearchTrigger({ size = "md" }) { return () => document.removeEventListener("keydown", handleOpenSearch); }, []); - /** - * @todo fix localstorage `recentSearches` getting overwitten on `SearchResult` click or select - * specific to this `sm` search trigger - */ if (size === "sm") return (
$isSearchOpen.set(!isSearchOpen)}>
diff --git a/src/components/islands/word-editor.jsx b/src/components/islands/word-editor.jsx index 53d49bd..baa34a3 100644 --- a/src/components/islands/word-editor.jsx +++ b/src/components/islands/word-editor.jsx @@ -4,12 +4,14 @@ import { useStore } from "@nanostores/react"; import useRouter from "../../lib/hooks/use-router.js"; import { capitalizeText } from "../../lib/utils/index.js"; import useWordEditor from "../../lib/hooks/use-word-editor.js"; -import { $isWordSubmitLoading, $isWordSubmitted } from "../../lib/stores/dictionary.js"; +import { $isWordSubmitLoading, $isWordSubmitted, $togglePreview } from "../../lib/stores/dictionary.js"; /** * Main Word Editor Component - Island */ export default function WordEditor({ title = "", content = "", metadata = {}, action }) { + const togglePreview = useStore($togglePreview); + return (
- + +
); } @@ -32,7 +35,7 @@ export function SubmitButton({ children = "Submit" }) { const isSubmitLoading = useStore($isWordSubmitLoading); return ( -