Skip to content

Topics/tags page#605

Merged
feruzm merged 5 commits into
developfrom
tags
Jan 7, 2026
Merged

Topics/tags page#605
feruzm merged 5 commits into
developfrom
tags

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Jan 7, 2026

Summary by CodeRabbit

  • New Features
    • New Trending Tags page with a responsive, themed table showing rank, tag, comments, top posts, and total payouts; supports pagination via a Load More button and shows loading/error states. Includes Scroll-to-Top and navbar entry for Trending Tags.
  • Appearance
    • Full day/night theming, responsive layout, zebra-striping, and empty-state styling for the tags page.
  • Localization
    • Added translations for the tags page UI and load-more controls.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

Adds a new "Tags" feature: client React TagsPage with infinite loading and SCSS, a server Next.js Page that prefetches/hydrates tag data, i18n strings, a sidebar nav item, a new SDK infinite-query helper that filters community tags, a new isCommunity utility, and an SDK version bump.

Changes

Cohort / File(s) Summary
Web — Page component & server preload
apps/web/src/app/tags/_page.tsx, apps/web/src/app/tags/page.tsx
New client TagsPage using useInfiniteQuery for trending tags (table, load-more, loading/error states). Server Page prefetches the infinite query, exports dynamic = "force-dynamic" and metadata, and hydrates client state.
Web — Styling
apps/web/src/app/tags/_page.scss
New SCSS for tags page: layout, header, table, zebra rows, action/empty-state, day/night theming via mixins.
Web — Navigation
apps/web/src/features/shared/navbar/navbar-main-sidebar.tsx
Adds sidebar menu item "Trending Tags" linking to /tags using UilTag; closes sidebar on click.
Web — i18n
apps/web/src/features/i18n/locales/en-US.json
Adds tags-page locale keys: title, description, error, columns (tag, comments, top-posts, total-payouts), and load-more (cta, loading, done).
SDK — Trending tags query
packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts, packages/sdk/src/modules/posts/queries/index.ts
New getTrendingTagsWithStatsQueryOptions(limit = 250) returning infinite query options that call get_trending_tags, filter out empty names and community names, set initial/next page params; re-exported from queries index.
SDK — Utility: isCommunity
packages/sdk/src/modules/core/utils/is-community.ts, packages/sdk/src/modules/core/utils/index.ts
New isCommunity(value) utility (detects hive-<digits> pattern) and re-exported from utils index.
Packages — Version bump
packages/sdk/package.json
SDK package version bumped 1.4.0 → 1.4.1.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Browser
  participant NextServer as Next.js Server
  participant QueryClient
  participant HiveAPI as Hive RPC (CONFIG.hiveClient)

  Note over Browser,NextServer: Server-side prefetch + hydrate
  Browser->>NextServer: GET /tags
  NextServer->>QueryClient: prefetchInfiniteQuery(getTrendingTagsWithStatsQueryOptions)
  QueryClient->>HiveAPI: call("get_trending_tags", [afterTag="", limit])
  HiveAPI-->>QueryClient: trending tags page (items)
  QueryClient-->>NextServer: dehydrate(state)
  NextServer-->>Browser: HTML + hydrated state

  Note over Browser: Client interactions and pagination
  Browser->>QueryClient: hydrate(state)
  Browser->>Browser: render TagsPage (useInfiniteQuery)
  Browser->>HiveAPI: call("get_trending_tags", [afterTag=lastTag, limit]) on "Load more"
  HiveAPI-->>Browser: next page of tags
  Browser-->>Browser: append rows, update UI
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

"I hopped through fields of tags today,
I fetched and filtered, then leapt away.
Load-more carrots, pages pre-warmed bright,
Day and night my burrow's just right.
Hooray — new trails for bunnies' tags tonight! 🐇"

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Topics/tags page' directly and clearly describes the main change: introduction of a new page feature for displaying trending tags/topics with filtering, sorting, and pagination capabilities.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3a421f and 33ad682.

⛔ Files ignored due to path filters (6)
  • packages/sdk/dist/browser/index.js is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.cjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.mjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (1)
  • packages/sdk/src/modules/core/utils/is-community.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/sdk/src/modules/core/utils/is-community.ts

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In
@packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts:
- Around line 17-18: Replace the infinite caching for trending tags by setting
staleTime to a finite interval (e.g., 5–10 minutes) instead of Infinity so
trending data refreshes periodically; update the object that currently sets
staleTime: Infinity (and leave refetchOnMount: true) to use a millisecond value
like 5 * 60 * 1000 (or 10 * 60 * 1000) to ensure automatic refresh while
retaining caching.
- Line 12: The current filter on tags uses a startsWith check
("!tag.name.startsWith('hive-')") which incorrectly excludes non-community tags;
replace that predicate with the shared utility check by importing isCommunity
and using .filter(tag => !isCommunity(tag.name)) so community detection matches
getTrendingTags/getAllTrendingTags; update the imports at the top of the module
to import isCommunity from the utils module where other consumers use it (same
module referenced by apps/web/src/api/hive.ts).
🧹 Nitpick comments (5)
packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts (1)

