Skip to content

Conversation

@appflowy
Copy link
Contributor

@appflowy appflowy commented Nov 26, 2025

Description


Checklist

General

  • I've included relevant documentation or comments for the changes introduced.
  • I've tested the changes in multiple environments (e.g., different browsers, operating systems).

Testing

  • I've added or updated tests to validate the changes introduced for AppFlowy Web.

Feature-Specific

  • For feature additions, I've added a preview (video, screenshot, or demo) in the "Feature Preview" section.
  • I've verified that this feature integrates seamlessly with existing functionality.

Summary by Sourcery

Standardize the block popover to use a narrower, consistent width across math equation and media popups.

Enhancements:

  • Adjust the math equation popover content to use a fixed 400px width.
  • Align the generic block popover width to 400px for all block types instead of varying by content type.

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 26, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Standardizes the block popover popup to use a consistent fixed width of 400px for math, image, and video blocks, removing the previous mixed width/max-width behavior.

Flow diagram for block popover width selection

flowchart TD
  A[Render BlockPopover] --> B{Block type}
  B --> C[MathEquationPopoverContent]
  B --> D[ImageBlock]
  B --> E[VideoBlock]

  C --> F[Set popover width 400px]
  D --> F
  E --> F

  F --> G[Render popover with fixed width 400px]
Loading

File-Level Changes

Change Details Files
Standardize block popover width to a fixed 400px and align the math equation popover content to that width.
  • Update math equation popover container to use a fixed width of 400px instead of a wider width with a max-width constraint
  • Adjust the generic BlockPopover popup configuration so all block types now use a width of 400px instead of conditionally using 560px for non-media blocks
src/components/editor/components/block-popover/MathEquationPopoverContent.tsx
src/components/editor/components/block-popover/index.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • The popup width values (400) are now hard-coded in multiple places; consider extracting these into a shared constant or config to avoid divergence if the design changes later.
  • By removing the max-w-[964px] and forcing a fixed width, the math equation popover may behave poorly on smaller viewports; consider using responsive classes or a max-width constraint to keep it usable on narrow screens.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The popup width values (400) are now hard-coded in multiple places; consider extracting these into a shared constant or config to avoid divergence if the design changes later.
- By removing the `max-w-[964px]` and forcing a fixed width, the math equation popover may behave poorly on smaller viewports; consider using responsive classes or a max-width constraint to keep it usable on narrow screens.

## Individual Comments

### Comment 1
<location> `src/components/editor/components/block-popover/MathEquationPopoverContent.tsx:60` </location>
<code_context>

   return (
-    <div className={'flex flex-col p-4 gap-3 w-[560px] max-w-[964px]'}>
+    <div className={'flex flex-col p-4 gap-3 w-[400px]'}>
       <TextField
         inputRef={(input: HTMLTextAreaElement) => {
</code_context>

<issue_to_address>
**suggestion:** Avoid hardcoding the width here; derive it from a shared constant or popover config to keep it in sync.

This `400px` value should match the width passed to `positionPopover` in `block-popover/index.tsx`. Right now the same magic number lives in two places. Please extract a shared constant (e.g. `MATH_EQUATION_POPOVER_WIDTH`) or otherwise use a single source of truth so the container and inner content stay aligned.

Suggested implementation:

```typescript
import { MATH_EQUATION_POPOVER_WIDTH } from './constants';

  const inputRef = useRef<HTMLTextAreaElement | null>(null);

  return (
    <div
      className={'flex flex-col p-4 gap-3'}
      style={{ width: MATH_EQUATION_POPOVER_WIDTH }}
    >

```

```typescript
  return (
    <div
      className={'flex flex-col p-4 gap-3'}
      style={{ width: MATH_EQUATION_POPOVER_WIDTH }}
    >
      <TextField
        inputRef={(input: HTMLTextAreaElement) => {
          if (!input) return;

```

1. Create a shared constants file for the popover width, for example:
   - `src/components/editor/components/block-popover/constants.ts`
   ```ts
   export const MATH_EQUATION_POPOVER_WIDTH = 400;
   ```
2. In `src/components/editor/components/block-popover/index.tsx`, replace the hardcoded `400` (or similar) passed to `positionPopover` with `MATH_EQUATION_POPOVER_WIDTH` from the same constants file:
   ```ts
   import { MATH_EQUATION_POPOVER_WIDTH } from './constants';

   positionPopover({
     // ...
     width: MATH_EQUATION_POPOVER_WIDTH,
   });
   ```
3. If Tailwind JIT is required for width, you may alternatively define a Tailwind-safe class and map it from the constant (e.g., via a config or mapping), but the simplest alignment is using a numeric constant for both the style width and the popover positioning.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@appflowy appflowy changed the title fix: use consistence width for popup fix: math equation width Nov 26, 2025
@appflowy appflowy merged commit b5c300c into main Nov 26, 2025
12 checks passed
@appflowy appflowy deleted the fix_math_equation_ui branch November 26, 2025 13:22
josue693 pushed a commit to josue693/AppFlowy-Web that referenced this pull request Dec 21, 2025
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