1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

vueui: moved breadcrumbs to be on top. moved title/url/date to be on bottom under timeline; updated CSS classes and vue component to match functionality

This commit is contained in:
Ivan Velev 2021-09-12 21:29:13 -07:00
parent 771437b5a2
commit a079072c24
4 changed files with 124 additions and 119 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,20 +1,23 @@
<template> <template>
<div class="app" data-app="webrecorder-replay-app"> <div class="app" data-app="webrecorder-replay-app">
<div class="short-nav"> <div class="banner">
<div class="first-line"> <div class="row">
<div class="logo"><img :src="config.logoImg" /></div> <div class="logo"><img :src="config.logoImg" /></div>
<div class="url-and-timeline"> <div class="timeline-wrap">
<div class="url"> <div class="row">
<strong>{{config.title}}</strong> ({{snapshots.length}} captures: {{snapshots[0].getDateFormatted()}} - {{snapshots[snapshots.length-1].getDateFormatted()}})<br/> <TimelineBreadcrumbs
<TimelineSummary
v-if="currentPeriod" v-if="currentPeriod"
:period="currentPeriod" :period="currentPeriod"
@goto-period="gotoPeriod" @goto-period="gotoPeriod"
></TimelineSummary> class="breadcrumbs"
<span class="full-view-toggle" :class="{expanded: showFullView}" @click="showFullView = !showFullView"> ></TimelineBreadcrumbs>
<template v-if="!showFullView"><span class="detail">show year calendar</span></template><template v-else><span class="detail">hide year calendar</span></template>
<img src="/static/calendar-icon.png" /> <div class="toggles">
</span> <span class="toggle" :class="{expanded: showFullView}" @click="showFullView = !showFullView">
<template v-if="!showFullView"><span class="detail">show year calendar</span></template><template v-else><span class="detail">hide year calendar</span></template>
<img src="/static/calendar-icon.png" />
</span>
</div>
</div> </div>
<Timeline <Timeline
v-if="currentPeriod" v-if="currentPeriod"
@ -24,11 +27,14 @@
></Timeline> ></Timeline>
</div> </div>
</div> </div>
<div class="second-line" v-if="currentSnapshot && !showFullView"> </div>
<h2>Showing Capture from {{currentSnapshot.getTimeDateFormatted()}}</h2> <div class="snapshot-title">
<div>{{ config.url }}</div>
<div v-if="currentSnapshot && !showFullView">
<span v-if="config.title">{{ config.title }}</span>
{{currentSnapshot.getTimeDateFormatted()}}
</div> </div>
</div> </div>
<CalendarYear v-if="showFullView" <CalendarYear v-if="showFullView"
:period="currentPeriod" :period="currentPeriod"
@goto-period="gotoPeriod"> @goto-period="gotoPeriod">
@ -38,7 +44,7 @@
<script> <script>
import Timeline from "./components/Timeline.vue"; import Timeline from "./components/Timeline.vue";
import TimelineSummary from "./components/Summary.vue"; import TimelineBreadcrumbs from "./components/TimelineBreadcrumbs.vue";
import CalendarYear from "./components/CalendarYear.vue"; import CalendarYear from "./components/CalendarYear.vue";
import { PywbSnapshot } from "./model.js"; import { PywbSnapshot } from "./model.js";
@ -60,7 +66,7 @@ export default {
timelineHighlight: false timelineHighlight: false
}; };
}, },
components: {Timeline, TimelineSummary, CalendarYear}, components: {Timeline, TimelineBreadcrumbs, CalendarYear},
mounted: function() { mounted: function() {
this.init(); this.init();
}, },
@ -84,8 +90,9 @@ export default {
this.showFullView = false; this.showFullView = false;
}, },
init() { init() {
if (!this.config.title) { this.config.url = this.config.initialView.url;
this.config.title = this.config.initialView.url; if (this.config.initialView.title) {
this.config.title = this.config.initialView.title;
} }
if (this.config.initialView.timestamp === undefined) { if (this.config.initialView.timestamp === undefined) {
this.showFullView = true; this.showFullView = true;
@ -97,7 +104,8 @@ export default {
setSnapshot(view) { setSnapshot(view) {
// convert to snapshot objec to support proper rendering of time/date // convert to snapshot objec to support proper rendering of time/date
const snapshot = new PywbSnapshot(view, 0); const snapshot = new PywbSnapshot(view, 0);
this.config.title = view.url; this.config.url = view.url;
this.config.title = view.title;
this.gotoSnapshot(snapshot); this.gotoSnapshot(snapshot);
} }
} }
@ -111,7 +119,7 @@ export default {
width: 100%; width: 100%;
} }
.full-view { .full-view {
position: absolute; position: fixed;
top: 150px; top: 150px;
left: 0; left: 0;
} }
@ -123,66 +131,70 @@ export default {
margin-right: 30px; margin-right: 30px;
width: 180px; width: 180px;
} }
.short-nav { .banner {
width: 100%; width: 100%;
max-width: 1200px; /* limit width */ max-width: 1200px; /* limit width */
position: relative; position: relative;
} }
.short-nav .first-line { .banner .row {
display: flex;
justify-content: flex-start;
}
.short-nav .second-line {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
} }
.short-nav .logo { .banner .logo {
flex-shrink: initial; flex-shrink: initial;
/* for any content/image inside the logo container */ /* for any content/image inside the logo container */
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.short-nav .logo img { .banner .logo img {
flex-shrink: 1; flex-shrink: 1;
} }
.short-nav .url-and-timeline { .banner .timeline-wrap {
flex-grow: 2; flex-grow: 2;
overflow-x: hidden; overflow-x: hidden;
}
.short-nav .url {
text-align: left; text-align: left;
margin: 0 25px; margin: 0 25px;
position: relative; position: relative;
} }
.full-view-toggle { .timeline-wrap .row .breadcrumbs {
position: absolute; display: inline-block;
top: 0; flex-grow: 1;
right: 0; }
.timeline-wrap .row .toggles {
display: inline-block;
flex-shrink: 1;
}
.toggles .toggle {
border-radius: 5px; border-radius: 5px;
padding: 4px; padding: 4px;
cursor: zoom-in; cursor: zoom-in;
} }
.full-view-toggle img { .toggles .toggle img {
width: 17px; width: 17px;
display: inline-block; display: inline-block;
margin-top: 2px; margin-top: 2px;
} }
.full-view-toggle:hover { .toggles .toggle:hover {
background-color: #eeeeee; background-color: #eeeeee;
} }
.full-view-toggle .detail { .toggles .toggle .detail {
display: none; display: none;
} }
.full-view-toggle:hover .detail { .toggles .toggle:hover .detail {
display: inline; display: inline;
} }
.full-view-toggle.expanded { .toggles .toggle.expanded {
background-color: #eeeeee; background-color: #eeeeee;
cursor: zoom-out; cursor: zoom-out;
} }
.snapshot-title {
text-align: center;
font-weight: bold;
font-size: 16px;
}
</style> </style>

View File

@ -1,6 +1,6 @@
<style> <style>
.full-view { .full-view {
position: absolute; position: fixed;
z-index: 10; z-index: 10;
height: 80vh; height: 80vh;
width: 100%; width: 100%;

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="summary"> <div class="breadcrumbs">
<template v-if="parents.length"> <template v-if="parents.length">
<span class="item"> <span class="item">
<span class="goto" @click="changePeriod(parents[0])">{{parents[0].getReadableId(true)}}</span> <span class="goto" @click="changePeriod(parents[0])">{{parents[0].getReadableId(true)}}</span>
@ -39,37 +39,33 @@ export default {
</script> </script>
<style> <style>
.summary { .breadcrumbs .item {
display: inline-block;
}
.summary .item {
position: relative; position: relative;
display: inline; display: inline;
margin: 0 2px 0 0; margin: 0 2px 0 0;
font-size: inherit; font-size: inherit;
} }
.summary .count { .breadcrumbs .count {
vertical-align: middle; vertical-align: middle;
font-size: inherit; font-size: inherit;
} }
.summary .count .verbose { .breadcrumbs .count .verbose {
display: none; display: none;
} }
.summary .count:hover .verbose { .breadcrumbs .count:hover .verbose {
display: inline; display: inline;
} }
.summary .item .goto { .breadcrumbs .item .goto {
margin: 1px; margin: 1px;
cursor: pointer; cursor: pointer;
color: darkslateblue; color: darkslateblue;
text-decoration: underline; text-decoration: underline;
} }
.summary .item .goto:hover { .breadcrumbs .item .goto:hover {
background-color: #a6cdf5; background-color: #a6cdf5;
} }
.summary .item.snapshot { .breadcrumbs .item.snapshot {
display: block; display: block;
} }