trading-app/src/components/find-ideas.tsx
David 234efda586 Fix trade proposals, speed, Trade Republic setup and stock UI
- Buy by EUR amount (fractional shares, like Trade Republic): 200 EUR can
  now reach every large cap; risk engine sizes in whole euros
- No-AI screener (pullback in uptrend) feeds training cards and AI candidates
- Auto-update on app open via after(); "find ideas now" button (3/day)
- New Actions tab: stock list, stock page with chart, news, AI opinion,
  sandbox buy by amount or shares
- "Mon compte" tab: declare deposits, cash, holdings and PEA plan
  (no broker credentials, no PEA invented by default)
- Yahoo data cached and deduplicated, pages stream per section
- Tests: fractional sizing, screener, no-AI idea flow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:05:20 +01:00

33 lines
1.0 KiB
TypeScript

"use client";
import { useState, useTransition } from "react";
import { findIdeasNow } from "@/app/actions";
import { secondaryBtn } from "./ui";
/** Lance l'analyse du soir tout de suite, sans attendre le rendez-vous. */
export function FindIdeas({ label = "🔎 Chercher des idées maintenant" }: { label?: string }) {
const [pending, start] = useTransition();
const [log, setLog] = useState<string[] | null>(null);
return (
<div className="flex flex-col gap-2">
<button
className={`${secondaryBtn} w-full`}
disabled={pending}
onClick={() =>
start(async () => {
setLog(null);
try {
setLog(await findIdeasNow());
} catch (e) {
setLog([e instanceof Error ? e.message : "Erreur"]);
}
})
}
>
{pending ? "Analyse en cours… (jusqu'à 1 minute)" : label}
</button>
{log && log.length > 0 && <p className="text-xs text-muted">{log.at(-1)}</p>}
</div>
);
}