Skip to content

Commit 5e7cc45

Browse files
committed
overlay loading
1 parent dac31ed commit 5e7cc45

3 files changed

Lines changed: 45 additions & 19 deletions

File tree

src/.vuepress/components/Redirect.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ export default {
1818
await nextTick();
1919
2020
if (typeof window !== 'undefined') {
21-
console.log(props.to);
22-
console.log('window.location', window.location);
23-
2421
// Remove leading/trailing slashes and ensure proper joining
2522
const joinUrl = (base, path) => {
2623
const cleanBase = base.replace(/\/$/, '');

src/.vuepress/theme/Layout.vue

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div class="md-layout">
33
<AlgoliaTags :kuzzle-major="kuzzleMajor" />
4+
<div class="overlayLoading" v-if="isLoading" />
45
<div
56
class="overlay"
67
:class="{ hidden: !sidebarOpen }"
@@ -55,9 +56,14 @@
5556
<closed-sources-banner v-if="isClosedSourcesSection" />
5657
<article class="md-content__inner md-typeset">
5758
<Content />
58-
<hr class="solid">
59-
<div class="edit-link" style="color: #4e6e8e;">
60-
<a target="_blank" rel="noopener noreferrer" :href="getGithubLink()">Edit this page on Github</a>
59+
<hr class="solid" />
60+
<div class="edit-link" style="color: #4e6e8e">
61+
<a
62+
target="_blank"
63+
rel="noopener noreferrer"
64+
:href="getGithubLink()"
65+
>Edit this page on Github</a
66+
>
6167
<span class="sr-only">(opens new window)</span>
6268
</div>
6369
</article>
@@ -91,7 +97,7 @@ export default {
9197
DeprecatedBanner,
9298
Footer,
9399
MajorVersionDeprecation,
94-
ClosedSourcesBanner
100+
ClosedSourcesBanner,
95101
},
96102
setup() {
97103
return {
@@ -101,6 +107,7 @@ export default {
101107
},
102108
data() {
103109
return {
110+
isLoading: true,
104111
sidebarOpen: false,
105112
headerResizeObserver: undefined,
106113
removeRouterListener: undefined,
@@ -126,7 +133,7 @@ export default {
126133
},
127134
sdkList() {
128135
return this.page$.sectionList.filter(
129-
s =>
136+
(s) =>
130137
s.kuzzleMajor === this.kuzzleMajor &&
131138
(s.section === 'sdk' || s.subsection === 'api') &&
132139
s.released
@@ -154,17 +161,21 @@ export default {
154161
},
155162
},
156163
methods: {
157-
getGithubLink () {
164+
getGithubLink() {
158165
const fullPath = this.page$.fullPath;
159166
const base = fullPath.replace(this.page$.regularPath, '');
160167
const relativePath = fullPath.replace(base, '');
161-
const repository = repositories.find(repo => repo.deploy_path.startsWith(base));
168+
const repository = repositories.find((repo) =>
169+
repo.deploy_path.startsWith(base)
170+
);
162171
163-
if (! repository) {
172+
if (!repository) {
164173
return;
165174
}
166175
167-
const link = `${repository.url.replace('.git', '')}/blob/${repository.dev}/doc/${repository.doc_version}/${relativePath}index.md`;
176+
const link = `${repository.url.replace('.git', '')}/blob/${
177+
repository.dev
178+
}/doc/${repository.doc_version}/${relativePath}index.md`;
168179
169180
return link;
170181
},
@@ -180,8 +191,8 @@ export default {
180191
},
181192
setContainerPadding() {
182193
try {
183-
const padding = this.$refs.header.$el.querySelector('header')
184-
.offsetHeight;
194+
const padding =
195+
this.$refs.header.$el.querySelector('header').offsetHeight;
185196
186197
if (padding === null || typeof padding === 'undefined') {
187198
return;
@@ -213,8 +224,8 @@ export default {
213224
return;
214225
}
215226
216-
const topBoundary = this.$refs.header.$el.querySelector('header')
217-
.offsetHeight;
227+
const topBoundary =
228+
this.$refs.header.$el.querySelector('header').offsetHeight;
218229
219230
if (topBoundary === null || typeof topBoundary === 'undefined') {
220231
return;
@@ -235,7 +246,7 @@ export default {
235246
236247
this.$refs.sidebar.$el.style = `height: ${sidebarHeight}px`;
237248
this.$refs.toc.style = `height: ${sidebarHeight}px`;
238-
}
249+
},
239250
},
240251
mounted() {
241252
// fix scroll to anchor on chrome https://github.com/vuejs/vuepress/issues/2558
@@ -252,7 +263,9 @@ export default {
252263
this.headerResizeObserver = new ResizeObserver(
253264
this.computeContentHeight.bind(this)
254265
);
255-
this.headerResizeObserver.observe(this.$refs.header.$el.querySelector('header'));
266+
this.headerResizeObserver.observe(
267+
this.$refs.header.$el.querySelector('header')
268+
);
256269
257270
this.removeRouterListener = this.router$.afterEach(() => {
258271
this.$nextTick(() => {
@@ -261,13 +274,14 @@ export default {
261274
});
262275
263276
this.computeContentHeight();
277+
this.isLoading = false;
264278
},
265279
beforeUnmount() {
266280
window.removeEventListener('resize', this.computeContentHeight.bind(this));
267281
window.removeEventListener('scroll', this.computeSidebarHeight.bind(this));
268282
269283
this.headerResizeObserver.disconnect();
270284
this.removeRouterListener?.();
271-
}
285+
},
272286
};
273287
</script>

src/.vuepress/theme/styles/layout/_sidebar.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,21 @@ $md-toggle__drawer--checked: '[data-md-toggle="drawer"]:checked ~ .md-container'
187187
}
188188
}
189189

190+
.overlayLoading {
191+
width: 100%;
192+
height: 100%;
193+
position: fixed;
194+
background-color: rgb(255, 255, 255);
195+
opacity: 1;
196+
z-index: 10;
197+
overflow: hidden;
198+
cursor: pointer;
199+
200+
&.hidden {
201+
display: none;
202+
}
203+
}
204+
190205
.noscroll {
191206
overflow: hidden;
192207
}

0 commit comments

Comments
 (0)