Skip to content

Add responsiveness breakpoint #7

Open
Eriikah wants to merge 2 commits intolinagora:mainfrom
Eriikah:feat/reponsiveness
Open

Add responsiveness breakpoint #7
Eriikah wants to merge 2 commits intolinagora:mainfrom
Eriikah:feat/reponsiveness

Conversation

@Eriikah
Copy link
Copy Markdown

@Eriikah Eriikah commented Mar 26, 2026

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

    • Added a responsive breakpoint detection hook and exposed breakpoint utilities for layout decisions.
    • Added theming support for Drawer components.
  • Style

    • Improved dialog and drawer backdrop appearance with refined background styling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Warning

Rate limit exceeded

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

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 @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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a65168e3-710a-462f-92c2-36b7da238750

📥 Commits

Reviewing files that changed from the base of the PR and between 8bb25ed and d4c746b.

📒 Files selected for processing (7)
  • packages/twake-mui/src/hooks/useBreakpoint/breakpoints.ts
  • packages/twake-mui/src/hooks/useBreakpoint/index.ts
  • packages/twake-mui/src/index.ts
  • packages/twake-mui/src/lib/makeDarkOverrides.ts
  • packages/twake-mui/src/lib/makeLightOverrides.ts
  • packages/twake-mui/src/lib/overrides/dialogOverrides.ts
  • packages/twake-mui/src/lib/overrides/drawerOverrides.ts

Walkthrough

Adds a breakpoints constant and Breakpoint type, and implements a new useBreakpoint() React hook that reports 'mobile' | 'tablet' | 'desktop' using matchMedia and useSyncExternalStore (server-safe). Re-exports useBreakpoint, Breakpoint, and BREAKPOINTS from the package entry. Introduces drawerOverrides() (with backdrop sx) and wires it into both makeLightOverrides and makeDarkOverrides. Extends dialogOverrides() to set BackdropProps.sx.backgroundColor to rgba(0, 0, 0, 0.1).

Possibly related PRs

  • UI/update minicalendar and collapse #4 — Modifies theme override modules (including makeLightOverrides, makeDarkOverrides, and dialogOverrides) with overlapping component override changes.
  • Update button style #3 — Updates dialog and light theme override files and integrates component overrides in a similar pattern.

Suggested reviewers

  • JF-Cozy
  • chibenwa
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 'Add responsiveness breakpoint' directly aligns with the main change: introducing a new useBreakpoint hook and BREAKPOINTS constant for responsive design. It accurately summarizes the primary feature addition.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

@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)
packages/twake-mui/src/hooks/useBreakpoint/breakpoints.ts (1)

1-6: Consider deriving Breakpoint type from BREAKPOINTS keys.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b60c6f0 and c102e45.

📒 Files selected for processing (6)
  • packages/twake-mui/src/hooks/useBreakpoint/breakpoints.ts
  • packages/twake-mui/src/hooks/useBreakpoint/index.ts
  • packages/twake-mui/src/index.ts
  • packages/twake-mui/src/lib/makeDarkOverrides.ts
  • packages/twake-mui/src/lib/makeLightOverrides.ts
  • packages/twake-mui/src/lib/overrides/backdropOverrides.ts

@Crash-- Crash-- requested a review from JF-Cozy March 26, 2026 16:44
@Eriikah Eriikah force-pushed the feat/reponsiveness branch from c102e45 to c77b562 Compare March 26, 2026 16:52
@Eriikah Eriikah force-pushed the feat/reponsiveness branch from c77b562 to 14924f5 Compare March 27, 2026 16:27
Copy link
Copy Markdown

@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 (2)
packages/twake-mui/src/lib/overrides/dialogOverrides.ts (1)

14-21: Fix inconsistent indentation.

The defaultProps block (lines 15-21) has extra indentation compared to styleOverrides. 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:

  1. The indentation is inconsistent between styleOverrides (line 5-7) and defaultProps (line 8-16)
  2. 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

📥 Commits

Reviewing files that changed from the base of the PR and between c77b562 and 14924f5.

📒 Files selected for processing (7)
  • packages/twake-mui/src/hooks/useBreakpoint/breakpoints.ts
  • packages/twake-mui/src/hooks/useBreakpoint/index.ts
  • packages/twake-mui/src/index.ts
  • packages/twake-mui/src/lib/makeDarkOverrides.ts
  • packages/twake-mui/src/lib/makeLightOverrides.ts
  • packages/twake-mui/src/lib/overrides/dialogOverrides.ts
  • packages/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

@Eriikah Eriikah force-pushed the feat/reponsiveness branch from 14924f5 to 8bb25ed Compare March 27, 2026 16:42
@Eriikah Eriikah force-pushed the feat/reponsiveness branch from 8bb25ed to d4c746b Compare March 27, 2026 16:47
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