Ui Added Like dislike and comments icons. I Hide the comments.
This commit is contained in:
@@ -1,37 +1,53 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="shadow-md rounded-2xl bg-gray-50 border custom-border">
|
<div class="shadow-md rounded-2xl bg-gray-50 border custom-border">
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<v-card-title>
|
<v-card-title>
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row justify-between items-center">
|
||||||
<div>
|
<div class="flex items-center">
|
||||||
<img
|
<img
|
||||||
:src="props.content.createdByPortraitUrl"
|
:src="props.content.createdByPortraitUrl"
|
||||||
alt="Profile Image"
|
alt="Profile Image"
|
||||||
class="rounded-full"
|
class="rounded-full"
|
||||||
width="32px"
|
width="32px"
|
||||||
height="32px">
|
height="32px">
|
||||||
</div>
|
<div class="capitalize px-2">
|
||||||
|
{{ props.content.createdByName }}
|
||||||
<div class="capitalize px-2">
|
</div>
|
||||||
{{ props.content.createdByName }}
|
<span class="text-subtitle-2 mt-1">
|
||||||
|
{{ time_ago(props.content.createdAt) }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-subtitle-2 mt-1">
|
|
||||||
{{ time_ago(props.content.createdAt) }}
|
<v-menu>
|
||||||
</span>
|
<template v-slot:activator="{ props }">
|
||||||
|
<v-btn variant="plain" v-bind="props">
|
||||||
|
<v-icon>mdi-dots-vertical</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
<v-list>
|
||||||
|
<v-list-item @click="editContent">
|
||||||
|
<v-list-item-title>Modifier le contenu</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
|
<v-list-item @click="deleteContent">
|
||||||
|
<v-list-item-title>Effacer le contenu</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
|
<v-list-item @click="reportContent">
|
||||||
|
<v-list-item-title>Reporter le contenu</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="uppercase">
|
<div class="uppercase">
|
||||||
{{ props.content.title }}
|
{{ props.content.title }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ props.content.description }}
|
{{ props.content.description }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
|
|
||||||
|
|
||||||
<v-carousel v-if="hasUrls" hide-delimiter-background show-arrows="hover">
|
<router-link :to="'content/' + props?.content?.id">
|
||||||
|
</router-link>
|
||||||
|
<v-carousel hide-delimiters v-if="hasUrls" :show-arrows="props.content.urls.length > 1" :show-indicators="props.content.urls.length > 1">
|
||||||
<v-carousel-item
|
<v-carousel-item
|
||||||
v-for="url in props.content.urls"
|
v-for="url in props.content.urls"
|
||||||
:key="url"
|
:key="url"
|
||||||
@@ -43,12 +59,29 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="px-4">
|
<div class="px-4">
|
||||||
<div>
|
<div class="flex justify-around py-2">
|
||||||
|
<v-btn variant="plain" icon @click="likeContent">
|
||||||
|
<v-icon>mdi-thumb-up-outline</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
<v-btn variant="plain" icon @click="dislikeContent">
|
||||||
|
<v-icon>mdi-thumb-down-outline</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
<v-btn
|
||||||
|
:class="{'comment-active': hasComments}"
|
||||||
|
variant="plain"
|
||||||
|
icon
|
||||||
|
@click="toggleComments"
|
||||||
|
>
|
||||||
|
<v-icon>mdi-comment-outline</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div :class="{'hidden': !commentsVisible}">
|
||||||
<h2 class="font-sans font-semibold mt-2">Commentaires</h2>
|
<h2 class="font-sans font-semibold mt-2">Commentaires</h2>
|
||||||
<message-list :subject-id="props.content.id" :messages="messages"></message-list>
|
<message-list :subject-id="props.content.id" :messages="messages"></message-list>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="py-2">
|
<div class="py-2">
|
||||||
<post-message :subject-id="props.content.id" @message-posted="addMessage"></post-message>
|
<post-message :subject-id="props.content.id" @message-posted="addMessage"></post-message>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -56,8 +89,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {computed, reactive} from 'vue';
|
import { computed, ref, onMounted } from 'vue';
|
||||||
import {time_ago} from "@/internal_time_ago.js";
|
import { time_ago } from "@/internal_time_ago.js";
|
||||||
import MessageList from "@/views/messages/MessageList.vue";
|
import MessageList from "@/views/messages/MessageList.vue";
|
||||||
import PostMessage from "@/views/messages/PostMessage.vue";
|
import PostMessage from "@/views/messages/PostMessage.vue";
|
||||||
import YoutubePlayer from './YoutubePlayer.vue';
|
import YoutubePlayer from './YoutubePlayer.vue';
|
||||||
@@ -71,11 +104,26 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const hasUrls = computed(() => !!props.content.urls && props.content.urls.length > 0);
|
const hasUrls = computed(() => !!props.content.urls && props.content.urls.length > 0);
|
||||||
|
const commentsVisible = ref(false);
|
||||||
|
const messages = ref([]);
|
||||||
|
|
||||||
const messages = reactive([]);
|
// Propriété calculée pour vérifier s'il y a des commentaires
|
||||||
|
const hasComments = computed(() => messages.value.length > 0);
|
||||||
|
|
||||||
function addMessage(newMessage) {
|
function addMessage(newMessage) {
|
||||||
messages.unshift(newMessage);
|
messages.value.unshift(newMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleComments() {
|
||||||
|
commentsVisible.value = !commentsVisible.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function likeContent() {
|
||||||
|
console.log('Content liked');
|
||||||
|
}
|
||||||
|
|
||||||
|
function dislikeContent() {
|
||||||
|
console.log('Content disliked');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getComponent(url) {
|
function getComponent(url) {
|
||||||
@@ -85,6 +133,18 @@ function getComponent(url) {
|
|||||||
return ImageViewer;
|
return ImageViewer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editContent() {
|
||||||
|
console.log('Modifier le contenu');
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteContent() {
|
||||||
|
console.log('Effacer le contenu');
|
||||||
|
}
|
||||||
|
|
||||||
|
function reportContent() {
|
||||||
|
console.log('Reporter le contenu');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -102,6 +162,14 @@ function getComponent(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.custom-border {
|
.custom-border {
|
||||||
border-color: #EAEBEC;
|
border-color: #EAEBEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-active-v-icon {
|
||||||
|
color: #DB1AAA;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user