Files
frontend/src/panels/lovelace/editor/get-dashboard-documentation-url.ts
Wendelin 830d8d2410 Add type import check to eslint (#22488)
* Add type import check to eslint

* Add type imports with eslint --fix
2024-10-30 11:12:30 +00:00

31 lines
815 B
TypeScript

import {
getCustomBadgeEntry,
getCustomCardEntry,
isCustomType,
stripCustomPrefix,
} from "../../../data/lovelace_custom_cards";
import type { HomeAssistant } from "../../../types";
import { documentationUrl } from "../../../util/documentation-url";
export const getCardDocumentationURL = (
hass: HomeAssistant,
type: string
): string | undefined => {
if (isCustomType(type)) {
return getCustomCardEntry(stripCustomPrefix(type))?.documentationURL;
}
return `${documentationUrl(hass, "/dashboards/")}${type}`;
};
export const getBadgeDocumentationURL = (
hass: HomeAssistant,
type: string
): string | undefined => {
if (isCustomType(type)) {
return getCustomBadgeEntry(stripCustomPrefix(type))?.documentationURL;
}
return `${documentationUrl(hass, "/dashboards/badges")}`;
};