2020-06-24 20:54:36 +00:00
|
|
|
<template>
|
2020-09-15 16:11:29 +00:00
|
|
|
<aside id="sidebar" role="navigation">
|
2020-08-31 21:07:52 +00:00
|
|
|
<router-link
|
|
|
|
tag="span"
|
2020-08-31 20:14:14 +00:00
|
|
|
id="main_home_tablink"
|
|
|
|
class="main_tablinks"
|
|
|
|
:class="{ active: activeTablink === 'home' }"
|
|
|
|
role="link"
|
|
|
|
aria-label="home"
|
2020-08-31 21:07:52 +00:00
|
|
|
:to="{ name: 'Home' }"
|
|
|
|
@click.native="activeTablink = 'home'"
|
2020-08-31 20:14:14 +00:00
|
|
|
>
|
2020-06-24 20:54:36 +00:00
|
|
|
<i class="material-icons side_icon">home</i>
|
2020-07-18 20:44:27 +00:00
|
|
|
<span class="main_tablinks_text">{{ $t('sidebar.home') }}</span>
|
2020-08-31 21:07:52 +00:00
|
|
|
</router-link>
|
|
|
|
<router-link
|
|
|
|
tag="span"
|
2020-08-31 20:14:14 +00:00
|
|
|
id="main_search_tablink"
|
|
|
|
class="main_tablinks"
|
|
|
|
:class="{ active: activeTablink === 'search' }"
|
|
|
|
role="link"
|
|
|
|
aria-label="search"
|
2020-08-31 21:07:52 +00:00
|
|
|
:to="{ name: 'Search' }"
|
|
|
|
@click.native="activeTablink = 'search'"
|
2020-08-31 20:14:14 +00:00
|
|
|
>
|
2020-06-24 20:54:36 +00:00
|
|
|
<i class="material-icons side_icon">search</i>
|
2020-07-18 20:44:27 +00:00
|
|
|
<span class="main_tablinks_text">{{ $t('sidebar.search') }}</span>
|
2020-08-31 21:07:52 +00:00
|
|
|
</router-link>
|
|
|
|
<router-link
|
|
|
|
tag="span"
|
2020-08-31 20:14:14 +00:00
|
|
|
id="main_charts_tablink"
|
|
|
|
class="main_tablinks"
|
|
|
|
:class="{ active: activeTablink === 'charts' }"
|
|
|
|
role="link"
|
|
|
|
aria-label="charts"
|
2020-08-31 21:07:52 +00:00
|
|
|
:to="{ name: 'Charts' }"
|
|
|
|
@click.native="activeTablink = 'charts'"
|
2020-08-31 20:14:14 +00:00
|
|
|
>
|
2020-08-13 20:39:46 +00:00
|
|
|
<i class="material-icons side_icon">show_chart</i>
|
2020-07-18 20:44:27 +00:00
|
|
|
<span class="main_tablinks_text">{{ $t('sidebar.charts') }}</span>
|
2020-08-31 21:07:52 +00:00
|
|
|
</router-link>
|
|
|
|
<router-link
|
|
|
|
tag="span"
|
2020-08-31 20:14:14 +00:00
|
|
|
id="main_favorites_tablink"
|
|
|
|
class="main_tablinks"
|
|
|
|
:class="{ active: activeTablink === 'favorites' }"
|
|
|
|
role="link"
|
|
|
|
aria-label="favorites"
|
2020-08-31 21:07:52 +00:00
|
|
|
:to="{ name: 'Favorites' }"
|
|
|
|
@click.native="activeTablink = 'favorites'"
|
2020-08-31 20:14:14 +00:00
|
|
|
>
|
2020-08-13 20:39:46 +00:00
|
|
|
<i class="material-icons side_icon">star</i>
|
2020-07-18 20:44:27 +00:00
|
|
|
<span class="main_tablinks_text">{{ $t('sidebar.favorites') }}</span>
|
2020-08-31 21:07:52 +00:00
|
|
|
</router-link>
|
|
|
|
<router-link
|
|
|
|
tag="span"
|
2020-08-31 20:14:14 +00:00
|
|
|
id="main_analyzer_tablink"
|
|
|
|
class="main_tablinks"
|
|
|
|
:class="{ active: activeTablink === 'analyzer' }"
|
|
|
|
role="link"
|
|
|
|
aria-label="link analyzer"
|
2020-08-31 21:07:52 +00:00
|
|
|
:to="{ name: 'Link Analyzer' }"
|
|
|
|
@click.native="activeTablink = 'analyzer'"
|
2020-08-31 20:14:14 +00:00
|
|
|
>
|
2020-06-24 20:54:36 +00:00
|
|
|
<i class="material-icons side_icon">link</i>
|
2020-07-18 20:44:27 +00:00
|
|
|
<span class="main_tablinks_text">{{ $t('sidebar.linkAnalyzer') }}</span>
|
2020-08-31 21:07:52 +00:00
|
|
|
</router-link>
|
|
|
|
<router-link
|
|
|
|
tag="span"
|
2020-08-31 20:14:14 +00:00
|
|
|
id="main_settings_tablink"
|
|
|
|
class="main_tablinks"
|
|
|
|
:class="{ active: activeTablink === 'settings' }"
|
|
|
|
role="link"
|
|
|
|
aria-label="settings"
|
2020-08-31 21:07:52 +00:00
|
|
|
:to="{ name: 'Settings' }"
|
|
|
|
@click.native="activeTablink = 'settings'"
|
2020-08-31 20:14:14 +00:00
|
|
|
>
|
2020-06-24 20:54:36 +00:00
|
|
|
<i class="material-icons side_icon">settings</i>
|
2020-07-18 20:44:27 +00:00
|
|
|
<span class="main_tablinks_text">{{ $t('sidebar.settings') }}</span>
|
2020-08-31 21:07:52 +00:00
|
|
|
</router-link>
|
|
|
|
<router-link
|
|
|
|
tag="span"
|
2020-08-31 20:14:14 +00:00
|
|
|
id="main_about_tablink"
|
|
|
|
class="main_tablinks"
|
|
|
|
:class="{ active: activeTablink === 'about' }"
|
|
|
|
role="link"
|
|
|
|
aria-label="info"
|
2020-08-31 21:07:52 +00:00
|
|
|
:to="{ name: 'About' }"
|
|
|
|
@click.native="activeTablink = 'about'"
|
2020-08-31 20:14:14 +00:00
|
|
|
>
|
2020-06-24 20:54:36 +00:00
|
|
|
<i class="material-icons side_icon">info</i>
|
2020-07-18 20:44:27 +00:00
|
|
|
<span class="main_tablinks_text">{{ $t('sidebar.about') }}</span>
|
2020-08-31 21:07:52 +00:00
|
|
|
</router-link>
|
2020-06-24 20:54:36 +00:00
|
|
|
<span id="theme_selector" class="main_tablinks" role="link" aria-label="theme selector">
|
|
|
|
<i class="material-icons side_icon side_icon--theme">palette</i>
|
|
|
|
<div id="theme_togglers">
|
2020-07-06 17:02:03 +00:00
|
|
|
<div
|
2020-07-18 20:44:27 +00:00
|
|
|
v-for="theme of themes"
|
|
|
|
:key="theme"
|
2020-07-28 20:09:13 +00:00
|
|
|
class="theme_toggler"
|
2020-07-18 20:44:27 +00:00
|
|
|
:class="[{ 'theme_toggler--active': activeTheme === theme }, `theme_toggler--${theme}`]"
|
|
|
|
@click="changeTheme(theme)"
|
|
|
|
></div>
|
2020-06-24 20:54:36 +00:00
|
|
|
</div>
|
|
|
|
</span>
|
2020-06-29 16:10:55 +00:00
|
|
|
<div id="network-status" :class="{ online: appOnline, offline: !appOnline }">
|
|
|
|
<i v-if="appOnline" class="material-icons">wifi</i>
|
|
|
|
<i v-else class="material-icons">
|
2020-06-29 16:49:33 +00:00
|
|
|
<!-- wifi_off icon not working, maybe need to include it? -->
|
2020-06-29 16:10:55 +00:00
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
|
|
<path d="M24 .01c0-.01 0-.01 0 0L0 0v24h24V.01zM0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none" />
|
|
|
|
<path
|
|
|
|
d="M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7l2-2zm-4 4c-1.29-1.29-2.84-2.13-4.49-2.56l3.53 3.53.96-.97zM2 3.05L5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24C7.81 10.89 6.27 11.73 5 13v.01L6.99 15c1.36-1.36 3.14-2.04 4.92-2.06L18.98 20l1.27-1.26L3.29 1.79 2 3.05zM9 17l3 3 3-3c-1.65-1.66-4.34-1.66-6 0z"
|
|
|
|
/>
|
|
|
|
</svg>
|
|
|
|
</i>
|
|
|
|
</div>
|
2020-06-24 20:54:36 +00:00
|
|
|
</aside>
|
|
|
|
</template>
|
|
|
|
|
2020-07-07 20:04:26 +00:00
|
|
|
<style scoped>
|
|
|
|
#network-status {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
position: relative;
|
|
|
|
margin-top: auto;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#network-status.online i.material-icons {
|
|
|
|
color: hsl(151, 100%, 31%);
|
|
|
|
}
|
|
|
|
|
|
|
|
#network-status.offline i.material-icons svg {
|
|
|
|
fill: red;
|
|
|
|
width: 1em;
|
|
|
|
height: 1em;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2020-06-24 20:54:36 +00:00
|
|
|
<script>
|
2020-07-16 22:11:28 +00:00
|
|
|
import { changeTab } from '@js/tabs.js'
|
2020-07-07 20:04:26 +00:00
|
|
|
|
2020-06-24 20:54:36 +00:00
|
|
|
export default {
|
|
|
|
name: 'the-sidebar',
|
2020-07-18 20:44:27 +00:00
|
|
|
data: () => ({
|
|
|
|
appOnline: null,
|
|
|
|
activeTheme: 'light',
|
2020-08-31 20:14:14 +00:00
|
|
|
themes: ['purple', 'dark', 'light'],
|
|
|
|
activeTablink: 'home'
|
2020-07-18 20:44:27 +00:00
|
|
|
}),
|
2020-06-29 16:10:55 +00:00
|
|
|
mounted() {
|
2020-07-06 17:02:03 +00:00
|
|
|
/* === Online status handling === */
|
2020-06-29 16:10:55 +00:00
|
|
|
this.appOnline = navigator.onLine
|
|
|
|
|
|
|
|
window.addEventListener('online', () => {
|
|
|
|
this.appOnline = true
|
|
|
|
})
|
|
|
|
|
|
|
|
window.addEventListener('offline', () => {
|
|
|
|
this.appOnline = false
|
|
|
|
})
|
2020-07-06 17:02:03 +00:00
|
|
|
|
|
|
|
/* === Current theme handling === */
|
|
|
|
this.activeTheme = localStorage.getItem('selectedTheme') || 'light'
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
changeTheme(newTheme) {
|
|
|
|
if (newTheme === this.activeTheme) return
|
|
|
|
|
|
|
|
this.activeTheme = newTheme
|
|
|
|
document.documentElement.setAttribute('data-theme', newTheme)
|
|
|
|
localStorage.setItem('selectedTheme', newTheme)
|
|
|
|
|
|
|
|
// Animating everything to have a smoother theme switch
|
|
|
|
document.querySelectorAll('*').forEach(el => {
|
|
|
|
el.style.transition = 'all 200ms ease-in-out'
|
|
|
|
})
|
|
|
|
|
|
|
|
document.documentElement.addEventListener('transitionend', function transitionHandler() {
|
|
|
|
document.querySelectorAll('*').forEach(el => {
|
|
|
|
el.style.transition = ''
|
|
|
|
})
|
|
|
|
|
|
|
|
document.documentElement.removeEventListener('transitionend', transitionHandler)
|
|
|
|
})
|
|
|
|
}
|
2020-06-24 20:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|