Skip to content

Conversation

@chmurson
Copy link
Collaborator

@chmurson chmurson commented Nov 3, 2025

Summary by CodeRabbit

  • New Features

    • Keyboard shortcuts for note editing (Ctrl/Cmd+Enter to save, Escape to cancel).
    • Improved note editing flow with clearer edit/save/cancel actions and visible edit affordance.
    • Labels now display source-prefixed text where applicable; selected-text areas are highlighted with a link.
  • Style

    • Vertical-only scrolling in the note manager.
    • Cleaner inputs: textarea and input borders removed.
  • Chores

    • Updated a UI dependency to a newer patch version.
  • Documentation

    • Clarified README instructions for updating and reviewing snapshot changes.
  • Tests

    • Increased wait timeout for a visual snapshot step.

@netlify
Copy link

netlify bot commented Nov 3, 2025

Deploy Preview for graypaper-reader ready!

Name Link
🔨 Latest commit 2d36bf0
🔍 Latest deploy log https://app.netlify.com/projects/graypaper-reader/deploys/69091550fbe74700088cc596
😎 Deploy Preview https://deploy-preview-336--graypaper-reader.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

coderabbitai bot commented Nov 3, 2025

Warning

Rate limit exceeded

@chmurson has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 45 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 850e75e and 2d36bf0.

⛔ Files ignored due to path filters (4)
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-activation-dark-mode-linux.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-activation-light-mode-linux.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-edit-dark-mode-linux.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-edit-light-mode-linux.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • README.md (1 hunks)
  • src/components/NoteManager/components/Note.tsx (5 hunks)
  • src/components/NoteManager/components/NoteContext.tsx (1 hunks)

Walkthrough

This PR bumps a shared-ui dependency, refactors note UI by adding a NoteContext and extracting NoteLayout components, adjusts note-related CSS and global textarea styling, updates label handling, increases a snapshot test wait timeout, and adds README guidance about snapshot updates.

Changes

Cohort / File(s) Summary
Dependency Update
package.json
Bumps @fluffylabs/shared-ui from ^0.4.0 to ^0.4.2.
CSS Refinements
src/components/NoteManager/NoteManager.css, src/index.css
Constrains scrolling to vertical (overflow-y: auto; overflow-x: hidden;) and removes custom textarea/input border and global textarea styling.
Note Context System
src/components/NoteManager/components/NoteContext.tsx
Adds noteContext and useNoteContext() exposing note, edit state, handlers (edit/save/cancel), handleNoteContentChange, noteDirty, onEditNote, and isEditing; enforces provider usage.
Component Refactor / Layout Extraction
src/components/NoteManager/components/Note.tsx, src/components/NoteManager/components/NoteLayout.tsx
Removes in-file state/context in Note.tsx; consumes new NoteContext; extracts NoteLayout exports (Root, Text, TextArea, SelectedText) and wires keyboard shortcuts (Ctrl/Cmd+Enter save, Escape cancel) and selection display.
Label API & Usage
src/components/Label/Label.tsx, src/components/NoteManager/components/NoteLabels.tsx
Label prop type changed from PrefixedLabel to plain string (helper LabelString removed). NoteLabels now prefixes labels via prefixLabel(note.source, label) and passes them to Label with variant="outlined".
Tests & Docs
tools/snapshot-tests/tests/basic-snapshots.spec.ts, README.md
Doubled waitFor timeout for selected-text visibility in snapshot test; README adds note that npm run docker:test:update updates snapshots and they can be reviewed locally/GitHub.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant User
    participant NoteComp as Note.tsx
    participant NoteCtx as NoteContext Provider
    participant Layout as NoteLayout (Root/Text/TextArea/SelectedText)
    participant Store as Note State

    User->>NoteComp: open or select note
    NoteComp->>NoteCtx: consume context (useNoteContext)
    NoteComp->>Layout: render appropriate view (Text / TextArea / SelectedText)
    User->>Layout: type or press keys (Ctrl/Cmd+Enter, Escape)
    Layout->>NoteCtx: handleNoteContentChange / handleSaveClick / handleCancelClick
    NoteCtx->>Store: update noteDirty / isEditing / persist via onEditNote
    Store-->>NoteComp: state changes cause re-render
    NoteComp->>Layout: reflect updated note state
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Extra attention:
    • src/components/NoteManager/components/Note.tsx — verify context consumption and correct view/edit transitions.
    • src/components/NoteManager/components/NoteContext.tsx — validate types, provider shape, and thrown error message when used outside provider.
    • src/components/NoteManager/components/NoteLayout.tsx — confirm keyboard shortcut behavior and focus/aria/test-id handling.
    • src/components/Label/Label.tsx & NoteLabels.tsx — ensure label prefixing and prop type change don't break consumers.

