(SP: 1) [Frontend] Disable quiz editor Save button when no changes made#356
(SP: 1) [Frontend] Disable quiz editor Save button when no changes made#356ViktorSvertoka merged 2 commits intodevelopfrom
Conversation
- fix eslint imports sorting warning
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for develop-devlovers ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughReorders imports across many frontend files, adds a required Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/components/quiz/QuizzesSection.tsx (1)
111-136: Extractlinesabove themapto eliminate the IIFE and redundant per-category computation.
t('noQuizzes')returns the same string for every category iteration. Computinglinesonce outsidecategoryData.map()avoids the repeated call and removes the inline IIFE, which is an unusual pattern in JSX.♻️ Proposed refactor
+ const noQuizzesLines = t('noQuizzes') + .split('\n') + .map(l => l.trim()) + .filter(Boolean); + return ( <div className="w-full"> ... {categoryData.map(category => { ... return ( <TabsContent key={category.slug} value={category.slug}> {categoryQuizzes.length > 0 ? ( ... ) : ( <div className="py-20 text-center"> - {(() => { - const lines = t('noQuizzes') - .split('\n') - .map(l => l.trim()) - .filter(Boolean); - return ( - <> - {lines[0] && ( + {noQuizzesLines[0] && ( <p className="motion-safe:animate-fade-up text-lg font-semibold text-gray-900 motion-reduce:opacity-100 dark:text-white"> - {lines[0]} + {noQuizzesLines[0]} </p> )} - {lines[1] && ( + {noQuizzesLines[1] && ( <p className="motion-safe:animate-fade-up mt-2 text-gray-400 motion-safe:[animation-delay:150ms] motion-reduce:opacity-100 dark:text-gray-300"> - {lines[1]} + {noQuizzesLines[1]} </p> )} - {lines[2] && ( + {noQuizzesLines[2] && ( <p className="motion-safe:animate-fade-up mt-1 text-gray-500 motion-safe:[animation-delay:300ms] motion-reduce:opacity-100 dark:text-gray-400"> - {lines[2]} + {noQuizzesLines[2]} </p> )} - </> - ); - })()} </div> )}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/components/quiz/QuizzesSection.tsx` around lines 111 - 136, The JSX contains an IIFE that computes "lines" from t('noQuizzes') per render/iteration; extract that computation out of the inline function and the per-category render so it's computed once. Concretely, in QuizzesSection (the component rendering the category list), compute const lines = t('noQuizzes').split('\n').map(l => l.trim()).filter(Boolean) once above where you call categoryData.map(...) and then replace the IIFE with JSX that references lines[0], lines[1], lines[2] directly; remove the anonymous self-invoking function to eliminate redundant t('noQuizzes') calls and simplify the markup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@frontend/components/quiz/QuizzesSection.tsx`:
- Around line 111-136: The JSX contains an IIFE that computes "lines" from
t('noQuizzes') per render/iteration; extract that computation out of the inline
function and the per-category render so it's computed once. Concretely, in
QuizzesSection (the component rendering the category list), compute const lines
= t('noQuizzes').split('\n').map(l => l.trim()).filter(Boolean) once above where
you call categoryData.map(...) and then replace the IIFE with JSX that
references lines[0], lines[1], lines[2] directly; remove the anonymous
self-invoking function to eliminate redundant t('noQuizzes') calls and simplify
the markup.
Summary by CodeRabbit
New Features
Improvements
Style & Refactoring