Skip to content

Blog and Sanity: fixes and refactoring#267

Merged
ViktorSvertoka merged 44 commits into
developfrom
sanity
Feb 4, 2026
Merged

Blog and Sanity: fixes and refactoring#267
ViktorSvertoka merged 44 commits into
developfrom
sanity

Conversation

@KomrakovaAnna
Copy link
Copy Markdown
Collaborator

@KomrakovaAnna KomrakovaAnna commented Feb 3, 2026

Refactoring and fixes fot eslint

Summary by CodeRabbit

  • New Features

    • Added comprehensive quiz encryption test suite with coverage for answer encryption, decryption, and tampering detection.
  • Improvements

    • Enhanced blog image rendering with responsive sizing and optimization.
    • Improved blog filtering and pagination state management.

….org JSON‑LD for Article (BlogPosting) and BreadcrumbList , Added <time datetime> tags where blog dates renders
…he BreadcrumbList, logo to the cocial links in User info, Fixed: main container alignment, category navigation in breadcrumbs
…he BreadcrumbList, logo to the cocial links in User info, Fixed: main container alignment, category navigation in breadcrumbs
…, fied breadcrumbs category translaion, added category to the recommended cards, fixed search for localisations
feat(Blog): merging develop
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 3, 2026

Deploy Preview for develop-devlovers ready!

Name Link
🔨 Latest commit df07575
🔍 Latest deploy log https://app.netlify.com/projects/develop-devlovers/deploys/6982f3b4700a78000820b1a8
😎 Deploy Preview https://deploy-preview-267--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.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 3, 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 4, 2026 7:23am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 3, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

This PR updates blog components to use Next.js Image component, refactors BlogFilters state management to derive currentPage from URL parameters, modifies quiz-related test files and infrastructure, and contains unresolved merge conflicts in multiple files requiring manual resolution before merging.

Changes

Cohort / File(s) Summary
Quiz import cleanup
frontend/actions/quiz.ts
Added duplicate import of eq and inArray from drizzle-orm, resulting in redundant symbols already available in existing import.
Blog image rendering updates
frontend/app/[locale]/blog/[slug]/PostDetails.tsx, frontend/components/blog/BlogFilters.tsx
Replaced standard img tags with Next.js Image component, adding explicit width, height, sizes attributes, and responsive styling. Removed unused linkKey variable in PostDetails.
BlogFilters state refactoring
frontend/components/blog/BlogFilters.tsx
Migrated from local currentPage state to derived state based on parsedPage from URL parameters. Updated pagination logic, filter reset behavior, and image rendering for featured posts. Replaced direct state mutations with URL search parameter updates.
Search effect dependency
frontend/components/blog/BlogHeaderSearch.tsx
Extended useEffect dependency array to include locale, causing re-runs when locale changes alongside open, items.length, and isLoading.
Quiz container unresolved conflict
frontend/components/quiz/QuizContainer.tsx
Unresolved merge conflict in icon imports with competing choices between AlertTriangle and TriangleAlert from lucide-react. Conflict markers present; requires manual reconciliation.
Blog test mock updates
frontend/components/tests/blog/blog-card.test.tsx, frontend/components/tests/blog/blog-filters.test.tsx, frontend/components/tests/blog/blog-header-search.test.tsx
Updated Next.js Image mock to explicitly render alt attribute; removed beforeEach import from vitest in two test files.
Quiz test infrastructure & conflicts
frontend/lib/tests/quiz/quiz-crypto.test.ts, frontend/lib/tests/quiz/setup.ts, frontend/lib/tests/quiz/verify-answer.test.ts
Added new comprehensive quiz-crypto test suite covering encryption/decryption and blob creation. Unresolved merge conflict markers present in setup.ts and verify-answer.test.ts requiring manual resolution; conflicting vitest imports and test setup logic between branches.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related issues

Possibly related PRs

Suggested labels

refactor, blog, quiz, tests

Suggested reviewers

  • AM1007
  • ViktorSvertoka

Poem

🐰 Hop-hops through the blog and quiz,
Images now sharper, state's a whiz,
Conflicts merge with careful care,
Next.js Image floating there! ✨
Tests now crypto-strong and bright! 🔐

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 'Blog and Sanity: fixes and refactoring' accurately reflects the primary focus of the changeset, covering blog-related updates and general refactoring work across multiple components.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sanity

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist.


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

Caution

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

⚠️ Outside diff range comments (2)
frontend/components/blog/BlogHeaderSearch.tsx (1)

76-98: ⚠️ Potential issue | 🟡 Minor

Locale change won't refresh search items if already loaded.

Adding locale to the dependency array is correct since it's used in the fetch URL. However, the effect guard if (!open || items.length || !isLoading) returns early when items.length is truthy, meaning a locale change won't trigger a re-fetch if items are already loaded.

Consider clearing items when locale changes to ensure fresh data for the new language:

🔧 Proposed fix

Add a separate effect to clear items on locale change:

+ const prevLocaleRef = useRef(locale);
+ 
+ useEffect(() => {
+   if (prevLocaleRef.current !== locale) {
+     prevLocaleRef.current = locale;
+     setItems([]);
+     if (open) setIsLoading(true);
+   }
+ }, [locale, open]);
frontend/lib/tests/quiz/verify-answer.test.ts (1)

