Adds widget compatibility into workspace view

This commit is contained in:
Alicia Sykes 2022-01-20 05:41:29 +00:00
parent 7b7c427c97
commit 63904366ce
3 changed files with 55 additions and 1 deletions

View File

@ -55,6 +55,7 @@ export default {
/* Toggles the section clicked, and closes all other sections */ /* Toggles the section clicked, and closes all other sections */
openSection(index) { openSection(index) {
this.isOpen = this.isOpen.map((val, ind) => (ind !== index ? false : !val)); this.isOpen = this.isOpen.map((val, ind) => (ind !== index ? false : !val));
if (this.sections[index].widgets) this.$emit('launch-widget', this.sections[index].widgets);
}, },
/* When item clicked, emit a launch event */ /* When item clicked, emit a launch event */
launchApp(options) { launchApp(options) {

View File

@ -0,0 +1,39 @@
<template>
<div class="workspace-widget-view" v-if="widgets">
<WidgetBase
v-for="(widget, widgetIndx) in widgets"
:key="widgetIndx"
:widget="widget"
:index="widgetIndx"
class="workspace-widget"
/>
</div>
</template>
<script>
import WidgetBase from '@/components/Widgets/WidgetBase';
export default {
components: {
WidgetBase,
},
props: {
widgets: Array,
},
};
</script>
<style lang="scss" scoped>
.workspace-widget-view {
padding: 1rem 0;
background: var(--background);
position: absolute;
left: var(--side-bar-width);
height: calc(100% - var(--header-height) - 1rem);
width: calc(100% - var(--side-bar-width));
.workspace-widget {
max-width: 800px;
margin: 0 auto;
}
}
</style>

View File

@ -1,8 +1,14 @@
<template> <template>
<div class="work-space"> <div class="work-space">
<SideBar :sections="sections" @launch-app="launchApp" :initUrl="getInitialUrl()" /> <SideBar
:sections="sections"
@launch-app="launchApp"
@launch-widget="launchWidget"
:initUrl="getInitialUrl()"
/>
<WebContent :url="url" v-if="!isMultiTaskingEnabled" /> <WebContent :url="url" v-if="!isMultiTaskingEnabled" />
<MultiTaskingWebComtent :url="url" v-else /> <MultiTaskingWebComtent :url="url" v-else />
<WidgetView :widgets="widgets" v-if="widgets" />
</div> </div>
</template> </template>
@ -10,6 +16,7 @@
import HomeMixin from '@/mixins/HomeMixin'; import HomeMixin from '@/mixins/HomeMixin';
import SideBar from '@/components/Workspace/SideBar'; import SideBar from '@/components/Workspace/SideBar';
import WebContent from '@/components/Workspace/WebContent'; import WebContent from '@/components/Workspace/WebContent';
import WidgetView from '@/components/Workspace/WidgetView';
import MultiTaskingWebComtent from '@/components/Workspace/MultiTaskingWebComtent'; import MultiTaskingWebComtent from '@/components/Workspace/MultiTaskingWebComtent';
import Defaults from '@/utils/defaults'; import Defaults from '@/utils/defaults';
import { GetTheme, ApplyLocalTheme, ApplyCustomVariables } from '@/utils/ThemeHelper'; import { GetTheme, ApplyLocalTheme, ApplyCustomVariables } from '@/utils/ThemeHelper';
@ -19,6 +26,7 @@ export default {
mixins: [HomeMixin], mixins: [HomeMixin],
data: () => ({ data: () => ({
url: '', url: '',
widgets: null,
GetTheme, GetTheme,
ApplyLocalTheme, ApplyLocalTheme,
ApplyCustomVariables, ApplyCustomVariables,
@ -37,6 +45,7 @@ export default {
components: { components: {
SideBar, SideBar,
WebContent, WebContent,
WidgetView,
MultiTaskingWebComtent, MultiTaskingWebComtent,
}, },
methods: { methods: {
@ -46,6 +55,11 @@ export default {
} else { } else {
this.url = options.url; this.url = options.url;
} }
this.widgets = null;
},
launchWidget(widgets) {
this.url = '';
this.widgets = widgets;
}, },
setTheme() { setTheme() {
const theme = this.GetTheme(); const theme = this.GetTheme();