forked from MapComplete/MapComplete
Support for lexemes, decent etymology layer and theme with rudimentary icon
This commit is contained in:
parent
9726d85ad7
commit
9faac532b5
18 changed files with 611 additions and 270 deletions
|
@ -51,8 +51,9 @@ export default class WikidataPreviewBox extends VariableUiElement {
|
|||
wikidata.id,
|
||||
Svg.wikidata_ui().SetStyle("width: 2.5rem").SetClass("block")
|
||||
]).SetClass("flex"),
|
||||
"https://wikidata.org/wiki/"+wikidata.id ,true)
|
||||
"https://wikidata.org/wiki/"+wikidata.id ,true).SetClass("must-link")
|
||||
|
||||
console.log(wikidata)
|
||||
let info = new Combine( [
|
||||
new Combine([Translation.fromMap(wikidata.labels).SetClass("font-bold"),
|
||||
link]).SetClass("flex justify-between"),
|
||||
|
|
|
@ -6,12 +6,10 @@ import {UIEventSource} from "../../Logic/UIEventSource";
|
|||
import Wikidata, {WikidataResponse} from "../../Logic/Web/Wikidata";
|
||||
import Locale from "../i18n/Locale";
|
||||
import {VariableUiElement} from "../Base/VariableUIElement";
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import WikidataPreviewBox from "./WikidataPreviewBox";
|
||||
import Title from "../Base/Title";
|
||||
import WikipediaBox from "./WikipediaBox";
|
||||
import Svg from "../../Svg";
|
||||
import Link from "../Base/Link";
|
||||
|
||||
export default class WikidataSearchBox extends InputElement<string> {
|
||||
|
||||
|
@ -104,7 +102,7 @@ export default class WikidataSearchBox extends InputElement<string> {
|
|||
if (wid === undefined) {
|
||||
return undefined
|
||||
}
|
||||
return new WikipediaBox([wid]);
|
||||
return new WikipediaBox(wid.split(";"));
|
||||
})).SetStyle("max-height:12.5rem"),
|
||||
full
|
||||
]).ConstructElement();
|
||||
|
|
|
@ -22,7 +22,7 @@ export default class WikipediaBox extends Combine {
|
|||
|
||||
const mainContents = []
|
||||
|
||||
const pages = wikidataIds.map(wdId => WikipediaBox.createLinkedContent(wdId))
|
||||
const pages = wikidataIds.map(wdId => WikipediaBox.createLinkedContent(wdId.trim()))
|
||||
if (wikidataIds.length == 1) {
|
||||
const page = pages[0]
|
||||
mainContents.push(
|
||||
|
@ -88,6 +88,9 @@ export default class WikipediaBox extends Combine {
|
|||
|
||||
}
|
||||
const wikidata = <WikidataResponse>maybewikidata["success"]
|
||||
if(wikidata === undefined){
|
||||
return "failed"
|
||||
}
|
||||
if (wikidata.wikisites.size === 0) {
|
||||
return ["no page", wikidata]
|
||||
}
|
||||
|
@ -157,7 +160,7 @@ export default class WikipediaBox extends Combine {
|
|||
}
|
||||
return undefined
|
||||
}))
|
||||
.SetClass("flex items-center")
|
||||
.SetClass("flex items-center enable-links")
|
||||
|
||||
return {
|
||||
contents: contents,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue