mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-24 07:38:13 +02:00
feat: Rebranding PriceFlow + OpenRouter + i18n FR + Docker
Modifications majeures: 1. Rebranding: Pricecious → PriceFlow - Mise à jour du titre, logo et noms de projet 2. Intégration OpenRouter - Ajout comme provider IA avec filtres (chat, vision, code, reasoning, free) - Récupération dynamique des modèles et coûts - Service et router dédiés (/api/openrouter/models) 3. Internationalisation (i18n) - Installation i18next + react-i18next - Application entièrement traduite en français - Fichier de traduction: fr.json 4. Configuration Docker - docker-compose.yml avec réseau nginx_default (external) - PostgreSQL sur port 5488:5432 - Browserless sur port 3012:3000 - init.sql pour initialisation de la base de données - .env.example avec variables documentées 5. Favicon - Documentation ajoutée dans index.html pour faciliter le remplacement
This commit is contained in:
19 files changed
+914
-76
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import axios from 'axios';
|
||||
import { toast } from 'sonner';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -10,6 +11,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
|
||||
const API_URL = '/api';
|
||||
|
||||
export function ItemModal({ item, onClose, onSaved, open }) {
|
||||
const { t } = useTranslation();
|
||||
const [formData, setFormData] = useState({
|
||||
url: '',
|
||||
name: '',
|
||||
@@ -62,16 +64,16 @@ export function ItemModal({ item, onClose, onSaved, open }) {
|
||||
|
||||
if (item) {
|
||||
await axios.put(`${API_URL}/items/${item.id}`, payload);
|
||||
toast.success('Item updated');
|
||||
toast.success(t('toast.itemUpdated'));
|
||||
} else {
|
||||
await axios.post(`${API_URL}/items`, payload);
|
||||
toast.success('Item added');
|
||||
toast.success(t('toast.itemCreated'));
|
||||
}
|
||||
onSaved();
|
||||
onClose();
|
||||
} catch (error) {
|
||||
console.error('Error saving item:', error);
|
||||
toast.error('Failed to save item');
|
||||
toast.error(t('toast.itemError'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,33 +81,33 @@ export function ItemModal({ item, onClose, onSaved, open }) {
|
||||
<Dialog open={open} onOpenChange={onClose}>
|
||||
<DialogContent className="sm:max-w-[500px]">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{item ? 'Edit Item' : 'Add New Item'}</DialogTitle>
|
||||
<DialogTitle>{item ? t('itemModal.editTitle') : t('itemModal.addTitle')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<form onSubmit={handleSubmit} className="space-y-4 py-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="url">URL</Label>
|
||||
<Label htmlFor="url">{t('itemModal.url')}</Label>
|
||||
<Input
|
||||
id="url"
|
||||
type="url"
|
||||
required
|
||||
placeholder="https://example.com/product"
|
||||
placeholder={t('itemModal.urlPlaceholder')}
|
||||
value={formData.url}
|
||||
onChange={e => setFormData({ ...formData, url: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="name">Name</Label>
|
||||
<Label htmlFor="name">{t('itemModal.name')}</Label>
|
||||
<Input
|
||||
id="name"
|
||||
required
|
||||
placeholder="Product Name"
|
||||
placeholder={t('itemModal.namePlaceholder')}
|
||||
value={formData.name}
|
||||
onChange={e => setFormData({ ...formData, name: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="target_price">Target Price ($)</Label>
|
||||
<Label htmlFor="target_price">{t('itemModal.targetPrice')} (€)</Label>
|
||||
<Input
|
||||
id="target_price"
|
||||
type="number"
|
||||
@@ -116,26 +118,26 @@ export function ItemModal({ item, onClose, onSaved, open }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="selector">Selector (Optional)</Label>
|
||||
<Label htmlFor="selector">{t('itemModal.selector')}</Label>
|
||||
<Input
|
||||
id="selector"
|
||||
placeholder=".price-class"
|
||||
placeholder={t('itemModal.selectorPlaceholder')}
|
||||
value={formData.selector}
|
||||
onChange={e => setFormData({ ...formData, selector: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="profile">Notification Profile</Label>
|
||||
<Label htmlFor="profile">{t('itemModal.notificationProfile')}</Label>
|
||||
<Select
|
||||
value={formData.notification_profile_id}
|
||||
onValueChange={(value) => setFormData({ ...formData, notification_profile_id: value })}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select a profile" />
|
||||
<SelectValue placeholder={t('itemModal.selectProfile')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="none">None</SelectItem>
|
||||
<SelectItem value="none">{t('itemModal.noProfile')}</SelectItem>
|
||||
{profiles.map(p => (
|
||||
<SelectItem key={p.id} value={p.id.toString()}>{p.name}</SelectItem>
|
||||
))}
|
||||
@@ -143,27 +145,27 @@ export function ItemModal({ item, onClose, onSaved, open }) {
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="tags">Tags</Label>
|
||||
<Label htmlFor="tags">{t('itemModal.tags')}</Label>
|
||||
<Input
|
||||
id="tags"
|
||||
placeholder="tech, home, gift (comma separated)"
|
||||
placeholder={t('itemModal.tagsPlaceholder')}
|
||||
value={formData.tags}
|
||||
onChange={e => setFormData({ ...formData, tags: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="description">Description</Label>
|
||||
<Label htmlFor="description">{t('itemModal.description')}</Label>
|
||||
<textarea
|
||||
id="description"
|
||||
className="flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
placeholder="Add notes about this item..."
|
||||
placeholder={t('itemModal.descriptionPlaceholder')}
|
||||
value={formData.description}
|
||||
onChange={e => setFormData({ ...formData, description: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="outline" onClick={onClose}>Cancel</Button>
|
||||
<Button type="submit">Save Item</Button>
|
||||
<Button type="button" variant="outline" onClick={onClose}>{t('common.cancel')}</Button>
|
||||
<Button type="submit">{t('itemModal.save')}</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
|
||||
Reference in new issue
Block a user