Skip to content

(SP: 2) [Frontend] Add logo icons svg, styles & refactoring#450

Merged
ViktorSvertoka merged 2 commits into
developfrom
qa-category
Apr 23, 2026
Merged

(SP: 2) [Frontend] Add logo icons svg, styles & refactoring#450
ViktorSvertoka merged 2 commits into
developfrom
qa-category

Conversation

@ViktorSvertoka
Copy link
Copy Markdown
Member

@ViktorSvertoka ViktorSvertoka commented Apr 23, 2026

Summary

  • add tab styles for PHP, Laravel, C#, and .NET categories
  • refactor category data/styles to use a single categoryRegistry source
  • keep existing API contracts (categoryData, categoryTabStyles, getCategoryTabStyle) to avoid UI breakage
  • brighten Django accent color for better contrast on dark UI

Why

Category data and styles were duplicated across files, making updates error-prone and harder to scale as new icons/categories are added.

Changes

  • frontend/data/categoryRegistry.ts (new): centralized category metadata and style classes
  • frontend/data/category.ts: generate categoryData from registry
  • frontend/data/categoryStyles.ts: generate style map from registry
  • updated Django color from #092E20 to #0E7A53

Closes #449

Summary by CodeRabbit

  • Bug Fixes

    • Updated LinkedIn follower count display from 1.8k+ to 2k+
  • Chores

    • Removed Sanity Studio content management system and associated dependencies
    • Optimized category data structure for improved system performance

@ViktorSvertoka ViktorSvertoka self-assigned this Apr 23, 2026
@ViktorSvertoka ViktorSvertoka added the UI Visual components, styling, layout changes label Apr 23, 2026
@ViktorSvertoka ViktorSvertoka added refactor Code restructuring without functional changes UX User experience improvements, visual polish, interaction feedback labels Apr 23, 2026
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
devlovers-net Ignored Ignored Preview Apr 23, 2026 8:24am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@ViktorSvertoka has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 12 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 46 minutes and 12 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0be00f21-b811-4027-9f3b-1aa7def0fbd6

📥 Commits

Reviewing files that changed from the base of the PR and between b2550eb and 11a2ba3.

📒 Files selected for processing (2)
  • frontend/data/categoryRegistry.ts
  • frontend/lib/about/stats.ts
📝 Walkthrough

Walkthrough

The PR consolidates duplicated category definitions into a centralized typed registry (categoryRegistry.ts), refactors categoryData and categoryTabStyles to derive from this registry, updates LinkedIn follower statistics from 1.8k to 2k, and removes the entire Sanity Studio directory including configuration files and schema type definitions.

Changes

Cohort / File(s) Summary
Category Registry Consolidation
frontend/data/categoryRegistry.ts, frontend/data/categoryData.ts, frontend/data/categoryStyles.ts
Introduces new typed categoryRegistry as single source of truth with CategoryRegistryItem and factory function. Refactors categoryData to derive from registry via .map() instead of hardcoded array. Refactors categoryTabStyles to generate styles dynamically from registry entries using Object.fromEntries(), removing 186 lines of hardcoded per-category definitions.
LinkedIn Statistics & UI Updates
frontend/components/about/HeroSection.tsx, frontend/lib/about/stats.ts
Updates default LinkedIn follower display from '1.8k+' to '2k+' and adjusts fallback count from 1900 to 2000 when environment variable is unavailable.
Sanity Studio Removal
studio/package.json, studio/sanity.cli.ts, studio/sanity.config.ts, studio/eslint.config.mjs, studio/.gitignore, studio/.prettierrc, studio/tsconfig.json
Removes Sanity Studio configuration files including package dependencies, CLI config, ESLint/Prettier/TypeScript settings, and .gitignore rules.
Sanity Schema Types Removal
studio/schemaTypes/{author,blockContent,category,post,socialLink}.ts, studio/schemaTypes/index.ts
Deletes all Sanity document and object schema type definitions including post, author, category, blockContent, and socialLink, along with the schema registry export.
Miscellaneous
studio/static/.gitkeep
Removes single-line comment from .gitkeep file.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~70 minutes

Possibly related PRs

Suggested reviewers

  • AM1007
  • LesiaUKR
  • liudmylasovetovs

Poem

🐰 A registry born from duplication's sting,
One source of truth for categories to sing!
Sanity's scaffolding cleared away clean,
The frontend now leaner, more streamlined, pristine.
From hardcoded arrays to mapped-over grace,
Two thousand followers light up the space! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 4

