Skip to content

[WEB-4746] fix: position peek view relative to app layout#7635

Merged
sriramveeraghanta merged 1 commit intopreviewfrom
fix-project-analytics-peek-view
Aug 24, 2025
Merged

[WEB-4746] fix: position peek view relative to app layout#7635
sriramveeraghanta merged 1 commit intopreviewfrom
fix-project-analytics-peek-view

Conversation

@prateekshourya29
Copy link
Member

@prateekshourya29 prateekshourya29 commented Aug 24, 2025

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • Bug Fixes

    • Peek and analytics overlays render more consistently across modes, with non-embedded views always using a portal to avoid overlap issues.
    • Side-peek overlay now aligns to the top-right, spans full height, and stays above page content.
  • Refactor

    • Simplified sizing: full-screen uses full width; otherwise half width for easier readability.
    • Standardized absolute positioning for overlays to improve layout stability and scrolling behavior.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 24, 2025

Walkthrough

This PR adjusts peek/modal positioning and portal rendering, integrates isPeekView from useAnalytics into modal behavior, and updates updateIsEpic invocation. It also exposes isPeekView from the analytics store hook. Non-embedded peek views and analytics modals now render via portals more broadly with revised absolute positioning and sizing.

Changes

Cohort / File(s) Summary
Analytics modal integration
apps/web/core/components/analytics/work-items/modal/index.tsx
Uses isPeekView from useAnalytics. updateIsEpic now called with isPeekView ? (isEpic ?? false) : false. Container positioning unified to absolute; inner modal sizing simplified (full width when fullScreen, else half). z-index set to z-[25]. Portal now used whenever portalContainer exists.
Analytics store hook
src/hooks/store/use-analytics.ts
useAnalytics() now returns isPeekView in addition to existing values (e.g., updateIsEpic).
Issue peek view overlay
apps/web/core/components/issues/peek-overview/view.tsx
Non-embedded overlay uses absolute instead of fixed. Offsets adjusted to top-0 bottom-0 right-0. Portal condition simplified to !embedIssue (render via portal whenever not embedded).

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant Modal as Analytics Work-Items Modal
  participant Hook as useAnalytics
  participant Store as Analytics Store
  participant Portal as Portal Container

  User->>Modal: Open modal (peek/full-screen)
  Modal->>Hook: useAnalytics()
  Hook-->>Modal: { isPeekView, updateIsEpic, ... }
  Note over Modal,Hook: On effect
  Modal->>Hook: updateIsEpic(isPeekView ? (isEpic ?? false) : false)
  alt portalContainer exists
    Modal->>Portal: Render modal content
  else
    Modal->>Modal: Render inline
  end
Loading
sequenceDiagram
  actor User
  participant Peek as Issue Peek View
  participant Portal as Portal Root

  User->>Peek: Open peek (embedIssue? / peekMode)
  alt embedIssue == false
    Peek->>Portal: Render overlay via portal
    Note right of Portal: Absolute positioned<br/>top-0 right-0 bottom-0<br/>w-full/md:w-1/2
  else
    Peek->>Peek: Render inline
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

🌐frontend, ready to merge

Suggested reviewers

  • sriramveeraghanta
  • vamsikrishnamathala
  • anmolsinghbhatia

Poem

I hop through portals, light and fleet,
From fixed to absolute, a tidy feat.
Peek or full, I’ve set the stage—
Z-index high, I turn the page.
With analytics’ gentle view,
I nudge epics—peek-a-boo! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-project-analytics-peek-view

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented Aug 24, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@prateekshourya29 prateekshourya29 linked an issue Aug 24, 2025 that may be closed by this pull request
1 task
Copy link
Contributor

@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 (6)
apps/web/core/components/issues/peek-overview/view.tsx (3)

116-116: Tailwind nit: prefer md:w-1/2 over md:w-[50%]

Functionally identical, but md:w-1/2 avoids arbitrary values and stays consistent with the rest of the codebase.

-      "top-0 bottom-0 right-0 w-full md:w-[50%] border-0 border-l": peekMode === "side-peek",
+      "top-0 bottom-0 right-0 w-full md:w-1/2 border-0 border-l": peekMode === "side-peek",

118-118: Remove duplicate “absolute” in the full-screen variant

The container is already absolute in the base branch. Keeping it twice is harmless but noisy.

-      "inset-0 m-4 absolute": peekMode === "full-screen",
+      "inset-0 m-4": peekMode === "full-screen",

122-122: Portaling all non-embedded views: confirm outside-click/escape semantics and stacking

Rendering via portal for all non-embedded cases is a good unification. Please sanity-check:

  • Outside click still works with the portaled node.
  • ESC closes reliably.
  • No z-index collisions with analytics modal (both are z-[25] now).

Manual checks:

  • Open side-peek and modal modes, verify close-on-outside-click/ESC.
  • Open analytics modal simultaneously and confirm expected stacking order between the two.

