feat(app): draggable tabs (#31364)

Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com>
This commit is contained in:
Aarav Sareen 2026-06-25 10:36:49 +05:30 committed by GitHub
commit d5aa5ff8fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 1504 additions and 384 deletions

View file

@ -125,6 +125,16 @@ export const { use: useTabs, provider: TabsProvider } = createSimpleContext({
)
return next
},
reorder(keys: string[]) {
setStore(
produce((tabs) => {
const byKey = new Map(tabs.map((tab) => [tabKey(tab), tab]))
const next = keys.map((key) => byKey.get(key)).filter((tab): tab is Tab => !!tab)
if (next.length !== tabs.length) return
tabs.splice(0, tabs.length, ...next)
}),
)
},
draft(draftID: string) {
const tab = store.find((item) => item.type === "draft" && item.draftID === draftID)
if (!tab || tab.type !== "draft") throw new Error(`Draft not found: ${draftID}`)