| 1 | import { EDITORS, type EditorId } from "@t3tools/contracts"; |
| 2 | |
| 3 | import { getLocalFileManagerName } from "~/lib/utils"; |
| 4 | |
| 5 | const editorLabels = new Map<EditorId, string>(EDITORS.map((editor) => [editor.id, editor.label])); |
| 6 | |
| 7 | export 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 | |
| 15 | export 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 | } |