Skip to content

Commit

Permalink
Simplify SideBar component
Browse files Browse the repository at this point in the history
  • Loading branch information
dmohns committed Jul 23, 2024
1 parent 5629175 commit 3db899e
Showing 1 changed file with 7 additions and 49 deletions.
56 changes: 7 additions & 49 deletions Website/ui/src/modules/Sidebar/SideBar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="sidebar" :data-color="sidebarItemColor" :style="sidebarStyle">
<div class="sidebar" :data-color="sidebarItemColor">
<div class="logo">
<div class="brand-column">
<img class="logo" alt="logo" :src="imgLogo" />
Expand Down Expand Up @@ -27,7 +27,7 @@
<!-- If the route has no children, then it should be a clickable menu item -->
<router-link
v-if="!hasSubMenu(menu)"
:to="route(menu.path)"
:to="menu.path"
:exact-path="true"
:key="'menu' + menu.path"
>
Expand Down Expand Up @@ -72,11 +72,7 @@
<router-link
v-for="sub in menu.children"
:key="sub.path"
:to="
route(
subMenuUrl(menu.path, sub.path),
)
"
:to="subMenuUrl(menu.path, sub.path)"
class="sub-menu"
:exact-path="true"
>
Expand Down Expand Up @@ -139,8 +135,6 @@ export default {
data() {
return {
show_extender: false,
admin: null,
translateItem: translateItem,
routes: this.$router.options.routes,
}
Expand All @@ -163,7 +157,6 @@ export default {
type: String,
default: 'green',
},
autoClose: {
type: Boolean,
default: true,
Expand Down Expand Up @@ -199,28 +192,9 @@ export default {
return this.$tc('menu.' + name)
}
},
route(routeUrl) {
// In the backend/database these are sometimes stored as (for example)
// /meters/page/1
// but we actually need to convert that to query params
if (routeUrl !== '') {
if (routeUrl.includes('/page/1')) {
routeUrl = routeUrl.split('/page/1')[0]
return {
path: routeUrl,
query: { page: 1, per_page: 15 },
}
} else {
return { path: routeUrl }
}
}
},
},
computed: {
...mapGetters('settings', ['getEnabledPlugins']),
adminName() {
return this.$store.getters['auth/getAuthenticateUser'].name
},
sidebarStyle() {
return {
background: '#2b2b2b !important',
Expand All @@ -230,6 +204,10 @@ export default {
}
</script>
<style>
.sidebar {
background: #2b2b2b;
}
.brand-column {
display: -webkit-box;
display: -webkit-flex;
Expand Down Expand Up @@ -303,12 +281,6 @@ export default {
color: #f5e8e8 !important;
}
.sidebar-layout {
position: absolute;
height: 100%;
width: 100%;
}
.icon-box {
margin-right: 10px !important;
width: 25px !important;
Expand All @@ -323,20 +295,6 @@ export default {
width: 100% !important;
}
.c-gray {
color: gray;
}
.app-style {
width: calc(100% / 12 * 2);
position: fixed;
}
.drawer-style {
background-color: #2b2b2b !important;
height: 100vh;
}
.p-15 {
padding: 10px;
}
Expand Down

0 comments on commit 3db899e

Please sign in to comment.