This commit is contained in:
193
GUIDE_COMPLET.md
Normal file
193
GUIDE_COMPLET.md
Normal file
@ -0,0 +1,193 @@
|
||||
# GUIDE COMPLET — Prompts Cursor
|
||||
# App Marchand de Biens — Expo + PocketBase
|
||||
|
||||
---
|
||||
|
||||
## PROMPT 1 — Fondation (Setup + Auth + Navigation)
|
||||
|
||||
Lis .cursorrules et AGENTS.md.
|
||||
|
||||
Je crée une app React Native Expo pour marchand de biens immobiliers.
|
||||
Backend : PocketBase sur http://localhost:8090 (déjà lancé, collections déjà créées).
|
||||
|
||||
Collections existantes dans PocketBase :
|
||||
users, etapes_pipeline, contacts, biens, analyses_financieres,
|
||||
visites, taches, notes_biens, documents_biens, devis_travaux
|
||||
|
||||
PARTIE A — Initialisation :
|
||||
Dans le dossier actuel, initialise l'app Expo :
|
||||
npx create-expo-app@latest app --template tabs
|
||||
cd app
|
||||
|
||||
Installe ces dépendances dans app/ :
|
||||
pocketbase
|
||||
@tanstack/react-query
|
||||
zustand
|
||||
nativewind
|
||||
tailwindcss
|
||||
@react-native-async-storage/async-storage
|
||||
expo-image-picker
|
||||
expo-document-picker
|
||||
expo-haptics
|
||||
|
||||
PARTIE B — Fichier .env.local à la racine de app/ :
|
||||
EXPO_PUBLIC_PB_URL=http://localhost:8090
|
||||
|
||||
PARTIE C — Service PocketBase app/services/pocketbase.ts :
|
||||
- Client singleton PocketBase
|
||||
- Persistance session avec AsyncStorage
|
||||
- Export : pb, getCurrentUserId(), isAuthenticated()
|
||||
|
||||
PARTIE D — Types TypeScript app/types/collections.ts :
|
||||
Interfaces pour toutes les collections (étendent RecordModel de pocketbase) :
|
||||
UserRecord, BienRecord, ContactRecord, VisiteRecord, TacheRecord,
|
||||
EtapePipelineRecord, AnalyseFinanciereRecord, NoteRecord, DocumentRecord, DevisRecord
|
||||
+ types BienCreate, BienUpdate (Omit + Partial)
|
||||
|
||||
PARTIE E — Constantes app/constants/metier.ts :
|
||||
ETAPES_DEFAUT (9 étapes avec couleurs)
|
||||
CATEGORIES_CONTACTS avec labels français
|
||||
TYPES_BIENS avec labels français
|
||||
AVIS_VISITE avec labels et couleurs
|
||||
|
||||
PARTIE F — Auth :
|
||||
app/context/AuthContext.tsx : login, logout, user courant, redirect auto
|
||||
app/app/auth/login.tsx : email + password, couleur primaire #1D4ED8
|
||||
app/app/auth/register.tsx : email, password, nom, prénom
|
||||
|
||||
PARTIE G — Navigation :
|
||||
5 onglets dans app/app/(tabs)/ :
|
||||
- index.tsx → Dashboard (icône grid)
|
||||
- biens.tsx → Biens (icône home)
|
||||
- visites.tsx → Visites (icône clipboard)
|
||||
- contacts.tsx → Contacts (icône people)
|
||||
- agenda.tsx → Agenda (icône calendar)
|
||||
|
||||
Écrans de détail :
|
||||
- app/bien/[id].tsx
|
||||
- app/bien/nouveau.tsx
|
||||
- app/contact/[id].tsx
|
||||
- app/visite/[id].tsx
|
||||
- app/calculateur/[bienId].tsx
|
||||
|
||||
Chaque écran de détail = placeholder avec titre pour l'instant.
|
||||
FAB "+" sur les onglets Biens et Contacts.
|
||||
|
||||
L'app doit se lancer avec : cd app && npx expo start
|
||||
L'auth doit fonctionner avec un compte créé sur PocketBase.
|
||||
Mets à jour AGENTS.md quand c'est terminé.
|
||||
|
||||
---
|
||||
|
||||
## PROMPT 2 — Pipeline + Fiche Bien + Calculateur
|
||||
## Lancer SEULEMENT après que le Prompt 1 tourne
|
||||
|
||||
Lis .cursorrules et AGENTS.md.
|
||||
L'auth et la navigation fonctionnent. Je construis le cœur de l'app.
|
||||
|
||||
HOOK app/hooks/useEtapes.ts :
|
||||
- fetchEtapes() : étapes du user triées par ordre
|
||||
- initEtapesDefaut() : crée les 9 étapes si l'user n'en a pas encore
|
||||
|
||||
HOOK app/hooks/useBiens.ts :
|
||||
- fetchBiens(filters?) : avec expand etape
|
||||
- fetchBienDetail(id) : avec expand etape, visites, notes
|
||||
- createBien(data), updateBien(id, data), deleteBien(id)
|
||||
- moveBienToEtape(bienId, etapeId)
|
||||
|
||||
ONGLET BIENS app/app/(tabs)/biens.tsx :
|
||||
Switch Kanban / Liste :
|
||||
MODE KANBAN : ScrollView horizontal, une colonne par étape
|
||||
Header colonne : nom + couleur + nombre de biens
|
||||
Card bien : titre, ville, surface, prix achat formaté, badge priorité
|
||||
Long press → bottom sheet : changer étape | supprimer
|
||||
MODE LISTE : FlatList triable, barre de recherche
|
||||
FAB "+" → /bien/nouveau
|
||||
|
||||
FORMULAIRE app/app/bien/nouveau.tsx :
|
||||
3 étapes avec barre de progression :
|
||||
1. type_bien, adresse, ville, code_postal
|
||||
2. surface_habitable, nb_pieces, prix estimé, source, is_off_market
|
||||
3. Résumé + Créer → PocketBase → redirect /bien/[id]
|
||||
|
||||
FICHE BIEN app/app/bien/[id].tsx :
|
||||
Sections : Header | Infos | Finances | Visites | Notes | Documents
|
||||
Auto-save notes debounce 500ms.
|
||||
|
||||
HOOK app/hooks/useAnalyse.ts :
|
||||
- fetchAnalyse(bienId), saveAnalyse(bienId, data)
|
||||
- calculateResults(data) : toutes les formules de .cursorrules
|
||||
|
||||
CALCULATEUR app/app/calculateur/[bienId].tsx :
|
||||
Recalcul temps réel. Sections : Acquisition | Travaux | Portage | Revente
|
||||
Résultats colorés : vert >15% | orange 8-15% | rouge <8%
|
||||
Scénarios -10%/réaliste/+10%. Bouton Enregistrer.
|
||||
|
||||
Mets à jour AGENTS.md.
|
||||
|
||||
---
|
||||
|
||||
## PROMPT 3 — Contacts + Visites IA + Agenda + Dashboard
|
||||
## Lancer SEULEMENT après que le Prompt 2 tourne
|
||||
|
||||
Lis .cursorrules et AGENTS.md.
|
||||
Pipeline, fiche bien et calculateur fonctionnent.
|
||||
|
||||
CONTACTS app/app/(tabs)/contacts.tsx :
|
||||
SectionList par catégorie, recherche live, appel direct Linking.openURL tel:
|
||||
Fiche contact : coordonnées, biens associés, notes
|
||||
|
||||
VISITES app/app/(tabs)/visites.tsx :
|
||||
Écran visite app/app/visite/[id].tsx avec 3 tabs :
|
||||
Tab 1 Check-liste : 4 états par item (OK/Attention/Problème/Non vérifié)
|
||||
Tab 2 Notes : zone texte + bouton photo
|
||||
Tab 3 Estimation : sliders travaux, avis global, score 1-10
|
||||
Bouton "Générer rapport IA" → pb.send('/api/generate-rapport') → affiche markdown
|
||||
|
||||
Hook serveur pocketbase/pb_hooks/generate_rapport.pb.js :
|
||||
routerAdd("POST", "/api/generate-rapport", (c) => {
|
||||
const info = $apis.requestInfo(c);
|
||||
if (!info.authRecord) return c.json(401, {error: "Non autorisé"});
|
||||
const { notes_brutes, checklist_reponses, bien_info } = info.data;
|
||||
const response = $http.send({
|
||||
url: "https://api.anthropic.com/v1/messages",
|
||||
method: "POST",
|
||||
headers: {
|
||||
"x-api-key": $os.getenv("ANTHROPIC_API_KEY"),
|
||||
"anthropic-version": "2023-06-01",
|
||||
"content-type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: "claude-sonnet-4-20250514",
|
||||
max_tokens: 1500,
|
||||
messages: [{ role: "user", content: "Génère un compte-rendu de visite professionnel en français. Bien: " + JSON.stringify(bien_info) + " Notes: " + notes_brutes + " Checklist: " + JSON.stringify(checklist_reponses) }]
|
||||
}),
|
||||
timeout: 30
|
||||
});
|
||||
const result = JSON.parse(response.raw);
|
||||
return c.json(200, { rapport: result.content[0].text });
|
||||
}, $apis.requireRecordAuth());
|
||||
|
||||
AGENDA app/app/(tabs)/agenda.tsx :
|
||||
Vue Aujourd'hui : En retard (rouge) + Aujourd'hui + Cette semaine
|
||||
Card tâche : checkbox, titre, badge bien, swipe snooze/supprimer
|
||||
Création : bottom sheet
|
||||
|
||||
DASHBOARD app/app/(tabs)/index.tsx :
|
||||
Alertes urgentes | KPIs | Mini pipeline | Derniers biens | Tâches du jour
|
||||
|
||||
Mets à jour AGENTS.md : tous modules terminés.
|
||||
|
||||
---
|
||||
|
||||
## PROMPT DEBUG
|
||||
Lis .cursorrules.
|
||||
Erreur dans [MODULE] :
|
||||
ERREUR : [message exact]
|
||||
FICHIER : [nom]
|
||||
Stack : Expo + PocketBase v0.23+. Diagnostique et corrige.
|
||||
|
||||
## PROMPT UI
|
||||
Lis .cursorrules.
|
||||
L'écran [NOM] fonctionne. Améliore l'UI pour usage pro en extérieur.
|
||||
Couleurs : #1D4ED8 | #16A34A | #D97706 | #DC2626
|
||||
Reference in New Issue
Block a user