before gemiin

This commit is contained in:
2026-02-22 22:18:32 +01:00
parent fb33540bb0
commit 9db5cbf236
147 changed files with 7948 additions and 531 deletions

View File

@@ -2,6 +2,7 @@
import { computed, onMounted, reactive, ref } from 'vue';
import axios from 'axios';
import { usePlantsStore } from '@/stores/plants';
import { formatPlantLabel } from '@/utils/plants';
const plantsStore = usePlantsStore();
const showForm = ref(false);
const editPlant = ref(null);
@@ -29,7 +30,17 @@ const form = reactive({
temp_min_c: undefined,
plantation_mois: '', recolte_mois: '', notes: '',
});
const filteredPlants = computed(() => selectedCat.value ? plantsStore.plants.filter(p => p.categorie === selectedCat.value) : plantsStore.plants);
const filteredPlants = computed(() => {
const source = selectedCat.value
? plantsStore.plants.filter(p => p.categorie === selectedCat.value)
: plantsStore.plants;
return [...source].sort((a, b) => {
const byName = (a.nom_commun || '').localeCompare(b.nom_commun || '', 'fr', { sensitivity: 'base' });
if (byName !== 0)
return byName;
return (a.variete || '').localeCompare(b.variete || '', 'fr', { sensitivity: 'base' });
});
});
const catClass = (cat) => ({
potager: 'bg-green/20 text-green',
fleur: 'bg-orange/20 text-orange',
@@ -148,7 +159,7 @@ const __VLS_ctx = {};
let __VLS_components;
let __VLS_directives;
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "p-4 max-w-4xl mx-auto" },
...{ class: "p-4 max-w-6xl mx-auto" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "flex items-center justify-between mb-6" },
@@ -186,161 +197,194 @@ else if (!__VLS_ctx.filteredPlants.length) {
...{ class: "text-text-muted text-sm py-4" },
});
}
for (const [p] of __VLS_getVForSourceType((__VLS_ctx.filteredPlants))) {
else {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
key: (p.id),
...{ class: "bg-bg-soft rounded-lg mb-2 border border-bg-hard overflow-hidden" },
...{ class: "grid grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3 gap-3" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ onClick: (...[$event]) => {
__VLS_ctx.toggleDetail(p.id);
} },
...{ class: "p-4 flex items-start justify-between gap-4 cursor-pointer" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "flex-1 min-w-0" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "flex items-center gap-2 mb-1 flex-wrap" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({
...{ class: "text-text font-semibold" },
});
(p.nom_commun);
if (p.variete) {
for (const [p] of __VLS_getVForSourceType((__VLS_ctx.filteredPlants))) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
key: (p.id),
...{ class: "bg-bg-soft rounded-lg border border-bg-hard overflow-hidden" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ onClick: (...[$event]) => {
if (!!(__VLS_ctx.plantsStore.loading))
return;
if (!!(!__VLS_ctx.filteredPlants.length))
return;
__VLS_ctx.toggleDetail(p.id);
} },
...{ class: "p-4 flex items-start justify-between gap-4 cursor-pointer" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "flex-1 min-w-0" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "flex items-center gap-2 mb-1 flex-wrap" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({
...{ class: "text-text font-semibold" },
});
(p.nom_commun);
if (p.variete) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({
...{ class: "text-text-muted text-xs" },
});
(p.variete);
}
if (p.categorie) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({
...{ class: (['text-xs px-2 py-0.5 rounded-full font-medium', __VLS_ctx.catClass(p.categorie)]) },
});
(__VLS_ctx.catLabel(p.categorie));
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "text-text-muted text-xs flex gap-3 flex-wrap" },
});
if (p.famille) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({});
(p.famille);
}
if (p.espacement_cm) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({});
(p.espacement_cm);
}
if (p.besoin_eau) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({});
(p.besoin_eau);
}
if (p.plantation_mois) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({});
(p.plantation_mois);
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "flex items-center gap-2 shrink-0" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({
...{ class: "text-text-muted text-xs" },
});
(p.variete);
}
if (p.categorie) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({
...{ class: (['text-xs px-2 py-0.5 rounded-full font-medium', __VLS_ctx.catClass(p.categorie)]) },
});
(__VLS_ctx.catLabel(p.categorie));
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "text-text-muted text-xs flex gap-3 flex-wrap" },
});
if (p.famille) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({});
(p.famille);
}
if (p.espacement_cm) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({});
(p.espacement_cm);
}
if (p.besoin_eau) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({});
(p.besoin_eau);
}
if (p.plantation_mois) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({});
(p.plantation_mois);
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "flex items-center gap-2 shrink-0" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({
...{ class: "text-text-muted text-xs" },
});
(__VLS_ctx.openId === p.id ? '▲' : '▼');
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
...{ onClick: (...[$event]) => {
__VLS_ctx.startEdit(p);
} },
...{ class: "text-yellow text-xs hover:underline" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
...{ onClick: (...[$event]) => {
__VLS_ctx.removePlant(p.id);
} },
...{ class: "text-red text-xs hover:underline" },
});
if (__VLS_ctx.openId === p.id) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "border-t border-bg-hard px-4 pb-4 pt-3" },
});
if (p.notes) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.p, __VLS_intrinsicElements.p)({
...{ class: "text-text-muted text-sm mb-3 italic" },
});
(p.notes);
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "mb-2 flex items-center justify-between" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({
...{ class: "text-text-muted text-xs font-medium uppercase tracking-wide" },
(__VLS_ctx.openId === p.id ? '▲' : '▼');
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
...{ onClick: (...[$event]) => {
if (!!(__VLS_ctx.plantsStore.loading))
return;
if (!!(!__VLS_ctx.filteredPlants.length))
return;
__VLS_ctx.startEdit(p);
} },
...{ class: "text-yellow text-xs hover:underline" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
...{ onClick: (...[$event]) => {
if (!(__VLS_ctx.openId === p.id))
if (!!(__VLS_ctx.plantsStore.loading))
return;
__VLS_ctx.openUpload(p);
if (!!(!__VLS_ctx.filteredPlants.length))
return;
__VLS_ctx.removePlant(p.id);
} },
...{ class: "text-green text-xs hover:underline" },
...{ class: "text-red text-xs hover:underline" },
});
if (__VLS_ctx.loadingPhotos) {
if (__VLS_ctx.openId === p.id) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "text-text-muted text-xs" },
...{ class: "border-t border-bg-hard px-4 pb-4 pt-3" },
});
}
else if (!__VLS_ctx.plantPhotos.length) {
if (p.notes) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.p, __VLS_intrinsicElements.p)({
...{ class: "text-text-muted text-sm mb-3 italic" },
});
(p.notes);
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "text-text-muted text-xs mb-3" },
...{ class: "mb-2 flex items-center justify-between" },
});
}
else {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "grid grid-cols-4 gap-2 mb-3" },
__VLS_asFunctionalElement(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({
...{ class: "text-text-muted text-xs font-medium uppercase tracking-wide" },
});
for (const [m] of __VLS_getVForSourceType((__VLS_ctx.plantPhotos))) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
...{ onClick: (...[$event]) => {
if (!!(__VLS_ctx.plantsStore.loading))
return;
if (!!(!__VLS_ctx.filteredPlants.length))
return;
if (!(__VLS_ctx.openId === p.id))
return;
__VLS_ctx.openUpload(p);
} },
...{ class: "text-green text-xs hover:underline" },
});
if (__VLS_ctx.loadingPhotos) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ onClick: (...[$event]) => {
if (!(__VLS_ctx.openId === p.id))
return;
if (!!(__VLS_ctx.loadingPhotos))
return;
if (!!(!__VLS_ctx.plantPhotos.length))
return;
__VLS_ctx.lightbox = m;
} },
key: (m.id),
...{ class: "aspect-square rounded overflow-hidden bg-bg-hard relative group cursor-pointer" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.img)({
src: (m.thumbnail_url || m.url),
...{ class: "w-full h-full object-cover" },
});
if (m.identified_common) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "absolute bottom-0 left-0 right-0 bg-black/70 text-xs text-green px-1 py-0.5 truncate" },
});
(m.identified_common);
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
...{ onClick: (...[$event]) => {
if (!(__VLS_ctx.openId === p.id))
return;
if (!!(__VLS_ctx.loadingPhotos))
return;
if (!!(!__VLS_ctx.plantPhotos.length))
return;
__VLS_ctx.deletePhoto(m);
} },
...{ class: "hidden group-hover:flex absolute top-1 right-1 bg-red/80 text-white text-xs rounded px-1" },
...{ class: "text-text-muted text-xs" },
});
}
else if (!__VLS_ctx.plantPhotos.length) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "text-text-muted text-xs mb-3" },
});
}
else {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "grid grid-cols-4 gap-2 mb-3" },
});
for (const [m] of __VLS_getVForSourceType((__VLS_ctx.plantPhotos))) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ onClick: (...[$event]) => {
if (!!(__VLS_ctx.plantsStore.loading))
return;
if (!!(!__VLS_ctx.filteredPlants.length))
return;
if (!(__VLS_ctx.openId === p.id))
return;
if (!!(__VLS_ctx.loadingPhotos))
return;
if (!!(!__VLS_ctx.plantPhotos.length))
return;
__VLS_ctx.lightbox = m;
} },
key: (m.id),
...{ class: "aspect-square rounded overflow-hidden bg-bg-hard relative group cursor-pointer" },
});
__VLS_asFunctionalElement(__VLS_intrinsicElements.img)({
src: (m.thumbnail_url || m.url),
...{ class: "w-full h-full object-cover" },
});
if (m.identified_common) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
...{ class: "absolute bottom-0 left-0 right-0 bg-black/70 text-xs text-green px-1 py-0.5 truncate" },
});
(m.identified_common);
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
...{ onClick: (...[$event]) => {
if (!!(__VLS_ctx.plantsStore.loading))
return;
if (!!(!__VLS_ctx.filteredPlants.length))
return;
if (!(__VLS_ctx.openId === p.id))
return;
if (!!(__VLS_ctx.loadingPhotos))
return;
if (!!(!__VLS_ctx.plantPhotos.length))
return;
__VLS_ctx.deletePhoto(m);
} },
...{ class: "hidden group-hover:flex absolute top-1 right-1 bg-red/80 text-white text-xs rounded px-1" },
});
}
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
...{ onClick: (...[$event]) => {
if (!!(__VLS_ctx.plantsStore.loading))
return;
if (!!(!__VLS_ctx.filteredPlants.length))
return;
if (!(__VLS_ctx.openId === p.id))
return;
__VLS_ctx.openLinkPhoto(p);
} },
...{ class: "text-blue text-xs hover:underline" },
});
}
__VLS_asFunctionalElement(__VLS_intrinsicElements.button, __VLS_intrinsicElements.button)({
...{ onClick: (...[$event]) => {
if (!(__VLS_ctx.openId === p.id))
return;
__VLS_ctx.openLinkPhoto(p);
} },
...{ class: "text-blue text-xs hover:underline" },
});
}
}
if (__VLS_ctx.showForm || __VLS_ctx.editPlant) {
@@ -597,7 +641,7 @@ if (__VLS_ctx.uploadTarget) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.h3, __VLS_intrinsicElements.h3)({
...{ class: "text-text font-bold mb-4" },
});
(__VLS_ctx.uploadTarget.nom_commun);
(__VLS_ctx.formatPlantLabel(__VLS_ctx.uploadTarget));
__VLS_asFunctionalElement(__VLS_intrinsicElements.label, __VLS_intrinsicElements.label)({
...{ class: "block border-2 border-dashed border-bg-soft rounded-lg p-6 text-center cursor-pointer hover:border-green transition-colors" },
});
@@ -634,7 +678,7 @@ if (__VLS_ctx.linkTarget) {
__VLS_asFunctionalElement(__VLS_intrinsicElements.h3, __VLS_intrinsicElements.h3)({
...{ class: "text-text font-bold mb-3" },
});
(__VLS_ctx.linkTarget.nom_commun);
(__VLS_ctx.formatPlantLabel(__VLS_ctx.linkTarget));
__VLS_asFunctionalElement(__VLS_intrinsicElements.p, __VLS_intrinsicElements.p)({
...{ class: "text-text-muted text-xs mb-3" },
});
@@ -733,7 +777,7 @@ if (__VLS_ctx.lightbox) {
});
}
/** @type {__VLS_StyleScopedClasses['p-4']} */ ;
/** @type {__VLS_StyleScopedClasses['max-w-4xl']} */ ;
/** @type {__VLS_StyleScopedClasses['max-w-6xl']} */ ;
/** @type {__VLS_StyleScopedClasses['mx-auto']} */ ;
/** @type {__VLS_StyleScopedClasses['flex']} */ ;
/** @type {__VLS_StyleScopedClasses['items-center']} */ ;
@@ -759,9 +803,13 @@ if (__VLS_ctx.lightbox) {
/** @type {__VLS_StyleScopedClasses['text-text-muted']} */ ;
/** @type {__VLS_StyleScopedClasses['text-sm']} */ ;
/** @type {__VLS_StyleScopedClasses['py-4']} */ ;
/** @type {__VLS_StyleScopedClasses['grid']} */ ;
/** @type {__VLS_StyleScopedClasses['grid-cols-1']} */ ;
/** @type {__VLS_StyleScopedClasses['lg:grid-cols-2']} */ ;
/** @type {__VLS_StyleScopedClasses['2xl:grid-cols-3']} */ ;
/** @type {__VLS_StyleScopedClasses['gap-3']} */ ;
/** @type {__VLS_StyleScopedClasses['bg-bg-soft']} */ ;
/** @type {__VLS_StyleScopedClasses['rounded-lg']} */ ;
/** @type {__VLS_StyleScopedClasses['mb-2']} */ ;
/** @type {__VLS_StyleScopedClasses['border']} */ ;
/** @type {__VLS_StyleScopedClasses['border-bg-hard']} */ ;
/** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
@@ -1274,6 +1322,7 @@ var __VLS_dollars;
const __VLS_self = (await import('vue')).defineComponent({
setup() {
return {
formatPlantLabel: formatPlantLabel,
plantsStore: plantsStore,
showForm: showForm,
editPlant: editPlant,