blob: 4f2426324cb60449000e0bfe96e6291bad4c7c68 [file] [log] [blame]
Derick Montaguee080a1a2019-12-04 16:30:08 -06001<template>
Yoshie Muranaka74f86872020-02-10 12:28:37 -08002 <div class="app-container">
kennyneedsmilky14172d72021-11-10 15:26:07 -06003 <app-header
4 ref="focusTarget"
5 class="app-header"
6 :router-key="routerKey"
7 @refresh="refresh"
8 />
Yoshie Muranaka74f86872020-02-10 12:28:37 -08009 <app-navigation class="app-navigation" />
10 <page-container class="app-content">
11 <router-view ref="routerView" :key="routerKey" />
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060012 <!-- Scroll to top button -->
13 <button-back-to-top />
Yoshie Muranaka74f86872020-02-10 12:28:37 -080014 </page-container>
Derick Montaguee080a1a2019-12-04 16:30:08 -060015 </div>
16</template>
17
18<script>
Derick Montaguee2fd1562019-12-20 13:26:53 -060019import AppHeader from '@/components/AppHeader';
20import AppNavigation from '@/components/AppNavigation';
SurenNeware61859092020-10-01 09:37:32 +053021import PageContainer from '@/components/Global/PageContainer';
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060022import ButtonBackToTop from '@/components/Global/ButtonBackToTop';
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050023import JumpLinkMixin from '@/components/Mixins/JumpLinkMixin';
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060024
Derick Montaguee080a1a2019-12-04 16:30:08 -060025export default {
Derick Montaguee2fd1562019-12-20 13:26:53 -060026 name: 'App',
Derick Montaguee080a1a2019-12-04 16:30:08 -060027 components: {
28 AppHeader,
Yoshie Muranaka8d129102019-12-19 09:51:55 -080029 AppNavigation,
Derick Montague602e98a2020-10-21 16:20:00 -050030 PageContainer,
Dixsie Wolmers970ea7d2020-11-16 16:46:01 -060031 ButtonBackToTop,
Derick Montague75b48322019-12-06 01:24:41 -060032 },
Dixsie Wolmersdc6b3cd2021-05-20 19:01:42 -050033 mixins: [JumpLinkMixin],
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080034 data() {
35 return {
Derick Montague602e98a2020-10-21 16:20:00 -050036 routerKey: 0,
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080037 };
38 },
Derick Montague75b48322019-12-06 01:24:41 -060039 watch: {
Derick Montague602e98a2020-10-21 16:20:00 -050040 $route: function () {
Derick Montague602e98a2020-10-21 16:20:00 -050041 this.$nextTick(function () {
Derick Montague80267972021-02-16 09:47:03 -060042 this.setFocus(this.$refs.focusTarget.$el);
Derick Montague75b48322019-12-06 01:24:41 -060043 });
Derick Montague602e98a2020-10-21 16:20:00 -050044 },
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080045 },
Yoshie Muranaka6f712842021-02-04 11:23:03 -080046 mounted() {
47 this.$root.$on('refresh-application', () => this.refresh());
BlueSnake00248d5bc2024-02-01 16:55:54 +030048 setInterval(() => {
49 if (!localStorage.getItem('storedUsername')) {
Ed Tanous883a0d52024-03-23 14:56:34 -070050 this.$eventBus.$consoleWindow?.close();
BlueSnake00248d5bc2024-02-01 16:55:54 +030051 this.refresh();
52 }
53 }, 10000);
Yoshie Muranaka6f712842021-02-04 11:23:03 -080054 },
Yoshie Muranakaeb154bb2020-02-07 12:18:45 -080055 methods: {
56 refresh() {
57 // Changing the component :key value will trigger
58 // a component re-rendering and 'refresh' the view
59 this.routerKey += 1;
Derick Montague602e98a2020-10-21 16:20:00 -050060 },
61 },
Derick Montaguee080a1a2019-12-04 16:30:08 -060062};
63</script>
64
65<style lang="scss" scoped>
Ed Tanous7d6b44c2024-03-23 14:56:34 -070066@import '@/assets/styles/bmc/helpers/_index.scss';
67@import '@/assets/styles/bootstrap/_helpers.scss';
68
Yoshie Muranaka74f86872020-02-10 12:28:37 -080069.app-container {
70 display: grid;
71 grid-template-columns: 100%;
72 grid-template-rows: auto;
73 grid-template-areas:
74 'header'
75 'content';
76
77 @include media-breakpoint-up($responsive-layout-bp) {
78 grid-template-columns: $navigation-width 1fr;
79 grid-template-areas:
80 'header header'
81 'navigation content';
82 }
83}
84
85.app-header {
86 grid-area: header;
87 position: sticky;
88 top: 0;
89 z-index: $zindex-fixed + 1;
90}
91
92.app-navigation {
93 grid-area: navigation;
94}
95
96.app-content {
97 grid-area: content;
98 background-color: $white;
Derick Montaguee080a1a2019-12-04 16:30:08 -060099}
100</style>