If we need deterministic stacking, we can bump one to z-[26] or centralize overlay z-indices in a theme token.

apps/web/core/components/analytics/work-items/modal/index.tsx (3)

32-33: Gate updateIsEpic by isOpen and reset on unmount

Avoid toggling analytics state when the modal isn’t visible and ensure cleanup to prevent “sticky” epic state.

-  useEffect(() => {
-    updateIsEpic(isPeekView ? (isEpic ?? false) : false);
-  }, [isEpic, updateIsEpic, isPeekView]);
+  useEffect(() => {
+    if (!isOpen) return;
+    updateIsEpic(isPeekView ? (isEpic ?? false) : false);
+    return () => updateIsEpic(false);
+  }, [isOpen, isEpic, isPeekView, updateIsEpic]);

40-40: Anchor the absolute wrapper with inset-0 to avoid layout drift

absolute without offsets relies on the element’s static position; add inset-0 so the wrapper consistently spans the portal container.

-    <div className={cn("z-[25] h-full w-full overflow-y-auto absolute")}>
+    <div className={cn("z-[25] h-full w-full overflow-y-auto absolute inset-0")}>

42-44: Responsive sizing: keep full width on small screens

Using w-1/2 at all breakpoints can make the modal cramped on mobile. Suggest w-full on small, md:w-1/2 on medium+.

-        className={`top-0 right-0 z-[25] h-full bg-custom-background-100 shadow-custom-shadow-md absolute ${
-          fullScreen ? "w-full p-2" : "w-1/2"
-        }`}
+        className={`top-0 right-0 z-[25] h-full bg-custom-background-100 shadow-custom-shadow-md absolute ${
+          fullScreen ? "w-full p-2" : "w-full md:w-1/2"
+        }`}

If desired, we can also cap width on very large screens (e.g., max-w-[960px]) without changing behavior elsewhere.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 841388e and 307dc72.

📒 Files selected for processing (2)
  • apps/web/core/components/analytics/work-items/modal/index.tsx (3 hunks)
  • apps/web/core/components/issues/peek-overview/view.tsx (1 hunks)
⏰ 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). (3)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/web/core/components/issues/peek-overview/view.tsx (1)

113-113: Absolute positioning: confirm full-viewport context for #full-screen-portal

The portal element in question now renders as:

<div
  id="full-screen-portal"
  className="inset-0 absolute w-full"
/>

Tailwind’s inset-0 sets top/right/bottom/left to 0, but without an explicit height (h-full), its height will collapse to the height of its positioned ancestor. In your layout the immediate ancestor is:

<div className="relative flex flex-col h-full w-full …">
  <div id="full-screen-portal" className="inset-0 absolute w-full" /></div>

That ancestor has h-full, but neither <html> nor <body> in your root layout carry h-full (and there’s no global CSS enforcing height:100%). As a result, the portal will fill only as much height as the content wrapper hierarchy provides—and may clip if that container ever shrinks or scrolls.

To guarantee true full-viewport coverage (and avoid subtle clipping or misalignment), please verify one of the following approaches:

  • Switch the portal to fixed positioning at the viewport level:
    - <div id="full-screen-portal" className="inset-0 absolute w-full" />
    + <div id="full-screen-portal" className="fixed inset-0 z-[25]" />
  • Add an explicit height utility so it spans its container’s full height:
    - className="inset-0 absolute w-full"
    + className="inset-0 absolute w-full h-full"
  • Ensure that all parent wrappers (including <html>, <body>, your root <AppLayout> and the AuthenticationWrapper/WorkspaceAuthWrapper) propagate h-full so the h-full on your flex container truly reaches the viewport.
  • Alternatively, move the portal out of the nested layout entirely (e.g. render it in the root layout) so its positioning context is unambiguously the viewport.

Please confirm which pattern you’d prefer, or that the existing hierarchy already enforces 100% height through every wrapper.

apps/web/core/components/analytics/work-items/modal/index.tsx (1)

23-23: No action needed: isPeekView is correctly exposed by useAnalytics

I’ve confirmed that:

  • The useAnalytics hook (in apps/web/core/hooks/store/use-analytics.ts) returns the IAnalyticsStore, which includes the isPeekView boolean property and its updater updateIsPeekView.
  • The store interface and implementation (apps/web/core/store/analytics.store.ts) declare and initialize isPeekView: boolean = false, and provide the updateIsPeekView(isPeekView: boolean) action.
  • Downstream components (including WorkItemsModal and its content) correctly destructure isPeekView (and where needed, updateIsPeekView) from useAnalytics.

Everything is wired and typed as expected—no changes required here.

@sriramveeraghanta sriramveeraghanta merged commit 599ff2e into preview Aug 24, 2025
7 of 8 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-project-analytics-peek-view branch August 24, 2025 20:02
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.

[bug]: No option to close Analytics of a project

2 participants