Add drag-to-reorder for thumbnail rail in dev mode#72
Merged
Conversation
Pages in the left rail at /s/<id> are sortable via @dnd-kit. Drop-end PUTs /__slides/<id>/reorder, which rewrites the slide's `export default [...]` array via Babel-located source slices. HMR reloads the slide module so the rail and canvas stay in sync.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Zero out the x component of the sortable transform so a dragged thumbnail can't drift sideways during reorder. Vertical reordering behavior is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both entries describe the same unreleased feature; fold the axis-lock note into the original minor changeset. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds drag-and-drop reordering functionality to the thumbnail rail in development mode, allowing users to reorder pages by dragging thumbnails. The new order is persisted back to the slide's
index.tsxfile.Key Changes
Thumbnail Rail Component (
thumbnail-rail.tsx):@dnd-kitfor drag-and-drop functionalityonReordercallback prop to enable reorderingThumbContentscomponent for reusabilitySortableRailwrapper component to manage drag context and handle reorder eventsSortableThumbcomponent that wraps individual thumbnails with drag handlesonReorderpropFiles Plugin (
files-plugin.ts):findDefaultExportArray()to parse and locate array elements in the default export using BabelreorderDefaultExportPagesInSource()to reorder array elements while preserving formatting, comments, and separators/reorderPUT endpoint to handle page reordering requests and write changes back to diskSlide Route (
slide.tsx):reorderPage()callback that:reorderPageto thumbnail rail only in dev modeTests (
files-plugin.test.ts):reorderDefaultExportPagesInSource()Implementation Details
sortableKeyboardCoordinatesimport.meta.env.DEV)https://claude.ai/code/session_01VW9S5dJWqn6Du9PnsX27of