Skip to content

Commit b69799b

Browse files
committed
Add shared ViewerToolbar and integrate across all viewers
1 parent e6ef480 commit b69799b

11 files changed

Lines changed: 512 additions & 301 deletions

File tree

kolibri/plugins/bloompub_viewer/frontend/views/BloomPubRendererIndex.vue

Lines changed: 30 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,11 @@
66
:style="{ width: iframeWidth }"
77
@changeFullscreen="isInFullscreen = $event"
88
>
9-
<div
10-
class="fullscreen-header"
11-
:style="{ backgroundColor: $themePalette.grey.v_200 }"
12-
>
13-
<KButton
14-
:primary="false"
15-
appearance="flat-button"
16-
@click="$refs.bloompubViewer.toggleFullscreen()"
17-
>
18-
<KIcon
19-
v-if="isInFullscreen"
20-
icon="fullscreen_exit"
21-
class="fs-icon"
22-
/>
23-
<KIcon
24-
v-else
25-
icon="fullscreen"
26-
class="fs-icon"
27-
/>
28-
{{ fullscreenText }}
29-
</KButton>
30-
</div>
9+
<ViewerToolbar
10+
:isInFullscreen="isInFullscreen"
11+
:embedded="embedded"
12+
@toggleFullscreen="$refs.bloompubViewer.toggleFullscreen()"
13+
/>
3114
<div
3215
class="iframe-container"
3316
:style="containerStyle"
@@ -58,26 +41,45 @@
5841
import urls from 'kolibri/urls';
5942
import { now } from 'kolibri/utils/serverClock';
6043
import CoreFullscreen from 'kolibri-common/components/CoreFullscreen';
44+
import ViewerToolbar from 'kolibri-common/components/ViewerToolbar';
6145
import Sandbox from 'kolibri-sandbox';
46+
6247
import useContentViewer from 'kolibri/composables/useContentViewer';
6348
6449
const defaultContentHeight = '500px';
65-
const frameTopbarHeight = '37px';
50+
const frameTopbarHeight = '48px';
6651
export default {
6752
name: 'BloomPubRendererIndex',
6853
components: {
6954
CoreFullscreen,
55+
ViewerToolbar,
7056
},
7157
setup(props, context) {
72-
const { defaultFile, options, forceDurationBasedProgress, reportError } = useContentViewer(
73-
context,
74-
{ defaultDuration: 300 },
75-
);
58+
const {
59+
defaultFile,
60+
options,
61+
lang,
62+
forceDurationBasedProgress,
63+
reportError,
64+
embedded,
65+
extraFields,
66+
timeSpent,
67+
userId,
68+
userFullName,
69+
progress,
70+
} = useContentViewer(context, { defaultDuration: 300 });
7671
return {
7772
defaultFile,
7873
options,
74+
lang,
7975
forceDurationBasedProgress,
8076
reportError,
77+
embedded,
78+
extraFields,
79+
timeSpent,
80+
userId,
81+
userFullName,
82+
progress,
8183
};
8284
},
8385
data() {
@@ -94,9 +96,6 @@
9496
iframeWidth() {
9597
return (this.options && this.options.width) || 'auto';
9698
},
97-
fullscreenText() {
98-
return this.isInFullscreen ? this.$tr('exitFullscreen') : this.$tr('enterFullscreen');
99-
},
10099
userData() {
101100
return {
102101
userId: this.userId,
@@ -161,18 +160,6 @@
161160
}
162161
this.$emit('stopTracking');
163162
},
164-
$trs: {
165-
exitFullscreen: {
166-
message: 'Exit fullscreen',
167-
context:
168-
"Learners can use the Esc key or the 'exit fullscreen' button to close the fullscreen view on an html5 app.",
169-
},
170-
enterFullscreen: {
171-
message: 'Enter fullscreen',
172-
context:
173-
'Learners can use the full screen button in the upper right corner to open an html5 app in fullscreen view.\n',
174-
},
175-
},
176163
};
177164
178165
</script>
@@ -181,18 +168,7 @@
181168
<style lang="scss" scoped>
182169
183170
@import '~kolibri-design-system/lib/styles/definitions';
184-
$frame-topbar-height: 37px;
185-
186-
.fullscreen-header {
187-
text-align: right;
188-
}
189-
190-
.fs-icon {
191-
position: relative;
192-
top: 8px;
193-
width: 24px;
194-
height: 24px;
195-
}
171+
$frame-topbar-height: 48px;
196172
197173
.bloompub-viewer {
198174
position: relative;

0 commit comments

Comments
 (0)