Skip to content

Quorum submission#2270

Merged
simo6529 merged 5 commits intomainfrom
QUORUM-submission
Apr 15, 2026
Merged

Quorum submission#2270
simo6529 merged 5 commits intomainfrom
QUORUM-submission

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Apr 15, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added quorum proposal creation workflow with dedicated multi-step modal interface for wave participants
    • Enabled automatic routing to proposal creation experience for quorum waves
    • Enhanced keyboard accessibility with improved focus management in modals
    • Made empty state messaging dynamic for different wave types (e.g., "Create Proposal" vs "Drop")
  • Tests

    • Added comprehensive test coverage for quorum proposal creation, validation, and modal keyboard interactions

Signed-off-by: Simo <simo@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

@simo6529 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 45 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 23 minutes and 45 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 670467d0-2419-450f-9c28-96af0e399535

📥 Commits

Reviewing files that changed from the base of the PR and between 7679c1e and 3195b48.

📒 Files selected for processing (1)
  • components/waves/quorum/QuorumProposalDropModal.tsx
📝 Walkthrough

Walkthrough

This PR introduces comprehensive support for a new "Quorum Proposal" wave submission experience, including a multi-step proposal modal, markdown-based form handling, focus-trapping utilities, and integration across existing wave submission infrastructure. Updates affect contexts, hooks, helpers, UI components, configuration, and extensive test coverage.

Changes

Cohort / File(s) Summary
Quorum Proposal Modal & Form
components/waves/quorum/QuorumProposalDropModal.tsx, components/waves/quorum/quorumProposalMarkdown.ts
New modal component managing multi-step form state with markdown preview, submission handling, focus management, and reply/quote context. Accompanying form data model with urgency levels, field normalization, and content validation.
Wave Submission Experience
helpers/waves/wave-submission-experience.helpers.ts, hooks/useWave.ts
Extended WaveSubmissionExperience enum with QUORUM_PROPOSAL member. Updated resolveWaveSubmissionExperience resolver to accept and prioritize isQuorumWave flag. Modified useWave hook to expose isQuorumWave field.
Seize Settings Context
contexts/SeizeSettingsContext.tsx
Added quorum_wave_id configuration field and isQuorumWave(waveId) predicate function alongside existing memes/curation wave checkers.
Leaderboard & Header Components
components/brain/my-stream/MyStreamWaveLeaderboard.tsx, components/brain/my-stream/MyStreamWaveChat.tsx, components/waves/leaderboard/header/WaveleaderboardHeader.tsx, components/waves/leaderboard/drops/WaveLeaderboardEmptyState.tsx
Integrated isQuorumWave into submission experience resolution and conditional rendering. Added quorum-specific empty-state text, create button labels, and modal flow handling.
Create Drop Flow
components/waves/CreateDrop.tsx, components/waves/CreateDropContent.tsx, components/waves/CreateDropDropModeToggle.tsx
Extended drop mode selection to handle quorum proposal type with dedicated modal, dismissal tracking, and button labeling. Updated inactive action label to include "proposal" alongside existing "drop" and "nominate" options.
Empty State & Default Rendering
components/waves/leaderboard/drops/WaveLeaderboardDefaultEmptyState.tsx
Expanded props to accept customizable createDropLabel, emptyTitle, and emptyDescription with quorum-specific defaults. Minor styling adjustment from tw-rounded-xl to tw-rounded-lg.
Focus Trap Utility
components/utils/modal/focusTrap.ts, components/waves/leaderboard/create/WaveLeaderboardCurationDropModal.tsx
Extracted generic Tab-focus trapping helper from modal component logic. Refactored curation modal to use shared utility, removing 70 lines of duplicate focus-cycling code.
Configuration & Environment
config/env.schema.ts, next.config.ts, jest.setup.js, openapi.yaml
Added DEV_MODE_QUORUM_WAVE_ID public runtime environment variable and Seize settings schema. Updated OpenAPI spec with quorum_wave_id field in ApiSeizeSettings.
Comprehensive Test Coverage
__tests__/components/waves/quorum/QuorumProposalDropModal.test.tsx, __tests__/components/waves/quorum/quorumProposalMarkdown.test.ts, __tests__/components/utils/modal/focusTrap.test.ts, __tests__/components/brain/my-stream/MyStreamWaveLeaderboard.test.tsx, __tests__/components/waves/CreateDrop.test.tsx, __tests__/components/waves/leaderboard/WaveLeaderboardEmptyState.test.tsx, __tests__/contexts/SeizeSettingsContext.test.tsx, __tests__/helpers/waves/wave-submission-experience.helpers.test.ts, __tests__/hooks/useWave.test.ts
New test suites validating modal workflows, markdown generation, focus trapping, and integration across wave submission experience resolution and component rendering.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Header as WaveleaderboardHeader
    participant Leaderboard as MyStreamWaveLeaderboard
    participant CreateDrop as CreateDrop Component
    participant Modal as QuorumProposalDropModal
    participant API as Submit API

    User->>Header: Click "Create Proposal" (Quorum Wave)
    Header->>Leaderboard: onCreateDrop()
    Leaderboard->>CreateDrop: setIsCreateDropOpen(true)
    CreateDrop->>Modal: isOpen={true}
    Modal->>User: Show multi-step form
    
    User->>Modal: Fill proposal fields
    User->>Modal: Click "Submit Proposal"
    Modal->>Modal: Validate content
    Modal->>Modal: Build markdown
    Modal->>Modal: Trigger auth
    Modal->>API: submitDrop(createRequest)
    API-->>Modal: Drop created
    Modal->>Modal: Insert optimistic drop
    Modal->>CreateDrop: onClose()
    CreateDrop->>Leaderboard: setIsCreateDropOpen(false)
    Leaderboard->>User: Show updated leaderboard
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • show quoted drop correctly for non-meme wave #2038 — Modifies SeizeSettingsContext with new context APIs and wave-type predicates, overlapping with quorum wave context additions.
  • Vote for identity wave #2171 — Overlaps on wave submission experience enum, useWave hook flags, and CreateDrop modal flow handling for different wave types.
  • icon change #2194 — Extends CreateDropDropModeToggle.inactiveActionLabel prop with "nominate" support; this PR further extends it to include "proposal" case.

