Skip to content

Commit 91cf74a

Browse files
committed
Make final pywb 2.7 UI tweaks
- Remove redundant icon title - Fix display date in TimelineLinear tooltip - Adjust calendar spacing, add border and shadow - Remove tooltip scroll - Auto-size calendar to contents - Make display date consistent across browsers - Render calendar for all months regardless of captures - Fix weekday labels to avoid off-by-one - Grey out calendar days without captures
1 parent 373eca6 commit 91cf74a

File tree

7 files changed

+139
-173
lines changed

7 files changed

+139
-173
lines changed

pywb/static/vue/vueui.js

Lines changed: 99 additions & 140 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pywb/vueui/src/App.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
:aria-pressed="(showFullView ? true : false)"
6262
@click="showFullView = !showFullView"
6363
:title="(showFullView ? _('Hide calendar') : _('Show calendar'))">
64-
<i class="far fa-calendar-alt" :title="_('Calendar')"></i>
64+
<i class="far fa-calendar-alt"></i>
6565
</button>
6666
</li>
6767
<li class="nav-item">
@@ -71,7 +71,7 @@
7171
:aria-pressed="showTimelineView"
7272
@click="showTimelineView = !showTimelineView"
7373
:title="(showTimelineView ? _('Hide timeline') : _('Show timeline'))">
74-
<i class="far fa-chart-bar" :title="_('Timeline')"></i>
74+
<i class="far fa-chart-bar"></i>
7575
</button>
7676
</li>
7777
<li class="nav-item dropdown" v-if="localesAreSet">
@@ -142,8 +142,8 @@
142142
</div>
143143

144144
<!-- Calendar -->
145-
<div class="card border-0" v-if="currentPeriod && showFullView && currentPeriod.children.length">
146-
<div class="card-body">
145+
<div class="card" v-if="currentPeriod && showFullView && currentPeriod.children.length">
146+
<div class="card-body" id="calendar-card-body">
147147
<CalendarYear
148148
:period="currentPeriod"
149149
:current-snapshot="currentSnapshot"
@@ -453,6 +453,9 @@ export default {
453453
align-items: center;
454454
justify-content: center;
455455
}
456+
#calendar-card-body {
457+
padding: 0;
458+
}
456459
.strong {
457460
font-weight: bold;
458461
}

pywb/vueui/src/components/CalendarMonth.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
7979
color: black;
8080
}
81+
.calendar-month .day .day-id.empty {
82+
color: #454545 !important;
83+
}
8184
.calendar-month .day:hover .size {
8285
border: 1px solid black;
8386
}
@@ -92,11 +95,8 @@
9295
<template>
9396
<div class="calendar-month" :class="{current: isCurrent, 'contains-current-snapshot': containsCurrentSnapshot}">
9497
<h3>{{getLongMonthName(month.id)}} <span v-if="month.snapshotCount">({{ month.snapshotCount }})</span></h3>
95-
<div v-if="month.snapshotCount">
96-
<span v-for="(dayInitial) in dayInitials" class="day" :style="dayStyle">{{dayInitial}}</span><br/>
97-
<span v-for="(day,i) in days"><br v-if="i && i % 7===0"/><span class="day" :class="{empty: !day || !day.snapshotCount, 'contains-current-snapshot':dayContainsCurrentSnapshot(day)}" :style="dayStyle" @click="gotoDay(day, $event)" @keyup.13="gotoDay(day, $event)"><template v-if="day"><span class="size" v-if="day.snapshotCount" :style="getDayCountCircleStyle(day.snapshotCount)" tabindex="0"> </span><span class="day-id">{{day.id}}</span><span v-if="day.snapshotCount" class="count">{{ $root._(day.snapshotCount !== 1 ? '{count} captures':'{count} capture', {count: day.snapshotCount}) }}</span></template><template v-else v-html="'&nbsp;'"></template></span></span>
98-
</div>
99-
<div v-else class="empty">{{ _('no captures') }}</div>
98+
<span v-for="(dayInitial) in dayInitials" class="day" :style="dayStyle">{{dayInitial}}</span><br/>
99+
<span v-for="(day,i) in days"><br v-if="i && i % 7===0"/><span class="day" :class="{empty: !day || !day.snapshotCount, 'contains-current-snapshot':dayContainsCurrentSnapshot(day)}" :style="dayStyle" @click="gotoDay(day, $event)" @keyup.13="gotoDay(day, $event)"><template v-if="day"><span class="size" v-if="day.snapshotCount" :style="getDayCountCircleStyle(day.snapshotCount)" tabindex="0"> </span><span class="day-id" :class="{empty: !day.snapshotCount}">{{day.id}}</span><span v-if="day.snapshotCount" class="count">{{ $root._(day.snapshotCount !== 1 ? '{count} captures':'{count} capture', {count: day.snapshotCount}) }}</span></template><template v-else v-html="'&nbsp;'"></template></span></span>
100100
</div>
101101
</template>
102102

