Skip to content

refactor/code quality docs#30

Merged
mkutay merged 27 commits into
mainfrom
refactor/code-quality-docs
May 14, 2026
Merged

refactor/code quality docs#30
mkutay merged 27 commits into
mainfrom
refactor/code-quality-docs

Conversation

@mkutay
Copy link
Copy Markdown
Owner

@mkutay mkutay commented May 12, 2026

Works towards #27 with regards to improving the code quality.

mkutay added 18 commits May 12, 2026 18:08
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.
@mkutay mkutay marked this pull request as ready for review May 14, 2026 16:06
@mkutay mkutay requested a review from Copilot May 14, 2026 16:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (, leaves parenthesesContent empty 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/MyInlineCode is CatppuccinFrappe. 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 add action 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.

Comment thread src/app/api/views/route.ts
Comment thread src/components/copy-shortened.tsx Outdated
Comment thread src/lib/dbContentQueries.ts Outdated
Comment thread src/lib/rehype-katex-block.ts
Comment thread src/app/posts/[slug]/page.tsx
Comment thread src/app/layout.tsx Outdated
Comment thread src/app/admin/comments.tsx
Comment thread src/lib/database-queries/comments.ts
- Use native Node.js fs module.
- Improve error handling with Result types.
- Simplify image placeholder generation with a unified API.
@mkutay mkutay merged commit 8760b0d into main May 14, 2026
1 check passed
@mkutay mkutay deleted the refactor/code-quality-docs branch May 14, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants