Co-authored-by: Dara Adedeji <[email protected]> Co-authored-by: shivam <[email protected]>
20 lines
663 B
TypeScript
20 lines
663 B
TypeScript
import { EDITORS, type EditorId } from "@t3tools/contracts";
|
|
|
|
import { getLocalFileManagerName } from "~/lib/utils";
|
|
|
|
const editorLabels = new Map<EditorId, string>(EDITORS.map((editor) => [editor.id, editor.label]));
|
|
|
|
export function editorLabelForPlatform(editorId: EditorId, platform: string): string {
|
|
if (editorId === "file-manager") {
|
|
return getLocalFileManagerName(platform);
|
|
}
|
|
|
|
return editorLabels.get(editorId) ?? "Editor";
|
|
}
|
|
|
|
export function openInEditorMenuLabel(editorId: EditorId | null): string {
|
|
return editorId === null || editorId === "file-manager"
|
|
? "Open in editor"
|
|
: `Open in ${editorLabels.get(editorId) ?? "Editor"}`;
|
|
}
|