Skip to content

(SP: 2) [Frontend] Feat(Q&A): Add category & styles#336

Merged
ViktorSvertoka merged 1 commit into
developfrom
feat/qa-add-sql
Feb 17, 2026
Merged

(SP: 2) [Frontend] Feat(Q&A): Add category & styles#336
ViktorSvertoka merged 1 commit into
developfrom
feat/qa-add-sql

Conversation

@ViktorSvertoka
Copy link
Copy Markdown
Member

@ViktorSvertoka ViktorSvertoka commented Feb 17, 2026

  • Added SQL questions and answers to the database.
  • Added the SQL icon.
  • Styled the SQL tab button.
  • Styled the accordion border.
  • Styled pagination (including current page) and page size controls.

Closes #335

Summary by CodeRabbit

  • New Features

    • Added four new quiz categories: SQL, PostgreSQL, MongoDB, and Python
    • Enabled Web3Forms integration support through environment configuration
  • Refactor

    • Improved category styling system with dynamic fallback mechanism

@ViktorSvertoka ViktorSvertoka self-assigned this Feb 17, 2026
@ViktorSvertoka ViktorSvertoka added the enhancement New feature or request label Feb 17, 2026
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 17, 2026

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

Project Deployment Actions Updated (UTC)
devlovers-net Ready Ready Preview, Comment Feb 17, 2026 1:15am

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 17, 2026

Deploy Preview for develop-devlovers ready!

Name Link
🔨 Latest commit 66d7b5e
🔍 Latest deploy log https://app.netlify.com/projects/develop-devlovers/deploys/6993c14100735d00084a2920
😎 Deploy Preview https://deploy-preview-336--develop-devlovers.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

New SQL, PostgreSQL, MongoDB, and Python categories added to the frontend with corresponding styling configurations. A Web3Forms environment variable introduced. Category styling refactored from direct object indexing to a utility function (getCategoryTabStyle) providing safe fallback handling across Q&A and Quiz components.

Changes

Cohort / File(s) Summary
Environment Configuration
frontend/.env.example
Added NEXT_PUBLIC_WEB3FORMS_KEY environment variable for Web3Forms integration.
Category Data Management
frontend/data/category.ts
Added four new categories: SQL (id 10), PostgreSQL (id 11), MongoDB (id 12), Python (id 13) to the categoryData array.
Category Styling System
frontend/data/categoryStyles.ts
Introduced defaultCategoryTabStyle constant and getCategoryTabStyle(slug) utility function for safe styling lookup with fallback. Added styling entries for sql, postgresql, mongodb, python categories. Changed categoryTabStyles type assertion from strict Record<CategorySlug, CategoryTabStyle> to Partial<Record<CategorySlug, CategoryTabStyle>>.
Q&A Components
frontend/components/q&a/QaSection.tsx
Replaced categoryTabStyles with getCategoryTabStyle(value) for dynamic styling. Removed mobile media query state and useEffect. Updated CategoryTabButton and Pagination styling to use new utility function.
Quiz Components
frontend/components/quiz/QuizContainer.tsx, frontend/components/quiz/QuizzesSection.tsx
Refactored category styling from categoryTabStyles indexing to getCategoryTabStyle() utility function calls. Updated accentColor derivation to use new utility with fallback.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • #317: Both refactor categoryStyles usage and improve safe property access patterns for category-related styling.
  • #78: Both modify category data structures and Q&A/Quiz components consuming category slugs and styling.
  • #89: Both modify quiz UI components (QuizContainer, QuizzesSection) with styling logic updates and component feature enhancements.

Suggested labels

UI

Suggested reviewers

  • AM1007

Poem

🐰 Four new languages hop into view,
SQL, Postgres, Mongo, Python too!
Styles now flow through a function so neat,
No more direct indexing—much safer, much sweet! ✨
Categories flourish with each careful refactor complete!

🚥 Pre-merge checks | ✅ 2 | ❌ 4

