feat: Multi WACZ json Front End Support (#214)
Better display for Multi WACZ collections, including showing: - File size of combined WACZ - List of all WACZ files (with downloadable links) - Use collection title instead of filename for all names (collection index, breadcrumb, sidebar) - Display collection description (if available) on sidebar + info page
This commit is contained in:
+2
-1
@@ -619,7 +619,8 @@ class ReplayWebApp extends LitElement {
|
|||||||
onCollLoaded(event) {
|
onCollLoaded(event) {
|
||||||
this.loadInfo = null;
|
this.loadInfo = null;
|
||||||
if (event.detail.collInfo) {
|
if (event.detail.collInfo) {
|
||||||
this.collTitle = event.detail.collInfo.title;
|
this.collTitle =
|
||||||
|
event.detail.collInfo.name || event.detail.collInfo.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.detail.alreadyLoaded) {
|
if (event.detail.alreadyLoaded) {
|
||||||
|
|||||||
+26
-5
@@ -1,5 +1,6 @@
|
|||||||
import { LitElement, html, css } from "lit";
|
import { LitElement, html, css } from "lit";
|
||||||
import { wrapCss, apiPrefix } from "./misc";
|
import { wrapCss, apiPrefix } from "./misc";
|
||||||
|
import { map } from "lit/directives/map.js";
|
||||||
|
|
||||||
import prettyBytes from "pretty-bytes";
|
import prettyBytes from "pretty-bytes";
|
||||||
|
|
||||||
@@ -461,7 +462,7 @@ class CollInfo extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
<div class="column is-2">
|
<div class="column is-2">
|
||||||
<p class="minihead">Total Size</p>
|
<p class="minihead">Total Size</p>
|
||||||
${prettyBytes(Number(coll.size || 0))}
|
${prettyBytes(Number(coll.totalSize || coll.size || 0))}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -473,7 +474,7 @@ class CollInfo extends LitElement {
|
|||||||
<div class="column col-title is-4">
|
<div class="column col-title is-4">
|
||||||
<span class="subtitle has-text-weight-bold">
|
<span class="subtitle has-text-weight-bold">
|
||||||
<a href="?source=${encodeURIComponent(coll.sourceUrl)}"
|
<a href="?source=${encodeURIComponent(coll.sourceUrl)}"
|
||||||
>${coll.title || coll.filename}</a
|
>${coll.name || coll.title || coll.filename}</a
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -503,7 +504,7 @@ class CollInfo extends LitElement {
|
|||||||
return html` <div class="columns">
|
return html` <div class="columns">
|
||||||
<div class="column col-title is-4">
|
<div class="column col-title is-4">
|
||||||
<span class="subtitle has-text-weight-bold">
|
<span class="subtitle has-text-weight-bold">
|
||||||
${coll.title || coll.filename}
|
${coll.name || coll.title || coll.filename}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
${coll.desc
|
${coll.desc
|
||||||
@@ -512,10 +513,30 @@ class CollInfo extends LitElement {
|
|||||||
${coll.desc}
|
${coll.desc}
|
||||||
</div>`
|
</div>`
|
||||||
: html``}
|
: html``}
|
||||||
<div class="column">
|
${coll.description
|
||||||
|
? html`<div class="column">
|
||||||
|
<p class="minihead">Description</p>
|
||||||
|
${coll.description}
|
||||||
|
</div>`
|
||||||
|
: html``}
|
||||||
|
<!-- Only show filename if coll.resources doesn't exist -->
|
||||||
|
${coll.resources
|
||||||
|
? html`<div class="column">
|
||||||
|
<p class="minihead">Files</p>
|
||||||
|
<ol style="padding: revert">
|
||||||
|
${map(
|
||||||
|
coll.resources,
|
||||||
|
(resource) =>
|
||||||
|
html`<li>
|
||||||
|
<a href="${resource.path}">${resource.name + "\n"}</a>
|
||||||
|
</li>`,
|
||||||
|
)}
|
||||||
|
</ol>
|
||||||
|
</div>`
|
||||||
|
: html`<div class="column">
|
||||||
<p class="minihead">Filename</p>
|
<p class="minihead">Filename</p>
|
||||||
${coll.filename}
|
${coll.filename}
|
||||||
</div>
|
</div>`}
|
||||||
${this.renderSource(coll)}
|
${this.renderSource(coll)}
|
||||||
${domain
|
${domain
|
||||||
? html`
|
? html`
|
||||||
|
|||||||
+16
-3
@@ -471,9 +471,15 @@ class Pages extends LitElement {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex-auto {
|
.flex-auto {
|
||||||
flex: auto;
|
flex: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.index-bar-description {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,8 +588,16 @@ class Pages extends LitElement {
|
|||||||
class="index-bar-title"
|
class="index-bar-title"
|
||||||
@dblclick="${() => (this.editing = true)}"
|
@dblclick="${() => (this.editing = true)}"
|
||||||
>
|
>
|
||||||
${this.collInfo.title}
|
${this.collInfo.name || this.collInfo.title}
|
||||||
</div>`}
|
</div>
|
||||||
|
${this.collInfo.description
|
||||||
|
? html`<div
|
||||||
|
class="index-bar-description"
|
||||||
|
@dblclick="${() => (this.editing = true)}"
|
||||||
|
>
|
||||||
|
${this.collInfo.description}
|
||||||
|
</div>`
|
||||||
|
: html``}`}
|
||||||
${this.editable
|
${this.editable
|
||||||
? html`<fa-icon class="editIcon" .svg="${fasEdit}"></fa-icon>`
|
? html`<fa-icon class="editIcon" .svg="${fasEdit}"></fa-icon>`
|
||||||
: html``}
|
: html``}
|
||||||
@@ -607,7 +621,6 @@ class Pages extends LitElement {
|
|||||||
aria-atomic="true"
|
aria-atomic="true"
|
||||||
>${this.formatResults()}</span
|
>${this.formatResults()}</span
|
||||||
>
|
>
|
||||||
|
|
||||||
${this.editable
|
${this.editable
|
||||||
? html` <div class="index-bar-actions">
|
? html` <div class="index-bar-actions">
|
||||||
${this.renderDownloadMenu()}
|
${this.renderDownloadMenu()}
|
||||||
|
|||||||
Reference in New Issue
Block a user