-
Notifications
You must be signed in to change notification settings - Fork 125
Expand file tree
/
Copy pathNavbarComponent.vue
More file actions
164 lines (150 loc) · 5.16 KB
/
NavbarComponent.vue
File metadata and controls
164 lines (150 loc) · 5.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<template>
<nav :class="navState()">
<figure class="logo" v-if="showLogo()">Scatter</figure>
<section class="breadcrumb" v-else>
<figure class="icon" v-on:click="back">
<i class="fa fa-chevron-left"></i>
</figure>
<figure class="route">{{breadcrumb()}}</figure>
</section>
<figure class="settings-button" v-on:click="toggleSettings">
<i class="fa fa-gear"></i>
</figure>
</nav>
</template>
<script>
import { mapActions, mapGetters, mapState } from 'vuex'
import {RouteNames} from '../vue/Routing'
export default {
computed: {
...mapState([
'scatter'
])
},
methods: {
back(){ this.$router.back() },
showLogo(){
switch(this.$route.name){
case RouteNames.ENTRY:
case RouteNames.MAIN_MENU:
case RouteNames.FIRST_TIME:
case RouteNames.SHOW_MNEMONIC: return true;
default: return false;
}
},
navState(){
switch(this.$route.name){
case RouteNames.ENTRY: if(this.scatter.settings.hasEncryptionKey) return 'locked';
else return 'no-chain';
case RouteNames.MAIN_MENU: return 'main-menu-nav';
default: return '';
}
},
breadcrumb(){
// TODO: Localize
switch(this.$route.name){
case RouteNames.LOAD_FROM_BACKUP: return 'Import Keychain';
case RouteNames.SETTINGS: return 'Settings';
case RouteNames.TRANSFER: return 'Transfer';
case RouteNames.IDENTITIES: return this.locale(this.langKeys.MAINMENU_Identities);
case RouteNames.IDENTITY: return 'Identity';
case RouteNames.PERMISSIONS:
case RouteNames.DOMAIN_PERMISSIONS: return this.locale(this.langKeys.MAINMENU_Permissions);
case RouteNames.HISTORY: return this.locale(this.langKeys.MAINMENU_History);
case RouteNames.NETWORKS: return 'Networks';
case RouteNames.NETWORK: return 'Network';
case RouteNames.CHANGE_PASSWORD: return 'Password';
case RouteNames.BACKUP:
case RouteNames.EXPORT_JSON: return 'Backup';
case RouteNames.DESTROY: return 'Destroy';
case RouteNames.AUTO_LOCK: return 'Auto Lock';
case RouteNames.LANGUAGE: return 'Language';
case RouteNames.KEYPAIRS: return 'Key Pair';
case RouteNames.KEYS: return this.locale(this.langKeys.MAINMENU_Keys);
}
return 'Undefined'
},
toggleSettings(){
if(this.$route.name === RouteNames.SETTINGS) this.back();
else this.$router.push({name:RouteNames.SETTINGS})
}
},
}
</script>
<style lang="scss">
nav {
height:600px;
max-height:60px;
line-height:60px;
background:#fff;
transition:all 0.2s ease;
transition-property: max-height, line-height, background;
padding:0 20px;
overflow:hidden;
/*border-bottom:1px solid #f9f9f9;*/
position: relative;
z-index:2;
.logo {
font-family: 'Grand Hotel', sans-serif;
font-size:22px;
color:#888888;
width:calc(100% - 60px);
float:left;
}
.settings-button {
cursor: pointer;
float: right;
height: 60px;
margin-left:10px;
line-height: 59px;
font-size: 24px;
text-align:right;
color: #d6d6d6;
}
.breadcrumb {
width:calc(100% - 60px);
float:left;
.icon {
cursor: pointer;
display:inline-block;
font-size:18px;
color:#dbdbdb;
padding-right:15px;
transition: color 0.2s ease;
&:hover {
color:rgba(0,0,0,0.3);
}
}
.route {
display:inline-block;
font-family:'Raleway', sans-serif;
font-size:18px;
color:#a5a5a5;
vertical-align: top;
}
}
&.no-chain {
max-height:299px;
line-height:299px;
.logo {
font-size:64px;
color:#656565;
width:100%;
text-align:center;
}
}
&.locked {
max-height:450px;
line-height:450px;
.logo {
font-size:64px;
color:#656565;
width:100%;
text-align:center;
}
}
&.main-menu-nav {
background:#f9f9f9;
}
}
</style>