❌ Failed checks (3 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR adds three additional categories (PostgreSQL, MongoDB, Python) beyond the SQL requirement in issue #335, and refactors styling logic with getCategoryTabStyle function. Restrict the PR scope to SQL category implementation as specified in issue #335, or update the issue to include the additional categories being added in this PR.
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.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (22 files):

⚔️ frontend/.env.example (content)
⚔️ frontend/app/[locale]/dashboard/page.tsx (content)
⚔️ frontend/app/[locale]/leaderboard/page.tsx (content)
⚔️ frontend/components/dashboard/ExplainedTermsCard.tsx (content)
⚔️ frontend/components/dashboard/ProfileCard.tsx (content)
⚔️ frontend/components/dashboard/QuizResultRow.tsx (content)
⚔️ frontend/components/dashboard/QuizResultsSection.tsx (content)
⚔️ frontend/components/dashboard/QuizSavedBanner.tsx (content)
⚔️ frontend/components/dashboard/StatsCard.tsx (content)
⚔️ frontend/components/leaderboard/LeaderboardPodium.tsx (content)
⚔️ frontend/components/leaderboard/LeaderboardTable.tsx (content)
⚔️ frontend/components/leaderboard/types.ts (content)
⚔️ frontend/components/q&a/QaSection.tsx (content)
⚔️ frontend/components/quiz/QuizContainer.tsx (content)
⚔️ frontend/components/quiz/QuizzesSection.tsx (content)
⚔️ frontend/data/category.ts (content)
⚔️ frontend/data/categoryStyles.ts (content)
⚔️ frontend/db/queries/leaderboard.ts (content)
⚔️ frontend/lib/about/github-sponsors.ts (content)
⚔️ frontend/messages/en.json (content)
⚔️ frontend/messages/pl.json (content)
⚔️ frontend/messages/uk.json (content)

These conflicts must be resolved before merging into develop.
Resolve conflicts locally and push changes to this branch.
Linked Issues check ❓ Inconclusive The PR adds SQL, PostgreSQL, MongoDB, and Python categories with styles, but the linked issue #335 specifically requires SQL category, icon, tab styling, accordion border styling, and pagination styling. Verify that accordion border styling and pagination styling changes are present in the PR, as these are explicitly required by issue #335 but not evident in the provided summaries.
✅ 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 accurately reflects the main changes: adding new Q&A categories and their corresponding styles across multiple components.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/qa-add-sql
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch feat/qa-add-sql
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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: 1

🧹 Nitpick comments (2)
frontend/components/q&a/QaSection.tsx (1)

78-78: Unnecessary type cast.

category.slug is already a string, and CategorySlug resolves to string (since categoryData isn't declared as const). The as CategorySlug cast is a no-op and can be removed for clarity.

Suggested simplification
-            const value = category.slug as CategorySlug;
+            const value = category.slug;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/components/q`&a/QaSection.tsx at line 78, Remove the redundant type
assertion on category.slug in QaSection.tsx: replace the cast usage in the
assignment (the line assigning to value in the component where you see "const
value = category.slug as CategorySlug;") with a direct use of category.slug
(e.g., "const value = category.slug"). No other type changes required because
CategorySlug resolves to string; just drop the unnecessary "as CategorySlug"
cast to improve clarity.
frontend/components/quiz/QuizContainer.tsx (1)

174-176: Minor inconsistency in fallback accent colors.

When categorySlug is falsy, the fallback is '#3B82F6' (blue). When categorySlug is truthy but unrecognized, getCategoryTabStyle returns defaultCategoryTabStyle.accent which is '#A1A1AA' (gray). Consider using defaultCategoryTabStyle.accent (or a shared constant) as the fallback here too, for consistency.

Suggested fix
+import { getCategoryTabStyle, defaultCategoryTabStyle } from '@/data/categoryStyles';
-import { getCategoryTabStyle } from '@/data/categoryStyles';
 ...
  const accentColor = categorySlug
    ? getCategoryTabStyle(categorySlug).accent
-   : '#3B82F6';
+   : defaultCategoryTabStyle.accent;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/components/quiz/QuizContainer.tsx` around lines 174 - 176, The
fallback accentColor uses a hardcoded '#3B82F6' when categorySlug is falsy;
change it to use the shared default value so it's consistent with
getCategoryTabStyle for unknown slugs. Replace the literal fallback with
defaultCategoryTabStyle.accent (or the shared constant used by
getCategoryTabStyle) when computing accentColor (referencing categorySlug,
getCategoryTabStyle, defaultCategoryTabStyle, and accentColor) so both the falsy
and unrecognized-slug cases use the same default.
🤖 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/.env.example`:
- Line 107: The file is missing a trailing newline which triggers dotenv-linter;
open the file containing the NEXT_PUBLIC_WEB3FORMS_KEY entry and add a single
blank line (newline) at the end of the file so the file ends with a newline
character.

---

Nitpick comments:
In `@frontend/components/q`&a/QaSection.tsx:
- Line 78: Remove the redundant type assertion on category.slug in
QaSection.tsx: replace the cast usage in the assignment (the line assigning to
value in the component where you see "const value = category.slug as
CategorySlug;") with a direct use of category.slug (e.g., "const value =
category.slug"). No other type changes required because CategorySlug resolves to
string; just drop the unnecessary "as CategorySlug" cast to improve clarity.

In `@frontend/components/quiz/QuizContainer.tsx`:
- Around line 174-176: The fallback accentColor uses a hardcoded '#3B82F6' when
categorySlug is falsy; change it to use the shared default value so it's
consistent with getCategoryTabStyle for unknown slugs. Replace the literal
fallback with defaultCategoryTabStyle.accent (or the shared constant used by
getCategoryTabStyle) when computing accentColor (referencing categorySlug,
getCategoryTabStyle, defaultCategoryTabStyle, and accentColor) so both the falsy
and unrecognized-slug cases use the same default.

Comment thread frontend/.env.example
GROQ_API_KEY= No newline at end of file
GROQ_API_KEY=

NEXT_PUBLIC_WEB3FORMS_KEY= No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add a trailing newline at EOF.

dotenv-linter flags missing ending blank line; add one to satisfy the linter.

🧩 Proposed fix
 NEXT_PUBLIC_WEB3FORMS_KEY=
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
NEXT_PUBLIC_WEB3FORMS_KEY=
NEXT_PUBLIC_WEB3FORMS_KEY=
🧰 Tools
🪛 dotenv-linter (4.0.0)

[warning] 107-107: [EndingBlankLine] No blank line at the end of the file

(EndingBlankLine)

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

In `@frontend/.env.example` at line 107, The file is missing a trailing newline
which triggers dotenv-linter; open the file containing the
NEXT_PUBLIC_WEB3FORMS_KEY entry and add a single blank line (newline) at the end
of the file so the file ends with a newline character.

@ViktorSvertoka ViktorSvertoka merged commit 4e50dff into develop Feb 17, 2026
12 checks passed
@ViktorSvertoka ViktorSvertoka deleted the feat/qa-add-sql branch February 17, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant