Files
radicle-explorer/desktop/src/lib/boardActions.ts
T
Brandon OxendineandRūdolfs Ošiņš 682a406d85 desktop: Add the board view
Every issue and patch of a repository shows on its board, in a column
derived from its state until someone moves it. Cards move by drag and
drop or from their menu, closing columns close and reopen issues for
those allowed to, and a drop that isn't allowed says why. Changes wait
2.5 seconds and are written as one op. Patches link to issues with a
keyword and a full reference. Boards stay hidden until turned on under
Settings → Labs.

Co-authored-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2026-11-06 18:21:33 +01:00

45 lines
1.3 KiB
TypeScript

import type { Board } from "@bindings/cob/board/Board";
import { get } from "svelte/store";
import { nodeRunning } from "@app/lib/events";
import { invoke } from "@app/lib/invoke";
import { show } from "@app/lib/modal";
import * as router from "@app/lib/router";
import { announce } from "@app/components/AnnounceSwitch.svelte";
import CreateBoard from "@app/modals/CreateBoard.svelte";
export const DEFAULT_BOARD_NAME = "Board";
// A board is only ever created on request, and after confirmation. The
// first board is simply "Board"; later ones are numbered from the count.
export async function promptNewBoard(rid: string, repoName: string) {
const boards = await invoke<Board[]>("list_boards", { rid });
const opts = () => ({ announce: get(nodeRunning) && get(announce) });
show({
component: CreateBoard,
props: {
title: boards.length === 0 ? "Create board" : "New board",
repoName,
name:
boards.length === 0
? DEFAULT_BOARD_NAME
: `${DEFAULT_BOARD_NAME} ${boards.length + 1}`,
confirm: async (name: string) => {
const created = await invoke<Board>("create_board", {
rid,
name,
opts: opts(),
});
await router.push({
resource: "repo.board",
rid,
board: created.id,
});
},
},
});
}