Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 10 minutes and 15 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
WalkthroughAdds a breakpoints constant and Breakpoint type, and implements a new Possibly related PRs
Suggested reviewers
🚥 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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/twake-mui/src/hooks/useBreakpoint/breakpoints.ts (1)
1-6: Consider derivingBreakpointtype fromBREAKPOINTSkeys.The type is manually defined separately from the constant. Deriving it would keep them in sync automatically.
♻️ Proposed refactor
export const BREAKPOINTS = { mobile: 769, tablet: 1023 } as const -export type Breakpoint = 'mobile' | 'tablet' | 'desktop' +export type Breakpoint = keyof typeof BREAKPOINTS | 'desktop'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/twake-mui/src/hooks/useBreakpoint/breakpoints.ts` around lines 1 - 6, The Breakpoint type is manually defined and can drift from BREAKPOINTS; change Breakpoint to be derived from the BREAKPOINTS keys (export type Breakpoint = keyof typeof BREAKPOINTS) and if "desktop" is intended as a valid key, add desktop to the BREAKPOINTS constant so the set of keys and the type remain in sync (refer to BREAKPOINTS and Breakpoint to make the change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/twake-mui/src/hooks/useBreakpoint/index.ts`:
- Around line 10-16: The guard in getSnapshot is currently ineffective because
queries is always initialized; update the module so that queries can be lazily
initialized (make the module-level queries variable possibly undefined and
initialize it on first use or during hook mount), then keep the existing if
(!queries) return 'desktop' in getSnapshot so it correctly returns the default
when queries hasn't been created yet; reference the module-level queries
variable and the getSnapshot() function to locate where to change initialization
to lazy (e.g., set queries = undefined initially and assign it before use or in
the hook initialization path).
- Around line 5-8: The top-level creation of queries using window.matchMedia
(the queries object referencing BREAKPOINTS) runs at module import and crashes
in SSR; change this to lazy initialization by moving the matchMedia calls into a
function (e.g., getQueries or createMediaQueries) or into the useBreakpoint hook
so you first check typeof window !== 'undefined' before calling
window.matchMedia; return safe fallbacks (e.g., all false or MediaQueryList-like
stubs) for server environments and use that function inside the
useSyncExternalStore subscriber/initializer (and where queries is referenced) so
no window access happens at module load time.
---
Nitpick comments:
In `@packages/twake-mui/src/hooks/useBreakpoint/breakpoints.ts`:
- Around line 1-6: The Breakpoint type is manually defined and can drift from
BREAKPOINTS; change Breakpoint to be derived from the BREAKPOINTS keys (export
type Breakpoint = keyof typeof BREAKPOINTS) and if "desktop" is intended as a
valid key, add desktop to the BREAKPOINTS constant so the set of keys and the
type remain in sync (refer to BREAKPOINTS and Breakpoint to make the change).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1d0c5f9e-bbf0-4299-b8ad-8d9da5143276
📒 Files selected for processing (6)
packages/twake-mui/src/hooks/useBreakpoint/breakpoints.tspackages/twake-mui/src/hooks/useBreakpoint/index.tspackages/twake-mui/src/index.tspackages/twake-mui/src/lib/makeDarkOverrides.tspackages/twake-mui/src/lib/makeLightOverrides.tspackages/twake-mui/src/lib/overrides/backdropOverrides.ts
c102e45 to
c77b562
Compare
c77b562 to
14924f5
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/twake-mui/src/lib/overrides/dialogOverrides.ts (1)
14-21: Fix inconsistent indentation.The
defaultPropsblock (lines 15-21) has extra indentation compared tostyleOverrides. This should align with the rest of the object structure.🧹 Proposed fix
} - }, - defaultProps: { - BackdropProps: { - sx: { - backgroundColor: 'rgba(0, 0, 0, 0.1)', - } - } - } + }, + defaultProps: { + BackdropProps: { + sx: { + backgroundColor: 'rgba(0, 0, 0, 0.1)', + } + } + } } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/twake-mui/src/lib/overrides/dialogOverrides.ts` around lines 14 - 21, The defaultProps block is over-indented relative to the surrounding object (it should align with styleOverrides); adjust indentation for the defaultProps key and its nested BackdropProps so that defaultProps sits at the same object level as styleOverrides (keep the inner sx nesting intact), e.g., ensure the 'defaultProps' identifier and its child 'BackdropProps' are indented to the same column as 'styleOverrides'.packages/twake-mui/src/lib/overrides/drawerOverrides.ts (1)
5-16: Inconsistent indentation and unnecessary empty object.Two issues:
- The indentation is inconsistent between
styleOverrides(line 5-7) anddefaultProps(line 8-16)styleOverrides.root: {}serves no purpose if empty🧹 Proposed cleanup
export const drawerOverrides = (): Components['MuiDrawer'] => { return { - styleOverrides: { - root: {}, - }, - defaultProps: { - ModalProps: { - BackdropProps: { - sx: { - backgroundColor: 'rgba(0, 0, 0, 0.1)', - }, + defaultProps: { + ModalProps: { + BackdropProps: { + sx: { + backgroundColor: 'rgba(0, 0, 0, 0.1)', }, }, }, + }, } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/twake-mui/src/lib/overrides/drawerOverrides.ts` around lines 5 - 16, Remove the unnecessary empty styleOverrides.root and normalize indentation for the whole export: delete the empty root object (or remove styleOverrides entirely if it becomes empty) and re-indent defaultProps/ModalProps/BackdropProps so spacing matches the surrounding file style; ensure you keep the existing keys defaultProps, ModalProps and BackdropProps and their sx backgroundColor intact while removing the redundant styleOverrides.root.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/twake-mui/src/lib/overrides/drawerOverrides.ts`:
- Around line 8-15: The Drawer override is using the deprecated BackdropProps
inside defaultProps; replace that usage by moving the BackdropProps
configuration into defaultProps.slotProps.backdrop so the sx backgroundColor
remains but follows MUI v7 slotProps pattern (i.e., change
defaultProps.ModalProps.BackdropProps.sx to defaultProps.slotProps.backdrop.sx).
Update any references to BackdropProps in the override file (e.g.,
drawerOverrides.ts) to use slotProps.backdrop and remove the deprecated
BackdropProps block; you can also run the official MUI codemod if you prefer
automated changes.
---
Nitpick comments:
In `@packages/twake-mui/src/lib/overrides/dialogOverrides.ts`:
- Around line 14-21: The defaultProps block is over-indented relative to the
surrounding object (it should align with styleOverrides); adjust indentation for
the defaultProps key and its nested BackdropProps so that defaultProps sits at
the same object level as styleOverrides (keep the inner sx nesting intact),
e.g., ensure the 'defaultProps' identifier and its child 'BackdropProps' are
indented to the same column as 'styleOverrides'.
In `@packages/twake-mui/src/lib/overrides/drawerOverrides.ts`:
- Around line 5-16: Remove the unnecessary empty styleOverrides.root and
normalize indentation for the whole export: delete the empty root object (or
remove styleOverrides entirely if it becomes empty) and re-indent
defaultProps/ModalProps/BackdropProps so spacing matches the surrounding file
style; ensure you keep the existing keys defaultProps, ModalProps and
BackdropProps and their sx backgroundColor intact while removing the redundant
styleOverrides.root.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e7eb1a3e-6101-4cd1-bad8-2ed84aa79b25
📒 Files selected for processing (7)
packages/twake-mui/src/hooks/useBreakpoint/breakpoints.tspackages/twake-mui/src/hooks/useBreakpoint/index.tspackages/twake-mui/src/index.tspackages/twake-mui/src/lib/makeDarkOverrides.tspackages/twake-mui/src/lib/makeLightOverrides.tspackages/twake-mui/src/lib/overrides/dialogOverrides.tspackages/twake-mui/src/lib/overrides/drawerOverrides.ts
✅ Files skipped from review due to trivial changes (2)
- packages/twake-mui/src/hooks/useBreakpoint/breakpoints.ts
- packages/twake-mui/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/twake-mui/src/lib/makeDarkOverrides.ts
- packages/twake-mui/src/hooks/useBreakpoint/index.ts
14924f5 to
8bb25ed
Compare
8bb25ed to
d4c746b
Compare
As suggested by @Crash-- in linagora/twake-calendar-frontend#718 (comment)
I want to add a hook to get the type of screen we have : mobile, tablet or desktop.
In this PR there is also another commit for UI, to update the backdrop opacity. This was needed by my work on the new tablet view.
Summary by CodeRabbit
New Features
Style