Skip to content

Commit

Permalink
col treatments also for tn
Browse files Browse the repository at this point in the history
  • Loading branch information
nleanba committed Dec 18, 2024
1 parent df5f147 commit 9a173f6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 168 deletions.
50 changes: 9 additions & 41 deletions src/components/SynoName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export class SynoAuthName extends LitElement {
});

return html`
<h3>
<h3 id=${
this.authorizedName.colURI
? encodeURIComponent(this.authorizedName.colURI)
: nothing
}>
<i class="ditto">${this.authorizedName.displayName}</i>
${this.authorizedName.authority}
${
Expand All @@ -66,14 +70,6 @@ export class SynoAuthName extends LitElement {
shortUrl(this.authorizedName.taxonConceptURI)
}<s-icon icon="link"></s-icon></a>`
: nothing
}${
this.authorizedName.colURI
? html`<a class="taxon uri" id=${
encodeURIComponent(this.authorizedName.colURI)
} href=${this.authorizedName.colURI} target="_blank">${
shortUrl(this.authorizedName.colURI)
}<s-icon icon="link"></s-icon></a>`
: nothing
}
</h3>
<ul>
Expand Down Expand Up @@ -126,7 +122,9 @@ export class SynoName extends LitElement {

return html`
<div class="header">
<h2>
<h2 id=${
this.name.colURI ? encodeURIComponent(this.name.colURI) : nothing
}>
<i>${this.name.displayName}</i>
<span class="rank">${this.name.kingdom || "Missing Kingdom"}</span>
<span class="rank">${this.name.rank}</span>
Expand All @@ -138,14 +136,6 @@ export class SynoName extends LitElement {
shortUrl(this.name.taxonNameURI)
}<s-icon icon="link"></s-icon></a>`
: nothing
}${
this.name.colURI
? html`<a class="taxon uri" id=${
encodeURIComponent(this.name.colURI)
} href=${this.name.colURI} target="_blank">${
shortUrl(this.name.colURI)
}<s-icon icon="link"></s-icon></a>`
: nothing
}
<abbr class="justification" title="${
until(
Expand All @@ -170,29 +160,7 @@ export class SynoName extends LitElement {
<ul>
${
this.name.colURI
? html`<div class="treatmentline">
<s-icon icon=${
this.name.acceptedColURI !== this.name.colURI ? "col_dpr" : "col_aug"
}></s-icon>
Catalogue of Life
<div class="indent">${
this.name.acceptedColURI !== this.name.colURI
? html`<div><s-icon icon="east"></s-icon><s-icon icon="col_aug"></s-icon><a
href="#${
encodeURIComponent(this.name.acceptedColURI!)
}" title="show name">${
until(
this.synoGroup.findName(this.name.acceptedColURI!).then((n) =>
(n as AuthorizedName).authority
? n.displayName + " " + (n as AuthorizedName).authority
: n.displayName
),
shortUrl(this.name.acceptedColURI!),
)
}</a></div>`
: nothing
}</div>
</div>`
? html`<syno-col .synoGroup=${this.synoGroup} .colURI=${this.name.colURI} .acceptedColURI=${this.name.acceptedColURI}></syno-col>`
: nothing
}${
treatments_array.map(({ trt, status }) => {
Expand Down
138 changes: 12 additions & 126 deletions src/components/SynoTreatment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ s-icon {
&>div {
grid-row-end: span 2;
}
&:hover button::before {
background: #ededed8c;
}
}
.counts {
Expand Down Expand Up @@ -284,13 +288,13 @@ export class SynoTreatment extends LitElement {
}}>
<s-icon icon=${this.status || "unknown"}></s-icon>
<div>
${this.trt?.date ?? html`<i>No Date</i>`}:
${
until(
this.trt?.details.then((d) => d.creators),
html`<progress></progress>`,
)
}
},
<b>${this.trt?.date ?? html`<i>No Date</i>`}</b>:
<i>${
until(this.trt?.details.then((d) => `“${d.title}”`), nothing)
}</i></div>
Expand Down Expand Up @@ -343,7 +347,7 @@ export class SynoTreatment extends LitElement {
details.treats.def.size
? html`<div class="row ${
this.status === "def" || this.status === "cite" ? "hidden" : ""
}"><s-icon icon="def"></s-icon><div><b class="green">Defines:</b>${
}"><s-icon icon="def"></s-icon><div><b class="green"><abbr title="This treatment defines (e.g. as 'sp. nov.)' a new Taxon.">Defines:</abbr></b>${
details.treats.def.values().map((n) => {
const short = n.replace(
"http://taxon-concept.plazi.org/id/",
Expand All @@ -369,7 +373,7 @@ export class SynoTreatment extends LitElement {
details.treats.aug.size > 0 || details.treats.treattn.size > 0
? html`<div class="row ${
this.status === "aug" || this.status === "cite" ? "hidden" : ""
}"><s-icon icon="aug"></s-icon><div><b class="blue">Treats:</b>${
}"><s-icon icon="aug"></s-icon><div><b class="blue"><abbr title="The taxon the treatment is about. SynoSpecies interprets this as an assertion that this name is valid.">Treats:</abbr></b>${
details.treats.aug.union(details.treats.treattn).values().map(
(n) => {
const short = n.replace(
Expand Down Expand Up @@ -400,7 +404,7 @@ export class SynoTreatment extends LitElement {
details.treats.dpr.size
? html`<div class="row ${
this.status === "dpr" || this.status === "cite" ? "hidden" : ""
}"><s-icon icon="dpr"></s-icon><div><b class="red">Deprecates:</b>${
}"><s-icon icon="dpr"></s-icon><div><b class="red"><abbr title="Synonym(s) cited in the treatment.">Deprecates:</abbr></b>${
details.treats.dpr.values().map((n) => {
const short = n.replace(
"http://taxon-concept.plazi.org/id/",
Expand All @@ -424,7 +428,7 @@ export class SynoTreatment extends LitElement {
: nothing
}${
details.treats.citetc.size > 0 || details.treats.citetn.size > 0
? html`<div class="row hidden"><s-icon icon="cite"></s-icon><div><b class="gray"><abbr title="These citations are not considered to find synonyms by SynoSpecies.">Cites:</abbr></b>${
? html`<div class="row hidden"><s-icon icon="cite"></s-icon><div><b class="gray"><abbr title="These citations are not considered synonyms by SynoSpecies.">Cites:</abbr></b>${
details.treats.citetc.union(details.treats.citetn).values().map(
(n) => {
const short = n.replace(
Expand Down Expand Up @@ -543,7 +547,7 @@ export class SynoTreatment extends LitElement {
: nothing
}`
),
html`<progress></progress>`,
nothing,
)
}
</div>
Expand All @@ -553,7 +557,7 @@ export class SynoTreatment extends LitElement {

@customElement("syno-col")
export class SynoColTreatment extends LitElement {
static override styles = styles;
static override styles = css`${styles} :host { border-radius: 4px; }`;

@property({ attribute: false })
accessor synoGroup: SynonymGroup | null = null;
Expand Down Expand Up @@ -622,124 +626,6 @@ export class SynoColTreatment extends LitElement {
}</a>
</div>
</div>
${nothing
/*
until(
this.trt?.details.then((details) =>
html`${
details.treats.def.size
? html`<div class="row ${
this.status === "def" || this.status === "cite" ? "hidden" : ""
}"><s-icon icon="def"></s-icon><div><b class="green">Defines:</b>${
details.treats.def.values().map((n) => {
const short = n.replace(
"http://taxon-concept.plazi.org/id/",
"",
);
return until(
this.synoGroup?.findName(n).then((nn) => {
if ((nn as AuthorizedName).authority) {
return html` <a class="taxon" href="#${short}">${
nn.displayName + " " +
(nn as AuthorizedName).authority
}</a>`;
} else {
return html` <a class="taxon" href="#${short}">${nn.displayName}</a>`;
}
}),
html` <a class="taxon uri">${short}</a>`,
);
})
}</div></div>`
: nothing
}${
details.treats.aug.size > 0 || details.treats.treattn.size > 0
? html`<div class="row ${
this.status === "aug" || this.status === "cite" ? "hidden" : ""
}"><s-icon icon="aug"></s-icon><div><b class="blue">Treats:</b>${
details.treats.aug.union(details.treats.treattn).values().map(
(n) => {
const short = n.replace(
"http://taxon-concept.plazi.org/id/",
"",
).replace(
"http://taxon-name.plazi.org/id/",
"",
);
return until(
this.synoGroup?.findName(n).then((nn) => {
if ((nn as AuthorizedName).authority) {
return html` <a class="taxon" href="#${short}">${
nn.displayName + " " +
(nn as AuthorizedName).authority
}</a>`;
} else {
return html` <a class="taxon" href="#${short}">${nn.displayName}</a>`;
}
}),
html` <a class="taxon uri">${short}</a>`,
);
},
)
}</div></div>`
: nothing
}${
details.treats.dpr.size
? html`<div class="row ${
this.status === "dpr" || this.status === "cite" ? "hidden" : ""
}"><s-icon icon="dpr"></s-icon><div><b class="red">Deprecates:</b>${
details.treats.dpr.values().map((n) => {
const short = n.replace(
"http://taxon-concept.plazi.org/id/",
"",
);
return until(
this.synoGroup?.findName(n).then((nn) => {
if ((nn as AuthorizedName).authority) {
return html` <a class="taxon" href="#${short}">${
nn.displayName + " " +
(nn as AuthorizedName).authority
}</a>`;
} else {
return html` <a class="taxon" href="#${short}">${nn.displayName}</a>`;
}
}),
html` <a class="taxon uri">${short}</a>`,
);
})
}</div></div>`
: nothing
}${
details.treats.citetc.size > 0 || details.treats.citetn.size > 0
? html`<div class="row hidden"><s-icon icon="cite"></s-icon><div><b class="gray"><abbr title="These citations are not considered to find synonyms by SynoSpecies.">Cites:</abbr></b>${
details.treats.citetc.union(details.treats.citetn).values().map(
(n) => {
const short = n.replace(
"http://taxon-concept.plazi.org/id/",
"",
).replace(
"http://taxon-name.plazi.org/id/",
"",
);
return until(
this.synoGroup?.findName(n).then((nn) => {
if ((nn as AuthorizedName).authority) {
return html` <a class="taxon" href="#${short}">${
nn.displayName + " " +
(nn as AuthorizedName).authority
}</a>`;
} else {
return html` <a class="taxon" href="#${short}">${nn.displayName}</a>`;
}
}),
html` <a class="taxon uri">${short}</a>`,
);
},
)
}</div></div>`
: nothing
*/
}
</div>
`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ export class Timeline extends LitElement {
: a.taxonConceptURI
? "#" + encodeURIComponent(a.taxonConceptURI)
: nothing
}"><span class="ditto">—“—</span> ${a.authority}</a>`
}><span class="ditto">—“—</span> ${a.authority}</a>`
)
}</div>`
)
Expand Down

0 comments on commit 9a173f6

Please sign in to comment.