feat: implement hierarchical category management with parent-child relationships and enhance category creation dialog

This commit is contained in:
Julien Froidefond
2025-11-27 10:29:59 +01:00
parent d7374e4129
commit 7314cb6716
9 changed files with 1048 additions and 260 deletions

View File

@@ -1,11 +1,33 @@
import type { Category, CategoryRule, Folder } from "./types"
import type { CategoryRule } from "./types"
export const defaultCategories: Omit<Category, "id">[] = [
// ═══════════════════════════════════════════════════════════════════════════
// STRUCTURE HIÉRARCHIQUE DES CATÉGORIES
// ═══════════════════════════════════════════════════════════════════════════
export interface CategoryDefinition {
slug: string // Identifiant unique pour le référencement parent/enfant
name: string
color: string
icon: string
keywords: string[]
parentSlug: string | null // Référence au slug du parent
}
export const defaultCategories: CategoryDefinition[] = [
// ═══════════════════════════════════════════════════════════════════════════
// ALIMENTATION & COURSES
// 🛒 ALIMENTATION (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
name: "Alimentation",
slug: "alimentation",
name: "🛒 Alimentation",
color: "#22c55e",
icon: "utensils",
keywords: [],
parentSlug: null,
},
{
slug: "alimentation-courses",
name: "Courses & Supermarchés",
color: "#22c55e",
icon: "shopping-cart",
keywords: [
@@ -23,9 +45,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Générique
"supermarche", "hypermarche", "epicerie", "alimentation", "courses",
],
parentId: null,
parentSlug: "alimentation",
},
{
slug: "alimentation-restaurants",
name: "Restaurants & Bars",
color: "#f97316",
icon: "utensils",
@@ -42,9 +65,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"restaurant", "brasserie", "bistrot", "cafe", "bar", "pub", "snack",
"pizzeria", "traiteur", "cantine",
],
parentId: null,
parentSlug: "alimentation",
},
{
slug: "alimentation-boulangerie",
name: "Boulangerie & Pâtisserie",
color: "#d97706",
icon: "croissant",
@@ -53,13 +77,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
"maison kayser", "eric kayser", "paul", "la mie caline", "marie blachere",
"ange", "feuillette", "le fournil", "au bon pain",
],
parentId: null,
parentSlug: "alimentation",
},
// ═══════════════════════════════════════════════════════════════════════════
// TRANSPORT & MOBILITÉ
// 🚗 TRANSPORT (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "transport",
name: "🚗 Transport",
color: "#3b82f6",
icon: "car",
keywords: [],
parentSlug: null,
},
{
slug: "transport-carburant",
name: "Carburant",
color: "#64748b",
icon: "fuel",
@@ -72,9 +105,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"essence", "gasoil", "diesel", "carburant", "station service", "sp95", "sp98",
"sans plomb", "gazole",
],
parentId: null,
parentSlug: "transport",
},
{
slug: "transport-commun",
name: "Transports en commun",
color: "#3b82f6",
icon: "train",
@@ -88,9 +122,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Générique
"transport", "titre transport", "abonnement transport",
],
parentId: null,
parentSlug: "transport",
},
{
slug: "transport-vtc",
name: "VTC & Taxi",
color: "#1e3a8a",
icon: "car-taxi",
@@ -98,9 +133,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"uber", "bolt", "kapten", "heetch", "freenow", "free now",
"taxi", "vtc", "chauffeur", "g7", "taxi bleu", "allocab",
],
parentId: null,
parentSlug: "transport",
},
{
slug: "transport-parking",
name: "Parking & Péages",
color: "#475569",
icon: "parking",
@@ -113,9 +149,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"cofiroute", "escota", "sapn", "asf", "atmb", "sftrf",
"liber-t", "telepeage", "badge autoroute",
],
parentId: null,
parentSlug: "transport",
},
{
slug: "transport-location",
name: "Location véhicule",
color: "#0891b2",
icon: "car-key",
@@ -124,9 +161,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"ada", "rent a car", "getaround", "ouicar", "drivy",
"location voiture", "location vehicule",
],
parentId: null,
parentSlug: "transport",
},
{
slug: "transport-mobilite-douce",
name: "Mobilité douce",
color: "#10b981",
icon: "bike",
@@ -139,9 +177,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Vélo
"decathlon cycle", "alltricks", "probikeshop", "velo", "cyclable",
],
parentId: null,
parentSlug: "transport",
},
{
slug: "transport-avion",
name: "Avion",
color: "#7c3aed",
icon: "plane",
@@ -155,13 +194,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Réservation
"skyscanner", "kayak", "opodo", "liligo", "google flights",
],
parentId: null,
parentSlug: "transport",
},
// ═══════════════════════════════════════════════════════════════════════════
// LOGEMENT & MAISON
// 🏠 LOGEMENT (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "logement",
name: "🏠 Logement",
color: "#f59e0b",
icon: "home",
keywords: [],
parentSlug: null,
},
{
slug: "logement-loyer",
name: "Loyer & Charges",
color: "#f59e0b",
icon: "home",
@@ -170,9 +218,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"foncia", "nexity", "orpi", "century 21", "laforet", "guy hoquet",
"agence immobiliere", "bail", "quittance",
],
parentId: null,
parentSlug: "logement",
},
{
slug: "logement-electricite",
name: "Électricité & Gaz",
color: "#fbbf24",
icon: "zap",
@@ -182,9 +231,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"electricite", "gaz", "energie", "compteur", "linky", "gazpar",
"direct energie", "cdiscount energie", "sowee",
],
parentId: null,
parentSlug: "logement",
},
{
slug: "logement-eau",
name: "Eau",
color: "#06b6d4",
icon: "droplet",
@@ -192,9 +242,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"veolia", "suez", "saur", "eau de paris", "sedif",
"eau", "facture eau", "compteur eau", "assainissement",
],
parentId: null,
parentSlug: "logement",
},
{
slug: "logement-bricolage",
name: "Bricolage & Jardinage",
color: "#84cc16",
icon: "hammer",
@@ -207,9 +258,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Générique
"bricolage", "outillage", "quincaillerie", "jardinage", "plante",
],
parentId: null,
parentSlug: "logement",
},
{
slug: "logement-ameublement",
name: "Ameublement & Déco",
color: "#a855f7",
icon: "sofa",
@@ -220,9 +272,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"meuble", "decoration", "deco", "literie", "matelas",
"emma matelas", "tediber", "simba", "hypnia",
],
parentId: null,
parentSlug: "logement",
},
{
slug: "logement-electromenager",
name: "Électroménager",
color: "#f43f5e",
icon: "refrigerator",
@@ -231,13 +284,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
"electromenager", "lave linge", "lave vaisselle", "refrigerateur",
"aspirateur", "four", "micro onde", "cafetiere",
],
parentId: null,
parentSlug: "logement",
},
// ═══════════════════════════════════════════════════════════════════════════
// SANTÉ & BIEN-ÊTRE
// 💊 SANTÉ (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "sante",
name: "💊 Santé",
color: "#ef4444",
icon: "heart",
keywords: [],
parentSlug: null,
},
{
slug: "sante-pharmacie",
name: "Pharmacie",
color: "#ef4444",
icon: "pill",
@@ -246,9 +308,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"docmorris", "shop pharmacie", "para",
"medicament", "ordonnance",
],
parentId: null,
parentSlug: "sante",
},
{
slug: "sante-medecins",
name: "Médecins & Spécialistes",
color: "#dc2626",
icon: "stethoscope",
@@ -259,9 +322,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"kine", "kinesitherapeute", "osteopathe", "psychologue", "psychiatre",
"doctolib", "maiia", "qare", "livi",
],
parentId: null,
parentSlug: "sante",
},
{
slug: "sante-hopital",
name: "Hôpital & Clinique",
color: "#b91c1c",
icon: "hospital",
@@ -270,9 +334,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"urgences", "hospitalisation", "imagerie", "radiologie",
"scanner", "irm", "laboratoire", "labo analyse", "biologie",
],
parentId: null,
parentSlug: "sante",
},
{
slug: "sante-optique",
name: "Optique & Audition",
color: "#f87171",
icon: "glasses",
@@ -282,9 +347,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"audioprothesiste", "audition", "appareil auditif", "audika", "amplifon",
"lentille", "verres",
],
parentId: null,
parentSlug: "sante",
},
{
slug: "sante-sport",
name: "Sport & Fitness",
color: "#14b8a6",
icon: "dumbbell",
@@ -296,9 +362,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"piscine", "tennis", "golf", "escalade", "yoga", "pilates",
"crossfit", "cours collectif", "coach sportif",
],
parentId: null,
parentSlug: "sante",
},
{
slug: "sante-beaute",
name: "Beauté & Soins",
color: "#ec4899",
icon: "sparkles",
@@ -311,13 +378,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
"estheticienne", "institut beaute", "manucure", "pedicure",
"spa", "massage", "epilation",
],
parentId: null,
parentSlug: "sante",
},
// ═══════════════════════════════════════════════════════════════════════════
// LOISIRS & DIVERTISSEMENT
// 🎬 LOISIRS (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "loisirs",
name: "🎬 Loisirs",
color: "#8b5cf6",
icon: "gamepad",
keywords: [],
parentSlug: null,
},
{
slug: "loisirs-streaming",
name: "Streaming & VOD",
color: "#e11d48",
icon: "tv",
@@ -327,9 +403,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"mycanal", "salto", "molotov", "adn", "crunchyroll", "wakanim",
"dazn", "rmc sport", "bein sport",
],
parentId: null,
parentSlug: "loisirs",
},
{
slug: "loisirs-musique",
name: "Musique & Podcasts",
color: "#22c55e",
icon: "music",
@@ -338,9 +415,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"soundcloud", "youtube music", "qobuz", "napster",
"audible", "podcast", "audiobook",
],
parentId: null,
parentSlug: "loisirs",
},
{
slug: "loisirs-cinema",
name: "Cinéma & Spectacles",
color: "#8b5cf6",
icon: "film",
@@ -353,9 +431,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"zenith", "olympia", "bercy", "accor arena", "stade de france",
"fnac spectacles", "ticketmaster", "digitick", "billetreduc",
],
parentId: null,
parentSlug: "loisirs",
},
{
slug: "loisirs-jeux",
name: "Jeux vidéo",
color: "#6366f1",
icon: "gamepad",
@@ -364,9 +443,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"ea games", "ubisoft", "activision", "blizzard",
"micromania", "game", "jeux video",
],
parentId: null,
parentSlug: "loisirs",
},
{
slug: "loisirs-livres",
name: "Livres & Presse",
color: "#0ea5e9",
icon: "book",
@@ -379,9 +459,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"cafeyn", "epresse", "kiosque", "magazine", "journal", "presse",
"librairie", "livre", "bouquin",
],
parentId: null,
parentSlug: "loisirs",
},
{
slug: "loisirs-sorties",
name: "Sorties & Activités",
color: "#f472b6",
icon: "ticket",
@@ -394,14 +475,23 @@ export const defaultCategories: Omit<Category, "id">[] = [
"escape game", "bowling", "karting", "laser game", "paintball",
"accrobranche", "parc attractions", "zoo", "aquarium",
],
parentId: null,
parentSlug: "loisirs",
},
// ═══════════════════════════════════════════════════════════════════════════
// SHOPPING & MODE
// 👕 SHOPPING (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
name: "Vêtements",
slug: "shopping",
name: "👕 Shopping",
color: "#06b6d4",
icon: "shopping-bag",
keywords: [],
parentSlug: null,
},
{
slug: "shopping-vetements",
name: "Vêtements & Mode",
color: "#06b6d4",
icon: "shirt",
keywords: [
@@ -423,9 +513,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Générique
"vetement", "mode", "textile", "habillement", "chaussure",
],
parentId: null,
parentSlug: "shopping",
},
{
slug: "shopping-hightech",
name: "High-Tech",
color: "#3b82f6",
icon: "smartphone",
@@ -438,9 +529,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Générique
"informatique", "ordinateur", "tablette", "telephone", "accessoire",
],
parentId: null,
parentSlug: "shopping",
},
{
slug: "shopping-ecommerce",
name: "E-commerce",
color: "#f59e0b",
icon: "package",
@@ -449,13 +541,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
"veepee", "showroomprive", "privatesportshop", "bazarchic",
"leboncoin", "vinted", "vestiaire collective", "ebay", "etsy",
],
parentId: null,
parentSlug: "shopping",
},
// ═══════════════════════════════════════════════════════════════════════════
// ABONNEMENTS & TÉLÉCOMS
// 📱 ABONNEMENTS (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "abonnements",
name: "📱 Abonnements",
color: "#8b5cf6",
icon: "repeat",
keywords: [],
parentSlug: null,
},
{
slug: "abonnements-telecom",
name: "Téléphonie & Internet",
color: "#8b5cf6",
icon: "wifi",
@@ -469,9 +570,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Générique
"internet", "fibre", "adsl", "forfait mobile", "telephone mobile", "operateur",
],
parentId: null,
parentSlug: "abonnements",
},
{
slug: "abonnements-divers",
name: "Abonnements divers",
color: "#a78bfa",
icon: "repeat",
@@ -483,13 +585,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Autres
"abonnement", "mensualite", "prelevement", "cotisation",
],
parentId: null,
parentSlug: "abonnements",
},
// ═══════════════════════════════════════════════════════════════════════════
// FINANCE & ASSURANCE
// 💰 FINANCE (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "finance",
name: "💰 Finance",
color: "#64748b",
icon: "landmark",
keywords: [],
parentSlug: null,
},
{
slug: "finance-banque",
name: "Banque & Frais bancaires",
color: "#64748b",
icon: "landmark",
@@ -505,9 +616,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"frais bancaire", "agios", "commission intervention", "cotisation carte",
"frais tenue compte", "frais virement",
],
parentId: null,
parentSlug: "finance",
},
{
slug: "finance-assurance",
name: "Assurances",
color: "#0369a1",
icon: "shield",
@@ -520,9 +632,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"assurance auto", "assurance habitation", "assurance vie",
"responsabilite civile", "garantie", "prime assurance",
],
parentId: null,
parentSlug: "finance",
},
{
slug: "finance-mutuelle",
name: "Mutuelle & Prévoyance",
color: "#0891b2",
icon: "heart-pulse",
@@ -533,9 +646,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Générique
"sante", "prevoyance", "complementaire sante", "remboursement soin",
],
parentId: null,
parentSlug: "finance",
},
{
slug: "finance-impots",
name: "Impôts & Taxes",
color: "#dc2626",
icon: "receipt",
@@ -544,9 +658,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"taxe habitation", "taxe fonciere", "impot revenu",
"prelevement source", "csg", "crds", "urssaf",
],
parentId: null,
parentSlug: "finance",
},
{
slug: "finance-epargne",
name: "Épargne & Investissement",
color: "#16a34a",
icon: "piggy-bank",
@@ -557,9 +672,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"etoro", "interactive brokers", "scalable capital",
"crypto", "bitcoin", "ethereum", "binance", "coinbase", "kraken",
],
parentId: null,
parentSlug: "finance",
},
{
slug: "finance-credit",
name: "Crédit & Emprunt",
color: "#991b1b",
icon: "banknote",
@@ -568,13 +684,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
"sofinco", "cetelem", "cofidis", "oney", "floa", "younited",
"credit immobilier", "pret immo", "pret conso",
],
parentId: null,
parentSlug: "finance",
},
// ═══════════════════════════════════════════════════════════════════════════
// REVENUS
// 💵 REVENUS (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "revenus",
name: "💵 Revenus",
color: "#10b981",
icon: "wallet",
keywords: [],
parentSlug: null,
},
{
slug: "revenus-salaire",
name: "Salaire",
color: "#10b981",
icon: "wallet",
@@ -582,9 +707,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"salaire", "paie", "paye", "virement salaire", "bulletin",
"net a payer", "remuneration",
],
parentId: null,
parentSlug: "revenus",
},
{
slug: "revenus-allocations",
name: "Allocations & Aides",
color: "#34d399",
icon: "hand-coins",
@@ -593,9 +719,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"pole emploi", "france travail", "are", "chomage", "indemnite",
"cpam", "secu", "securite sociale", "ameli",
],
parentId: null,
parentSlug: "revenus",
},
{
slug: "revenus-remboursements",
name: "Remboursements",
color: "#6ee7b7",
icon: "undo",
@@ -603,9 +730,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"remboursement", "avoir", "retour", "rembourse", "credit note",
"annulation", "refund",
],
parentId: null,
parentSlug: "revenus",
},
{
slug: "revenus-divers",
name: "Revenus divers",
color: "#a7f3d0",
icon: "coins",
@@ -614,13 +742,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
"dividende", "interets", "loyer percu", "pension",
"retraite", "rente",
],
parentId: null,
parentSlug: "revenus",
},
// ═══════════════════════════════════════════════════════════════════════════
// VOYAGE & HÉBERGEMENT
// ✈️ VOYAGE (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "voyage",
name: "✈️ Voyage",
color: "#a855f7",
icon: "plane",
keywords: [],
parentSlug: null,
},
{
slug: "voyage-hotel",
name: "Hôtel & Hébergement",
color: "#a855f7",
icon: "bed",
@@ -635,9 +772,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Générique
"hotel", "hebergement", "nuitee", "reservation hotel",
],
parentId: null,
parentSlug: "voyage",
},
{
slug: "voyage-sejours",
name: "Voyages & Séjours",
color: "#c084fc",
icon: "luggage",
@@ -648,13 +786,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
// Générique
"voyage", "sejour", "vacances", "croisiere", "circuit",
],
parentId: null,
parentSlug: "voyage",
},
// ═══════════════════════════════════════════════════════════════════════════
// ÉDUCATION & ENFANTS
// 📚 ÉDUCATION (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "education",
name: "📚 Éducation",
color: "#0284c7",
icon: "graduation-cap",
keywords: [],
parentSlug: null,
},
{
slug: "education-formation",
name: "Éducation & Formation",
color: "#0284c7",
icon: "graduation-cap",
@@ -664,9 +811,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"formation", "cours", "udemy", "coursera", "openclassrooms",
"linkedin learning", "masterclass",
],
parentId: null,
parentSlug: "education",
},
{
slug: "education-enfants",
name: "Enfants & Famille",
color: "#f472b6",
icon: "baby",
@@ -681,14 +829,15 @@ export const defaultCategories: Omit<Category, "id">[] = [
"creche", "nounou", "assistante maternelle", "baby sitting",
"pajemploi", "cesu",
],
parentId: null,
parentSlug: "education",
},
// ═══════════════════════════════════════════════════════════════════════════
// ANIMAUX
// 🐕 ANIMAUX (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
name: "Animaux",
slug: "animaux",
name: "🐕 Animaux",
color: "#ea580c",
icon: "paw-print",
keywords: [
@@ -701,13 +850,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
"croquettes", "alimentation animale", "accessoire animal",
"chien", "chat", "animal",
],
parentId: null,
parentSlug: null, // Pas de sous-catégories, reste au niveau racine
},
// ═══════════════════════════════════════════════════════════════════════════
// AUTO & MOTO
// 🔧 AUTO & MOTO (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "auto",
name: "🔧 Auto & Moto",
color: "#78716c",
icon: "car",
keywords: [],
parentSlug: null,
},
{
slug: "auto-entretien",
name: "Entretien véhicule",
color: "#78716c",
icon: "wrench",
@@ -722,9 +880,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"garage", "reparation auto", "vidange", "revision", "controle technique",
"pneu", "freins", "entretien voiture",
],
parentId: null,
parentSlug: "auto",
},
{
slug: "auto-achat",
name: "Achat véhicule",
color: "#57534e",
icon: "car",
@@ -733,13 +892,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
"arval", "alphabet", "ald automotive",
"la centrale", "leboncoin auto", "autoscout", "aramis",
],
parentId: null,
parentSlug: "auto",
},
// ═══════════════════════════════════════════════════════════════════════════
// DONS & CADEAUX
// 🎁 DONS & CADEAUX (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "dons",
name: "🎁 Dons & Cadeaux",
color: "#f43f5e",
icon: "gift",
keywords: [],
parentSlug: null,
},
{
slug: "dons-charite",
name: "Dons & Charité",
color: "#fb7185",
icon: "heart-handshake",
@@ -748,9 +916,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"croix rouge", "medecins sans frontieres", "msf", "unicef",
"fondation", "association caritative", "solidarite",
],
parentId: null,
parentSlug: "dons",
},
{
slug: "dons-cadeaux",
name: "Cadeaux",
color: "#f43f5e",
icon: "gift",
@@ -759,13 +928,22 @@ export const defaultCategories: Omit<Category, "id">[] = [
"fleuriste", "interflora", "aquarelle", "florajet",
"bijouterie", "joaillerie", "pandora", "swarovski", "histoire d'or",
],
parentId: null,
parentSlug: "dons",
},
// ═══════════════════════════════════════════════════════════════════════════
// DIVERS
// DIVERS (Parent)
// ═══════════════════════════════════════════════════════════════════════════
{
slug: "divers",
name: "❓ Divers",
color: "#71717a",
icon: "more-horizontal",
keywords: [],
parentSlug: null,
},
{
slug: "divers-tabac",
name: "Tabac & Jeux",
color: "#9ca3af",
icon: "cigarette",
@@ -774,9 +952,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"loto", "euromillions", "grattage", "pari sportif", "betclic", "winamax",
"cigarette", "vapoteuse", "ecig",
],
parentId: null,
parentSlug: "divers",
},
{
slug: "divers-retraits",
name: "Retraits DAB",
color: "#71717a",
icon: "banknote",
@@ -784,9 +963,10 @@ export const defaultCategories: Omit<Category, "id">[] = [
"retrait", "dab", "distributeur", "retrait especes", "retrait cb",
"cash", "liquide",
],
parentId: null,
parentSlug: "divers",
},
{
slug: "divers-virements",
name: "Virements & Transferts",
color: "#52525b",
icon: "arrow-right-left",
@@ -794,69 +974,82 @@ export const defaultCategories: Omit<Category, "id">[] = [
"virement", "vir ", "transfert", "virement emis", "virement permanent",
"paypal", "wise", "western union", "moneygram",
],
parentId: null,
parentSlug: "divers",
},
{
slug: "divers-non-categorise",
name: "Non catégorisé",
color: "#d4d4d8",
icon: "help-circle",
keywords: [],
parentId: null,
parentSlug: "divers",
},
]
// ═══════════════════════════════════════════════════════════════════════════
// RÈGLES DE CATÉGORISATION AVANCÉES
// ═══════════════════════════════════════════════════════════════════════════
export const defaultCategoryRules: Omit<CategoryRule, "id" | "categoryId">[] = [
// Ces règles seront associées aux catégories correspondantes lors du seeding
// Format: pattern à matcher, isRegex indique si c'est une expression régulière
export interface CategoryRuleDefinition extends Omit<CategoryRule, "id" | "categoryId"> {
categorySlug: string // Référence au slug de la catégorie
}
export const defaultCategoryRules: CategoryRuleDefinition[] = [
// Salaire - patterns typiques de virements salaire
{ pattern: "^VIR(EMENT)? (RECU )?.*SALAIRE", isRegex: true },
{ pattern: "^VIR(EMENT)? (RECU )?.*PAIE", isRegex: true },
{ categorySlug: "revenus-salaire", pattern: "^VIR(EMENT)? (RECU )?.*SALAIRE", isRegex: true },
{ categorySlug: "revenus-salaire", pattern: "^VIR(EMENT)? (RECU )?.*PAIE", isRegex: true },
// Loyer - patterns de prélèvement loyer
{ pattern: "^PRLV.*LOYER", isRegex: true },
{ pattern: "^PRLV.*FONCIA", isRegex: true },
{ pattern: "^PRLV.*NEXITY", isRegex: true },
{ categorySlug: "logement-loyer", pattern: "^PRLV.*LOYER", isRegex: true },
{ categorySlug: "logement-loyer", pattern: "^PRLV.*FONCIA", isRegex: true },
{ categorySlug: "logement-loyer", pattern: "^PRLV.*NEXITY", isRegex: true },
// EDF/Engie
{ pattern: "^PRLV.*EDF", isRegex: true },
{ pattern: "^PRLV.*ENGIE", isRegex: true },
{ pattern: "^PRLV.*TOTAL.?ENERGIE", isRegex: true },
{ categorySlug: "logement-electricite", pattern: "^PRLV.*EDF", isRegex: true },
{ categorySlug: "logement-electricite", pattern: "^PRLV.*ENGIE", isRegex: true },
{ categorySlug: "logement-electricite", pattern: "^PRLV.*TOTAL.?ENERGIE", isRegex: true },
// Télécom
{ pattern: "^PRLV.*FREE( MOBILE)?", isRegex: true },
{ pattern: "^PRLV.*ORANGE", isRegex: true },
{ pattern: "^PRLV.*SFR", isRegex: true },
{ pattern: "^PRLV.*BOUYGUES", isRegex: true },
{ categorySlug: "abonnements-telecom", pattern: "^PRLV.*FREE( MOBILE)?", isRegex: true },
{ categorySlug: "abonnements-telecom", pattern: "^PRLV.*ORANGE", isRegex: true },
{ categorySlug: "abonnements-telecom", pattern: "^PRLV.*SFR", isRegex: true },
{ categorySlug: "abonnements-telecom", pattern: "^PRLV.*BOUYGUES", isRegex: true },
// Assurances
{ pattern: "^PRLV.*AXA", isRegex: true },
{ pattern: "^PRLV.*MAIF", isRegex: true },
{ pattern: "^PRLV.*MACIF", isRegex: true },
{ pattern: "^PRLV.*MATMUT", isRegex: true },
{ categorySlug: "finance-assurance", pattern: "^PRLV.*AXA", isRegex: true },
{ categorySlug: "finance-assurance", pattern: "^PRLV.*MAIF", isRegex: true },
{ categorySlug: "finance-assurance", pattern: "^PRLV.*MACIF", isRegex: true },
{ categorySlug: "finance-assurance", pattern: "^PRLV.*MATMUT", isRegex: true },
// Impôts
{ pattern: "^PRLV.*DGFIP", isRegex: true },
{ pattern: "^PRLV.*TRESOR PUBLIC", isRegex: true },
{ pattern: "IMPOT", isRegex: false },
{ categorySlug: "finance-impots", pattern: "^PRLV.*DGFIP", isRegex: true },
{ categorySlug: "finance-impots", pattern: "^PRLV.*TRESOR PUBLIC", isRegex: true },
{ categorySlug: "finance-impots", pattern: "IMPOT", isRegex: false },
// Remboursements
{ pattern: "^VIR(EMENT)? (RECU )?.*CPAM", isRegex: true },
{ pattern: "^VIR(EMENT)? (RECU )?.*AMELI", isRegex: true },
{ pattern: "REMBOURSEMENT", isRegex: false },
{ categorySlug: "revenus-remboursements", pattern: "^VIR(EMENT)? (RECU )?.*CPAM", isRegex: true },
{ categorySlug: "revenus-remboursements", pattern: "^VIR(EMENT)? (RECU )?.*AMELI", isRegex: true },
{ categorySlug: "revenus-remboursements", pattern: "REMBOURSEMENT", isRegex: false },
// CAF
{ pattern: "^VIR(EMENT)? (RECU )?.*CAF", isRegex: true },
{ pattern: "ALLOCATION", isRegex: false },
{ categorySlug: "revenus-allocations", pattern: "^VIR(EMENT)? (RECU )?.*CAF", isRegex: true },
{ categorySlug: "revenus-allocations", pattern: "ALLOCATION", isRegex: false },
// Retraits
{ pattern: "^RETRAIT DAB", isRegex: true },
{ pattern: "^RET DAB", isRegex: true },
{ categorySlug: "divers-retraits", pattern: "^RETRAIT DAB", isRegex: true },
{ categorySlug: "divers-retraits", pattern: "^RET DAB", isRegex: true },
]
// ═══════════════════════════════════════════════════════════════════════════
// DOSSIER RACINE
// ═══════════════════════════════════════════════════════════════════════════
export interface Folder {
id: string
name: string
parentId: string | null
color: string
icon: string
}
export const defaultRootFolder: Folder = {
id: "folder-root",
name: "Mes Comptes",
@@ -864,4 +1057,3 @@ export const defaultRootFolder: Folder = {
color: "#6366f1",
icon: "folder",
}