Whalebird-desktop-client-ma.../src/renderer/components/TimelineSpace/SideMenu.vue

97 lines
2.2 KiB
Vue
Raw Normal View History

<template>
<div id="side_menu">
2018-03-09 07:48:20 +01:00
<div class="profile-wrapper">
<div class="profile">
2018-03-09 09:36:57 +01:00
<span>@{{ username }}</span>
<span>{{ account.domain }}</span>
2018-03-09 07:48:20 +01:00
</div>
</div>
<el-menu
default-active="1"
background-color="#373d48"
text-color="#909399"
active-text-color="#ffffff"
:router="true"
class="el-menu-vertical timeline-menu">
<el-menu-item index="1" :route="{path: `/${id()}/home`}">
<icon name="home"></icon>
<span>Home</span>
</el-menu-item>
<el-menu-item index="2" :route="{path: `/${id()}/notification`}">
<icon name="bell"></icon>
<span>Notification</span>
</el-menu-item>
<el-menu-item index="3" :route="{path: `/${id()}/fav`}">
<icon name="star"></icon>
<span>Fav</span>
</el-menu-item>
<el-menu-item index="4" :route="{path: `/${id()}/local`}">
<icon name="users"></icon>
<span>LocalTimeline</span>
</el-menu-item>
<el-menu-item index="5" :route="{path: `/${id()}/global`}">
<icon name="globe"></icon>
<span>PublicTimeline</span>
</el-menu-item>
</el-menu>
</div>
</template>
<script>
2018-03-09 07:48:20 +01:00
import { mapState } from 'vuex'
export default {
name: 'side-menu',
2018-03-09 07:48:20 +01:00
computed: {
...mapState({
account: state => state.TimelineSpace.SideMenu.account,
2018-03-09 09:36:57 +01:00
username: state => state.TimelineSpace.SideMenu.username
2018-03-09 07:48:20 +01:00
})
},
created () {
this.$store.dispatch('TimelineSpace/SideMenu/fetchAccount', this.$route.params.id)
.then((account) => {
this.$store.dispatch('TimelineSpace/SideMenu/username', account)
})
.catch(() => {
this.$message({
message: 'Could not find account',
type: 'error'
})
})
2018-03-09 07:48:20 +01:00
},
methods: {
id () {
return this.$route.params.id
}
}
}
</script>
<style lang="scss" scoped>
#side_menu {
2018-03-09 07:48:20 +01:00
.profile-wrapper {
background-color: #373d48;
position: fixed;
top: 0;
left: 65px;
2018-03-09 09:36:57 +01:00
width: 180px;
height: 60px;
2018-03-09 07:48:20 +01:00
.profile {
color: #ffffff;
font-weight: bold;
padding: 10px 20px;
}
}
.timeline-menu {
position: fixed;
2018-03-09 09:36:57 +01:00
top: 60px;
2018-03-09 07:48:20 +01:00
left: 65px;
height: 100%;
2018-03-09 09:36:57 +01:00
width: 180px;
}
}
</style>