initial commit on Federted servers
release gate / check (push) Failing after 8m35s

This commit is contained in:
Andrew S Erwin
2026-10-19 16:23:55 -05:00
commit b9721ff13f
217 changed files with 31534 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import type { PageSummary } from '@/lib/pages'
/**
* Reorder pages by moving sourceId beside targetId. Pinned and unpinned pages
* are separate groups (the server sorts pinned first), so a cross-group drop
* returns 'blocked' instead of silently landing at a different boundary.
* `after` places the source after the target; otherwise it goes before it.
*/
export function reorderPages(
pages: PageSummary[],
sourceId: string,
targetId: string,
after = false,
): PageSummary[] | 'blocked' | null {
const from = pages.findIndex((p) => p.id === sourceId)
const to = pages.findIndex((p) => p.id === targetId)
if (from < 0 || to < 0 || sourceId === targetId) return null
if (pages[from].pinned !== pages[to].pinned) return 'blocked'
const next = [...pages]
const [moved] = next.splice(from, 1)
let insertAt = to + (after ? 1 : 0)
if (from < insertAt) insertAt--
next.splice(insertAt, 0, moved)
return next
}