This commit is contained in:
Tamius Han 2020-12-03 01:35:22 +01:00
parent 7900bd18db
commit 4ed998a9ab
3 changed files with 36 additions and 9 deletions

View File

@ -41,6 +41,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex';
import Icon from '../common/components/Icon'; import Icon from '../common/components/Icon';
export default { export default {

View File

@ -1,6 +1,11 @@
import UI from './UI'; import UI from './UI';
import VuexWebExtensions from 'vuex-webextensions'; import VuexWebExtensions from 'vuex-webextensions';
import VideoNotification from '../../../csui/NotificationUi'; import NotificationUi from '../../../csui/NotificationUi.vue';
if (process.env.CHANNEL !== 'stable'){
console.info("Loading: PlayerNotificationUi");
}
class PlayerNotificationUi extends UI { class PlayerNotificationUi extends UI {
@ -9,16 +14,16 @@ class PlayerNotificationUi extends UI {
) { ) {
super( super(
'notification', 'notification',
getStoreConfig(), PlayerNotificationUi.getStoreConfig(),
getUiConfig(playerElement), PlayerNotificationUi.getUiConfig(playerElement),
getCommsConfig() PlayerNotificationUi.getCommsConfig()
) )
} }
//#region constructor helpers //#region constructor helpers
// we will move some things out of the constructor in order to keep things clean // we will move some things out of the constructor in order to keep things clean
getStoreConfig() { static getStoreConfig() {
return { return {
plugins: [ plugins: [
VuexWebExtensions({ VuexWebExtensions({
@ -48,14 +53,14 @@ class PlayerNotificationUi extends UI {
}; };
} }
getUiConfig(playerElement) { static getUiConfig(playerElement) {
return { return {
parentElement: playerElement, parentElement: playerElement,
component: VideoNotification component: NotificationUi
} }
} }
getCommsConfig() { static getCommsConfig() {
return { return {
handlers: { handlers: {
'show-notification': [(message) => this.showNotification(message)], 'show-notification': [(message) => this.showNotification(message)],
@ -94,4 +99,9 @@ class PlayerNotificationUi extends UI {
} }
} }
if (process.env.CHANNEL !== 'stable'){
console.info("PlayerNotificationUi loaded");
}
export default PlayerNotificationUi; export default PlayerNotificationUi;

View File

@ -1,6 +1,11 @@
import { createApp } from 'vue'; import { createApp } from 'vue';
import { createStore } from 'vuex'; import { createStore } from 'vuex';
if (process.env.CHANNEL !== 'stable'){
console.info("Loading: UI");
}
class UI { class UI {
constructor( constructor(
interfaceId, interfaceId,
@ -10,6 +15,10 @@ class UI {
) { ) {
this.interfaceId = interfaceId; this.interfaceId = interfaceId;
this.commsConfig = commsConfig; this.commsConfig = commsConfig;
this.storeConfig = storeConfig,
this.uiConfig = uiConfig;
this.init();
} }
async init() { async init() {
@ -34,11 +43,13 @@ class UI {
async initVue() { async initVue() {
this.vuexStore = createStore(this.storeConfig); this.vuexStore = createStore(this.storeConfig);
this.initUi();
} }
async initUi() { async initUi() {
const random = Math.round(Math.random() * 69420); const random = Math.round(Math.random() * 69420);
const uwid = `uw-${this.interfaceId}-root-${random}` // const uwid = `uw-${this.interfaceId}-root-${random}`
const uwid = 'not-so-random-id'
const rootDiv = document.createElement('div'); const rootDiv = document.createElement('div');
rootDiv.setAttribute('style', `position: ${uiConfig.style?.position ?? 'relative'}; width: ${uiConfig.style?.width ?? '100%'}; height: ${uiConfig.style?.height ?? '100%'}; ${uiConfig.additionalStyle}`); rootDiv.setAttribute('style', `position: ${uiConfig.style?.position ?? 'relative'}; width: ${uiConfig.style?.width ?? '100%'}; height: ${uiConfig.style?.height ?? '100%'}; ${uiConfig.additionalStyle}`);
@ -73,4 +84,9 @@ class UI {
} }
} }
if (process.env.CHANNEL !== 'stable'){
console.info("UI.js loaded");
}
export default UI; export default UI;