-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add role user and history interfaces to pusher mechanic (#36)
- Loading branch information
1 parent
667225e
commit ec116b9
Showing
62 changed files
with
936 additions
and
435 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,24 @@ | ||
<template> | ||
<Button :label="t('user-avatar.logout')" @click="logout" v-if="isAdmin" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import Button from 'primevue/button' | ||
import { useI18n } from 'vue-i18n' | ||
import { useSessionStore } from '@/stores/session' | ||
import { useRouter } from 'vue-router' | ||
import { storeToRefs } from 'pinia' | ||
const { t } = useI18n() | ||
const { goodbye, reconsider } = useSessionStore() | ||
const router = useRouter() | ||
const { isAdmin } = storeToRefs(useSessionStore()) | ||
const logout = async () => { | ||
await goodbye() | ||
await reconsider() | ||
await router.push({ name: 'app' }) | ||
} | ||
</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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template> | ||
<Avatar | ||
icon="pi pi-user" | ||
class="mr-2" | ||
:class="{ 'bg-black-alpha-90 text-white': isAdmin, 'text-black-alpha-90': isGuest }" | ||
@click="openUserPanel" | ||
/> | ||
<OverlayPanel ref="userPanel" class="w-full md:w-24rem"> | ||
<div class="mb-3"> | ||
<p class="font-semibold"> | ||
{{ username }} [{{ isAdmin ? t('role.admin') : t('role.guest') }}] | ||
</p> | ||
<i18n-t keypath="user-avatar.from-ip" tag="p"> | ||
<template v-slot:ip> | ||
<code class="text-sm p-1 bg-black-alpha-10">{{ ip }}</code> | ||
</template> | ||
</i18n-t> | ||
</div> | ||
|
||
<LoginWithPasswordForm v-if="isGuest" /> | ||
<LogoutForm v-if="!isGuest" /> | ||
</OverlayPanel> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import OverlayPanel from 'primevue/overlaypanel' | ||
import LoginWithPasswordForm from '@/components/auth/LoginWithPasswordForm.vue' | ||
import LogoutForm from '@/components/auth/LogoutForm.vue' | ||
import Avatar from 'primevue/avatar' | ||
import { useI18n } from 'vue-i18n' | ||
import { storeToRefs } from 'pinia' | ||
import { useSessionStore } from '@/stores/session' | ||
import { ref } from 'vue' | ||
const { t } = useI18n() | ||
const { username, ip, isGuest, isAdmin } = storeToRefs(useSessionStore()) | ||
const userPanel = ref() | ||
const openUserPanel = (event: Event) => { | ||
userPanel.value.toggle(event) | ||
} | ||
</script> |
Oops, something went wrong.