❌ Failed checks (2 warnings, 2 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The deletion of the entire studio folder (package.json, sanity.cli.ts, sanity.config.ts, schemaTypes, .gitignore, .prettierrc, eslint.config.mjs, tsconfig.json) appears unrelated to the stated PR objective of centralizing category metadata and refactoring frontend styles. Remove or justify the studio folder deletion. If intentional, separate it into a distinct PR with clear rationale, or update PR objectives to explicitly include studio deprecation/removal.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title partially relates to the changeset but is misleading about scope. It emphasizes 'Add logo icons svg' but the core changes are refactoring the category system, not adding new SVGs. The studio folder deletion is not reflected in the title. Consider revising the title to better represent the main refactoring: e.g., 'Centralize category registry and refactor metadata management' or clarify whether SVG additions are the primary focus.
Linked Issues check ❓ Inconclusive The PR substantially addresses issue #449 objectives: categoryRegistry created as single source of truth, categoryData and categoryTabStyles generated from registry, PHP/Laravel/C#/.NET styles added, and Django color improved. However, studio folder deletion appears unrelated to stated requirements. Clarify whether studio folder deletion aligns with issue #449 scope. If out-of-scope, it should be removed or addressed in a separate PR.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch qa-category

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/data/category.ts (1)

3-15: ⚠️ Potential issue | 🟠 Major

Preserve literal slug types through createCategory.

createCategory declares slug: string, so CategorySlug = (typeof categoryData)[number]['slug'] resolves to string rather than the literal union ('git' | 'html' | ...) available from categoryRegistry. This breaks the type chain: isCategorySlug accepts any string at the type level, and the type assertion in QaSection.tsx:87 indicates consumers already need workarounds.

Fix by preserving literal types through createCategory using a generic parameter:

🛠️ Proposed fix
-const createCategory = (slug: string, title: string, displayOrder: number) => ({
-  slug,
-  displayOrder,
-  translations: {
-    uk: title,
-    en: title,
-    pl: title,
-  },
-});
+const createCategory = <S extends string>(slug: S, title: string, displayOrder: number) => ({
+  slug,
+  displayOrder,
+  translations: {
+    uk: title,
+    en: title,
+    pl: title,
+  },
+});

Also apply the same pattern to createRegistryItem in categoryRegistry.ts so the literal types flow through from the start.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/data/category.ts` around lines 3 - 15, The createCategory function
currently types slug as plain string so literal slug types are lost; change
createCategory to be generic (e.g. function createCategory<T extends
string>(slug: T, title: string, displayOrder: number) => { slug: T;
displayOrder: number; translations: { uk: string; en: string; pl: string } }) so
the returned object's slug preserves the literal type, then update
categoryRegistry's createRegistryItem with the same generic pattern so the
literal union flows from the registry into categoryData and CategorySlug; this
will make isCategorySlug and consumers (e.g. the code asserting in QaSection)
receive the narrowed union type instead of string.
🧹 Nitpick comments (1)
frontend/data/categoryRegistry.ts (1)

32-309: Consider deriving displayOrder from array position.

Every entry hardcodes displayOrder equal to its array index (0–29). This duplication is easy to get out of sync when inserting/reordering entries. Since the registry is already an ordered array, you could drop the parameter and compute order via .map((item, index) => ({ ...item, displayOrder: index })) at the export site, eliminating a class of human error.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/data/categoryRegistry.ts` around lines 32 - 309, The array hardcodes
displayOrder for each createRegistryItem call, risking drift; remove the
positional displayOrder argument from the createRegistryItem invocations in
categoryRegistry and instead compute displayOrder from the array index when
exporting—e.g., keep the array of items (using createRegistryItem without the
index param) and wrap the exported categoryRegistry with .map((item, index) =>
({ ...item, displayOrder: index })); update createRegistryItem's
signature/usages if necessary to drop the index parameter and ensure the final
exported symbol categoryRegistry contains the computed displayOrder.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/data/categoryRegistry.ts`:
- Around line 309-311: The array-wide as const isn't preserving literal
slug/title types because createRegistryItem is declared to return
CategoryRegistryItem (with slug: string); update createRegistryItem so it's
generic over S extends string (and optionally T extends string for title) and
returns a typed object that preserves those literals, then let categoryRegistry
be inferred as readonly tuple (so CategoryRegistryEntry = (typeof
categoryRegistry)[number] retains literal slug types); adjust
CategoryRegistryItem or introduce a generic CategoryRegistryItem<S,T> if needed
and ensure downstream types (CategorySlug in frontend/components/q&a/types.ts
and uses in frontend/components/q&a/useQaTabs.ts and categoryStyles.ts) rely on
(typeof categoryRegistry)[number]['slug'] to get the narrowed literal union.

In `@frontend/lib/about/stats.ts`:
- Line 46: The frontend shows a mismatch between the formatted metric and the
fallback — update either formatMetric or the HeroSection fallback so they match
visually; specifically either (A) change formatMetric (function formatMetric) to
avoid rendering unnecessary “.0” (trim trailing “.0” after toFixed(1)) so it
returns "2k+" for 2000, or (B) change the fallback value in HeroSection.tsx from
"2k+" to "2.0k+" so the initial placeholder matches formatMetric; pick one
approach and update the referenced symbol (formatMetric or the HeroSection
fallback string) so both display the same formatted string.

---

Outside diff comments:
In `@frontend/data/category.ts`:
- Around line 3-15: The createCategory function currently types slug as plain
string so literal slug types are lost; change createCategory to be generic (e.g.
function createCategory<T extends string>(slug: T, title: string, displayOrder:
number) => { slug: T; displayOrder: number; translations: { uk: string; en:
string; pl: string } }) so the returned object's slug preserves the literal
type, then update categoryRegistry's createRegistryItem with the same generic
pattern so the literal union flows from the registry into categoryData and
CategorySlug; this will make isCategorySlug and consumers (e.g. the code
asserting in QaSection) receive the narrowed union type instead of string.

---

Nitpick comments:
In `@frontend/data/categoryRegistry.ts`:
- Around line 32-309: The array hardcodes displayOrder for each
createRegistryItem call, risking drift; remove the positional displayOrder
argument from the createRegistryItem invocations in categoryRegistry and instead
compute displayOrder from the array index when exporting—e.g., keep the array of
items (using createRegistryItem without the index param) and wrap the exported
categoryRegistry with .map((item, index) => ({ ...item, displayOrder: index }));
update createRegistryItem's signature/usages if necessary to drop the index
parameter and ensure the final exported symbol categoryRegistry contains the
computed displayOrder.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c6fc3c71-36bc-481d-8e31-2fc3b8678c1f

📥 Commits

Reviewing files that changed from the base of the PR and between 3c1764b and b2550eb.

⛔ Files ignored due to path filters (3)
  • frontend/public/icons/csharp.svg is excluded by !**/*.svg
  • frontend/public/icons/dotnet.svg is excluded by !**/*.svg
  • studio/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (19)
  • frontend/components/about/HeroSection.tsx
  • frontend/data/category.ts
  • frontend/data/categoryRegistry.ts
  • frontend/data/categoryStyles.ts
  • frontend/lib/about/stats.ts
  • studio/.gitignore
  • studio/.prettierrc
  • studio/eslint.config.mjs
  • studio/package.json
  • studio/sanity.cli.ts
  • studio/sanity.config.ts
  • studio/schemaTypes/author.ts
  • studio/schemaTypes/blockContent.ts
  • studio/schemaTypes/category.ts
  • studio/schemaTypes/index.ts
  • studio/schemaTypes/post.ts
  • studio/schemaTypes/socialLink.ts
  • studio/static/.gitkeep
  • studio/tsconfig.json
💤 Files with no reviewable changes (14)
  • studio/static/.gitkeep
  • studio/tsconfig.json
  • studio/.prettierrc
  • studio/schemaTypes/category.ts
  • studio/schemaTypes/index.ts
  • studio/sanity.config.ts
  • studio/package.json
  • studio/.gitignore
  • studio/sanity.cli.ts
  • studio/schemaTypes/blockContent.ts
  • studio/schemaTypes/socialLink.ts
  • studio/schemaTypes/author.ts
  • studio/eslint.config.mjs
  • studio/schemaTypes/post.ts

Comment thread frontend/data/categoryRegistry.ts
Comment thread frontend/lib/about/stats.ts
@ViktorSvertoka ViktorSvertoka merged commit 61722df into develop Apr 23, 2026
7 checks passed
@ViktorSvertoka ViktorSvertoka deleted the qa-category branch April 23, 2026 08:27
@coderabbitai coderabbitai Bot mentioned this pull request Apr 23, 2026
ViktorSvertoka added a commit that referenced this pull request Apr 23, 2026
* feat(svg) add icons PHP & Laravel (#447)

* (SP: 1) [SHOP] make cart provider capability env reads runtime-safe

* (SP: 1) [SHOP] validate STRIPE_MODE at runtime in stripe env helper

* (SP: 2) [Frontend] Add logo icons svg, styles & refactoring (#450)

* feat(categories): add php/laravel/csharp/dotnet styles and refactor category styles via registry

* fix(types): preserve category registry slug literals and normalize stats k-format

* docs(files): update documentation

* chore(release): bump frontend to v1.0.12 and update changelog

---------

Co-authored-by: liudmylasovetovs <milkaegik@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without functional changes UI Visual components, styling, layout changes UX User experience improvements, visual polish, interaction feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant