|
40 | 40 |
|
41 | 41 | <LanguageSwitcher/>
|
42 | 42 |
|
| 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> |
43 | 50 | <ProfileNavigator v-if="authUser" :auth-user="authUser" :logout="logout"/>
|
44 | 51 |
|
45 | 52 | <b-navbar-item v-else tag="div">
|
|
64 | 71 |
|
65 | 72 | <script lang="ts">
|
66 | 73 | import { Component, Vue } from 'nuxt-property-decorator';
|
67 |
| - import { AuthUser, Routes, StateNamespace } from "~/types"; |
| 74 | + import { AuthUser, DefaultProfilePhoto, Routes, StateNamespace } from "~/types"; |
68 | 75 | import LanguageSwitcher from "~/components/navbar/LanguageSwitcher.vue";
|
69 | 76 | import ProfileNavigator from "~/components/navbar/ProfileNavigator.vue";
|
70 | 77 | import Logo from '~/components/navbar/Logo.vue';
|
71 | 78 | import SearchBar from '~/components/navbar/SearchBar.vue';
|
| 79 | + import { getUserRoute } from '~/service/global-service'; |
| 80 | + import BackgroundSquareImage from '~/components/image/BackgroundSquareImage.vue'; |
72 | 81 |
|
73 | 82 | @Component({
|
74 |
| - components: { SearchBar, Logo, ProfileNavigator, LanguageSwitcher } |
| 83 | + components: { BackgroundSquareImage, SearchBar, Logo, ProfileNavigator, LanguageSwitcher } |
75 | 84 | })
|
76 | 85 | export default class TopNavbar extends Vue {
|
77 | 86 |
|
|
82 | 91 | return Routes
|
83 | 92 | }
|
84 | 93 |
|
| 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 | +
|
85 | 102 | }
|
86 | 103 | </script>
|
0 commit comments