feat: improve ui

This commit is contained in:
Maël Gangloff
2024-12-20 19:41:48 +01:00
parent 1dc16d769b
commit 425071bc23
6 changed files with 124 additions and 55 deletions

View File

@@ -7,5 +7,7 @@ export const entityToName = (e: { entity: Entity }): string => {
const jCard = vCard.fromJSON(e.entity.jCard)
let name = e.entity.handle
if (jCard.data.fn && !Array.isArray(jCard.data.fn) && jCard.data.fn.valueOf() !== '') name = jCard.data.fn.valueOf()
if (jCard.data.org && !Array.isArray(jCard.data.org) && jCard.data.org.valueOf() !== '') name = jCard.data.org.valueOf()
return name
}

View File

@@ -0,0 +1,14 @@
import vCard from "vcf";
import {Entity} from "../api";
export const extractDetailsFromJCard = (e: { entity: Entity }): {
fn?: string
organization?: string;
} => {
if (e.entity.jCard.length === 0) return {fn: e.entity.handle}
const jCard = vCard.fromJSON(e.entity.jCard)
const fn = jCard.data.fn && !Array.isArray(jCard.data.fn) ? jCard.data.fn.valueOf() : undefined
const organization = jCard.data.org && !Array.isArray(jCard.data.org) ? jCard.data.org.valueOf() : undefined
return {fn, organization}
}