Possibly related PRs

Suggested reviewers

  • DrEverr
  • mateuszsikora

Poem

🐇 A nibble, a hop, new pieces align,
Context stitched tidy, layout by design.
Keys that save, labels freshly dressed,
CSS trimmed down to scroll its best.
Snapshots refreshed — a small rabbit's fest.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Move edit button bottom right' is vague and does not clearly reflect the substantial refactoring work in this PR, which includes dependency updates, CSS adjustments, context creation, layout extraction, and component restructuring across multiple files. Consider a more descriptive title that captures the main refactoring effort, such as 'Refactor NoteManager with context and layout components' or 'Extract NoteLayout and establish NoteContext for note editing'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Visual Regression Test Report ✅ Passed

Github run id: 19048904357

🔗 Artifacts: Download

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

🧹 Nitpick comments (1)
src/components/NoteManager/components/NoteContext.tsx (1)

5-15: Consider using PascalCase for the context name.

The context is named noteContext (lowercase), but React contexts conventionally use PascalCase (NoteContext). This improves consistency with React ecosystem conventions and enhances code readability.

Apply this diff to align with naming conventions:

-export const noteContext = createContext<{
+export const NoteContext = createContext<{
   note: IDecoratedNote;
   isEditable: boolean;
   handleEditClick: () => void;
   handleSaveClick: () => void;
   handleCancelClick: () => void;
   handleNoteContentChange: (ev: ChangeEvent<HTMLTextAreaElement>) => void;
   noteDirty: { content: string };
   onEditNote: INotesContext["handleUpdateNote"];
   isEditing: boolean;
 } | null>(null);

Then update the hook accordingly:

 export const useNoteContext = () => {
-  const context = useContext(noteContext);
+  const context = useContext(NoteContext);
   if (!context) {
     throw new Error("useNoteContext must be used within a NoteContextProvider");
   }
   return context;
 };
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbc02c7 and 2ce7444.

⛔ Files ignored due to path filters (13)
  • package-lock.json is excluded by !**/package-lock.json
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-activation-dark-mode-darwin.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-activation-dark-mode-linux.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-activation-light-mode-darwin.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-activation-light-mode-linux.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-edit-dark-mode-darwin.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-edit-dark-mode-linux.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-edit-light-mode-darwin.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-after-note-edit-light-mode-linux.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-initial-dark-mode-darwin.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-initial-dark-mode-linux.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-initial-light-mode-darwin.png is excluded by !**/*.png
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts-snapshots/notes-tab-initial-light-mode-linux.png is excluded by !**/*.png
📒 Files selected for processing (7)
  • package.json (1 hunks)
  • src/components/NoteManager/NoteManager.css (1 hunks)
  • src/components/NoteManager/components/Note.tsx (5 hunks)
  • src/components/NoteManager/components/NoteContext.tsx (1 hunks)
  • src/components/NoteManager/components/NoteLayout.tsx (1 hunks)
  • src/index.css (0 hunks)
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • src/index.css
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

⚙️ CodeRabbit configuration file

When reviewing Tailwind CSS classes, ensure they follow Tailwind 4.x conventions and suggest modern 4.x alternatives for deprecated patterns.

Files:

  • src/components/NoteManager/components/NoteContext.tsx
  • src/components/NoteManager/components/NoteLayout.tsx
  • src/components/NoteManager/components/Note.tsx
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts
**/*.css

⚙️ CodeRabbit configuration file

Review CSS code with focus on Tailwind CSS 4.x best practices and conventions. Ensure compatibility with Tailwind 4.x features and syntax.

Files:

  • src/components/NoteManager/NoteManager.css
🧠 Learnings (3)
📓 Common learnings
Learnt from: chmurson
Repo: FluffyLabs/graypaper-reader PR: 330
File: src/components/Outline/OutlineLink.tsx:17-21
Timestamp: 2025-10-22T20:36:10.440Z
Learning: This repo targets React 19+; prefer passing refs as a normal prop to function components and avoid React.forwardRef in new code. File context: src/components/Outline/OutlineLink.tsx.
Learnt from: chmurson
Repo: FluffyLabs/graypaper-reader PR: 330
File: src/components/Outline/OutlineLink.tsx:17-21
Timestamp: 2025-10-22T20:36:10.440Z
Learning: Project targets React 19+; prefer passing refs as a regular prop in function components and avoid React.forwardRef in new code. File: src/components/Outline/OutlineLink.tsx.
📚 Learning: 2025-10-22T20:36:10.440Z
Learnt from: chmurson
Repo: FluffyLabs/graypaper-reader PR: 330
File: src/components/Outline/OutlineLink.tsx:17-21
Timestamp: 2025-10-22T20:36:10.440Z
Learning: This repo targets React 19+; prefer passing refs as a normal prop to function components and avoid React.forwardRef in new code. File context: src/components/Outline/OutlineLink.tsx.

Applied to files:

  • src/components/NoteManager/components/NoteContext.tsx
  • src/components/NoteManager/components/NoteLayout.tsx
  • src/components/NoteManager/components/Note.tsx
📚 Learning: 2025-10-22T20:36:10.440Z
Learnt from: chmurson
Repo: FluffyLabs/graypaper-reader PR: 330
File: src/components/Outline/OutlineLink.tsx:17-21
Timestamp: 2025-10-22T20:36:10.440Z
Learning: Project targets React 19+; prefer passing refs as a regular prop in function components and avoid React.forwardRef in new code. File: src/components/Outline/OutlineLink.tsx.

Applied to files:

  • src/components/NoteManager/components/NoteLayout.tsx
  • src/components/NoteManager/components/Note.tsx
🧬 Code graph analysis (3)
src/components/NoteManager/components/NoteContext.tsx (2)
src/components/NotesProvider/types/DecoratedNote.ts (1)
  • IDecoratedNote (4-19)
src/components/NotesProvider/NotesProvider.tsx (1)
  • INotesContext (20-40)
src/components/NoteManager/components/NoteLayout.tsx (4)
src/components/NoteManager/components/NoteContext.tsx (2)
  • useNoteContext (17-23)
  • noteContext (5-15)
src/components/NoteContent/NoteContent.tsx (1)
  • NoteContent (10-19)
src/components/SelectionProvider/SelectionProvider.tsx (2)
  • SelectionContext (35-35)
  • ISelectionContext (21-29)
src/components/NoteManager/components/NoteLink.tsx (1)
  • NoteLink (16-135)
src/components/NoteManager/components/Note.tsx (2)
src/components/NoteManager/components/NoteLabels.tsx (1)
  • NoteLabels (9-17)
src/components/NoteManager/components/NoteLayout.tsx (1)
  • NoteLayout (65-70)
⏰ 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: visual-tests

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ce7444 and b15f06a.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools/snapshot-tests/tests/basic-snapshots.spec.ts
🧰 Additional context used
🪛 LanguageTool
README.md

[locale-violation] ~55-~55: In American English, ‘afterward’ is the preferred variant. ‘Afterwards’ is more commonly used in British English and other dialects.
Context: ...e all the snapshots. You can compare it afterwards in your local Git GUI or Github web int...

(AFTERWARDS_US)

@chmurson chmurson merged commit 9f0355c into main Nov 4, 2025
9 checks passed
@chmurson chmurson deleted the move-edit-button-bottom-right branch November 4, 2025 22:23
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