Skip to content

Improve SafetyToolkit accessibility#1

Open
maitamdev wants to merge 2 commits intomainfrom
codex/them-noi-dung-cho-du-an-nay
Open

Improve SafetyToolkit accessibility#1
maitamdev wants to merge 2 commits intomainfrom
codex/them-noi-dung-cho-du-an-nay

Conversation

@maitamdev
Copy link
Owner

@maitamdev maitamdev commented Jan 2, 2026

Summary

  • add explicit button type to SafetyToolkit actions
  • provide accessible labels derived from localized card titles

Testing

  • not run (not requested)

Codex Task


Summary by cubic

Adds a new SafetyToolkit component and makes its actions accessible with explicit button types and localized aria-labels. Integrates the Safety Toolkit section into the home page to surface key tools and improve navigation.

  • New Features
    • Added SafetyToolkit grid with four actions: Scan, Alerts, Extension, Community.
    • Localized titles and descriptions (vi/en) with aria-labels derived from titles.
    • Integrated a new “Safety Toolkit” section on Home with motion animations and a “Smart recommendations” badge.

Written for commit cd6ce60. Summary will update on new commits.

Summary by CodeRabbit

  • New Features
    • Added a Safety Toolkit section on the home page with interactive, animated, clickable cards that guide users through steps.
    • Cards present bilingual titles and descriptions, adapt responsively to screen size, and navigate to relevant pages when selected.
    • Accessibility enhancements: cards include proper labels for screen readers and improved motion/staggered animations for a polished experience.

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

@vercel
Copy link

vercel bot commented Jan 2, 2026

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

Project Deployment Review Updated (UTC)
anti-scam Ready Ready Preview, Comment Jan 2, 2026 5:47pm

@coderabbitai
Copy link

coderabbitai bot commented Jan 2, 2026

📝 Walkthrough

Walkthrough

A new SafetyToolkit React component renders an animated grid of interactive cards with bilingual content and icon-based navigation. The Home page is updated with a new Safety Toolkit section that integrates and displays this component.

Changes

Cohort / File(s) Summary
New SafetyToolkit Component
app/components/SafetyToolkit.tsx
Introduces a new React component featuring a static array of four toolkit items. Each card includes an icon from lucide-react, bilingual title/description, gradient styling, and navigation action. Uses framer-motion for staggered fade-in animations, LanguageContext for localization, and Next.js router for navigation. Cards are responsive and include accessibility attributes (aria-label).
Home Page Integration
app/page.tsx
Adds import for SafetyToolkit component and introduces a new "Safety Toolkit" section with bilingual heading, description text, a small badge, and responsive layout. The section is integrated into the existing page flow with localization support consistent with the page's current patterns.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A toolkit of safety, animated in light,
Cards bloom in gradients, gentle and bright,
Four little guides with icons that steer,
Bilingual whispers make intentions clear,
Hop on—these steps will keep things right!

Pre-merge checks and finishing touches

❌ 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 'Improve SafetyToolkit accessibility' is partially related to the changeset. While the PR objectives mention accessibility improvements (explicit button types, accessible labels, aria-labels), the raw summary indicates the primary changes are adding a new SafetyToolkit component and integrating it into the Home page. The title captures only the accessibility aspect, not the main addition of the new component itself.
✨ Finishing touches
  • 📝 Generate docstrings

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

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link

@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: 0

🧹 Nitpick comments (1)
app/components/SafetyToolkit.tsx (1)

72-72: Minor formatting inconsistency.

The return statement has extra indentation. Consider aligning it with the opening brace of the .map() callback.