@@ -120,7 +120,7 @@ export default {
120120
return `height: ${s}px; width: ${s}px; line-height: ${s}px`;
121121
},
122122
days() {
123-
if (!this.month || !this.month.snapshotCount) {
123+
if (!this.month) {
124124
return [];
125125
}
126126
const days = [];

pywb/vueui/src/components/CalendarYear.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="full-view">
2+
<div class="full-view border-top-0 border-left-0 border-right-0 border-bottom border-dark shadow">
33
<h2>
44
<i
55
class="fas fa-arrow-left year-arrow"
@@ -159,12 +159,15 @@ export default {
159159

160160
<style scoped>
161161
.full-view {
162-
position: fixed;
162+
display: flex;
163+
flex: 1;
164+
flex-wrap: wrap;
163165
z-index: 10;
164-
height: 80vh;
165-
overflow: scroll;
166+
overflow-y: scroll;
166167
width: 100%;
167168
background-color: white;
169+
padding-bottom: 1em;
170+
justify-content: center;
168171
}
169172
.full-view .months {
170173
display: flex;

pywb/vueui/src/components/TimelineLinear.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="timeline-linear">
33
<div class="title">
4-
<div>{{ period.getFullReadableId() }}</div>
4+
<div>{{ displayDate }}</div>
55
<div>{{ $root._(period.snapshotCount !== 1 ? '{count} captures':'{count} capture', {count: period.snapshotCount}) }}</div>
66
</div>
77

@@ -21,6 +21,8 @@
2121
</template>
2222

2323
<script>
24+
import { PywbI18N } from "../i18n";
25+
2426
export default {
2527
name: "TimelineLinear",
2628
props: ['period', 'currentSnapshot'],
@@ -31,6 +33,11 @@ export default {
3133
containsCurrentSnapshot() {
3234
return this.currentSnapshot &&
3335
this.period.contains(this.currentSnapshot);
36+
},
37+
displayDate() {
38+
// replace '-' in date string with '/' so firefox and chrome will return same result
39+
let dateStringNoSlashes = this.period.fullId.replace(/-/g,'/');
40+
return new Date(dateStringNoSlashes).toLocaleDateString(PywbI18N.getLocale());
3441
}
3542
},
3643
methods: {
@@ -59,7 +66,8 @@ export default {
5966
.timeline-linear .list {
6067
max-height: 80vh;
6168
min-height: 50px;
62-
overflow: scroll;
69+
overflow-x: hidden;
70+
overflow-y: auto;
6371
}
6472
.timeline-linear .title {
6573
border-bottom: 1px solid black;

pywb/vueui/src/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class PywbI18N {
3636
return decodeURIComponent(this.config[id+'_'+type])
3737
}
3838
getWeekDays(type='long') {
39-
return ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'].map(d => this.getWeekDay(d, type));
39+
return ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'].map(d => this.getWeekDay(d, type));
4040
}
4141
getText(id, embeddedVariableStrings=null) {
4242
const translated = decodeURIComponent(this.config[id] || id);

pywb/vueui/src/model.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ PywbPeriod.prototype.getChildrenRange = function() {
278278
}
279279
return null;
280280
};
281-
PywbPeriod.prototype.fillEmptyGrancChildPeriods = function() {
281+
PywbPeriod.prototype.fillEmptyGrandChildPeriods = function() {
282282
if (this.hasFilledEmptyGrandchildPeriods) {
283283
return;
284284
}
@@ -289,19 +289,10 @@ PywbPeriod.prototype.fillEmptyGrancChildPeriods = function() {
289289
};
290290

291291
PywbPeriod.prototype.fillEmptyChildPeriods = function(isFillEmptyGrandChildrenPeriods=false) {
292-
if (this.snapshotCount === 0 || this.type > PywbPeriod.Type.day) {
292+
if (this.type > PywbPeriod.Type.day) {
293293
return;
294294
}
295295

296-
if (isFillEmptyGrandChildrenPeriods) {
297-
this.fillEmptyGrancChildPeriods();
298-
}
299-
300-
if (this.hasFilledEmptyChildPeriods) {
301-
return;
302-
}
303-
this.hasFilledEmptyChildPeriods = true;
304-
305296
const idRange = this.getChildrenRange();
306297
if (!idRange) {
307298
return;
@@ -321,15 +312,13 @@ PywbPeriod.prototype.fillEmptyChildPeriods = function(isFillEmptyGrandChildrenPe
321312
// insert new after existing
322313
this.children.splice(i+1, 0, empty);
323314
}
324-
// manually push children (no need to reverse link parent
325-
//empty.parent = this;
315+
empty.parent = this;
316+
empty.initFullId();
326317
}
327318
i++;
328319
} else {
329320
const empty = new PywbPeriod({type: this.type + 1, id: newId});
330-
this.children.push(empty);
331-
// manually push children (no need to reverse link parent
332-
//empty.parent = this;
321+
let result = this.addChild(empty);
333322
}
334323
}
335324

@@ -338,6 +327,10 @@ PywbPeriod.prototype.fillEmptyChildPeriods = function(isFillEmptyGrandChildrenPe
338327
this.childrenIds[this.children[i].id] = i;
339328
}
340329

330+
if (isFillEmptyGrandChildrenPeriods) {
331+
this.fillEmptyGrandChildPeriods();
332+
}
333+
341334
return idRange;
342335
};
343336

0 commit comments

Comments
 (0)