ui improvements:

- condense navbar, always show with breadcrumbs for collection title and current page
- add update-title event to propagate replay page title for breadcrumb, also updates document.title
- appmain: make app component more extensible, make coll-index also extensible with custom coll info component
- condense index view headers
- bump to 1.3.2
This commit is contained in:
Ilya Kreymer
2020-12-07 22:37:08 -08:00
parent ba89554833
commit 40c2e937dc
13 changed files with 559 additions and 438 deletions
+5 -4
View File
@@ -22,6 +22,7 @@ $light: $wr-light-green;
$dark: $wr-dark-green; $dark: $wr-dark-green;
$navbar-breakpoint: 840px; $navbar-breakpoint: 840px;
$navbar-height: 2.0rem;
// Set placeholder contrast to ~4.5:1 for WCAG AA compliance // Set placeholder contrast to ~4.5:1 for WCAG AA compliance
$input-placeholder-color: #757575; $input-placeholder-color: #757575;
@@ -44,10 +45,10 @@ a:focus {
background-color: $dark !important; background-color: $dark !important;
color: white !important; color: white !important;
} }
.button.is-warning:focus, .button.is-warning:hover, .button.is-warning:active { //.button.is-warning:focus, .button.is-warning:hover, .button.is-warning:active {
background-color: $wr-dark-yellow !important; // background-color: $wr-dark-yellow !important;
color: black !important; // color: black !important;
} //}
.replay-bar .button { .replay-bar .button {
margin: 0 1px; margin: 0 1px;
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "replaywebpage", "name": "replaywebpage",
"productName": "ReplayWeb.page", "productName": "ReplayWeb.page",
"version": "1.3.1", "version": "1.3.2",
"description": "Serverless Web Archive Replay", "description": "Serverless Web Archive Replay",
"repository": "https://github.com/webrecorder/replayweb.page", "repository": "https://github.com/webrecorder/replayweb.page",
"homepage": "https://replayweb.page/", "homepage": "https://replayweb.page/",
@@ -9,13 +9,13 @@
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.13.0", "@fortawesome/fontawesome-free": "^5.13.0",
"@webrecorder/wabac": "^2.3.1", "@webrecorder/wabac": "^2.3.2",
"bulma": "^0.9.0", "bulma": "^0.9.0",
"fetch-ndjson": "^1.1.0", "fetch-ndjson": "^1.1.0",
"flexsearch": "^0.6.32", "flexsearch": "^0.6.32",
"ipfs-core": "^0.2.0", "ipfs-core": "^0.2.0",
"keyword-mark-element": "^0.1.2", "keyword-mark-element": "^0.1.2",
"lit-element": "^2.3.1", "lit-element": "^2.4.0",
"marked": "^1.0.0", "marked": "^1.0.0",
"mime-types": "^2.1.27", "mime-types": "^2.1.27",
"minimist": "^1.2.5", "minimist": "^1.2.5",
+121 -57
View File
@@ -9,24 +9,35 @@ import fasArrowRight from '@fortawesome/fontawesome-free/svgs/solid/arrow-right.
// =========================================================================== // ===========================================================================
class App extends LitElement class ReplayWebApp extends LitElement
{ {
constructor() { constructor() {
super(); super();
this.sourceUrl = null; this.sourceUrl = null;
this.collInfo = null; this.collTitle = null;
this.showAbout = false; this.showAbout = false;
this.pageParams = {}; this.pageParams = {};
this.inited = false; this.inited = false;
this.navMenuShown = false; this.navMenuShown = false;
this.collPageUrl = "";
this.pageTitle = "";
this.pageReplay = false;
registerSW(__SW_NAME__); registerSW(__SW_NAME__);
this.safariKeyframes(); this.safariKeyframes();
} }
get appName() {
return "ReplayWeb.page";
}
get homeUrl() {
return "/";
}
static get properties() { static get properties() {
return { return {
inited: { type: Boolean }, inited: { type: Boolean },
@@ -34,19 +45,39 @@ class App extends LitElement
sourceUrl: { type: String }, sourceUrl: { type: String },
navMenuShown: { type: Boolean }, navMenuShown: { type: Boolean },
showAbout: { type: Boolean }, showAbout: { type: Boolean },
collInfo: { type: Object }, collTitle: { type: String },
loadInfo: { type: Object }, loadInfo: { type: Object },
embed: { type: String }, embed: { type: String },
collPageUrl: { type: String },
pageTitle: { type: String },
pageReplay: { type: Boolean },
} }
} }
static get styles() { static get styles() {
return wrapCss(css` return wrapCss(ReplayWebApp.appStyles);
}
static get appStyles() {
return css`
#wrlogo { #wrlogo {
max-height: 2.5rem; max-height: 1.0rem;
}
.navbar {
height: 1.5rem;
}
.navbar-brand {
height: 1.5rem;
display: flex;
align-items: center;
} }
.wr-logo-item { .wr-logo-item {
padding-right: 8px; padding: 0 8px 0 0;
}
.no-wrap {
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
} }
.has-allcaps { .has-allcaps {
font-variant-caps: small-caps; font-variant-caps: small-caps;
@@ -91,7 +122,7 @@ class App extends LitElement
.logo-text { .logo-text {
padding-left: 0px; padding-left: 0px;
margin-left: 8px; margin-left: 6px;
} }
a.navbar-item.logo-text:hover { a.navbar-item.logo-text:hover {
@@ -105,36 +136,41 @@ class App extends LitElement
} }
} }
`); `;
} }
renderNavBar() { get mainLogo() {
return rwpLogo;
} }
render() { renderNavBrand() {
if (!this.inited) {
return html``;
}
const showNavBar = !this.collInfo && (!this.embed || this.embed === "full");
return html` return html`
${showNavBar ? html` <span id="home" class="logo-text has-text-weight-bold is-size-6 has-allcaps wide-only">
<a href="#skip-main-target" @click=${this.skipMenu} class="skip-link">Skip main navigation</a>
<nav class="navbar has-background-info" aria-label="main">
<div class="navbar-brand">
${!this.embed ? html `
<a href="/" class="navbar-item wr-logo-item" aria-labelledby="home">
<fa-icon id="wrlogo" size="2.5rem" .svg=${rwpLogo} aria-hidden="true"></fa-icon>
<span id="home" class="logo-text has-text-weight-bold is-size-5 has-allcaps wide-only">
<span class="has-text-primary">replay</span> <span class="has-text-primary">replay</span>
<span class="has-text-link">web.page</span> <span class="has-text-link">web.page</span>
<span class="is-sr-only">Home</span> <span class="is-sr-only">Home</span>
</span>`;
}
renderNavBar() {
return html`
<a href="#skip-main-target" @click=${this.skipMenu} class="skip-link">Skip main navigation</a>
<nav class="navbar has-background-info" aria-label="main">
<div class="navbar-brand">
${!this.embed ? html`
<a href="${this.homeUrl}" class="navbar-item wr-logo-item" aria-labelledby="home">
<fa-icon id="wrlogo" size="1.0rem" .svg=${this.mainLogo} aria-hidden="true"></fa-icon>
${this.renderNavBrand()}
</a>
${this.collTitle ? html`
<a href="${this.collPageUrl}" class="no-wrap is-size-6 has-text-black">/&nbsp;&nbsp;<i>${this.collTitle}</i></a>
<span class="no-wrap is-size-6">&nbsp;&nbsp;/&nbsp;
${this.pageReplay ? html`<i>${this.pageTitle}</i>` : this.pageTitle}
</span> </span>
</a>`: html ` ` : ``}
`: html`
<span class="navbar-item wr-logo-item"> <span class="navbar-item wr-logo-item">
<fa-icon id="wrlogo" size="2.5rem" .svg=${rwpLogo} aria-hidden="true"></fa-icon> <fa-icon id="wrlogo" size="1.0rem" .svg=${this.mainLogo} aria-hidden="true"></fa-icon>
</span> </span>
`} `}
<a href="#" role="button" id="menu-button" @click="${this.onNavMenu}" @keyup="${clickOnSpacebarPress}" <a href="#" role="button" id="menu-button" @click="${this.onNavMenu}" @keyup="${clickOnSpacebarPress}"
@@ -144,56 +180,72 @@ class App extends LitElement
<span aria-hidden="true"></span> <span aria-hidden="true"></span>
</a> </a>
</div> </div>
${!this.sourceUrl ? html`
<div class="navbar-menu ${this.navMenuShown ? 'is-active' : ''}"> <div class="navbar-menu ${this.navMenuShown ? 'is-active' : ''}">
<div class="navbar-start"> <div class="navbar-start">
${!this.embed ? html` ${IS_APP ? html`
<a id="home" class="navbar-item logo-text has-text-weight-bold is-size-5 has-allcaps menu-only" href="/">
<span class="has-text-primary">replay</span>
<span class="has-text-link">web.page</span>
<span class="is-sr-only">Home</span>
</a>` : ``}
${IS_APP && !this.collInfo ? html`
<a role="button" href="#" class="navbar-item arrow-button" title="Go Back" @click="${(e) => window.history.back()}" @keyup="${clickOnSpacebarPress}"> <a role="button" href="#" class="navbar-item arrow-button" title="Go Back" @click="${(e) => window.history.back()}" @keyup="${clickOnSpacebarPress}">
<fa-icon .svg="${fasArrowLeft}" aria-hidden="true"></fa-icon><span class="menu-only">&nbsp;Go Back</span> <fa-icon size="1.0rem" .svg="${fasArrowLeft}" aria-hidden="true"></fa-icon><span class="menu-only is-size-7">&nbsp;Go Back</span>
</a> </a>
<a role="button" href="#" class="navbar-item arrow-button" title="Go Forward" @click="${(e) => window.history.forward()}" @keyup="${clickOnSpacebarPress}"> <a role="button" href="#" class="navbar-item arrow-button" title="Go Forward" @click="${(e) => window.history.forward()}" @keyup="${clickOnSpacebarPress}">
<fa-icon .svg="${fasArrowRight}" aria-hidden="true"></fa-icon><span class="menu-only">&nbsp;Go Forward</span> <fa-icon size="1.0rem" .svg="${fasArrowRight}" aria-hidden="true"></fa-icon><span class="menu-only is-size-7">&nbsp;Go Forward</span>
</a> </a>
` : ``} ` : ``}
</div> </div>
${!this.embed ? html` ${!this.embed ? html`
<div class="navbar-end"> <div class="navbar-end">
<a href="/docs" target="_blank" class="navbar-item"> ${this.renderNavEnd()}
</div>` : html``}
</div>` : html``}
</nav>
<p id="skip-main-target" tabindex="-1" class="is-sr-only">Skipped</p>`;
}
renderNavEnd() {
return html`
<a href="/docs" target="_blank" class="navbar-item is-size-6">
<fa-icon .svg="${fasHelp}" aria-hidden="true"></fa-icon><span>&nbsp;User Docs</span> <fa-icon .svg="${fasHelp}" aria-hidden="true"></fa-icon><span>&nbsp;User Docs</span>
</a> </a>
<!-- <!--
-- NB: the About modal is currently inaccessible to people using keyboards or screen readers. -- NB: the About modal is currently inaccessible to people using keyboards or screen readers.
-- Should all the JS and infrastructure for accessible modals be added, or should About be a normal page? -- Should all the JS and infrastructure for accessible modals be added, or should About be a normal page?
--> -->
<a href="?terms" @click="${(e) => { e.preventDefault(); this.showAbout = true} }"class="navbar-item">About</a> <a href="?terms" @click="${(e) => { e.preventDefault(); this.showAbout = true} }"class="navbar-item is-size-6">About
</div>` : html``} </a>`
</div> }
</nav><p id="skip-main-target" tabindex="-1" class="is-sr-only">Skipped</p>
` : ''}
${this.sourceUrl ? html`
renderColl() {
return html`
<wr-coll .loadInfo="${this.loadInfo}" <wr-coll .loadInfo="${this.loadInfo}"
sourceUrl="${this.sourceUrl}" sourceUrl="${this.sourceUrl}"
embed="${this.embed}" embed="${this.embed}"
appName="${this.appName}"
.appLogo="${this.mainLogo}"
@replay-favicons=${this.onFavIcons} @replay-favicons=${this.onFavIcons}
@update-title=${this.onTitle}
@coll-loaded=${this.onCollLoaded} @coll-loaded=${this.onCollLoaded}
@about-show=${(e) => this.showAbout = true}></wr-coll> @about-show=${(e) => this.showAbout = true}></wr-coll>`;
` : html` }
renderHomeIndex() {
return html`
<wr-coll-index> <wr-coll-index>
${!IS_APP ? html` ${!IS_APP ? html`
<p slot="header" class="tagline is-size-5 has-text-centered">Explore and Replay Interactive Archived Webpages Directly in your Browser. <i><a target="_blank" href="./docs/examples">(See Examples)</a></i></p> <p slot="header" class="tagline is-size-5 has-text-centered">Explore and Replay Interactive Archived Webpages Directly in your Browser. <i><a target="_blank" href="./docs/examples">(See Examples)</a></i></p>
` : ``} ` : ``}
<wr-chooser slot="header" @load-start=${this.onStartLoad}></wr-chooser> <wr-chooser slot="header" @load-start=${this.onStartLoad}></wr-chooser>
</wr-coll-index> </wr-coll-index>`;
`} }
render() {
if (!this.inited) {
return html``;
}
return html`
${!this.embed || this.embed === "full" ? this.renderNavBar() : ''}
${this.sourceUrl ? this.renderColl() : this.renderHomeIndex()}
${this.showAbout ? this.renderAbout() : ``} ${this.showAbout ? this.renderAbout() : ``}
`; `;
@@ -208,7 +260,7 @@ class App extends LitElement
updated(changedProperties) { updated(changedProperties) {
if (changedProperties.has("sourceUrl")) { if (changedProperties.has("sourceUrl")) {
this.collInfo = null; this.collTitle = null;
} }
} }
@@ -328,13 +380,16 @@ class App extends LitElement
// just redirect right away? // just redirect right away?
this.pageParams.set("source", event.detail.sourceUrl); this.pageParams.set("source", event.detail.sourceUrl);
const url = new URL(window.location.href);
url.search = this.pageParams.toString();
this.collPageUrl = url.toString();
if (!event.detail.isFile) { if (!event.detail.isFile) {
window.location.search = this.pageParams.toString(); window.location.search = this.pageParams.toString();
return; return;
} else { } else {
const url = new URL(window.location.href);
url.search = this.pageParams.toString(); window.history.pushState({}, "", this.collPageUrl);
window.history.pushState({}, "", url.toString());
} }
this.sourceUrl = event.detail.sourceUrl; this.sourceUrl = event.detail.sourceUrl;
@@ -344,7 +399,7 @@ class App extends LitElement
onCollLoaded(event) { onCollLoaded(event) {
this.loadInfo = null; this.loadInfo = null;
if (event.detail.collInfo) { if (event.detail.collInfo) {
this.collInfo = event.detail.collInfo; this.collTitle = event.detail.collInfo.title;
} }
if (event.detail.alreadyLoaded) { if (event.detail.alreadyLoaded) {
@@ -360,6 +415,15 @@ class App extends LitElement
} }
} }
onTitle(event) {
if (event.detail.title) {
this.pageTitle = event.detail.title;
this.pageReplay = event.detail.replayTitle;
document.title = (event.detail.replayTitle ? "Archive of " : "") + this.pageTitle + " | ReplayWeb.page";
}
}
safariKeyframes() { safariKeyframes() {
// Safari requires keyframes at the document level, add spinner keyframes here // Safari requires keyframes at the document level, add spinner keyframes here
const css = ` const css = `
@@ -442,6 +506,6 @@ class App extends LitElement
} }
} }
customElements.define("replay-app-main", App); customElements.define("replay-app-main", ReplayWebApp);
export { App }; export { ReplayWebApp };
+4 -3
View File
@@ -108,7 +108,7 @@ class Chooser extends LitElement
min-width: 0; min-width: 0;
} }
.extra-padding { .extra-padding {
padding: 2em; padding: 1.5em;
} }
.less-padding { .less-padding {
padding-top: 1.0em; padding-top: 1.0em;
@@ -119,6 +119,7 @@ class Chooser extends LitElement
} }
.panel-heading { .panel-heading {
background-color: #cff3ff; background-color: #cff3ff;
font-size: 0.85rem;
} }
form { form {
flex-grow: 1; flex-grow: 1;
@@ -154,9 +155,9 @@ class Chooser extends LitElement
return html` return html`
<section class="section less-padding"> <section class="section less-padding">
<div class="panel"> <div class="panel">
<h2 class="panel-heading">Load Web Archive</h2> <h4 class="panel-heading">Load Web Archive</h4>
<div class="extra-padding panel-block file has-name"> <div class="extra-padding panel-block file has-name">
<form class="content is-flex" @submit="${this.onStartLoad}"> <form class="is-flex" @submit="${this.onStartLoad}">
<label class="file-label"> <label class="file-label">
${!this.hasNativeFS ? html` ${!this.hasNativeFS ? html`
<input class="file-input" <input class="file-input"
+26 -10
View File
@@ -12,7 +12,7 @@ import fasSearch from '@fortawesome/fontawesome-free/svgs/solid/search.svg';
// =========================================================================== // ===========================================================================
class CollIndex extends LitElement class WrCollIndex extends LitElement
{ {
constructor() { constructor() {
super(); super();
@@ -26,9 +26,12 @@ class CollIndex extends LitElement
this.hideHeader = localStorage.getItem("index:hideHeader") === "1"; this.hideHeader = localStorage.getItem("index:hideHeader") === "1";
this._deleting = {}; this._deleting = {};
this.dateName = "Date Loaded";
this.headerName = "Loaded Archives";
} }
static get sortKeys() { get sortKeys() {
return [ return [
{key: "title", {key: "title",
name: "Title"}, name: "Title"},
@@ -37,7 +40,7 @@ class CollIndex extends LitElement
name: "Source"}, name: "Source"},
{key: "ctime", {key: "ctime",
name: "Date Loaded"}, name: this.dateName},
{key: "size", {key: "size",
name: "Total Size"} name: "Total Size"}
@@ -56,7 +59,10 @@ class CollIndex extends LitElement
hideHeader: { type: Boolean }, hideHeader: { type: Boolean },
_deleting: { type: Object } _deleting: { type: Object },
dateName: { type: String },
headerName: { type: String }
} }
} }
@@ -147,6 +153,9 @@ class CollIndex extends LitElement
.no-top-padding { .no-top-padding {
padding-top: 1.0em; padding-top: 1.0em;
} }
.panel-heading {
font-size: 0.85rem;
}
.is-loading { .is-loading {
line-height: 1.5em; line-height: 1.5em;
height: 1.5em; height: 1.5em;
@@ -224,19 +233,22 @@ class CollIndex extends LitElement
} }
render() { render() {
const hasHeader = this.childElementCount > 0;
return html` return html`
<header class="${this.hideHeader ? 'closed' : ''}"> <header class="${this.hideHeader ? 'closed' : ''}">
<slot name="header"></slot> <slot name="header"></slot>
</header> </header>
<section class="section no-top-padding"> <section class="section no-top-padding">
<div class="sort-header is-small"> <div class="sort-header is-small">
${hasHeader ? html`
<button @click=${(e) => this.hideHeader = !this.hideHeader} class="collapse button is-small"> <button @click=${(e) => this.hideHeader = !this.hideHeader} class="collapse button is-small">
<span class="icon"><fa-icon .svg=${this.hideHeader ? fasArrowDown : fasArrowUp}></span> <span class="icon"><fa-icon .svg=${this.hideHeader ? fasArrowDown : fasArrowUp}></span>
<span>${this.hideHeader ? 'Show ' : 'Hide'} <span class="is-sr-only">Header</span></span> <span>${this.hideHeader ? 'Show ' : 'Hide'} <span class="is-sr-only">Header</span></span>
</button> </button>` : ``}
</div> </div>
<div class="panel is-light"> <div class="panel is-light">
<h2 class="panel-heading"><span>Loaded Archives</span> <h2 class="panel-heading"><span>${this.headerName}</span>
</h2> </h2>
${this.colls.length ? html` ${this.colls.length ? html`
@@ -249,7 +261,7 @@ class CollIndex extends LitElement
<wr-sorter id="index" <wr-sorter id="index"
sortKey="ctime" sortKey="ctime"
?sortDesc="${true}" ?sortDesc="${true}"
.sortKeys="${CollIndex.sortKeys}" .sortKeys="${this.sortKeys}"
.data="${this.filteredColls}" .data="${this.filteredColls}"
@sort-changed="${(e) => this.sortedColls = e.detail.sortedData}"> @sort-changed="${(e) => this.sortedColls = e.detail.sortedData}">
</wr-sorter> </wr-sorter>
@@ -258,7 +270,7 @@ class CollIndex extends LitElement
<div class="coll-list"> <div class="coll-list">
${this.sortedColls.map((coll, i) => html` ${this.sortedColls.map((coll, i) => html`
<div class="coll-block panel-block"> <div class="coll-block panel-block">
<wr-coll-info .coll=${coll}></wr-coll-info> ${this.renderCollInfo(coll)}
${!this._deleting[coll.sourceUrl] ? html` ${!this._deleting[coll.sourceUrl] ? html`
<button class="delete" aria-label="Unload Collection" title="Unload Collection" data-coll-index="${i}" @click="${this.onDeleteColl}"></button> <button class="delete" aria-label="Unload Collection" title="Unload Collection" data-coll-index="${i}" @click="${this.onDeleteColl}"></button>
` : html` ` : html`
@@ -277,6 +289,10 @@ class CollIndex extends LitElement
</section> </section>
`; `;
} }
renderCollInfo(coll) {
return html`<wr-coll-info .coll=${coll}></wr-coll-info>`;
}
} }
@@ -424,6 +440,6 @@ class WrCollInfo extends LitElement
} }
customElements.define("wr-coll-info", WrCollInfo); customElements.define("wr-coll-info", WrCollInfo);
customElements.define("wr-coll-index", CollIndex); customElements.define("wr-coll-index", WrCollIndex);
export { CollIndex }; export { WrCollIndex, WrCollInfo };
+45 -40
View File
@@ -10,7 +10,6 @@ import farResources from '@fortawesome/fontawesome-free/svgs/solid/puzzle-piece.
import farPages from '@fortawesome/fontawesome-free/svgs/regular/file-image.svg'; import farPages from '@fortawesome/fontawesome-free/svgs/regular/file-image.svg';
import fasInfoIcon from '@fortawesome/fontawesome-free/svgs/solid/info-circle.svg'; import fasInfoIcon from '@fortawesome/fontawesome-free/svgs/solid/info-circle.svg';
import fasSync from '@fortawesome/fontawesome-free/svgs/solid/sync-alt.svg'; import fasSync from '@fortawesome/fontawesome-free/svgs/solid/sync-alt.svg';
import fasHome from '@fortawesome/fontawesome-free/svgs/solid/home.svg';
import fasRefresh from '@fortawesome/fontawesome-free/svgs/solid/redo-alt.svg'; import fasRefresh from '@fortawesome/fontawesome-free/svgs/solid/redo-alt.svg';
import fasFullscreen from '@fortawesome/fontawesome-free/svgs/solid/desktop.svg'; import fasFullscreen from '@fortawesome/fontawesome-free/svgs/solid/desktop.svg';
@@ -30,7 +29,7 @@ const RWP_SCHEME = "search://";
// =========================================================================== // ===========================================================================
class Coll extends LitElement class WrColl extends LitElement
{ {
constructor() { constructor() {
super(); super();
@@ -57,6 +56,12 @@ class Coll extends LitElement
this.ts = ""; this.ts = "";
this.tabNames = ["pages", "story", "resources", "info"]; this.tabNames = ["pages", "story", "resources", "info"];
this.tabLabels = {
"pages": "Pages",
"story": "Story",
"resources": "URLs",
"info": "Archive Info",
}
this.menuActive = false; this.menuActive = false;
@@ -73,7 +78,6 @@ class Coll extends LitElement
this.appName = "ReplayWeb.page"; this.appName = "ReplayWeb.page";
this.appLogo = rwpLogo; this.appLogo = rwpLogo;
this.appHomeUrl = "/";
} }
static get properties() { static get properties() {
@@ -108,7 +112,6 @@ class Coll extends LitElement
appName: { type: String }, appName: { type: String },
appLogo: { type: String }, appLogo: { type: String },
appHomeUrl: { type: String }
} }
} }
@@ -294,7 +297,7 @@ class Coll extends LitElement
} }
if (this.collInfo.coll && !this.tabNames.includes(this.tabData.view)) { if (this.collInfo.coll && !this.tabNames.includes(this.tabData.view)) {
const view = this.hasStory ? "story" : (this.collInfo.pages.length ? "pages" : "resources"); const view = this.hasStory ? "story" : (this.editable || this.collInfo.pages.length ? "pages" : "resources");
this.tabData = { this.tabData = {
...this.tabData, view ...this.tabData, view
@@ -429,12 +432,21 @@ class Coll extends LitElement
flex: auto; flex: auto;
} }
${Coll.replayBarStyles} ${WrColl.replayBarStyles}
`); `);
} }
static get replayBarStyles() { static get replayBarStyles() {
return css` return css`
.breadbar {
display: flex;
align-items: center;
height: 35px;
width: 100%;
background-color: aliceblue;
padding: 0.5em;
}
.replay-bar { .replay-bar {
padding: 0.5em 0em 0.5em 0.5em; padding: 0.5em 0em 0.5em 0.5em;
max-width: none; max-width: none;
@@ -502,7 +514,7 @@ class Coll extends LitElement
form { form {
width: 100%; width: 100%;
margin-left: 0.5em; margin: 0 0 0 0.5em;
} }
.gutter.gutter-horizontal { .gutter.gutter-horizontal {
@@ -591,8 +603,9 @@ class Coll extends LitElement
const isReplay = !!this.tabData.url; const isReplay = !!this.tabData.url;
const isSidebar = isReplay && this.showSidebar; const isSidebar = isReplay && this.showSidebar;
if (!isReplay){ if (!isReplay && this.tabData && this.tabData.view){
document.title = `Browse Contents | ${this.appName}`; const detail = {title: this.tabLabels[this.tabData.view], replayTitle: false};
this.dispatchEvent(new CustomEvent("update-title", {bubbles: true, composed: true, detail}));
} }
if (this.collInfo && !this.collInfo.coll) { if (this.collInfo && !this.collInfo.coll) {
@@ -703,15 +716,6 @@ class Coll extends LitElement
<a class="skip-link" href="#skip-replay-target" @click="${this.skipMenu}">Skip replay navigation</a> <a class="skip-link" href="#skip-replay-target" @click="${this.skipMenu}">Skip replay navigation</a>
<nav class="replay-bar" aria-label="replay"> <nav class="replay-bar" aria-label="replay">
<div class="field has-addons"> <div class="field has-addons">
${!this.embed ? html`
<a href="${this.appHomeUrl}" role="button" class="button is-borderless is-hidden-touch" aria-labelledby="home" @keyup="${clickOnSpacebarPress}">
<span class="icon is-small">
<fa-icon size="1.0em" .svg="${fasHome}" aria-hidden="true"></fa-icon>
<span class="is-sr-only">Home</span>
</span>
</a>` : ``}
<a href="#" role="button" class="button narrow is-borderless is-hidden-touch" id="fullscreen" @click="${this.onFullscreenToggle}" @keyup="${clickOnSpacebarPress}" <a href="#" role="button" class="button narrow is-borderless is-hidden-touch" id="fullscreen" @click="${this.onFullscreenToggle}" @keyup="${clickOnSpacebarPress}"
title="${this.isFullscreen ? "Exit Full Screen" : "Full Screen"}" aria-label="${this.isFullscreen ? "Exit Fullscreen" : "Fullscreen"}"> title="${this.isFullscreen ? "Exit Full Screen" : "Full Screen"}" aria-label="${this.isFullscreen ? "Exit Fullscreen" : "Fullscreen"}">
<span class="icon is-small"> <span class="icon is-small">
@@ -744,6 +748,7 @@ class Coll extends LitElement
<fa-icon size="1.0em" class="has-text-grey" aria-hidden="true" .svg="${farListAlt}"></fa-icon> <fa-icon size="1.0em" class="has-text-grey" aria-hidden="true" .svg="${farListAlt}"></fa-icon>
</span> </span>
</a> </a>
${this.renderExtraToolbar(false)}
<form @submit="${this.onSubmit}"> <form @submit="${this.onSubmit}">
<div class="control is-expanded ${showFavIcon ? 'has-icons-left' : ''}"> <div class="control is-expanded ${showFavIcon ? 'has-icons-left' : ''}">
<input id="url" class="input" type="text" @keydown="${this.onKeyDown}" @blur="${this.onLostFocus}" .value="${this.url}" placeholder="Enter text to search or a URL to replay"/> <input id="url" class="input" type="text" @keydown="${this.onKeyDown}" @blur="${this.onLostFocus}" .value="${this.url}" placeholder="Enter text to search or a URL to replay"/>
@@ -766,15 +771,6 @@ class Coll extends LitElement
</div> </div>
<div class="dropdown-menu" id="menu-dropdown"> <div class="dropdown-menu" id="menu-dropdown">
<div class="dropdown-content"> <div class="dropdown-content">
${!this.embed ? html`
<a href="${this.appHomeUrl}" role="button" class="dropdown-item is-hidden-desktop" @keyup="${clickOnSpacebarPress}">
<span class="icon is-small">
<fa-icon size="1.0em" class="has-text-grey" aria-hidden="true" .svg="${fasHome}"></fa-icon>
</span>
<span>Home</span>
</a>
<hr class="dropdown-divider is-hidden-tablet">
` : ``}
<a href="#" role="button" class="dropdown-item is-hidden-desktop" @click="${this.onFullscreenToggle}" @keyup="${clickOnSpacebarPress}"> <a href="#" role="button" class="dropdown-item is-hidden-desktop" @click="${this.onFullscreenToggle}" @keyup="${clickOnSpacebarPress}">
<span class="icon is-small"> <span class="icon is-small">
<fa-icon size="1.0em" class="has-text-grey" aria-hidden="true" .svg="${this.isFullscreen ? fasUnfullscreen : fasFullscreen}"></fa-icon> <fa-icon size="1.0em" class="has-text-grey" aria-hidden="true" .svg="${this.isFullscreen ? fasUnfullscreen : fasFullscreen}"></fa-icon>
@@ -805,13 +801,15 @@ class Coll extends LitElement
</span> </span>
<span>Browse Contents</span> <span>Browse Contents</span>
</a> </a>
${this.renderExtraToolbar(true)}
${!this.editable ? html`
<hr class="dropdown-divider is-hidden-desktop"> <hr class="dropdown-divider is-hidden-desktop">
<a href="#" role="button" class="dropdown-item" @click="${this.onPurgeCache}" @keyup="${clickOnSpacebarPress}"> <a href="#" role="button" class="dropdown-item" @click="${this.onPurgeCache}" @keyup="${clickOnSpacebarPress}">
<span class="icon is-small"> <span class="icon is-small">
<fa-icon size="1.0em" class="has-text-grey" aria-hidden="true" .svg="${fasSync}"></fa-icon> <fa-icon size="1.0em" class="has-text-grey" aria-hidden="true" .svg="${fasSync}"></fa-icon>
</span> </span>
<span>Purge Cache + Full Reload</span> <span>Purge Cache + Full Reload</span>
</a> </a>` : html``}
${dateStr ? html` ${dateStr ? html`
<hr class="dropdown-divider is-hidden-desktop"> <hr class="dropdown-divider is-hidden-desktop">
<div class="dropdown-item info is-hidden-desktop"> <div class="dropdown-item info is-hidden-desktop">
@@ -844,15 +842,8 @@ class Coll extends LitElement
} }
} }
renderCollTabs(isSidebar) { renderCollInfo() {
const isStory = this.hasStory && this.tabData.view === 'story';
const isPages = this.tabData.view === 'pages';
const isResources = this.tabData.view === 'resources';
const isInfo = this.tabData.view === 'info';
return html` return html`
${isInfo ? html`
<div class="info-bg"> <div class="info-bg">
<wr-coll-info <wr-coll-info
class="is-list" class="is-list"
@@ -861,8 +852,22 @@ class Coll extends LitElement
?canDelete="${!this.embed}" ?canDelete="${!this.embed}"
@coll-purge="${this.onPurgeCache}" @coll-purge="${this.onPurgeCache}"
></wr-coll-info> ></wr-coll-info>
</div> </div>`;
`: html``} }
renderExtraToolbar(isDropdown = false) {
return '';
}
renderCollTabs(isSidebar) {
const isStory = this.hasStory && this.tabData.view === 'story';
const isPages = this.tabData.view === 'pages';
const isResources = this.tabData.view === 'resources';
const isInfo = this.tabData.view === 'info';
return html`
${isInfo ? this.renderCollInfo() : html``}
${isStory ? html` ${isStory ? html`
<wr-coll-story .collInfo="${this.collInfo}" <wr-coll-story .collInfo="${this.collInfo}"
@@ -1110,6 +1115,6 @@ class Coll extends LitElement
} }
} }
customElements.define("wr-coll", Coll); customElements.define("wr-coll", WrColl);
export { Coll }; export { WrColl };
+2 -1
View File
@@ -128,4 +128,5 @@ class AnimLogo extends FaIcon
customElements.define("fa-icon", FaIcon); customElements.define("fa-icon", FaIcon);
customElements.define("wr-anim-logo", AnimLogo); customElements.define("wr-anim-logo", AnimLogo);
export { wrapCss, IS_APP, clickOnSpacebarPress, rwpLogo, FaIcon, AnimLogo }; export { wrapCss, IS_APP, clickOnSpacebarPress, rwpLogo, FaIcon, AnimLogo,
LitElement, html, css, unsafeCSS, unsafeSVG };
+1 -1
View File
@@ -806,7 +806,7 @@ class Pages extends LitElement
getNoResultsMessage() { getNoResultsMessage() {
if (!this.collInfo || !this.collInfo.pages.length) { if (!this.collInfo || !this.collInfo.pages.length) {
return html`<span class="fix-text-wrapping">No "Pages" are defined in this archive. <a href="#view=resources">Browse by URL</a>.</span>`; return html`<span class="fix-text-wrapping">No Pages are defined in this archive. The archive may be empty. <a href="#view=resources">Try browsing by URL</a>.</span>`;
} }
if (this.updatingSearch) { if (this.updatingSearch) {
+6 -2
View File
@@ -92,6 +92,9 @@ class Replay extends LitElement
if (this.iframeUrl && changedProperties.has("iframeUrl")) { if (this.iframeUrl && changedProperties.has("iframeUrl")) {
this.waitForLoad(); this.waitForLoad();
const detail = {title: "Archived Page", replayTitle: false};
this.dispatchEvent(new CustomEvent("update-title", {bubbles: true, composed: true, detail}));
} }
if (this.replayUrl && changedProperties.has("replayUrl")) { if (this.replayUrl && changedProperties.has("replayUrl")) {
@@ -131,8 +134,9 @@ class Replay extends LitElement
} }
} }
if (this.title){ if (this.title) {
document.title = `Replay of ${this.title} | ReplayWeb.page`; const detail = {title: this.title, replayTitle: true};
this.dispatchEvent(new CustomEvent("update-title", {bubbles: true, composed: true, detail}));
} }
} }
+6 -6
View File
File diff suppressed because one or more lines are too long
+290 -276
View File
File diff suppressed because one or more lines are too long
+19 -4
View File
@@ -18,6 +18,9 @@ const GDRIVE_CLIENT_ID = "160798412227-tko4c82uopud11q105b2lvbogsj77hlg.apps.goo
// Copyright banner text // Copyright banner text
const BANNER_TEXT = "'[name].js is part of ReplayWeb.page (https://replayweb.page) Copyright (C) 2020, Webrecorder Software. Licensed under the Affero General Public License v3.'"; const BANNER_TEXT = "'[name].js is part of ReplayWeb.page (https://replayweb.page) Copyright (C) 2020, Webrecorder Software. Licensed under the Affero General Public License v3.'";
// IPFS ipfs-core lib url
const IPFS_CORE_URL = "https://cdn.jsdelivr.net/npm/ipfs-core@0.2.0/dist/index.min.js";
const electronMainConfig = (env, argv) => { const electronMainConfig = (env, argv) => {
return { return {
@@ -70,8 +73,14 @@ const electronPreloadConfig = (env, argv) => {
'preload': './src/electron-preload.js', 'preload': './src/electron-preload.js',
}, },
plugins: [ plugins: [
new webpack.BannerPlugin(BANNER_TEXT) new webpack.BannerPlugin(BANNER_TEXT),
],
// this needs to be defined, but not actually used, as electron app uses
// ipfs-core from node
new webpack.DefinePlugin({
__IPFS_CORE_URL__: JSON.stringify(IPFS_CORE_URL)
}),
]
} }
}; };
@@ -116,9 +125,15 @@ const browserConfig = (env, argv) => {
__APP_FILE_SERVE_PREFIX__ : JSON.stringify(APP_FILE_SERVE_PREFIX), __APP_FILE_SERVE_PREFIX__ : JSON.stringify(APP_FILE_SERVE_PREFIX),
__HELPER_PROXY__ : JSON.stringify(HELPER_PROXY), __HELPER_PROXY__ : JSON.stringify(HELPER_PROXY),
__GDRIVE_CLIENT_ID__ : JSON.stringify(GDRIVE_CLIENT_ID), __GDRIVE_CLIENT_ID__ : JSON.stringify(GDRIVE_CLIENT_ID),
__VERSION__: JSON.stringify(require("./package.json").version) __VERSION__: JSON.stringify(require("./package.json").version),
__IPFS_CORE_URL__: JSON.stringify(IPFS_CORE_URL)
}),
new webpack.BannerPlugin(BANNER_TEXT),
new CopyPlugin({
patterns: [
{ from: 'node_modules/ipfs-core/dist/index.min.js', to: 'ipfs-core.min.js' },
]
}), }),
new webpack.BannerPlugin(BANNER_TEXT)
], ],
module: { module: {
+8 -8
View File
@@ -709,10 +709,10 @@
"@webassemblyjs/wast-parser" "1.9.0" "@webassemblyjs/wast-parser" "1.9.0"
"@xtuc/long" "4.2.2" "@xtuc/long" "4.2.2"
"@webrecorder/wabac@^2.3.1": "@webrecorder/wabac@^2.3.2":
version "2.3.1" version "2.3.2"
resolved "https://registry.yarnpkg.com/@webrecorder/wabac/-/wabac-2.3.1.tgz#e4f6a689113dc8501a8f6fc96896f04c0513e062" resolved "https://registry.yarnpkg.com/@webrecorder/wabac/-/wabac-2.3.2.tgz#08c02ce09d88e6a9e44bcf168ae9404d4deb965d"
integrity sha512-Rf7ajz7RG0ocmsCUjuFSr18z58KZW/44g4adDGgBZ3G3XQ1PYrJ2faIYOwnG/vm08x5mM7xRRTE5L4VtdepOsQ== integrity sha512-EXrqeZ7COUBrDW5dNT4PwWmN/OI9cUf6E+WkD+Dfl6hpcKSxzOZ8qUXDU2RBeaKtQtRkr4qbsq45eb/j5wpZYw==
dependencies: dependencies:
"@webrecorder/wombat" "^3.0.2" "@webrecorder/wombat" "^3.0.2"
brotli "github:foliojs/brotli.js" brotli "github:foliojs/brotli.js"
@@ -5830,10 +5830,10 @@ lie@~3.3.0:
dependencies: dependencies:
immediate "~3.0.5" immediate "~3.0.5"
lit-element@^2.3.1: lit-element@^2.4.0:
version "2.3.1" version "2.4.0"
resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.3.1.tgz#73343b978fa1e73d60526c6bb6ad60f53a16c343" resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.4.0.tgz#b22607a037a8fc08f5a80736dddf7f3f5d401452"
integrity sha512-tOcUAmeO3BzwiQ7FGWdsshNvC0HVHcTFYw/TLIImmKwXYoV0E7zCBASa8IJ7DiP4cen/Yoj454gS0qqTnIGsFA== integrity sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==
dependencies: dependencies:
lit-html "^1.1.1" lit-html "^1.1.1"