Skip to content

Andy g6/website split view#844

Merged
raghumanimehta merged 20 commits into
mainfrom
AndyG6/website-split-view
Jun 24, 2026
Merged

Andy g6/website split view#844
raghumanimehta merged 20 commits into
mainfrom
AndyG6/website-split-view

Conversation

@AndyG6

@AndyG6 AndyG6 commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

split screen feature in the layout model added!

this change allows the graphs to be displayed 2 at a time, or 3 at a time or EVEN 4 IN ONE TIME

Comprehensive technical changes (claude summary)

Introduced Layout, LayoutItem, and GraphId types in GraphsTypes.ts. A layout item is either a single GraphId or a GraphId[] (split group)
Renamed graphs.order → graphs.layout in the Redux store and session storage
Added GraphsLayoutHelpers.ts with pure layout manipulation helpers: moveGraph, moveGraphToIndex, extractGraph, and splitGraph
Replaced SortableContext/useSortable with useDraggable + a custom pointermove listener for richer drag intent detection (split vs. reorder vs. extract)

how to recreate change

-You can reorder the graphs via gap drop zones (highlighted with a blue line indicator)
-Split them alongside an existing item (left/right highlight on hover)
-Can also extract a graph out of a split group back into its own row

image

@yuekaifred yuekaifred left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is cool! when youre dragging over to make a split horizontal graph, what do you think about resizing the other div on drag over? currently we just kinda have a ghost that sits on top of the div were dragging over
image

@minjunminji

Copy link
Copy Markdown
Contributor

I'd consider limiting it to only two graphs per row, ppl don't really need four on one row and it's difficult to read the graphs when they're that narrow. Also prevents confusion with moving around the graphs.

@matthewcflam matthewcflam self-assigned this Apr 4, 2026
@raghumanimehta

Copy link
Copy Markdown
Contributor

Hi @yuekaifred @AndyG6 @minjunminji , can we have this wrapped up please?

@AndyG6 AndyG6 marked this pull request as ready for review June 9, 2026 17:28
minjunminji and others added 6 commits June 11, 2026 20:47
The `useEffect(() => rearrangeGraphs(layout), [layout])` fired on mount
with the layout already in the store (it was initialized from
graphs.layout), so opening the dropdown dispatched a redundant
REARRANGE_GRAPHS with the existing value. Replace the effect with a
commitLayout helper that the drag handlers call only when the layout
actually changes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The doc block describing splitGraph sat above moveGraphToIndex, which
had its own doc immediately below it — easy to misread as belonging to
the wrong function. Rewrite it to match the actual splitGraph behaviour
(two-graph cap, no-op cases) and put it directly above splitGraph.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The 'full' variant of SplitSide was only applied to graphs inside an
existing split group. But the pointermove logic falls through to gap
detection whenever the target is in a >=2-member group, and removeGraph
collapses 1-member groups back to standalone, so a split group always
has exactly 2 members. The 'full' branch was therefore unreachable, as
was its dropdownItemSplitTarget CSS class.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
splitGraph removed the source from the layout via removeGraph, then
attempted to insert it next to the target — but if the target was
already in a 2-member split group, the code returned the existing item
unchanged with no fallback path, leaving the layout without the source.
The 2-per-row UI gating in RearrangeGraphDropdown made this unreachable
in practice, but the helper itself was wrong: any future caller (or a
test) would see graphs disappear.

Move the full-group check above the removeGraph call so the function
returns the original layout untouched, matching the existing no-op
semantics for the other guard cases.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
22 tests covering findLayoutIndex, moveGraph, moveGraphToIndex,
extractGraph, and splitGraph — including the no-op cases that document
the helpers' intent (source === target, same item, full target group,
adjacent gaps), the split-group-as-atomic-unit semantics of moveGraph,
extractGraph's standalone-vs-group dispatch, and an end-to-end
invariant pass (no nested groups, no duplicates, all graphs preserved).

Node 25 ships type stripping by default, so the tests run with
`node --test` and need no extra deps. Two small infra tweaks make this
work cleanly:

- Split `GraphsLayoutHelpers.ts`'s import into `import type` for types
  and a value import for `isSplitGroup`, with explicit `.ts` extensions
  — Node ESM is extension-strict and strip-types can't elide imports
  without the `type` keyword. This also aligns with the project's
  existing `isolatedModules: true`.
- Add `allowImportingTsExtensions: true` to tsconfig (safe because the
  project already has `noEmit: true`) so tsc accepts the explicit
  extensions.

Add an `npm run test:graphs` script.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…view

# Conflicts:
#	src/website/package.json
@AndyG6 AndyG6 requested a review from yuekaifred June 12, 2026 02:16
@raghumanimehta raghumanimehta merged commit 51a2502 into main Jun 24, 2026
14 checks passed
@raghumanimehta raghumanimehta deleted the AndyG6/website-split-view branch June 24, 2026 07:05
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.

6 participants