Skip to content

Commit 95f76d8

Browse files
Resul AvanResul Avan
authored andcommitted
profile navbar improvement
1 parent 9bf0a74 commit 95f76d8

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

src/components/navbar/ProfileNavigator.vue

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
<template>
22
<b-navbar-dropdown :boxed="true" :close-on-click="true">
3-
4-
<template slot="label" class="is-grouped">
5-
<b-field>
6-
<BackgroundSquareImage :image-url="profilePhoto" size="28" rounded="true"/>
7-
<span class="has-margin-left-5"><b>{{ authUser.name || authUser.email }}</b></span>
8-
</b-field>
9-
</template>
10-
113
<b-navbar-item tag="router-link" :to="dynamicProfileRoute">
124
<b-icon pack="fas" icon="user" class="has-margin-right-5"/>
135
<p>{{$t('topNavbar.profileDynamic')}}</p>
@@ -30,22 +22,17 @@
3022

3123
<script lang="ts">
3224
import { Component, Prop, Vue } from 'nuxt-property-decorator';
33-
import { AuthUser, DefaultProfilePhoto, Routes } from "~/types";
34-
import BackgroundSquareImage from '~/components/image/BackgroundSquareImage.vue';
25+
import { AuthUser, Routes } from "~/types";
3526
import { getUserRoute } from '~/service/global-service';
3627
3728
@Component({
38-
components: { BackgroundSquareImage }
29+
components: {}
3930
})
4031
export default class ProfileNavigator extends Vue {
4132
4233
@Prop({ required: true }) authUser !: AuthUser;
4334
@Prop({ type: Function, required: true }) logout !: () => void;
4435
45-
get profilePhoto() {
46-
return this.authUser?.profilePhoto?.src || DefaultProfilePhoto.src
47-
}
48-
4936
get profileRoute() {
5037
return Routes.PROFILE
5138
}

src/components/navbar/TopNavbar.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040

4141
<LanguageSwitcher/>
4242

43+
44+
<b-navbar-item v-if="authUser" tag="router-link" :to="dynamicProfileRoute">
45+
<b-field>
46+
<BackgroundSquareImage :image-url="profilePhoto" size="28" rounded="true"/>
47+
<span class="has-margin-left-5"><b>{{ authUser.name || authUser.email }}</b></span>
48+
</b-field>
49+
</b-navbar-item>
4350
<ProfileNavigator v-if="authUser" :auth-user="authUser" :logout="logout"/>
4451

4552
<b-navbar-item v-else tag="div">
@@ -64,14 +71,16 @@
6471

6572
<script lang="ts">
6673
import { Component, Vue } from 'nuxt-property-decorator';
67-
import { AuthUser, Routes, StateNamespace } from "~/types";
74+
import { AuthUser, DefaultProfilePhoto, Routes, StateNamespace } from "~/types";
6875
import LanguageSwitcher from "~/components/navbar/LanguageSwitcher.vue";
6976
import ProfileNavigator from "~/components/navbar/ProfileNavigator.vue";
7077
import Logo from '~/components/navbar/Logo.vue';
7178
import SearchBar from '~/components/navbar/SearchBar.vue';
79+
import { getUserRoute } from '~/service/global-service';
80+
import BackgroundSquareImage from '~/components/image/BackgroundSquareImage.vue';
7281
7382
@Component({
74-
components: { SearchBar, Logo, ProfileNavigator, LanguageSwitcher }
83+
components: { BackgroundSquareImage, SearchBar, Logo, ProfileNavigator, LanguageSwitcher }
7584
})
7685
export default class TopNavbar extends Vue {
7786
@@ -82,5 +91,13 @@
8291
return Routes
8392
}
8493
94+
get dynamicProfileRoute() {
95+
return getUserRoute(Routes.PROFILE_DYNAMIC, this.authUser.username)
96+
}
97+
98+
get profilePhoto() {
99+
return this.authUser?.profilePhoto?.src || DefaultProfilePhoto.src
100+
}
101+
85102
}
86103
</script>

0 commit comments

Comments
 (0)