From ac367f0649714652d22eb35e83e1cd0107a6a323 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Mon, 22 Apr 2024 17:54:41 +0700 Subject: [PATCH] feat: user account info on top --- src/layouts/MainLayout.vue | 138 ++++++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 32 deletions(-) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index f023110b..c446df76 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -41,14 +41,16 @@ const leftDrawerOpen = ref(false); const filterUnread = ref(false); const unread = ref(1); const filterRole = ref(); +const userImage = ref(); const currentLanguage = ref('ไทย'); const language: { value: string; label: string; + icon: string; }[] = [ - { value: 'th-th', label: 'ไทย' }, - { value: 'en-US', label: 'English' }, + { value: 'th-th', label: 'ไทย', icon: 'circle-flags:th' }, + { value: 'en-US', label: 'English', icon: 'circle-flags:us' }, ]; const notiOpen = ref(false); @@ -84,8 +86,14 @@ const notification = ref([ read: true, }, ]); - -const userImage = ref(); +const options = ref([ + { + icon: 'mdi-lock-outline', + label: 'เปลี่ยนรหัสผ่าน', + value: 'op1', + color: 'primary', + }, +]); function setActive(button: NotificationButton) { notiMenu.value = notiMenu.value.map((current) => ({ @@ -130,7 +138,6 @@ onMounted(async () => { const userRoles = getRole(); if (userRoles) { - console.log(userRoles); filterRole.value = userRoles.filter( (role) => role !== 'default-roles-dev' && @@ -263,7 +270,8 @@ onMounted(async () => { dense flat no-caps - :menu-offset="[0, 10]" + content-style="border: 1px solid var(--border-color)" + :menu-offset="[30, 10]" color="dark" class="q-pa-none account-menu-down dropdown-menu" > @@ -296,32 +304,61 @@ onMounted(async () => { - - - - - - - เปลี่ยนรหัสผ่าน - - - - - - - - ออกจากระบบ - - - +
+
+
+ +
+ + + +
+
+ +
+ {{ getName() }} +
+
+ {{ getRoleName(userStore.userOption.roleOpts, filterRole) }} +
+
+ +
+ +
+ + + + + + + {{ op.label }} + + + +
+ +
+
@@ -411,4 +448,41 @@ onMounted(async () => { color: var(--foreground); } } + +.badge { + display: inline-block; + border-radius: var(--radius-6); + background-color: var(--indigo-0); + text-wrap: nowrap; + + &.dark { + background-color: var(--surface-3); + } +} + +.account-cover { + height: 65px; + background-color: var(--indigo-0); + + &.dark { + background-color: var(--surface-3); + } +} + +.avartar-border { + margin-top: 24px; + border: 5px solid var(--surface-1); + border-radius: 50%; + position: absolute; +} + +.logout-btn { + color: hsl(var(--negative-bg)); + background-color: hsl(var(--stone-3-hsl)); + + &.dark { + background-color: transparent; + border: 1px solid hsl(var(--negative-bg)); + } +}