1import { EDITORS, type EditorId } from "@t3tools/contracts";
2
3import { getLocalFileManagerName } from "~/lib/utils";
4
5const editorLabels = new Map<EditorId, string>(EDITORS.map((editor) => [editor.id, editor.label]));
6
7export function editorLabelForPlatform(editorId: EditorId, platform: string): string {
8 if (editorId === "file-manager") {
9 return getLocalFileManagerName(platform);
10 }
11
12 return editorLabels.get(editorId) ?? "Editor";
13}
14
15export function openInEditorMenuLabel(editorId: EditorId | null): string {
16 return editorId === null || editorId === "file-manager"
17 ? "Open in editor"
18 : `Open in ${editorLabels.get(editorId) ?? "Editor"}`;
19}