-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(seaside): #195 add create account component
- Loading branch information
Showing
6 changed files
with
173 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 73 additions & 61 deletions
134
seaside/src/layout/components/sidenav/SideNavManagement.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,86 @@ | ||
<template> | ||
<span class="mt-auto"></span> | ||
<ul class="menu -mx-4"> | ||
<li v-if="user.isAuthenticated && store.getters['user/hasRoleAdmin']"> | ||
<router-link to="/admin" active-class="active" @click="sideNavToggle"> | ||
<AcademicCapIcon class="fill-current w-6 h-6 mr-2"/> | ||
Administration | ||
</router-link> | ||
</li> | ||
<li v-if="user.isAuthenticated && store.getters['user/hasRoleUser']"> | ||
<router-link to="/teams" active-class="active" @click="sideNavToggle"> | ||
<UserGroupIcon class="fill-current w-6 h-6 mr-2"/> | ||
Teams | ||
</router-link> | ||
</li> | ||
<li v-if="user.isAuthenticated && store.getters['user/hasRoleUser']"> | ||
<router-link to="/config" active-class="active" @click="sideNavToggle"> | ||
<AdjustmentsVerticalIcon class="fill-current w-6 h-6 mr-2"/> | ||
Configuration | ||
</router-link> | ||
</li> | ||
<li class="text-primary"> | ||
<a v-if="user.isAuthenticated" @click.stop="$emit('logout')"> | ||
<ArrowRightOnRectangleIcon class="fill-current h-6 w-6"/> | ||
<span class="ml-2 capitalize font-medium">log out</span> | ||
</a> | ||
<router-link to="/login" v-else> | ||
<ArrowLeftOnRectangleIcon class="fill-current h-6 w-6"/> | ||
<span class="ml-2 capitalize font-medium">log in</span> | ||
</router-link> | ||
</li> | ||
</ul> | ||
<span class="mt-auto"></span> | ||
<ul class="menu -mx-4"> | ||
<li v-if="user.isAuthenticated && store.getters['user/hasRoleAdmin']"> | ||
<router-link to="/admin" active-class="active" @click="sideNavToggle"> | ||
<AcademicCapIcon class="fill-current w-6 h-6 mr-2"/> | ||
Administration | ||
</router-link> | ||
</li> | ||
<li v-if="user.isAuthenticated && store.getters['user/hasRoleUser']"> | ||
<router-link to="/teams" active-class="active" @click="sideNavToggle"> | ||
<UserGroupIcon class="fill-current w-6 h-6 mr-2"/> | ||
Teams | ||
</router-link> | ||
</li> | ||
<li v-if="user.isAuthenticated && store.getters['user/hasRoleUser']"> | ||
<router-link to="/config" active-class="active" @click="sideNavToggle"> | ||
<AdjustmentsVerticalIcon class="fill-current w-6 h-6 mr-2"/> | ||
Configuration | ||
</router-link> | ||
</li> | ||
<li> | ||
<a v-if="!user.isAuthenticated" @click.prevent.stop="onCreateAccountClick"> | ||
<InboxArrowDownIcon class="fill-current h-6 w-6"/> | ||
<span class="ml-2 capitalize font-medium">Create Account</span> | ||
</a> | ||
</li> | ||
<li class="text-primary"> | ||
<a v-if="user.isAuthenticated" @click.stop="$emit('logout')"> | ||
<ArrowRightStartOnRectangleIcon class="fill-current h-6 w-6"/> | ||
<span class="ml-2 capitalize font-medium">log out</span> | ||
</a> | ||
<router-link to="/login" v-else> | ||
<ArrowRightEndOnRectangleIcon class="fill-current h-6 w-6"/> | ||
<span class="ml-2 capitalize font-medium">log in</span> | ||
</router-link> | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import {Component, Vue} from 'vue-facing-decorator'; | ||
import {useStore} from 'vuex'; | ||
import {UserState} from '@/store/user/user'; | ||
import { Component, Vue } from 'vue-facing-decorator'; | ||
import { useStore } from 'vuex'; | ||
import { UserState } from '@/store/user/user'; | ||
import { | ||
AcademicCapIcon, | ||
AdjustmentsVerticalIcon, | ||
ArrowLeftOnRectangleIcon, | ||
ArrowRightOnRectangleIcon, | ||
UserGroupIcon | ||
AcademicCapIcon, | ||
AdjustmentsVerticalIcon, | ||
ArrowRightEndOnRectangleIcon, | ||
ArrowRightStartOnRectangleIcon, | ||
InboxArrowDownIcon, | ||
UserGroupIcon, | ||
} from '@heroicons/vue/20/solid'; | ||
import {SidenavMutation} from "@/store/sidenav/SidenavMutation.enum"; | ||
import { SidenavMutation } from '@/store/sidenav/SidenavMutation.enum'; | ||
@Component({ | ||
name: 'SideNavManagement', | ||
emits: ['logout'], | ||
components: { | ||
AcademicCapIcon, | ||
AdjustmentsVerticalIcon, | ||
ArrowLeftOnRectangleIcon, | ||
ArrowRightOnRectangleIcon, | ||
UserGroupIcon, | ||
}, | ||
setup() { | ||
const store = useStore(); | ||
return { | ||
store: store, | ||
user: store.state.user | ||
} | ||
} | ||
name: 'SideNavManagement', | ||
emits: ['logout'], | ||
components: { | ||
AcademicCapIcon, | ||
AdjustmentsVerticalIcon, | ||
InboxArrowDownIcon, | ||
ArrowRightStartOnRectangleIcon, | ||
ArrowRightEndOnRectangleIcon, | ||
UserGroupIcon, | ||
}, | ||
setup() { | ||
const store = useStore(); | ||
return { | ||
store: store, | ||
user: store.state.user, | ||
}; | ||
}, | ||
}) | ||
export default class SideNavManagement extends Vue { | ||
private store; | ||
private user: UserState; | ||
private store; | ||
private user: UserState; | ||
public sideNavToggle(): void { | ||
this.store.commit(SidenavMutation.TOGGLE); | ||
} | ||
public sideNavToggle(): void { | ||
this.store.commit(SidenavMutation.TOGGLE); | ||
} | ||
public onCreateAccountClick(): void { | ||
this.store.commit(SidenavMutation.OPEN_CREATE_ACCOUNT_MUTATION); | ||
} | ||
} | ||
</script> |
59 changes: 59 additions & 0 deletions
59
seaside/src/security/components/CreateAccountComponent.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<curtain-modal @leave="close()" v-slot="curtainModal"> | ||
<h2 class="font-sans text-xl border-b border-accent/40 pb-2 w-full">Create new account</h2> | ||
<div class="m-4"> | ||
<label class="label"> | ||
<span class="label-text">Team Name</span> | ||
</label> | ||
<input type="text" class="input input-bordered w-full"> | ||
<label class="label -mt-1"> | ||
<span class="label-text-alt"> </span> | ||
<span v-if="errors.has('name')" class="label-text-alt">{{ errors.get('name') }}</span> | ||
</label> | ||
<label class="label"> | ||
<span class="label-text">Team Topic</span> | ||
</label> | ||
<input type="text" class="input input-bordered w-full" | ||
:class="{'input-error': errors.has('topic')}"> | ||
<label class="label -mt-1"> | ||
<span class="label-text-alt"> </span> | ||
<span v-if="errors.has('topic')" class="label-text-alt">{{ errors.get('topic') }}</span> | ||
</label> | ||
<div class="text-right"> | ||
<button class="btn btn-sm mx-1" @click.stop="curtainModal.close()">Cancel</button> | ||
<button class="btn btn-sm btn-primary mx-1"> | ||
Save | ||
</button> | ||
</div> | ||
</div> | ||
</curtain-modal> | ||
</template> | ||
<script lang="ts"> | ||
import { Component, Vue } from 'vue-facing-decorator'; | ||
import CurtainModal from '@/common/components/CurtainModal.vue'; | ||
import { User } from '@/security/model/User'; | ||
import { Store, useStore } from 'vuex'; | ||
import { UserState } from '@/store/user/user'; | ||
import { CLOSE_CREATE_ACCOUNT_MUTATION } from '@/store/user/UserConstants'; | ||
const CLOSE_EVENT: string = 'close'; | ||
@Component({ | ||
emits: [CLOSE_EVENT], | ||
components: { CurtainModal }, | ||
setup() { | ||
return { | ||
userStore: useStore(), | ||
}; | ||
}, | ||
}) | ||
export default class CreateAccountComponent extends Vue { | ||
private readonly userStore: Store<UserState>; | ||
private account: User; | ||
private errors: Map<string, string> = new Map<string, string>(); | ||
private close(): void { | ||
this.userStore.commit(CLOSE_CREATE_ACCOUNT_MUTATION); | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export enum SidenavMutation { | ||
TOGGLE = 'sidenav/toggleSidenav', | ||
OPEN_CREATE_ACCOUNT_MUTATION = 'user/openCreateAccount', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters