mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-26 12:35:35 +02:00
- Create NavigationAdapter interface (push, replace, back, pathname, searchParams) - Create AppLink component replacing next/link in 4 files - Replace useRouter → useNavigation in 3 files (issue-detail, create-issue, create-workspace) - Create WebNavigationProvider wrapping Next.js useRouter/usePathname/useSearchParams - Move ~85 feature UI files (issues, editor, modals, my-issues, skills, runtimes) to packages/views/ - Add store singleton registration pattern (registerAuthStore, registerWorkspaceStore) - Create data-aware wrappers in packages/views/common/ (ActorAvatar, Markdown) - Update all app-layer imports to @multica/views/* - Add @source directive for Tailwind to scan views package - packages/views/ has zero next/* imports Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type { Issue } from "@multica/core/types";
|
|
import { PRIORITY_ORDER } from "@multica/core/issues/config";
|
|
import type { SortField, SortDirection } from "@multica/core/issues/stores/view-store";
|
|
|
|
const PRIORITY_RANK: Record<string, number> = Object.fromEntries(
|
|
PRIORITY_ORDER.map((p, i) => [p, i])
|
|
);
|
|
|
|
export function sortIssues(
|
|
issues: Issue[],
|
|
field: SortField,
|
|
direction: SortDirection
|
|
): Issue[] {
|
|
const sorted = [...issues].sort((a, b) => {
|
|
switch (field) {
|
|
case "priority":
|
|
return (
|
|
(PRIORITY_RANK[a.priority] ?? 99) -
|
|
(PRIORITY_RANK[b.priority] ?? 99)
|
|
);
|
|
case "due_date": {
|
|
if (!a.due_date && !b.due_date) return 0;
|
|
if (!a.due_date) return 1;
|
|
if (!b.due_date) return -1;
|
|
return (
|
|
new Date(a.due_date).getTime() - new Date(b.due_date).getTime()
|
|
);
|
|
}
|
|
case "created_at":
|
|
return (
|
|
new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
|
|
);
|
|
case "title":
|
|
return a.title.localeCompare(b.title);
|
|
case "position":
|
|
default:
|
|
return a.position - b.position;
|
|
}
|
|
});
|
|
return direction === "desc" ? sorted.reverse() : sorted;
|
|
}
|