refactor/code quality docs#30
Merged
Merged
Conversation
rename the copy code button and copy shortened components and make them more consistent by removing the dependency
- increase the documentation for such functions - combine the PostViewCounter and ViewDisplay components - update the views API route to accept increment search param
toggle all states consider for future would be to add the state for the toggle parantheses into the local storage, with inline scripts to remove the hydration flicker
- Extract authentication buttons into a shared component and refactor comments-related modules for better modularity. - Rename files to match their exported functions and consolidate duplicate logic.
- Refactored guestbook database functions to use `safeTry` for better async/await style error handling. - Added success toast notification when entries are deleted. - Improved validation logic with helper functions and added comprehensive JSDoc documentation across all guestbook-related components and utilities.
content/post interactions - Rename mdxRemoteSettings to mdx-settings and update imports across the app. - Export a Scope type and enable vfileDataIntoScope to surface the TOC into MDX scope. - Add rehype-katex-block to promote KaTeX block math, adjust CodeHike config (ignore unspecified languages) and rename the code theme. - Simplify post MDX evaluation to use the consolidated options/components and apply small TOC, side-bar, and content-query improvements.
There was a problem hiding this comment.
Pull request overview
This PR refactors code organization and documentation while moving several components/utilities to kebab-case names, centralizing shared auth/comment helpers, and adding MDX/math/view-count behavior changes.
Changes:
- Renames/replaces many components and imports with kebab-case files and named exports.
- Adds documentation comments across utilities, queries, components, and route handlers.
- Refactors comments, guestbook, views, MDX parentheses, KaTeX block handling, and sharing/view-count UI.
Reviewed changes
Copilot reviewed 65 out of 66 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/utils.ts | Consolidates string formatting helpers into humanReadable and documents schema parsing. |
| src/lib/server-helper.ts | Removes unused view/comment query server actions. |
| src/lib/remark-parentheses.ts | Expands documentation for parentheses remark behavior. |
| src/lib/rehype-katex-block.ts | Adds rehype plugin for KaTeX block wrapping. |
| src/lib/fsContentQueries.ts | Adds docs for about-page filesystem content loading. |
| src/lib/dbContentQueries.ts | Refactors post query documentation and getPost mapping. |
| src/lib/database-queries/views.ts | Refactors view queries and adds docs. |
| src/lib/database-queries/guestbook.ts | Refactors guestbook query selection and docs. |
| src/lib/database-queries/comments.ts | Refactors comment query flow and exported error interfaces. |
| src/lib/database-queries/auth.ts | Moves auth error type import. |
| src/lib/database-errors.ts | Removes old shared error type module. |
| src/lib/database-actions/views.ts | Refactors view increment behavior and docs. |
| src/lib/database-actions/guestbook.ts | Refactors guestbook save/delete flows and docs. |
| src/lib/database-actions/comments.ts | Refactors comment save/delete flows and docs. |
| src/lib/auth.ts | Enables Auth.js trustHost. |
| src/config/types.ts | Adds shared database/auth error interfaces. |
| src/config/site.ts | Removes noParentheses site setting. |
| src/config/mdx-settings.tsx | Renames MDX settings module and adds parentheses/KaTeX plugins. |
| src/components/viewDisplay.tsx | Removes legacy view display component. |
| src/components/view-display.tsx | Adds renamed view display with optional increment support. |
| src/components/ui/tooltip.tsx | Adds font class to tooltip content. |
| src/components/typography/code-block.tsx | Updates CodeHike theme/imports and docs. |
| src/components/typography/code-block-theme.tsx | Renames exported theme constant. |
| src/components/total-blog-views.tsx | Adds docs and simplifies rendering. |
| src/components/toggleParentheses.tsx | Removes legacy parentheses toggle component. |
| src/components/toggle-parentheses.tsx | Adds renamed/context-based parentheses toggle components. |
| src/components/theme-changer.tsx | Converts default export to named export and renames file. |
| src/components/tagsButtonGrid.tsx | Removes legacy tags grid component. |
| src/components/side-toc.tsx | Adds table-of-contents documentation. |
| src/components/project-card.tsx | Renames imports/exports and uses humanReadable. |
| src/components/postViewCounter.tsx | Removes legacy server-action view counter. |
| src/components/paginationArrows.tsx | Removes unused pagination component. |
| src/components/nav-bar.tsx | Renames imports/exports and adds docs. |
| src/components/mostViewedPosts.tsx | Removes most-viewed posts component. |
| src/components/list-posts.tsx | Renames imports/exports and uses humanReadable. |
| src/components/double-pane.tsx | Renames component and inlines subscribe button. |
| src/components/copyToClipboard.tsx | Removes legacy share component. |
| src/components/copy-shortened.tsx | Adds renamed share/copy component. |
| src/components/copy-code-button.tsx | Adds explanatory comment for code copy color. |
| src/components/comments/types.ts | Adds shared comment action union types. |
| src/components/comments/form.tsx | Refactors comment form imports/types and comments. |
| src/components/comments/delete.tsx | Extracts delete-only comment component and optimistic revert. |
| src/components/comments/comments.tsx | Refactors comments rendering and auth button usage. |
| src/components/auth-buttons.tsx | Adds shared sign-in/sign-out buttons. |
| src/app/tags/page.tsx | Inlines tag grid rendering with renamed helpers. |
| src/app/tags/layout.tsx | Updates renamed DoublePane import. |
| src/app/tags/[tag]/page.tsx | Updates renamed imports and tag formatting. |
| src/app/projects/page.tsx | Updates renamed ProjectCard import. |
| src/app/posts/page.tsx | Updates renamed imports and view display usage. |
| src/app/posts/[slug]/page.tsx | Updates MDX/options, sharing, views, and parentheses controls. |
| src/app/page.tsx | Updates renamed MDX settings and view display imports. |
| src/app/not-found.tsx | Updates renamed DoublePane import. |
| src/app/layout.tsx | Adds global parentheses provider and renamed navbar import. |
| src/app/guestbook/page.tsx | Uses shared auth buttons and adds docs. |
| src/app/guestbook/form.tsx | Uses shared sign-out button and adds docs. |
| src/app/guestbook/dialog.tsx | Adds dialog documentation. |
| src/app/guestbook/buttons.tsx | Removes guestbook-specific auth buttons. |
| src/app/api/views/route.ts | Adds optional view increment behavior to views API. |
| src/app/api/views/all/route.ts | Adds docs for total views API. |
| src/app/admin/page.tsx | Updates renamed admin component imports. |
| src/app/admin/guestbook.tsx | Adds docs and success toast. |
| src/app/admin/commentsAdmin.tsx | Removes legacy comments admin component. |
| src/app/admin/comments.tsx | Adds grouped admin comments renderer. |
| src/app/about/page.tsx | Updates renamed MDX settings and layout imports. |
| package.json | Removes copy-to-clipboard dependency. |
| bun.lock | Updates lockfile after dependency removal. |
Comments suppressed due to low confidence (3)
src/lib/remark-parentheses.ts:17
- This documentation overstates the unclosed-parenthesis behavior: a paragraph ending with a bare opening parenthesis, e.g.
text (, leavesparenthesesContentempty so the final recovery branch does not run and the(is dropped. Update the implementation or narrow the comment so it matches the actual behavior.
src/components/copy-code-button.tsx:20 - This comment says the code blocks use Catppuccin Macchiato, but the theme exported and used by
MyCode/MyInlineCodeisCatppuccinFrappe. The mismatch makes the hard-coded color harder to verify later.
src/components/comments/delete.tsx:50 - On delete failure this re-adds the removed comment through the same
addaction used for new comments, which prepends it to the list instead of restoring its original position. Keep the original index or refetch the comments so a failed delete does not reorder the thread.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use native Node.js fs module. - Improve error handling with Result types. - Simplify image placeholder generation with a unified API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Works towards #27 with regards to improving the code quality.