Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(blog): upgrade UI for archives and tags #542

Merged
merged 3 commits into from
Oct 31, 2024
Merged

feat(blog): upgrade UI for archives and tags #542

merged 3 commits into from
Oct 31, 2024

Conversation

duyet
Copy link
Owner

@duyet duyet commented Oct 30, 2024

Summary by Sourcery

Upgrade the blog UI by introducing alphabetical grouping of tags and enhancing the layout of the archives and tags pages. Refactor components to improve flexibility and readability, and update documentation for better clarity.

New Features:

  • Introduce alphabetical grouping of tags on the tags page, enhancing the user experience by organizing tags in a more accessible manner.

Enhancements:

  • Refactor the Feed component to support an optional noThumbnail prop, allowing for more flexible display options.
  • Update the Archives page to dynamically calculate and display the total number of posts and the span of years covered.
  • Improve the Year component by renaming it to YearPost and adjusting its layout for better readability.

Documentation:

  • Revise the table of contents in the 'git-19-tips-for-everyday-git-use' post for better clarity and navigation.

Copy link
Contributor

sourcery-ai bot commented Oct 30, 2024

Reviewer's Guide by Sourcery

This PR upgrades the UI for the blog's archives and tags pages, implementing a new alphabetical grouping system for tags and improving the overall layout and presentation of archived posts. The changes also include cleanup of tag metadata across blog posts and various component refinements.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Redesigned the tags page with alphabetical grouping
  • Implemented alphabetical grouping of tags with letter-based sections
  • Added a header section with total tag count
  • Removed filtering of tags with only one post
  • Updated layout to use a grid system for better organization
apps/blog/app/tags/page.tsx
Revamped the archives page layout and functionality
  • Added post count and year span information
  • Implemented a new dotted-line style for post listings
  • Removed year limit restriction
  • Added link to tags page for cross-navigation
apps/blog/app/archives/page.tsx
apps/blog/components/year-post.tsx
Enhanced the Feed component with new features
  • Added option to hide thumbnails
  • Reduced vertical spacing between posts
  • Removed hover arrow indicator
  • Updated component props interface
packages/components/Feed.tsx
Cleaned up and standardized blog post tags
  • Renamed 'Thủ thuật' and 'Thủ thuật Git' tags to 'How to'
  • Removed redundant and specific tags
  • Consolidated similar tags
apps/blog/_posts/2015/09/git-19-tips-for-everyday-git-use.md
apps/blog/_posts/2016/12/javascript-weekly-9.md
apps/blog/_posts/2016/08/su-co-vietcombank-mot-goc-nhin-ky-thuat.md
apps/blog/_posts/2016/09/bao-mat-hai-lop.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

vercel bot commented Oct 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2024 7:09am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cv ⬜️ Ignored (Inspect) Visit Preview Oct 31, 2024 7:09am
insights ⬜️ Ignored (Inspect) Visit Preview Oct 31, 2024 7:09am

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @duyet - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟡 Documentation: 1 issue found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -16,25 +16,30 @@ If you are completely new to git, I suggest reading [Git Cheat Sheet](http://www

**Table of Contexts:**
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (documentation): Fix typo in heading: 'Contexts' should be 'Contents'

@@ -6,35 +6,60 @@ import Link from 'next/link'
export default function Tags() {
const tags: TagCount = getAllTags()

// Sort and keep tags with > 1 post
const sortedTags = Object.fromEntries(
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (complexity): Consider simplifying the tag grouping logic by using a single sort operation with a composite comparator

The code can be simplified while maintaining the alphabetical grouping feature. Here's a more direct approach:

export default function Tags() {
  const tags: TagCount = getAllTags()

  // Sort by first letter then by count
  const sortedEntries = Object.entries(tags)
    .sort(([tagA, countA], [tagB, countB]) => {
      const letterA = tagA[0].toUpperCase()
      const letterB = tagB[0].toUpperCase()
      return letterA === letterB ? countB - countA : letterA.localeCompare(letterB)
    })

  // Group visually by first letter
  const currentLetter = { value: '' }

  return (
    <div>
      <div className="lg:mb-15 mb-10">
        <h1 className="mb-5 text-4xl font-bold md:text-6xl lg:text-8xl">
          Topics
        </h1>
        <p className="lg:mb-15 mb-10">
          This page lists my {sortedEntries.length} blogging topics in
          alphabetical order.
        </p>
      </div>

      <div className="flex flex-col gap-5">
        {sortedEntries.map(([tag, count]) => {
          const letter = tag[0].toUpperCase()
          const letterHeader = letter !== currentLetter.value && (
            <h1 className="mb-5 text-5xl font-bold">{letter}</h1>
          )
          currentLetter.value = letter

          return (
            <div key={tag}>
              {letterHeader}
              <Link
                as={`/tag/${getSlug(tag)}`}
                className="inline-flex gap-1"
                href="/tag/[tag]"
              >
                <h3>{tag}</h3>
                <span className="text-muted hover:no-underline">({count})</span>
              </Link>
            </div>
          )
        })}
      </div>
    </div>
  )
}

@duyet duyet merged commit efb8398 into master Oct 31, 2024
9 checks passed
@duyet duyet deleted the feat/ui-update branch October 31, 2024 07:12
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.

1 participant