Add Thumbnail - Work in Progress

This commit is contained in:
PascalMarchesseault
2024-11-23 10:54:31 -05:00
parent db18bd0b2a
commit 568a1ffd6c
5 changed files with 46 additions and 33 deletions

View File

@@ -19,17 +19,17 @@ const toggleHtmlEditor = () => {
<template> <template>
<div class="flex flex-col h-screen"> <div class="flex flex-col h-screen">
<!-- Titre en haut -->
<header class="text-2xl text-center py-4 bg-gray-200"> <header class="text-2xl text-center py-4 bg-gray-200">
Création de contenu Création de contenu
</header> </header>
<!-- Contenu en deux colonnes -->
<div class="flex flex-grow"> <div class="flex flex-grow">
<!-- Menu latéral -->
<aside class="side-menu flex flex-col items-center py-6 bg-gray-100 w-1/4"> <aside class="side-menu flex flex-col items-center py-6 bg-gray-100 w-1/4">
<div class="text-xl uppercase mb-6">Éditeurs de contenu</div> <div class="text-xl uppercase mb-6">Éditeurs de contenu</div>
<!-- Le bouton Quicky est plus visible quand il est actif -->
<v-btn <v-btn
:variant="showQuickyEditor ? 'elevated' : 'plain'" :variant="showQuickyEditor ? 'elevated' : 'plain'"
@click="toggleQuickyEditor" @click="toggleQuickyEditor"
@@ -37,14 +37,14 @@ const toggleHtmlEditor = () => {
> >
Quicky Quicky
</v-btn> </v-btn>
<!-- Le bouton Article est plus visible quand il est actif -->
<!-- <v-btn--> <v-btn
<!-- :variant="showHtmlEditor ? 'elevated' : 'plain'"--> :variant="showHtmlEditor ? 'elevated' : 'plain'"
<!-- @click="toggleHtmlEditor"--> @click="toggleHtmlEditor"
<!-- class="normal-button"--> class="normal-button"
<!-- >--> >
<!-- Article--> Article
<!-- </v-btn>--> </v-btn>
</aside> </aside>
<!-- Contenu principal --> <!-- Contenu principal -->
@@ -68,12 +68,12 @@ const toggleHtmlEditor = () => {
} }
.v-btn { .v-btn {
width: 80%; /* Ajuster la largeur des boutons */ width: 80%;
} }
.normal-button { .normal-button {
padding: 0.5rem 1rem; /* Taille normale des boutons */ padding: 0.5rem 1rem;
font-size: 1rem; /* Ajuster la taille du texte */ font-size: 1rem;
} }
header { header {

View File

@@ -18,8 +18,10 @@
</template> </template>
</div> </div>
<template v-slot:empty>
Il n'y a pas plus de contenus
<template v-slot:empty >
<div class="py-2" :style="{color:branding.colors.onSurface}">Il n'y a pas plus de contenu</div>
</template> </template>
<template v-slot:error> <template v-slot:error>
@@ -34,7 +36,9 @@ import { ref, onMounted, onBeforeUnmount, watch } from 'vue';
import ContentCardNormal from "@/views/contents/contentcards/NContentCard.vue"; import ContentCardNormal from "@/views/contents/contentcards/NContentCard.vue";
import ContentCardSm from "@/views/contents/contentcards/SmContentCard.vue"; import ContentCardSm from "@/views/contents/contentcards/SmContentCard.vue";
import { useClient } from '@/plugins/api.js'; import { useClient } from '@/plugins/api.js';
import { useBrandingStore } from "@/stores/brandingStore.js";
const branding = useBrandingStore();
const props = defineProps({ const props = defineProps({
creatorId: { creatorId: {
type: String, type: String,

View File

@@ -8,7 +8,7 @@ const client = useClient();
const title = ref(''); const title = ref('');
const message = ref(''); const message = ref('');
const files = ref([]); const files = ref([]);
const Thumbnail = ref([]); const Thumbnail = ref();
const externalUrls = ref([]); const externalUrls = ref([]);
const creatorProfileStore = useCreatorProfileStore(); const creatorProfileStore = useCreatorProfileStore();
@@ -27,9 +27,18 @@ async function publishPost() {
formData.append('creatorId', creatorProfileStore.creator.id); formData.append('creatorId', creatorProfileStore.creator.id);
formData.append('title', title.value); formData.append('title', title.value);
formData.append('description', message.value); formData.append('description', message.value);
formData.append('thumbnail', Thumbnail);
files.value.forEach(file => { files.value.forEach(file => {
formData.append('files', file); formData.append('files', file);
}); });
externalUrls.value.forEach(externalUrl => { externalUrls.value.forEach(externalUrl => {
formData.append('externalUrls', externalUrl); formData.append('externalUrls', externalUrl);
}); });
@@ -48,6 +57,7 @@ async function publishPost() {
title.value = ''; title.value = '';
message.value = ''; message.value = '';
files.value = []; files.value = [];
Thumbnail.value = null;
externalUrls.value = []; externalUrls.value = [];
} catch (error) { } catch (error) {
console.error(error); console.error(error);
@@ -58,10 +68,13 @@ const cancelPost = () => {
title.value = ''; title.value = '';
message.value = ''; message.value = '';
files.value = []; files.value = [];
Thumbnail.value = null;
externalUrls.value = []; externalUrls.value = [];
}; };
</script> </script>
<template> <template>
<v-form> <v-form>
<v-card class="text-center rounded-xl w-[600px]"> <v-card class="text-center rounded-xl w-[600px]">
@@ -105,15 +118,16 @@ const cancelPost = () => {
<v-icon>mdi-plus</v-icon> <v-icon>mdi-plus</v-icon>
</v-btn> </v-btn>
<v-file-input v-model="Thumbnail" <v-file-input v-model="Thumbnail"
label="Thumbnail" label="Glissez votre Thumbnail"
class="p-2 custom-file-input" class="p-2 custom-file-input"
variant="outlined" variant="outlined"
multiple
dropzone dropzone
prepend-icon="" prepend-icon=""
placeholder="Glissez et déposez des fichiers ici ou cliquez pour sélectionner des fichiers" placeholder="Glissez et déposez un fichier ici ou cliquez pour sélectionner un fichier"
></v-file-input> ></v-file-input>
<v-file-input v-model="files" <v-file-input v-model="files"
label="Glissez vos images" label="Glissez vos images"
class="p-2 custom-file-input" class="p-2 custom-file-input"

View File

@@ -74,11 +74,13 @@ function hexToRgb(hex) {
<div class="p-1"> <div class="p-1">
<div class="flex flex-row justify-between items-center"> <div class="flex flex-row justify-between items-center">
<span class="text-caption mt-1">{{ time_ago(props.content.createdAt) }}</span> <span class="text-caption mt-1 px-2" :style="{color:branding.colors.onSurface}">{{ time_ago(props.content.createdAt) }}</span>
<v-menu v-if="creatorIsCurrentUser" :offset-y="true"> <v-menu v-if="creatorIsCurrentUser" :offset-y="true">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn variant="plain" v-bind="props" style="min-width: auto; padding: 0; margin-right: 4px;"> <v-btn variant="plain" v-bind="props" style="min-width: auto; padding: 0; margin-right: 4px;">
<div :style="{color:branding.colors.onSurface}">
<v-icon>mdi-dots-vertical</v-icon> <v-icon>mdi-dots-vertical</v-icon>
</div>
</v-btn> </v-btn>
</template> </template>
<v-list> <v-list>
@@ -91,7 +93,7 @@ function hexToRgb(hex) {
</div> </div>
<div class="capitalize p-2">{{ props.content.title }}</div> <div class="capitalize p-2" :style="{color:branding.colors.onSurface}">{{ props.content.title }}</div>
</div> </div>
<!-- Delete Dialog --> <!-- Delete Dialog -->

View File

@@ -4,18 +4,10 @@
<div class="px-4" <div class="px-4"
:style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary}"> :style="{ backgroundColor: brandingStore.colors.primary, color: brandingStore.colors.onPrimary}">
<h1>TEST</h1> <h1>TEST</h1>
<p>MODE: {{ envv }}</p>
<p>VITE_API_URL: {{ enva }}</p>
<p>VITE_STRIPE_API_KEY: {{ envb }}</p>
<donation-button :creator-id="creatorId"
:creator-name="creatorName"
:on-success-url="successUrl"
:on-cancelled-url="cancelledUrl"
></donation-button>
</div> </div>
</div> </div>
</template> </template>
@@ -38,6 +30,7 @@ const brandingStore = useBrandingStore()
const envv = import.meta.env.MODE const envv = import.meta.env.MODE
const enva = import.meta.env.VITE_API_URL const enva = import.meta.env.VITE_API_URL
const envb = import.meta.env.VITE_STRIPE_API_KEY const envb = import.meta.env.VITE_STRIPE_API_KEY
const tinymceScriptSrc = '/tinymce/js/tinymce/tinymce.min.js';
const creatorId = computed(() => brandingStore.value.id) const creatorId = computed(() => brandingStore.value.id)
const creatorName = computed(() => brandingStore.value.name) const creatorName = computed(() => brandingStore.value.name)