🔎 Proposed fix
       {cards.map((card, index) => {
         const Icon = card.icon
 
-          return (
+        return (
             <motion.button
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c3e54d and 4b7dad1.

📒 Files selected for processing (2)
  • app/components/SafetyToolkit.tsx
  • app/page.tsx
🧰 Additional context used
🧬 Code graph analysis (2)
app/components/SafetyToolkit.tsx (1)
app/lib/i18n/LanguageContext.tsx (1)
  • useTranslation (52-55)
app/page.tsx (1)
app/components/SafetyToolkit.tsx (1)
  • SafetyToolkit (63-111)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cubic · AI code reviewer
🔇 Additional comments (4)
app/page.tsx (1)

27-27: LGTM! SafetyToolkit integration is well-structured.

The import and new section follow established patterns in the file. The bilingual content, responsive layout, and animation approach are consistent with other sections.

Also applies to: 577-604

app/components/SafetyToolkit.tsx (3)

1-6: LGTM! Clean imports and proper client directive.

The file correctly uses the 'use client' directive and imports necessary dependencies for client-side interactivity and animations.


73-106: Excellent accessibility implementation!

The button correctly implements:

  • type="button" attribute (line 76) to prevent form submission
  • aria-label with localized content (line 81) for screen reader support

These changes align perfectly with the PR objectives of improving accessibility.


8-61: All referenced routes (/scan, /alerts, /extension, /community) are properly implemented in the codebase.

Copy link

@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 (1)
app/components/SafetyToolkit.tsx (1)

81-103: Consider extracting language selection logic.

The language selection pattern language === 'vi' ? card.title.vi : card.title.en is repeated four times (lines 81, 95, 99, 102). Consider extracting this into a helper function or using a lookup pattern for better maintainability.

🔎 Proposed refactor to reduce duplication

Add a helper function at the top of the component:

 export default function SafetyToolkit() {
   const router = useRouter()
   const { language } = useTranslation()
+
+  const getLocalizedText = (text: { vi: string; en: string }) => 
+    language === 'vi' ? text.vi : text.en

   return (
     <div className="grid gap-4 sm:gap-6 md:grid-cols-2">

Then simplify the usage:

-            aria-label={language === 'vi' ? card.title.vi : card.title.en}
+            aria-label={getLocalizedText(card.title)}
             className="relative overflow-hidden rounded-2xl border border-white/10 bg-white/5 p-5 text-left shadow-lg backdrop-blur-xl transition hover:-translate-y-1 hover:border-white/20"
           >
             <div className={`absolute inset-0 bg-gradient-to-br ${card.color} opacity-40`} />
             <div className="relative flex items-start gap-4">
               <div className="rounded-xl bg-white/10 p-3 text-white shadow-inner">
                 <Icon className="h-6 w-6" />
               </div>
               <div className="space-y-1">
                 <div className="flex items-center gap-2">
                   <span className="rounded-full bg-white/10 px-2 py-1 text-[11px] font-semibold uppercase tracking-wide text-cyan-200">
                     {index + 1 < 10 ? `0${index + 1}` : index + 1}
                   </span>
                   <p className="text-sm font-semibold text-cyan-100">
-                    {language === 'vi' ? 'Bước tiếp theo' : 'Next step'}
+                    {getLocalizedText({ vi: 'Bước tiếp theo', en: 'Next step' })}
                   </p>
                 </div>
                 <h3 className="text-lg font-bold text-white">
-                  {language === 'vi' ? card.title.vi : card.title.en}
+                  {getLocalizedText(card.title)}
                 </h3>
                 <p className="text-sm text-gray-200">
-                  {language === 'vi' ? card.description.vi : card.description.en}
+                  {getLocalizedText(card.description)}
                 </p>
               </div>
             </div>
           </motion.button>
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b7dad1 and cd6ce60.

📒 Files selected for processing (1)
  • app/components/SafetyToolkit.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
app/components/SafetyToolkit.tsx (1)
app/lib/i18n/LanguageContext.tsx (1)
  • useTranslation (52-55)
🔇 Additional comments (2)
app/components/SafetyToolkit.tsx (2)

1-6: LGTM!

The imports are clean and appropriate. The 'use client' directive is correctly placed for client-side features (animations, routing, context hooks).


73-106: Excellent accessibility implementation.

The explicit type="button" attribute and localized aria-label align perfectly with the PR objectives and provide proper accessibility for screen readers.

Comment on lines +8 to +61
const cards = [
{
icon: ScanSearch,
action: '/scan',
color: 'from-blue-500/20 via-cyan-500/10 to-blue-600/20',
title: {
vi: 'Kiểm tra tức thì',
en: 'Instant check'
},
description: {
vi: 'Quét URL, hình ảnh hoặc tin nhắn đáng ngờ chỉ với một cú nhấp.',
en: 'Scan suspicious links, images, or messages in one tap.'
}
},
{
icon: Bell,
action: '/alerts',
color: 'from-amber-500/15 via-orange-500/10 to-amber-600/15',
title: {
vi: 'Cảnh báo nóng',
en: 'Live alerts'
},
description: {
vi: 'Cập nhật xu hướng lừa đảo mới nhất để tránh các chiêu trò mới.',
en: 'Stay ahead of emerging scam trends with fresh alerts.'
}
},
{
icon: Download,
action: '/extension',
color: 'from-emerald-500/15 via-green-500/10 to-emerald-600/15',
title: {
vi: 'Cài extension',
en: 'Install extension'
},
description: {
vi: 'Bảo vệ trình duyệt 24/7 với cảnh báo và kiểm tra tự động.',
en: 'Get always-on browser protection with automatic checks.'
}
},
{
icon: Users,
action: '/community',
color: 'from-indigo-500/15 via-purple-500/10 to-indigo-600/15',
title: {
vi: 'Cộng đồng hỗ trợ',
en: 'Community support'
},
description: {
vi: 'Học kinh nghiệm thực chiến từ cộng đồng và chuyên gia.',
en: 'Learn real-world tips from peers and experts.'
}
}
]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the app directory structure and verify routes
echo "=== App directory structure ==="
find app -type d -maxdepth 1 | sort

echo ""
echo "=== Checking for route implementations ==="
for route in scan alerts extension community; do
  echo "Checking /app/$route..."
  if [ -d "app/$route" ]; then
    ls -la "app/$route"
  else
    echo "  ⚠️  Directory app/$route does not exist"
  fi
done

echo ""
echo "=== Searching for page files in app directory ==="
fd -t f "page\.(tsx|ts|jsx|js)" app

Repository: maitamdev/Anti-Scam

Length of output: 2216


Fix broken /community route.

The cards array references four navigation routes, but /community is not properly implemented. While /scan, /alerts, and /extension all have corresponding page.tsx files, the /community route lacks a root page.tsx. The directory exists but only contains app/community/stories/page.tsx, which means navigating to /community will result in a 404 error. Either create a root page for /community or update the card's action to point to the existing /community/stories route.

🤖 Prompt for AI Agents
In app/components/SafetyToolkit.tsx around lines 8 to 61, the card for the
community action points to "/community" but there is no root
app/community/page.tsx (only app/community/stories/page.tsx), causing a 404; fix
by either creating a new root page.tsx at app/community/page.tsx that renders or
redirects to the stories page, or change the card's action to
"/community/stories" so it links to the existing route.

@maitamdev
Copy link
Owner Author

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant