Skip to content

Commit

Permalink
Adds settings page to studio
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpolman committed Sep 19, 2024
1 parent a0f5f66 commit 5c94bc6
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 26 deletions.
1 change: 1 addition & 0 deletions apps/api/src/app/models/Widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const Widget = mongoose.model<WidgetDocument>(
'Widget',
new mongoose.Schema(
{
sub: String,
uuid: String,
poolId: String,
iconImg: String,
Expand Down
1 change: 1 addition & 0 deletions apps/studio/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ declare module 'vue' {
BFormTextare: typeof import('bootstrap-vue-next')['BFormTextare']
BFormTextarea: typeof import('bootstrap-vue-next')['BFormTextarea']
BImg: typeof import('bootstrap-vue-next')['BImg']
BInput: typeof import('bootstrap-vue-next')['BInput']
BInputGroup: typeof import('bootstrap-vue-next')['BInputGroup']
BInputGroupAppend: typeof import('bootstrap-vue-next')['BInputGroupAppend']
BInputGroupText: typeof import('bootstrap-vue-next')['BInputGroupText']
Expand Down
5 changes: 5 additions & 0 deletions apps/studio/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ const routes: Array<RouteRecordRaw> = [
name: 'account',
component: () => import(/* webpackChunkName: "signinredirect" */ '../views/studio/Account.vue'),
},
{
path: '/settings',
name: 'settings',
component: () => import(/* webpackChunkName: "signinredirect" */ '../views/studio/Settings.vue'),
},
],
},
{
Expand Down
4 changes: 4 additions & 0 deletions apps/studio/src/stores/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useAuthStore } from './Auth';
export const useAccountStore = defineStore('account', {
state: () => ({
account: null as null | TAccount,
profiles: [] as TWidget[],
}),
actions: {
request(path: string, options?: TRequestOptions) {
Expand All @@ -12,5 +13,8 @@ export const useAccountStore = defineStore('account', {
async get() {
this.account = await this.request('/account');
},
async getSettings() {
this.profiles = await this.request('/widgets');
},
},
});
1 change: 1 addition & 0 deletions apps/studio/src/views/Studio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/>
</template>
<b-dropdown-item to="/account">Account</b-dropdown-item>
<b-dropdown-item to="/settings">Settings</b-dropdown-item>
<b-dropdown-item to="/logout">Logout</b-dropdown-item>
</b-nav-item-dropdown>
</b-navbar>
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/src/views/studio/Account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</b-container>
<div class="bg-dark py-5 flex-grow-1">
<b-container>
<b-card variant="darker">
<b-card variant="darker" class="mb-5">
<BaseFormGroup label="Account ID">
{{ accountStore.account.sub }}
</BaseFormGroup>
Expand Down
42 changes: 42 additions & 0 deletions apps/studio/src/views/studio/Settings.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<template>
<template v-if="accountStore.account">
<b-container class="py-5 text-white">
<h1>Settings</h1>
<p class="lead">Personalize your collectible wallet.</p>
</b-container>
<div class="bg-dark py-5 flex-grow-1">
<b-container>
<b-card v-for="profile of accountStore.profiles" variant="darker" class="mb-5">
<h3>Domain</h3>
<BaseFormGroup label="URL">
<b-form-input v-model="profile.domain" />
</BaseFormGroup>
<h3>Theme</h3>
{{ profile.theme }}
</b-card>
</b-container>
</div>
</template>
</template>

<script lang="ts">
import { mapStores } from 'pinia';
import { defineComponent } from 'vue';
import { useAccountStore } from '@thxnetwork/studio/stores';
export default defineComponent({
name: 'Account',
data() {
return {
domain: '',
};
},
computed: {
...mapStores(useAccountStore),
},
async mounted() {
await this.accountStore.get();
await this.accountStore.getSettings();
},
});
</script>
25 changes: 0 additions & 25 deletions apps/wallet/src/views/wallet/Account.vue

This file was deleted.

1 change: 1 addition & 0 deletions libs/common/src/lib/types/Widget.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
type TWidget = {
sub: string;
uuid: string;
poolId: string;
iconImg: string;
Expand Down

0 comments on commit 5c94bc6

Please sign in to comment.