10-26: ⚠️ Potential issue | 🔴 Critical

Unresolved merge conflict blocks compilation.

The second conflict is around mock setup. The tests use mockGetCorrectAnswer (lines 47, 70, 144, 163), which comes from the develop side's Redis mock pattern. The HEAD side's imports (factories, setup utilities) are not used anywhere in the test file.

🐛 Proposed fix: Resolve by keeping the develop side mock setup
-<<<<<<< HEAD
-import {
-  createCorrectAnswersMap,
-  createMockQuestions,
-  resetFactoryCounters,
-} from '../factories/quiz/quiz';
-import { cleanupQuizTestEnv, setupQuizTestEnv } from './setup';
-=======
 // Mock the Redis module
 vi.mock('@/lib/quiz/quiz-answers-redis', () => ({
   getCorrectAnswer: vi.fn(),
 }));

 import { getCorrectAnswer } from '@/lib/quiz/quiz-answers-redis';

 const mockGetCorrectAnswer = vi.mocked(getCorrectAnswer);
->>>>>>> develop
🤖 Fix all issues with AI agents
In `@frontend/actions/quiz.ts`:
- Around line 3-4: Remove the duplicate import from 'drizzle-orm' and drop the
unused symbol: consolidate the imports so only eq and inArray are imported once
(remove the extra line that re-imports eq and inArray) and remove the unused and
import; update the import statement that currently references and, eq, inArray
to only export the actually used symbols eq and inArray to fix the compilation
error.

In `@frontend/components/quiz/QuizContainer.tsx`:
- Around line 2-7: Resolve the unresolved git conflict in QuizContainer.tsx by
removing the conflict markers (<<<<<<< HEAD, =======, >>>>>>> develop) and
keeping the develop-side import that uses the renamed icon: replace the
conflicting import block with a single import from 'lucide-react' that includes
TriangleAlert (and the other icons Ban, Clock, FileText) so the component's use
of TriangleAlert at the referenced occurrence works.

In `@frontend/lib/tests/quiz/setup.ts`:
- Around line 1-5: Resolve the Git conflict markers in setup.ts by removing the
<<<<<<<, =======, and >>>>>>> lines and keeping the vitest import line "import {
afterEach, beforeEach, vi } from 'vitest';" (these symbols are required because
the file uses vi.fn(), beforeEach, and afterEach); ensure only a single clean
import statement remains at the top so the existing vi.fn() calls compile.

In `@frontend/lib/tests/quiz/verify-answer.test.ts`:
- Around line 2-6: There is an unresolved merge conflict in the vitest imports
that removes the `vi` import used by vi.clearAllMocks() and vi.mocked(); open
the import line in verify-answer.test.ts and resolve the conflict by keeping the
develop-side import that includes `vi` (i.e., import { beforeEach, describe,
expect, it, vi } from 'vitest'), ensuring any other expected imports like
afterEach are preserved if used elsewhere in the file.

Comment thread frontend/actions/quiz.ts Outdated
Comment thread frontend/components/quiz/QuizContainer.tsx Outdated
Comment thread frontend/lib/tests/quiz/setup.ts Outdated
Comment on lines +1 to +5
<<<<<<< HEAD
import { afterEach, beforeEach, vi } from 'vitest';

=======
>>>>>>> develop
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 | 🔴 Critical

Unresolved merge conflict blocks compilation.

The file contains Git conflict markers (<<<<<<<, =======, >>>>>>>) that must be resolved before merging. The HEAD side's import is required since vi.fn() is used throughout this file (lines 37, 38, 41, 44, 50).

🐛 Proposed fix: Resolve conflict by keeping the vitest import
-<<<<<<< HEAD
 import { afterEach, beforeEach, vi } from 'vitest';
-
-=======
->>>>>>> develop
+
📝 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
<<<<<<< HEAD
import { afterEach, beforeEach, vi } from 'vitest';
=======
>>>>>>> develop
import { afterEach, beforeEach, vi } from 'vitest';
🧰 Tools
🪛 Biome (2.3.13)

[error] 1-1: Expected a statement but instead found '<<<<<<< HEAD'.

Expected a statement here.

(parse)


[error] 3-5: Expected a statement but instead found '=======

develop'.

Expected a statement here.

(parse)

🤖 Prompt for AI Agents
In `@frontend/lib/tests/quiz/setup.ts` around lines 1 - 5, Resolve the Git
conflict markers in setup.ts by removing the <<<<<<<, =======, and >>>>>>> lines
and keeping the vitest import line "import { afterEach, beforeEach, vi } from
'vitest';" (these symbols are required because the file uses vi.fn(),
beforeEach, and afterEach); ensure only a single clean import statement remains
at the top so the existing vi.fn() calls compile.

Comment thread frontend/lib/tests/quiz/verify-answer.test.ts Outdated
Merging develop into sanity
@ViktorSvertoka ViktorSvertoka merged commit 622cde3 into develop Feb 4, 2026
10 checks passed
@ViktorSvertoka ViktorSvertoka deleted the sanity branch February 4, 2026 10:17
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