Skip to content

Add Keyboard Shortcuts#53

Merged
Nusab19 merged 4 commits intoContest-Hive:mainfrom
Nusab19:main
Dec 26, 2025
Merged

Add Keyboard Shortcuts#53
Nusab19 merged 4 commits intoContest-Hive:mainfrom
Nusab19:main

Conversation

@Nusab19
Copy link
Copy Markdown
Member

@Nusab19 Nusab19 commented Dec 26, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added global keyboard shortcuts: Backspace (navigate back), Ctrl+Backspace (home), F (focused view), Esc (unfocus), "/" (open shortcuts modal), Alt+T (toggle theme), Ctrl+Enter (send message), Backslash (toggle platform selector).
    • Introduced shortcuts modal displaying all available keyboard bindings with descriptions.
    • Feature comparison table now includes Clist platform with info tooltips for additional context.
  • Improvements

    • Reorganized navbar layout for better mobile/desktop experience.
    • Enhanced message sending with visual "Sending..." feedback and improved submission state handling.
    • Refined time display format.

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

@Nusab19 Nusab19 merged commit b63f058 into Contest-Hive:main Dec 26, 2025
1 check was pending
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 26, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR implements a comprehensive global keyboard shortcut system throughout the application. It introduces new components (GlobalShortcuts, ShortcutModal) and a custom hook (useKeyboardShortcut) for managing hotkeys, integrates keyboard shortcuts into existing components (MdEditor, SelectPlatform, theme-toggle), refactors the Navbar layout, and updates the WhyUs comparison table to include a Clist column.

Changes

Cohort / File(s) Summary
Keyboard Shortcut Infrastructure
src/components/GlobalShortcuts.tsx, src/components/ShortcutModal.tsx, src/hooks/useKeyboardShortcut.ts
New GlobalShortcuts component wires hotkeys for backspace, Ctrl+Backspace, F, and Esc navigation/escape. New ShortcutModal component renders a floating trigger button and grouped shortcuts overlay, toggled via "/" key. New useKeyboardShortcut hook registers global keydown listeners with modifier and runOnInput support.
Keyboard Shortcut Integration
src/components/sub/MdEditor.tsx, src/components/sub/SelectPlatform.tsx, src/components/ui/theme-toggle.tsx
MdEditor adds Ctrl+Enter to send messages with disabled state management and user feedback. SelectPlatform adds backslash hotkey to toggle dropdown menu. Theme-toggle adds Alt+T hotkey for theme switching, now using resolvedTheme from next-themes.
Navigation & Root Layout
src/app/layout.tsx, src/components/Navbar.tsx
Root layout imports and renders GlobalShortcuts and ShortcutModal components. Navbar reorganized: removes KeyboardShortcuts import, simplifies desktop/mobile navigation structure, consolidates ModeToggle rendering, and creates dedicated mobile menu container.
UI Table & Component Styling
src/app/about/components/WhyUs.tsx, src/components/sub/Contest.tsx
WhyUs rewrites table to 5 columns (adds Clist), introduces Info tooltip wrapper with InfoIcon, extends listItems data structure. Contest adjusts link container styling with relative positioning, replaces [GYM] tag to span, repositions trailing Link2 icon absolutely on the right.
Removed Component
src/components/sub/KeyboardShortcuts.tsx
Deleted static keyboard shortcuts card UI component; functionality replaced by new ShortcutModal.
Minor Updates
src/app/api/others/send/route.ts, src/components/Contact.tsx, src/lib/helpers/datetime.ts
send/route.ts adds blank line in request body. Contact.tsx applies formatting adjustments. datetime.ts removes year from IsoTimeToLocalTime output format.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Browser
    participant GlobalShortcuts
    participant ShortcutModal
    participant Router
    participant MdEditor

    User->>Browser: Press keyboard (e.g., Backspace, "/", Ctrl+Enter)
    Browser->>GlobalShortcuts: keydown event
    alt Navigation Shortcut
        GlobalShortcuts->>Router: Navigate back / home / focused
        Router->>Browser: Update location
    else "/" Shortcut
        GlobalShortcuts->>ShortcutModal: Toggle modal visibility
        ShortcutModal->>Browser: Render shortcuts overlay
    else Ctrl+Enter in Message
        Browser->>MdEditor: keydown event
        MdEditor->>MdEditor: handleKeyDown validates & calls handleSendMessage
        MdEditor->>Browser: POST /api/send (message)
        Browser-->>MdEditor: Response (clear textarea)
        MdEditor->>Browser: Show toast (success/error)
    else Esc Pressed
        GlobalShortcuts->>Browser: Blur focused element
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Possibly related PRs

Poem

🐰 Shortcuts Make the Heart Go Click

With Backspace, slash, and Ctrl we zoom,
Through global keys that light the room,
A modal blooms with hotkey cheer,
Each keystroke brings the shortcuts near! 📋✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf3e283 and c4cdd1d.

⛔ Files ignored due to path filters (1)
  • public/assets/cover.png is excluded by !**/*.png
📒 Files selected for processing (14)
  • src/app/about/components/WhyUs.tsx
  • src/app/api/others/send/route.ts
  • src/app/layout.tsx
  • src/components/Contact.tsx
  • src/components/GlobalShortcuts.tsx
  • src/components/Navbar.tsx
  • src/components/ShortcutModal.tsx
  • src/components/sub/Contest.tsx
  • src/components/sub/KeyboardShortcuts.tsx
  • src/components/sub/MdEditor.tsx
  • src/components/sub/SelectPlatform.tsx
  • src/components/ui/theme-toggle.tsx
  • src/hooks/useKeyboardShortcut.ts
  • src/lib/helpers/datetime.ts

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.

@coderabbitai coderabbitai bot mentioned this pull request Feb 14, 2026
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.

1 participant