Suggested reviewers

  • prxt6529

Poem

🐰 A quorum of proposals now hops through the modal,
With focus-trapped tabs and markdown most formal,
We've tamed the tab-cycling beast with a trap,
And quorum waves flow through each component's map,
The leaderboard sings as new drops take their leap! 🌙✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Quorum submission' is vague and does not clearly convey the specific changes made. While it references 'Quorum' which is present in the changeset, 'submission' is overly broad and fails to highlight the primary purpose or scope of the implementation. Consider revising the title to be more specific and descriptive, such as 'Add quorum proposal creation flow' or 'Implement QUORUM_PROPOSAL submission experience' to better summarize the main changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch QUORUM-submission

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7679c1ef00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread components/waves/quorum/QuorumProposalDropModal.tsx
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.

🧹 Nitpick comments (3)
components/waves/quorum/quorumProposalMarkdown.ts (1)

64-67: Consider using replaceAll for consistency (optional).

Per static analysis, prefer String#replaceAll() over String#replace() with a global regex. However, this is a minor stylistic preference.

♻️ Proposed fix
 const normalizeTitle = (title: string): string => {
-  const normalizedTitle = title.trim().replace(/\s+/g, " ");
+  const normalizedTitle = title.trim().replaceAll(/\s+/g, " ");
   return normalizedTitle.length ? normalizedTitle : "Untitled QUORUM Proposal";
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/waves/quorum/quorumProposalMarkdown.ts` around lines 64 - 67, The
normalizeTitle function currently uses title.trim().replace(/\s+/g, " "); update
it to use String.prototype.replaceAll with the same regex (e.g.,
title.trim().replaceAll(/\s+/g, " ")) for consistency with the project's
static-analysis preference; modify the normalizeTitle implementation (and the
normalizedTitle variable assignment) accordingly and ensure runtime
compatibility (polyfill/target) if needed.
components/utils/modal/focusTrap.ts (1)

39-44: Consider using .at(-1) for cleaner array access.

Per static analysis, prefer .at(-1) over [length - 1] for accessing the last element.

♻️ Proposed fix
 const getFocusableElements = (container: HTMLElement): HTMLElement[] =>
   Array.from(
     container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)
   ).filter(isFocusableElement);

 export const trapTabFocus = (
   event: KeyboardEvent,
   container: HTMLElement
 ): void => {
   if (event.key !== "Tab") {
     return;
   }

   const focusableElements = getFocusableElements(container);
   const firstElement = focusableElements[0] ?? null;
-  const lastElement = focusableElements[focusableElements.length - 1] ?? null;
+  const lastElement = focusableElements.at(-1) ?? null;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/utils/modal/focusTrap.ts` around lines 39 - 44, Replace the manual
last-item access with .at(-1) to make the intent clearer: in the block that
declares firstElement/lastElement (using focusableElements), change the
lastElement assignment to use focusableElements.at(-1) with the same nullish
fallback (e.g., const lastElement = focusableElements.at(-1) ?? null), leaving
the rest of the logic (the check for !firstElement || !lastElement and the call
to focusElement(event, container)) unchanged.
__tests__/components/waves/quorum/QuorumProposalDropModal.test.tsx (1)

98-100: Consider extracting the step count to a constant.

The hardcoded 4 iterations assumes a fixed number of modal steps. If the modal flow changes, both test cases would need updates.

♻️ Proposed improvement
+const MODAL_STEP_COUNT = 4;
+
 describe("QuorumProposalDropModal", () => {
   it("builds markdown and submits one participatory drop part", async () => {
     const user = userEvent.setup();
     const submitDrop = jest.fn();
     renderModal(submitDrop);
 
     await user.type(screen.getByLabelText("Summary"), "Coordinate proposals.");
-    for (let i = 0; i < 4; i += 1) {
+    for (let i = 0; i < MODAL_STEP_COUNT; i += 1) {
       await user.click(screen.getByRole("button", { name: "Next" }));
     }

Also applies to: 121-123

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@__tests__/components/waves/quorum/QuorumProposalDropModal.test.tsx` around
lines 98 - 100, The test uses a hardcoded iteration count (for loop with 4) in
QuorumProposalDropModal.test.tsx when clicking the "Next" button; extract that
magic number into a clearly named constant (e.g., TOTAL_MODAL_STEPS or
STEPS_TO_ADVANCE) at the top of the test file and replace the literal `4` in the
loop(s) (the for loop at the shown block and the similar loop at lines 121-123)
with that constant so future modal step changes only require updating the single
constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@__tests__/components/waves/quorum/QuorumProposalDropModal.test.tsx`:
- Around line 98-100: The test uses a hardcoded iteration count (for loop with
4) in QuorumProposalDropModal.test.tsx when clicking the "Next" button; extract
that magic number into a clearly named constant (e.g., TOTAL_MODAL_STEPS or
STEPS_TO_ADVANCE) at the top of the test file and replace the literal `4` in the
loop(s) (the for loop at the shown block and the similar loop at lines 121-123)
with that constant so future modal step changes only require updating the single
constant.

In `@components/utils/modal/focusTrap.ts`:
- Around line 39-44: Replace the manual last-item access with .at(-1) to make
the intent clearer: in the block that declares firstElement/lastElement (using
focusableElements), change the lastElement assignment to use
focusableElements.at(-1) with the same nullish fallback (e.g., const lastElement
= focusableElements.at(-1) ?? null), leaving the rest of the logic (the check
for !firstElement || !lastElement and the call to focusElement(event,
container)) unchanged.

In `@components/waves/quorum/quorumProposalMarkdown.ts`:
- Around line 64-67: The normalizeTitle function currently uses
title.trim().replace(/\s+/g, " "); update it to use String.prototype.replaceAll
with the same regex (e.g., title.trim().replaceAll(/\s+/g, " ")) for consistency
with the project's static-analysis preference; modify the normalizeTitle
implementation (and the normalizedTitle variable assignment) accordingly and
ensure runtime compatibility (polyfill/target) if needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e9ade9a2-6ef9-4a13-92a0-2a7b210950d8

📥 Commits

Reviewing files that changed from the base of the PR and between 04e109b and 7679c1e.

⛔ Files ignored due to path filters (1)
  • generated/models/ApiSeizeSettings.ts is excluded by !**/generated/**
📒 Files selected for processing (28)
  • __tests__/components/brain/my-stream/MyStreamWaveLeaderboard.test.tsx
  • __tests__/components/utils/modal/focusTrap.test.ts
  • __tests__/components/waves/CreateDrop.test.tsx
  • __tests__/components/waves/leaderboard/WaveLeaderboardEmptyState.test.tsx
  • __tests__/components/waves/quorum/QuorumProposalDropModal.test.tsx
  • __tests__/components/waves/quorum/quorumProposalMarkdown.test.ts
  • __tests__/contexts/SeizeSettingsContext.test.tsx
  • __tests__/helpers/waves/wave-submission-experience.helpers.test.ts
  • __tests__/hooks/useWave.test.ts
  • components/brain/my-stream/MyStreamWaveChat.tsx
  • components/brain/my-stream/MyStreamWaveLeaderboard.tsx
  • components/utils/modal/focusTrap.ts
  • components/waves/CreateDrop.tsx
  • components/waves/CreateDropContent.tsx
  • components/waves/CreateDropDropModeToggle.tsx
  • components/waves/leaderboard/create/WaveLeaderboardCurationDropModal.tsx
  • components/waves/leaderboard/drops/WaveLeaderboardDefaultEmptyState.tsx
  • components/waves/leaderboard/drops/WaveLeaderboardEmptyState.tsx
  • components/waves/leaderboard/header/WaveleaderboardHeader.tsx
  • components/waves/quorum/QuorumProposalDropModal.tsx
  • components/waves/quorum/quorumProposalMarkdown.ts
  • config/env.schema.ts
  • contexts/SeizeSettingsContext.tsx
  • helpers/waves/wave-submission-experience.helpers.ts
  • hooks/useWave.ts
  • jest.setup.js
  • next.config.ts
  • openapi.yaml

Signed-off-by: Simo <simo@6529.io>
Signed-off-by: Simo <simo@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
8.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@simo6529 simo6529 merged commit 1ba6183 into main Apr 15, 2026
6 of 7 checks passed
@simo6529 simo6529 deleted the QUORUM-submission branch April 15, 2026 12:24
This was referenced Apr 22, 2026
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