Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nleanba committed Jan 2, 2025
1 parent 930567d commit e40b457
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions src/components/SynoMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class SynoMain extends LitElement {
@state()
protected accessor names: NameState[] = [];
@state()
protected accessor hasHomonyms = false;
protected accessor hasMultipleKingdoms = false;
@state()
protected accessor colExpanded: boolean = false;
@state()
Expand All @@ -73,18 +73,23 @@ export class SynoMain extends LitElement {
alert("Uh Oh!");
return;
}
let multipleKingdoms: undefined | string = undefined;
for await (const name of this.synoGroup) {
if (!multipleKingdoms) {
multipleKingdoms = name.kingdom;
} else if (
!this.hasMultipleKingdoms && multipleKingdoms !== name.kingdom
) {
this.hasMultipleKingdoms = true;
}
const openable = name.authorizedNames.length > 0 &&
(name.authorizedNames.length > 1 ||
(!!name.colURI || name.treatments.cite.size > 0 ||
name.treatments.treats.size > 0));
const sameName = this.names.find((n) =>
n.name.displayName === name.displayName
);
if (sameName) {
sameName.homonym = true;
this.hasHomonyms = true;
}
if (sameName) sameName.homonym = true;

let dateOld = Infinity;
let dateNew = -Infinity;
Expand Down Expand Up @@ -266,7 +271,7 @@ export class SynoMain extends LitElement {
</label>
</div>
</div>
<s-timeline .names=${this.names} .cols=${this.cols} .years=${this.years} .showKingdoms=${this.hasHomonyms}></s-timeline>
<s-timeline .names=${this.names} .cols=${this.cols} .years=${this.years} .showKingdoms=${this.hasMultipleKingdoms}></s-timeline>
${
// this.names.map((name) =>
// html`<syno-name .synoGroup=${this.synoGroup} .name=${name.name}></syno-name>`
Expand All @@ -275,7 +280,7 @@ export class SynoMain extends LitElement {
this.names,
(name) => name.name.displayName + (name.name.taxonNameURI ?? "@"),
(name) =>
html`<syno-name .synoGroup=${this.synoGroup} .name=${name} .showKingdom=${this.hasHomonyms}></syno-name>`,
html`<syno-name .synoGroup=${this.synoGroup} .name=${name} .showKingdom=${this.hasMultipleKingdoms}></syno-name>`,
)}${
this.timeEnd === null && this.names.length === 0
? html`<div class="placeholder">It may take a moment for the first result to appear.</div>`
Expand Down
2 changes: 1 addition & 1 deletion src/components/SynoName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class SynoName extends LitElement {
</div>
<div class="hidden row">
<s-icon icon="justification"></s-icon>
<div style="white-space: pre"><b>Justification:</b> ${
<div style="white-space: pre-wrap;"><b>Justification:</b> ${
until(
justify(this.name.name).then((just) => `This ${just}`),
"Justification loading...",
Expand Down

0 comments on commit e40b457

Please sign in to comment.