Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Commit baf0340

Browse files
✨ Multi-level aside navbar
1 parent 30e77eb commit baf0340

10 files changed

Lines changed: 145 additions & 57 deletions

File tree

components/Manage.vue

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,33 @@
1717
<font-awesome-icon class="nav-icon" icon="box-open" fixed-width />
1818
<span>Subscription</span>
1919
</nuxt-link>
20-
<nuxt-link class="item" :to="`/manage/${$route.params.team}/billing`">
20+
<nuxt-link
21+
class="item item--type-parent"
22+
:to="`/manage/${$route.params.team}/billing/details`"
23+
>
2124
<font-awesome-icon class="nav-icon" icon="address-card" fixed-width />
22-
<span>Billing info</span>
23-
</nuxt-link>
24-
<nuxt-link class="item" :to="`/manage/${$route.params.team}/sources`">
25-
<font-awesome-icon class="nav-icon" icon="credit-card" fixed-width />
26-
<span>Payment methods</span>
27-
</nuxt-link>
28-
<nuxt-link class="item" :to="`/manage/${$route.params.team}/invoices`">
29-
<font-awesome-icon class="nav-icon" icon="file-invoice" fixed-width />
30-
<span>Invoices</span>
25+
<span>Billing</span>
3126
</nuxt-link>
27+
<nav v-if="$route.path.includes('/billing/')" class="sub-nav">
28+
<nuxt-link
29+
class="sub-item"
30+
:to="`/manage/${$route.params.team}/billing/details`"
31+
>
32+
<span>Customer info</span>
33+
</nuxt-link>
34+
<nuxt-link
35+
class="sub-item"
36+
:to="`/manage/${$route.params.team}/billing/sources`"
37+
>
38+
<span>Payment methods</span>
39+
</nuxt-link>
40+
<nuxt-link
41+
class="sub-item"
42+
:to="`/manage/${$route.params.team}/billing/invoices`"
43+
>
44+
<span>Invoices</span>
45+
</nuxt-link>
46+
</nav>
3247
<nuxt-link class="item" :to="`/manage/${$route.params.team}/data`">
3348
<font-awesome-icon class="nav-icon" icon="database" fixed-width />
3449
<span>Data &amp; security</span>
@@ -37,10 +52,6 @@
3752
<font-awesome-icon class="nav-icon" icon="code" fixed-width />
3853
<span>Developer APIs</span>
3954
</nuxt-link>
40-
<nuxt-link class="item" to="/settings/account">
41-
<font-awesome-icon class="nav-icon" icon="user" fixed-width />
42-
<span>Your account</span>
43-
</nuxt-link>
4455
</nav>
4556
</aside>
4657
<div class="card">
@@ -58,8 +69,6 @@ import {
5869
faDatabase,
5970
faUsers,
6071
faCog,
61-
faCreditCard,
62-
faFileInvoice,
6372
faBoxOpen,
6473
faUser,
6574
faAddressCard,
@@ -69,8 +78,6 @@ library.add(
6978
faDatabase,
7079
faUsers,
7180
faCog,
72-
faCreditCard,
73-
faFileInvoice,
7481
faBoxOpen,
7582
faUser,
7683
faCode,
@@ -121,20 +128,22 @@ aside nav {
121128
opacity: 0.75;
122129
}
123130
}
131+
&.nuxt-link-active:not(.item--type-parent) {
132+
font-weight: bold;
133+
}
134+
}
135+
.sub-nav {
136+
margin-top: -0.5rem;
137+
border-left: 0.1rem solid rgba(0, 0, 0, 0.1);
138+
padding-left: 1.4rem;
139+
margin-left: 0.5rem;
140+
}
141+
.sub-item {
142+
display: block;
143+
color: inherit;
144+
margin: 0.5rem 0;
124145
&.nuxt-link-active {
125146
font-weight: bold;
126-
padding-left: 1rem;
127-
margin-left: -1rem;
128-
color: #492257;
129-
background-color: #fff;
130-
border-radius: 0.2rem 0 0 0.2rem;
131-
box-shadow: -7px 10px 10px rgba(60, 66, 87, 0.075), 2px 0 0 #fff;
132-
&:hover {
133-
opacity: 1;
134-
}
135-
.nav-icon {
136-
opacity: 0.75;
137-
}
138147
}
139148
}
140149
</style>

