Solution simplifiée pour copie du lien - zone de texte sélectionnable

- Zone de texte en lecture seule avec le lien
- Sélection automatique au clic
- Bouton 'Sélectionner' explicite
- Instructions claires pour l'utilisateur
- Plus simple et plus fiable que l'alerte
This commit is contained in:
2025-11-23 11:12:30 +01:00
parent 8b0ba77b63
commit dd41da5b0a
3 changed files with 52 additions and 30 deletions

View File

@ -204,29 +204,50 @@ export default function ClientForm({ client, onSuccess, onCancel }: ClientFormPr
<div> <div>
<p className="text-sm font-medium text-gray-700 mb-2">Lien unique :</p> <p className="text-sm font-medium text-gray-700 mb-2">Lien unique :</p>
<div className="bg-secondary rounded-xl p-4 space-y-3"> <div className="bg-secondary rounded-xl p-4 space-y-3">
<code className="text-sm break-all block text-primary font-mono"> <textarea
{getClientUrl()} readOnly
</code> value={getClientUrl()}
<Button onClick={(e) => e.currentTarget.select()}
size="sm" onFocus={(e) => e.currentTarget.select()}
onClick={handleCopyLink} className="w-full p-3 text-sm font-mono text-primary bg-white border-2 border-primary rounded-lg resize-none"
className={`w-full ${copied ? "bg-green-600 hover:bg-green-700" : ""}`} rows={3}
> style={{ cursor: 'text' }}
{copied ? ( />
<> <div className="flex gap-2">
<Check className="h-4 w-4 mr-2" /> <Button
Copié ! size="sm"
</> onClick={handleCopyLink}
) : ( className={`flex-1 ${copied ? "bg-green-600 hover:bg-green-700" : ""}`}
<> >
<Copy className="h-4 w-4 mr-2" /> {copied ? (
Copier le lien <>
</> <Check className="h-4 w-4 mr-2" />
)} Copié !
</Button> </>
) : (
<>
<Copy className="h-4 w-4 mr-2" />
Copier
</>
)}
</Button>
<Button
size="sm"
variant="outline"
onClick={() => {
const textarea = document.querySelector('textarea[readonly]') as HTMLTextAreaElement;
if (textarea) {
textarea.select();
}
}}
className="flex-1"
>
Sélectionner
</Button>
</div>
</div> </div>
<p className="text-xs text-gray-500 mt-2"> <p className="text-xs text-gray-500 mt-2">
Partagez ce lien avec le client pour qu&apos;il configure son app automatiquement 💡 Cliquez sur le lien pour le sélectionner, puis Ctrl+C pour copier
</p> </p>
</div> </div>
<div> <div>

View File

@ -2,12 +2,18 @@
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
swcMinify: true, swcMinify: true,
output: "export", // Mode serveur (pas d'export statique)
// Les API routes fonctionnent normalement
compress: true, compress: true,
poweredByHeader: false, poweredByHeader: false,
images: { images: {
unoptimized: true, formats: ["image/avif", "image/webp"],
minimumCacheTTL: 60,
},
experimental: {
optimizePackageImports: ["lucide-react"],
}, },
}; };
module.exports = nextConfig; module.exports = nextConfig;

View File

@ -2,17 +2,12 @@
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
swcMinify: true, swcMinify: true,
output: "standalone", output: "export",
compress: true, compress: true,
poweredByHeader: false, poweredByHeader: false,
images: { images: {
formats: ["image/avif", "image/webp"], unoptimized: true,
minimumCacheTTL: 60,
},
experimental: {
optimizePackageImports: ["lucide-react"],
}, },
}; };
module.exports = nextConfig; module.exports = nextConfig;