kanban / src /lib /customField.ts
Leon4gr45's picture
Deploy magic-resume as Docker Space (port 3000) (part 2)
aa1ee73 verified
Raw
History Blame Contribute Delete
794 Bytes
import { CustomFieldType } from "@/types/resume";
import { getProjectLinkHref } from "@/lib/projectLink";
const trim = (value?: string) => value?.trim() || "";
export const getCustomFieldDisplayText = (
field: Pick<CustomFieldType, "label" | "value" | "displayLabel">
) => {
const label = trim(field.label);
const value = trim(field.value);
if (field.displayLabel) {
return label || value;
}
return value;
};
export const shouldShowCustomFieldLabelPrefix = (
field: Pick<CustomFieldType, "label" | "displayLabel">
) => {
return !field.displayLabel && Boolean(trim(field.label));
};
export const getCustomFieldHref = (
field: Pick<CustomFieldType, "value" | "displayLabel">
) => {
if (!field.displayLabel) return null;
return getProjectLinkHref(field.value);
};