MapComplete/src/UI/Wikipedia/WikidataPreviewBox.ts

71 lines
2.2 KiB
TypeScript
Raw Normal View History

import { TypedTranslation } from "../i18n/Translation"
2022-09-08 21:40:48 +02:00
import Translations from "../i18n/Translations"
import Gender_male from "../../assets/svg/Gender_male.svelte"
import Gender_female from "../../assets/svg/Gender_female.svelte"
import Gender_inter from "../../assets/svg/Gender_inter.svelte"
import Gender_trans from "../../assets/svg/Gender_trans.svelte"
import Gender_queer from "../../assets/svg/Gender_queer.svelte"
2021-10-08 04:33:39 +02:00
export default class WikidataPreviewBox {
2022-09-08 21:40:48 +02:00
private static isHuman = [{ p: 31 /*is a*/, q: 5 /* human */ }]
public static extraProperties: {
2022-09-08 21:40:48 +02:00
requires?: { p: number; q?: number }[]
property: string
textMode?: Map<string, string>
2022-09-08 21:40:48 +02:00
display:
| TypedTranslation<{ value }>
| Map<string, any>,
2021-11-07 16:34:51 +01:00
}[] = [
{
requires: WikidataPreviewBox.isHuman,
property: "P21",
display: new Map([
[
"Q6581097",
Gender_male
],
[
"Q6581072",
Gender_female
],
[
"Q1097630",
Gender_inter
],
2022-09-08 21:40:48 +02:00
[
"Q1052281",
Gender_trans /*'transwomen'*/
2022-09-08 21:40:48 +02:00
],
[
"Q2449503",
Gender_trans /*'transmen'*/
],
[
"Q48270",
Gender_queer
]
]),
textMode: new Map([
2022-09-08 21:40:48 +02:00
["Q6581097", "♂️"],
["Q6581072", "♀️"],
["Q1097630", "⚥️"],
["Q1052281", "🏳️‍⚧️" /*'transwomen'*/],
["Q2449503", "🏳️‍⚧️" /*'transmen'*/],
["Q48270", "🏳️‍🌈 ⚧"]
])
2021-11-07 16:34:51 +01:00
},
{
property: "P569",
requires: WikidataPreviewBox.isHuman,
display: Translations.t.general.wikipedia.previewbox.born
2021-11-07 16:34:51 +01:00
},
{
property: "P570",
requires: WikidataPreviewBox.isHuman,
display: Translations.t.general.wikipedia.previewbox.died
}
]
2021-11-07 16:34:51 +01:00
2022-09-08 21:40:48 +02:00
}