Disable copy tags menu item if no tags (#709)

This commit is contained in:
sua yoo 2023-03-16 19:45:04 -07:00 committed by GitHub
parent 0009ce8bf6
commit 03e9b2aba5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,20 +210,23 @@ export class CrawlsList extends LiteElement {
</div> </div>
</header> </header>
<section> <section>
${this.crawls.length ${
? this.renderCrawlList() this.crawls.length
: html` ? this.renderCrawlList()
: html`
<div class="border-t border-b py-5"> <div class="border-t border-b py-5">
<p class="text-center text-neutral-500"> <p class="text-center text-neutral-500">
${msg("No crawls yet.")} ${msg("No crawls yet.")}
</p> </p>
</div> </div>
`} `
}
</section> </section>
<footer class="m-2"> <footer class="m-2">
<span class="text-0-400 text-xs"> <span class="text-0-400 text-xs">
${this.lastFetched ${
? msg(html`Last updated: this.lastFetched
? msg(html`Last updated:
<sl-format-date <sl-format-date
date="${new Date(this.lastFetched).toString()}" date="${new Date(this.lastFetched).toString()}"
month="2-digit" month="2-digit"
@ -233,7 +236,8 @@ export class CrawlsList extends LiteElement {
minute="numeric" minute="numeric"
second="numeric" second="numeric"
></sl-format-date>`) ></sl-format-date>`)
: ""} : ""
}
</span> </span>
</footer> </footer>
</main> </main>
@ -326,8 +330,9 @@ export class CrawlsList extends LiteElement {
</div> </div>
</div> </div>
${this.userId ${
? html` <div class="h-6 mt-2 flex justify-end"> this.userId
? html` <div class="h-6 mt-2 flex justify-end">
<label> <label>
<span class="text-neutral-500 text-xs mr-1" <span class="text-neutral-500 text-xs mr-1"
>${msg("Show Only Mine")}</span >${msg("Show Only Mine")}</span
@ -339,7 +344,8 @@ export class CrawlsList extends LiteElement {
></sl-switch> ></sl-switch>
</label> </label>
</div>` </div>`
: ""} : ""
}
`; `;
} }
@ -471,6 +477,7 @@ export class CrawlsList extends LiteElement {
</sl-menu-item> </sl-menu-item>
<sl-menu-item <sl-menu-item
@click=${() => CopyButton.copyToClipboard(crawl.tags.join(","))} @click=${() => CopyButton.copyToClipboard(crawl.tags.join(","))}
?disabled=${!crawl.tags.length}
> >
<sl-icon name="tags" slot="prefix"></sl-icon> <sl-icon name="tags" slot="prefix"></sl-icon>
${msg("Copy Tags")} ${msg("Copy Tags")}