Skip to content
Snippets Groups Projects
Commit d0ee5ec0 authored by Gilgard's avatar Gilgard
Browse files

minor styling

parent bf17535e
No related branches found
No related tags found
1 merge request!32Community member list
<template> <template>
<div <div
class="max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700" class="min-w-full md:min-w-0 md:w-96 my-4 py-8 bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700"
> >
<div v-show="isCurrentUser" class="flex justify-end px-4 pt-4"> <div v-show="isCurrentUser" class="flex absolute justify-end px-4 pt-4">
<button <button
id="dropdownDefault" id="dropdownDefault"
data-dropdown-toggle="dropdown" data-dropdown-toggle="dropdown"
@click="dropdown = !dropdown" @click="dropdown = !dropdown"
class="hidden sm:inline-block text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-1.5" class="w-10 h-10 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-1.5"
type="button" type="button"
> >
<svg <svg
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
<div <div
id="dropdown" id="dropdown"
v-show="dropdown" v-show="dropdown"
zindex="2"
class="z-10 w-44 text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700" class="z-10 w-44 text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700"
> >
<ul class="py-1" aria-labelledby="dropdownDefault"> <ul class="py-1" aria-labelledby="dropdownDefault">
...@@ -67,6 +66,7 @@ ...@@ -67,6 +66,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<div class="flex flex-col items-center pb-10"> <div class="flex flex-col items-center pb-10">
<img <img
class="mb-3 w-24 h-24 rounded-full shadow-lg" class="mb-3 w-24 h-24 rounded-full shadow-lg"
...@@ -95,8 +95,7 @@ ...@@ -95,8 +95,7 @@
<script> <script>
import RatingComponent from "@/components/UserProfileComponents/RatingComponent.vue"; import RatingComponent from "@/components/UserProfileComponents/RatingComponent.vue";
import { parseCurrentUser } from "@/utils/token-utils"; import { parseCurrentUser } from "@/utils/token-utils";
import { getUser, getRenterRating, getOwnerRating } from "@/utils/apiutil"; import { getUser, getAverageRating } from "@/utils/apiutil";
import router from "@/router";
export default { export default {
name: "LargeProfileCard", name: "LargeProfileCard",
...@@ -106,8 +105,8 @@ export default { ...@@ -106,8 +105,8 @@ export default {
currentUser: {}, currentUser: {},
id: -1, id: -1,
isCurrentUser: false, isCurrentUser: false,
renterRating: -1, //getRenterRating(this.userID), renterRating: -1,
ownerRating: -1, //getOwnerRating(this.userID), ownerRating: -1,
dropdown: false, dropdown: false,
}; };
}, },
...@@ -116,21 +115,25 @@ export default { ...@@ -116,21 +115,25 @@ export default {
}, },
methods: { methods: {
async getUser() { async getUser() {
this.currentUser = parseCurrentUser(); this.currentUser = await parseCurrentUser();
this.id = router.currentRoute.value.params.id; this.id = await this.$router.currentRoute.value.params.id;
if (this.id == this.currentUser.account_id) {
if (this.id == this.currentUser.accountId) {
this.isCurrentUser = true; this.isCurrentUser = true;
this.user = this.currentUser; this.user = this.currentUser;
return; return;
} }
this.user = await getUser(this.id); this.user = await getUser(this.id);
this.renterRating = getRenterRating(this.id); let rating = await getAverageRating(this.id);
this.ownerRating = getOwnerRating(this.id); if (rating >= 0 && rating <= 5) {
this.renterRating = rating;
this.ownerRating = rating;
}
}, },
getProfilePicture() { getProfilePicture() {
/* if (this.user.picture != "") { if (this.user.picture != "") {
return this.user.picture; return this.user.picture;
} */ }
return "../assets/defaultUserProfileImage.jpg"; return "../assets/defaultUserProfileImage.jpg";
}, },
}, },
......
<template> <template>
<ul v-if="compRating != -1" class="flex justify-center"> <ul v-if="rating != -1" class="flex justify-center">
<li> <li>
<p class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400"> <p class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400">
{{ ratingType }}:&nbsp; {{ ratingType }}:&nbsp;
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</li> </li>
<li> <li>
<p class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400"> <p class="ml-2 text-sm font-medium text-gray-500 dark:text-gray-400">
{{ compRating }} out of 5 {{ rating }} out of 5
</p> </p>
</li> </li>
</ul> </ul>
...@@ -40,11 +40,6 @@ ...@@ -40,11 +40,6 @@
<script> <script>
export default { export default {
name: "RatingComponent", name: "RatingComponent",
data() {
return {
compRating: this.rating + 0,
};
},
props: { props: {
rating: Number, rating: Number,
ratingType: String, ratingType: String,
......
<!-- View for looking at different profile display methods -->
<template> <template>
<large-profile-card :isCurrentUser="true" /> <div class="h-screen bg-gray-200 grid place-items-center">
<large-profile-card :isCurrentUser="true" class="align-top" />
</div>
</template> </template>
<script> <script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment