mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-08 10:29:37 +00:00
31 lines
815 B
TypeScript
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")}`;
|
|
};
|