5-5: Consider a lower default limit.

The default limit of 250 tags in the initial fetch may impact performance. Since this powers an infinite scroll UI, consider starting with a smaller page size (e.g., 50-100) to improve initial load time and user experience.

♻️ Suggested adjustment
-export function getTrendingTagsWithStatsQueryOptions(limit = 250) {
+export function getTrendingTagsWithStatsQueryOptions(limit = 50) {
apps/web/src/app/tags/_page.tsx (3)

64-64: Consider using a stable unique key.

Using index in the key can cause React reconciliation issues if the tags list is reordered or items are inserted. If tag.name is guaranteed unique, use it alone as the key; otherwise, use a stable unique identifier from the tag object.

♻️ Proposed fix
-                    <Tr key={`${tag.name}-${index}`}>
+                    <Tr key={tag.name}>

73-80: Ensure consistent number formatting.

The comments and top_posts fields use toLocaleString() for formatting, but total_payouts does not. If total_payouts is a numeric value, apply the same formatting for consistency. If it's already a formatted currency string, consider adding a comment to clarify.

♻️ Proposed fix if total_payouts is numeric
                       <Td className="border p-2">
-                        <span className="tag-metric">{tag.total_payouts}</span>
+                        <span className="tag-metric">{typeof tag.total_payouts === 'number' ? tag.total_payouts.toLocaleString() : tag.total_payouts}</span>
                       </Td>

46-85: Consider adding table accessibility attributes.

For better accessibility, consider adding an aria-label or a <caption> element to describe the table's purpose for screen reader users.

♻️ Proposed enhancement
-              <Table full={true}>
+              <Table full={true} aria-label={i18next.t("tags-page.title")}>

Or add a caption:

               <Table full={true}>
+                <caption className="sr-only">{i18next.t("tags-page.title")}</caption>
                 <thead>
apps/web/src/app/tags/page.tsx (1)

9-11: Consider enhancing metadata for better SEO.

The page metadata only includes a title. Consider adding a description and other SEO-relevant fields (e.g., openGraph) to improve search engine visibility and social media sharing.

♻️ Proposed enhancement
 export const metadata: Metadata = {
-  title: "Tags"
+  title: "Trending Tags",
+  description: "Explore trending topics and tags on Ecency with statistics on comments, top posts, and total payouts."
 };
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5d7e1c and 95386ba.

⛔ Files ignored due to path filters (7)
  • packages/sdk/dist/browser/index.d.ts is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.cjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.mjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (8)
  • apps/web/src/app/tags/_page.scss
  • apps/web/src/app/tags/_page.tsx
  • apps/web/src/app/tags/page.tsx
  • apps/web/src/features/i18n/locales/en-US.json
  • apps/web/src/features/shared/navbar/navbar-main-sidebar.tsx
  • packages/sdk/package.json
  • packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts
  • packages/sdk/src/modules/posts/queries/index.ts
🔇 Additional comments (7)
packages/sdk/package.json (1)

4-4: LGTM! Version bump is appropriate.

The patch version increment (1.4.0 → 1.4.1) correctly reflects the addition of a new exported API (getTrendingTagsWithStatsQueryOptions) without breaking changes.

apps/web/src/features/i18n/locales/en-US.json (1)

411-426: LGTM! Translation keys are well-structured.

The new tags-page translation block provides comprehensive i18n support for the Tags page feature, including page metadata, column headers, error states, and load-more functionality.

apps/web/src/features/shared/navbar/navbar-main-sidebar.tsx (1)

9-9: LGTM! Navigation integration is clean.

The new "Trending Tags" menu item follows the existing patterns and is properly positioned in the navigation hierarchy. The i18n integration and icon selection are appropriate.

Also applies to: 119-124

packages/sdk/src/modules/posts/queries/index.ts (1)

2-2: LGTM! Export is properly structured.

The new export statement correctly exposes the trending tags query options and maintains the file's export organization.

apps/web/src/app/tags/_page.scss (1)

1-115: LGTM! Well-structured styling with proper theming.

The SCSS follows the project's theming conventions correctly, includes responsive design considerations, and provides a clean visual hierarchy for the tags page.

apps/web/src/app/tags/_page.tsx (2)

14-21: No action required—the function has sensible defaults.

The getTrendingTagsWithStatsQueryOptions() function has a default limit parameter of 250, which is used for pagination. Calling it without arguments is correct and will use this reasonable default value.


23-23: The code is correct. The data.pages structure from getTrendingTagsWithStatsQueryOptions() is indeed an array of arrays (each page returns TrendingTag[]), so .flat() properly flattens it to a single array of tags. The useInfiniteDataFlow utility elsewhere in the codebase uses the same pattern with .reduce() for identical logic, confirming this is the standard approach in the project.

…stats-query-options.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
@packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts:
- Line 12: Replace the ad-hoc community filter that uses
!tag.name.startsWith("hive-") with the shared isCommunity utility: import
isCommunity and change the filter chain on tags (the expression around
tags.filter((tag) => tag.name !== "").filter((tag) =>
!tag.name.startsWith("hive-"))) to instead exclude community tags via
!isCommunity(tag.name) while preserving the non-empty name check; this ensures
tags like "hive-gaming" are not wrongly filtered out and matches other usages of
isCommunity across the codebase.
🧹 Nitpick comments (1)
packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts (1)

12-12: Consider combining filter calls.

The two separate .filter() calls can be combined into a single filter for slightly better performance.

♻️ Combine filters
-          tags.filter((tag) => tag.name !== "").filter((tag) => !tag.name.startsWith("hive-"))
+          tags.filter((tag) => tag.name !== "" && !tag.name.startsWith("hive-"))

Note: This suggestion assumes the community filtering issue above is addressed first by using isCommunity().

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95386ba and 627334f.

📒 Files selected for processing (1)
  • packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts
🔇 Additional comments (3)
packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts (3)

1-3: Imports look good.

All necessary imports are present and correctly referenced.


5-7: Function signature and query key are well-designed.

The default limit of 250 is reasonable, and the query key properly includes the limit parameter for cache differentiation.


14-19: Pagination and cache configuration are correct.

The pagination logic properly derives the next page parameter, and the staleTime of 5 minutes is a good balance for trending data - it ensures periodic refresh while benefiting from caching. This addresses the previous concern about using Infinity.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @packages/sdk/src/modules/core/utils/is-community.ts:
- Around line 1-3: The isCommunity function's regex /^hive-\d+/ can produce
false positives (e.g., "hive-123abc"); update the pattern to enforce the end
anchor and use a boolean test: change the match call to use
/^hive-\d+$/.test(value) inside isCommunity so it only returns true for strings
that exactly match the hive-<digits> form.
🧹 Nitpick comments (1)
packages/sdk/src/modules/core/utils/is-community.ts (1)

1-3: Consider adding documentation and return type annotation.

For better maintainability and developer experience, consider:

  • Adding an explicit return type annotation (: boolean)
  • Adding JSDoc to document the function's purpose and behavior
📝 Suggested enhancement
+/**
+ * Checks if a value is a Hive community identifier.
+ * Community identifiers follow the pattern "hive-" followed by digits.
+ * 
+ * @param value - The value to check
+ * @returns true if the value is a community identifier, false otherwise
+ */
-export function isCommunity(value: unknown) {
+export function isCommunity(value: unknown): boolean {
   return typeof value === "string" ? /^hive-\d+$/.test(value) : false;
 }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 627334f and d3a421f.

⛔ Files ignored due to path filters (7)
  • packages/sdk/dist/browser/index.d.ts is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.cjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.mjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (3)
  • packages/sdk/src/modules/core/utils/index.ts
  • packages/sdk/src/modules/core/utils/is-community.ts
  • packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/sdk/src/modules/posts/queries/get-trending-tags-with-stats-query-options.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/sdk/src/modules/core/utils/is-community.ts (1)
packages/sdk/dist/browser/index.d.ts (1)
  • isCommunity (2967-2967)
🔇 Additional comments (1)
packages/sdk/src/modules/core/utils/index.ts (1)

4-4: LGTM!

The re-export follows the established pattern and properly exposes the new isCommunity utility.

Comment thread packages/sdk/src/modules/core/utils/is-community.ts
feruzm and others added 2 commits January 7, 2026 12:40
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@feruzm feruzm merged commit 4f0828e into develop Jan 7, 2026
1 check passed
@feruzm feruzm deleted the tags branch January 7, 2026 10:44
This was referenced Jan 21, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Mar 14, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Mar 30, 2026
@coderabbitai coderabbitai Bot mentioned this pull request May 8, 2026
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