pages/manage/_team/api-keys/index.vue

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
data-balloon="Delete"
6868
data-balloon-pos="up"
6969
class="button button--type-icon button--color-danger"
70-
@click="deleteApiKey(apiKey.apiKey)"
70+
@click="() => (showDelete = apiKey)"
7171
>
7272
<font-awesome-icon
7373
title="Delete"
@@ -104,6 +104,10 @@
104104
</div>
105105
</div>
106106
<h2>Create API key</h2>
107+
<p>
108+
You can use API keys to programmatically access Staart in your
109+
applications.
110+
</p>
107111
<form @submit.prevent="createApiKey">
108112
<div class="fake-radio-container">
109113
<label>
@@ -122,13 +126,32 @@
122126
<button class="button">Create API key</button>
123127
</form>
124128
</div>
129+
<transition name="modal">
130+
<Confirm v-if="showDelete" :on-close="() => (showDelete = null)">
131+
<h2>Are you sure you want to delete this API key?</h2>
132+
<p>
133+
Deleting an API key is not reversible, and you'll need to update any
134+
apps using this key.
135+
</p>
136+
<button
137+
class="button button--color-danger-cta"
138+
@click="deleteApiKey(showDelete.apiKey)"
139+
>
140+
Yes, delete API key
141+
</button>
142+
<button type="button" class="button" @click="showDelete = null">
143+
No, don't delete
144+
</button>
145+
</Confirm>
146+
</transition>
125147
</main>
126148
</template>
127149

