maj url photo + page 404 + gestion programmation d'article
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
"use client";
|
||||
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { Image as ImageIcon, Sparkles, Youtube, X, Globe, Facebook, Linkedin, Instagram, CheckCircle, AlertCircle } from 'lucide-react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Image as ImageIcon, Sparkles, Youtube, X, Globe, Facebook, Linkedin, Instagram, CheckCircle, AlertCircle, Hash } from 'lucide-react';
|
||||
import { Business, Country } from '../../types';
|
||||
import TagInput from '../TagInput';
|
||||
import { generateBusinessDescription } from '../../lib/geminiService';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import { useUser } from '../UserProvider';
|
||||
@@ -53,19 +53,22 @@ const DashboardProfile = ({ business, setBusiness }: { business: Business, setBu
|
||||
const [videoPreviewId, setVideoPreviewId] = useState<string | null>(getYouTubeId(business.videoUrl || ''));
|
||||
const [isGenerating, setIsGenerating] = useState(false);
|
||||
const [isMounted, setIsMounted] = useState(false);
|
||||
|
||||
// Fetch countries and categories
|
||||
const [allTags, setAllTags] = useState<string[]>([]);
|
||||
// Fetch countries, categories and tags
|
||||
React.useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const [cRes, catRes] = await Promise.all([
|
||||
const [cRes, catRes, tagsRes] = await Promise.all([
|
||||
fetch('/api/countries'),
|
||||
fetch('/api/categories')
|
||||
fetch('/api/categories'),
|
||||
fetch('/api/tags')
|
||||
]);
|
||||
const cData = await cRes.json();
|
||||
const catData = await catRes.json();
|
||||
const tagsData = await tagsRes.json();
|
||||
if (!cData.error) setCountries(cData);
|
||||
if (!catData.error) setCategories(catData);
|
||||
if (!tagsData.error) setAllTags(tagsData);
|
||||
} catch (error) {
|
||||
console.error('Error fetching metadata:', error);
|
||||
}
|
||||
@@ -381,6 +384,16 @@ const DashboardProfile = ({ business, setBusiness }: { business: Business, setBu
|
||||
</div>
|
||||
<textarea name="description" rows={3} value={formData.description} onChange={handleInputChange} className="block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-brand-500 focus:border-brand-500 sm:text-sm" />
|
||||
</div>
|
||||
<div className="sm:col-span-6">
|
||||
<TagInput
|
||||
value={formData.tags || []}
|
||||
onChange={(tags) => setFormData({ ...formData, tags })}
|
||||
suggestions={allTags}
|
||||
label="Mots-clés & Tags"
|
||||
placeholder="innovation, tech, artisanat..."
|
||||
/>
|
||||
<p className="mt-1 text-[10px] text-gray-500 italic">Ces tags aideront les clients à trouver votre boutique via la recherche.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user