Adds link to creator page in the user menu

This commit is contained in:
Jonathan Bourdon
2024-07-20 01:07:52 -04:00
parent 8afa037fbe
commit c358eb98d8
3 changed files with 17 additions and 32 deletions

View File

@@ -6,6 +6,7 @@ import StoredDataUrlsModel from "@/models/storedDataUrlsModel.js";
export default class MyUserModel export default class MyUserModel
{ {
id = ""; id = "";
creatorAlias = "";
firstName = ""; firstName = "";
lastName = ""; lastName = "";
userName = ""; userName = "";

View File

@@ -2,12 +2,12 @@
<div v-if="creator && creator.id"> <div v-if="creator && creator.id">
<creator-banner :creator="creator"></creator-banner> <creator-banner :creator="creator"></creator-banner>
<DonationPopup :creator-id="creator.id"></DonationPopup> <donation-popup :creator-id="creator.id"></donation-popup>
<div class="max-w-[800px] mx-auto flex flex-row justify-center border-l-2 border-r-2 -mt-6 "> <div class="max-w-[800px] mx-auto flex flex-row justify-center border-l-2 border-r-2 -mt-6 ">
<div class="w-full mt-20 h-full"> <div class="w-full mt-20 h-full">
<ContentList :creator-id="creator.id"> <content-list :creator-id="creator.id">
</ContentList> </content-list>
</div> </div>
</div> </div>
@@ -34,9 +34,7 @@ import {watch, ref, onBeforeMount} from 'vue';
import {useRoute} from 'vue-router'; import {useRoute} from 'vue-router';
import {useClient} from "@/plugins/api.js"; import {useClient} from "@/plugins/api.js";
import CreatorBanner from "@/views/creators/CreatorBanner.vue"; import CreatorBanner from "@/views/creators/CreatorBanner.vue";
import MessageList from "@/views/messages/MessageList.vue";
import ContentList from "@/views/contents/ContentList.vue"; import ContentList from "@/views/contents/ContentList.vue";
import PostMessage from "@/views/messages/PostMessage.vue";
import DonationPopup from "@/views/main/DonationPopup.vue"; import DonationPopup from "@/views/main/DonationPopup.vue";
const client = useClient(); const client = useClient();
@@ -44,7 +42,6 @@ const route = useRoute();
const creator = ref(null); const creator = ref(null);
const loading = ref(true); const loading = ref(true);
const tab = ref();
onBeforeMount(async () => { onBeforeMount(async () => {
setTimeout(() => { setTimeout(() => {
@@ -76,16 +73,3 @@ const fetchCreatorData = async (creatorAlias) => {
} }
</script> </script>
<style scoped>
.shadow-lg {
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.8);
}
.v-btn--active {
background-color: #1976D2;
color: white;
}
</style>

View File

@@ -53,12 +53,12 @@
<div class="text-center"> <div class="text-center">
<v-menu open-on-hover> <v-menu open-on-hover>
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn variant="plain" v-bind="props" class=" d-flex align-center text-capital-none"> <v-btn variant="plain" v-bind="props" class="d-flex align-center text-capital-none">
<span class="normal-case max-w-xs hidden md:block"> <span class="normal-case max-w-xs hidden md:block">
{{ currentUserName }} {{ currentUser.userName }}
</span> </span>
<img <img
:src="currentUser.storedDataUrls.profilePictureUrl" :src="currentUser.storedDataUrls.profilePictureUrl"
alt="Profile Image" alt="Profile Image"
@error="handleProfilePictureError" @error="handleProfilePictureError"
class="ml-2 rounded-full" style="width: 32px; height: 32px;"> class="ml-2 rounded-full" style="width: 32px; height: 32px;">
@@ -66,6 +66,7 @@
</template> </template>
<v-list min-width="200px" class=" align-center mt-3 left-3"> <v-list min-width="200px" class=" align-center mt-3 left-3">
<div v-if="currentUser.userName === 'Anonyme'"> <div v-if="currentUser.userName === 'Anonyme'">
<v-list-item class="nav-button"> <v-list-item class="nav-button">
<v-list-item-title> <v-list-item-title>
@@ -75,13 +76,15 @@
</div> </div>
<div v-if="currentUser.userName !== 'Anonyme'"> <div v-if="currentUser.userName !== 'Anonyme'">
<v-list-item class="nav-button">
<router-link :to="`/@${currentUserName}`"> <v-list-item v-if="currentUser.creatorAlias !== null" class="nav-button">
<v-btn class="w-100 " variant="plain"> {{ currentUserName }}</v-btn> <router-link :to="`/@${currentUser.creatorAlias}`">
<v-btn class="w-100 " variant="plain">@{{ currentUser.creatorAlias }}</v-btn>
</router-link> </router-link>
</v-list-item> </v-list-item>
<v-list-item class="nav-button"> <v-list-item class="nav-button">
<v-list-item-title > <v-list-item-title>
<v-btn to="/profile" class="w-100 " variant="plain">Mon profil</v-btn> <v-btn to="/profile" class="w-100 " variant="plain">Mon profil</v-btn>
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
@@ -89,7 +92,7 @@
<v-list-item-title> <v-list-item-title>
<v-btn to="/wallet" class="w-100 " variant="plain"> Portefeuille</v-btn> <v-btn to="/wallet" class="w-100 " variant="plain"> Portefeuille</v-btn>
</v-list-item-title> </v-list-item-title>
</v-list-item> </v-list-item>
<v-list-item class="nav-button"> <v-list-item class="nav-button">
<v-list-item-title> <v-list-item-title>
<v-btn @click="logout" to="/wallet" class="w-100 " variant="plain"> Déconnexion</v-btn> <v-btn @click="logout" to="/wallet" class="w-100 " variant="plain"> Déconnexion</v-btn>
@@ -113,7 +116,6 @@ import {useUserStore} from "@/stores/user.js";
import MyUserModel from "@/models/myUserModel.js"; import MyUserModel from "@/models/myUserModel.js";
const router = useRouter(); const router = useRouter();
const currentUserName = ref("Anonyme");
const searchQuery = ref(""); const searchQuery = ref("");
const showSearch = ref(false); const showSearch = ref(false);
let currentUser = reactive(MyUserModel.getDefaultUser()); let currentUser = reactive(MyUserModel.getDefaultUser());
@@ -161,10 +163,8 @@ const logout = () => {
window.location.reload(); window.location.reload();
}; };
onBeforeMount( () => { onBeforeMount(() => {
currentUser = userStore.getCurrentUser(); currentUser = userStore.getCurrentUser();
currentUserName.value = currentUser.userName;
document.addEventListener('click', handleClickOutside); document.addEventListener('click', handleClickOutside);
}); });