128150
<script lang="ts">
129151
import { Component, Vue, Watch } from "vue-property-decorator";
130152
import { mapGetters } from "vuex";
131153
import Loading from "@/components/Loading.vue";
154+
import Confirm from "@/components/Confirm.vue";
132155
import TimeAgo from "@/components/TimeAgo.vue";
133156
import LargeMessage from "@/components/LargeMessage.vue";
134157
import Input from "@/components/form/Input.vue";
@@ -145,12 +168,13 @@ import {
145168
faCloudDownloadAlt,
146169
faTrash
147170
} from "@fortawesome/free-solid-svg-icons";
148-
import { ApiKeys, emptyPagination } from "../../../../types/manage";
171+
import { ApiKeys, emptyPagination, ApiKey } from "../../../../types/manage";
149172
library.add(faPencilAlt, faCloudDownloadAlt, faArrowDown, faSync, faTrash);
150173
151174
@Component({
152175
components: {
153176
Loading,
177+
Confirm,
154178
TimeAgo,
155179
Input,
156180
FontAwesomeIcon,
@@ -162,6 +186,7 @@ library.add(faPencilAlt, faCloudDownloadAlt, faArrowDown, faSync, faTrash);
162186
})
163187
export default class ManageSettings extends Vue {
164188
apiKeys: ApiKeys = emptyPagination;
189+
showDelete: ApiKey | null = null;
165190
loadingMore = false;
166191
loading = "";
167192
newApiKeyAccess = 0;
@@ -222,6 +247,23 @@ export default class ManageSettings extends Vue {
222247
})
223248
.finally(() => (this.loading = ""));
224249
}
250+
251+
private deleteApiKey(key: string) {
252+
this.showDelete = null;
253+
this.loading = "Deleting your API key";
254+
this.$store
255+
.dispatch("manage/deleteApiKey", {
256+
team: this.$route.params.team,
257+
id: key
258+
})
259+
.then(apiKeys => {
260+
this.apiKeys = { ...apiKeys };
261+
})
262+
.catch(error => {
263+
throw new Error(error);
264+
})
265+
.finally(() => (this.loading = ""));
266+
}
225267
}
226268
</script>
227269

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
<template>
22
<main>
3-
<h1>Billing</h1>
3+
<div class="row">
4+
<h1>Billing</h1>
5+
<div class="text text--align-right">
6+
<button
7+
data-balloon="Refresh"
8+
data-balloon-pos="down"
9+
class="button button--type-icon"
10+
@click="load"
11+
>
12+
<font-awesome-icon
13+
title="Refresh"
14+
class="icon"
15+
icon="sync"
16+
fixed-width
17+
/>
18+
</button>
19+
</div>
20+
</div>
421
<p>
522
Manage your billing account details. This information will be used for
623
invoicing.
@@ -16,7 +33,7 @@
1633
<span style="text-transform: uppercase">{{
1734
billing.currency || "eur"
1835
}}</span>
19-
{{ parseFloat(billing.account_balance).toFixed(2) }}
36+
{{ billing.account_balance | currency }}
2037
</td>
2138
</tr>
2239
<tr>
@@ -112,15 +129,27 @@ import ImageInput from "@/components/form/Image.vue";
112129
import Checkbox from "@/components/form/Checkbox.vue";
113130
import { getAllCountries } from "countries-and-timezones";
114131
import { User } from "@/types/auth";
115-
import { Billing, emptyBilling, emptyAddress } from "../../../types/manage";
132+
import {
133+
Billing,
134+
emptyBilling,
135+
emptyAddress,
136+
Sources,
137+
emptyPagination
138+
} from "@/types/manage";
139+
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
140+
import { library } from "@fortawesome/fontawesome-svg-core";
141+
import { faSync } from "@fortawesome/free-solid-svg-icons";
142+
143+
library.add(faSync);
116144
117145
@Component({
118146
components: {
119147
Loading,
120148
Input,
121149
Select,
122150
ImageInput,
123-
Checkbox
151+
Checkbox,
152+
FontAwesomeIcon
124153
},
125154
computed: mapGetters({
126155
user: "auth/user"
@@ -149,6 +178,10 @@ export default class ManageSettings extends Vue {
149178
}
150179
151180
private mounted() {
181+
this.load();
182+
}
183+
184+
private load() {
152185
this.loading = "Loading billing details";
153186
this.$store
154187
.dispatch("manage/getBilling", this.$route.params.team)

pages/manage/_team/invoices/_id.vue renamed to pages/manage/_team/billing/invoices/_id.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ import {
113113
faFileInvoice
114114
} from "@fortawesome/free-solid-svg-icons";
115115
import { invoices } from "stripe";
116-
import { Invoices, emptyPagination } from "../../../../types/manage";
116+
import { Invoices, emptyPagination } from "@/types/manage";
117117
library.add(faCloudDownloadAlt, faFileInvoice);
118118
119119
@Component({

pages/manage/_team/invoices/index.vue renamed to pages/manage/_team/billing/invoices/index.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
heading="No billing account"
66
text="You need to setup a billing account before you view your invoices."
77
cta-text="Setup billing"
8-
:cta-to="`/manage/${$route.params.team}/billing`"
8+
:cta-to="`/manage/${$route.params.team}/billing/details`"
99
/>
1010
<Loading v-else-if="loading" :message="loading" />
1111
<div v-else>
@@ -93,7 +93,9 @@
9393
/>
9494
</a>
9595
<router-link
96-
:to="`/manage/${$route.params.team}/invoices/${invoice.id}`"
96+
:to="
97+
`/manage/${$route.params.team}/billing/invoices/${invoice.id}`
98+
"
9799
data-balloon="Details"
98100
data-balloon-pos="up"
99101
class="button button--type-icon"
@@ -156,7 +158,7 @@ import {
156158
faCreditCard,
157159
faCloudDownloadAlt
158160
} from "@fortawesome/free-solid-svg-icons";
159-
import { Invoices, emptyPagination } from "../../../../types/manage";
161+
import { Invoices, emptyPagination } from "@/types/manage";
160162
library.add(
161163
faFileInvoiceDollar,
162164
faCreditCard,

pages/manage/_team/sources/_id.vue renamed to pages/manage/_team/billing/sources/_id.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
3939
import { library } from "@fortawesome/fontawesome-svg-core";
4040
import { faCloudDownloadAlt } from "@fortawesome/free-solid-svg-icons";
4141
import { sources } from "stripe";
42-
import { Sources, emptyPagination } from "../../../../types/manage";
42+
import { Sources, emptyPagination } from "@/types/manage";
4343
library.add(faCloudDownloadAlt);
4444
4545
@Component({

pages/manage/_team/sources/index.vue renamed to pages/manage/_team/billing/sources/index.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
heading="No billing account"
66
text="You need to setup a billing account before you view your sources."
77
cta-text="Setup billing"
8-
:cta-to="`/manage/${$route.params.team}/billing`"
8+
:cta-to="`/manage/${$route.params.team}/billing/details`"
99
/>
1010
<Loading v-else-if="loading" :message="loading" />
1111
<div v-else>
@@ -50,7 +50,9 @@
5050
</td>
5151
<td class="text text--align-right">
5252
<router-link
53-
:to="`/manage/${$route.params.team}/sources/${source.id}`"
53+
:to="
54+
`/manage/${$route.params.team}/billing/sources/${source.id}`
55+
"
5456
data-balloon="Details"
5557
data-balloon-pos="up"
5658
class="button button--type-icon"
@@ -113,7 +115,7 @@ import {
113115
faSync,
114116
faCloudDownloadAlt
115117
} from "@fortawesome/free-solid-svg-icons";
116-
import { Sources, emptyPagination } from "../../../../types/manage";
118+
import { Sources, emptyPagination } from "@/types/manage";
117119
library.add(faPencilAlt, faCloudDownloadAlt, faArrowDown, faSync);
118120
119121
@Component({

pages/manage/_team/subscription/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
heading="No billing account"
66
text="You need to setup a billing account before you can create a subscription."
77
cta-text="Setup billing"
8-
:cta-to="`/manage/${$route.params.team}/billing`"
8+
:cta-to="`/manage/${$route.params.team}/billing/details`"
99
/>
1010
<Loading v-else-if="loading" :message="loading" />
1111
<div v-else>

0 commit comments

Comments
 (0)