Skip to content

Fix: corrige les trois points de review de la landing (markup, snippet iframe, échec de copie) - #65

Merged
Zoubeir23 merged 6 commits into
mainfrom
Fix/065-corrige-les-points-de-review-de-la-landing
Aug 2, 2026
Merged

Fix: corrige les trois points de review de la landing (markup, snippet iframe, échec de copie)#65
Zoubeir23 merged 6 commits into
mainfrom
Fix/065-corrige-les-points-de-review-de-la-landing

Conversation

@Zoubeir23

@Zoubeir23 Zoubeir23 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Contexte

Trois défauts relevés lors de la review de la PR #61, laissés en suivi lors du merge.

Ce qui change

1. Markup de liste invalidemedical-record-section.tsx, security-section.tsx

Les <dt>/<dd> n'étaient pas des enfants autorisés de leur <dl> : dans la section Dossier & IA
ils étaient imbriqués deux niveaux plus bas, et dans la section Sécurité ils cohabitaient avec un
<svg> dans le même conteneur. La spécification n'autorise qu'un seul <div> d'enveloppe, ne
contenant que des dt/dd.

Les deux sections passent en <ul>/<li> avec <h3>/<p>, sémantiquement correct et cohérent
avec le reste de la landing.

2. Snippet d'intégration du widgetembed-widget-section.tsx

  • frameborder a disparu du standard HTML : remplacé par style="border:0".
  • NEXT_PUBLIC_APP_URL pouvait finir par une barre oblique et produire https://exemple.fr//widget/…
    dans le code que le praticien colle sur son propre site. L'URL est désormais normalisée.

3. Échec de copie silencieuxcopy-embed-code-button.tsx

Le catch remettait simplement l'état à false : hors contexte sécurisé ou si la permission est
refusée, le clic n'avait aucun effet visible. Le bouton expose maintenant trois états
(idle / copied / failed) avec un libellé traduit, une icône d'alerte et une bordure
destructive, plus aria-live="polite". Nouvelle clé landing.widget.copyFailed en FR et EN.

Tests

  • npx tsc --noEmit, npm run lint — propres
  • npx vitest run — 193 tests
  • npm run build — succès
  • Vérifié au navigateur sur le build de production :
    • copie réussie → « Code copié », snippet sans frameborder
    • presse-papiers refusé → « Copie impossible, sélectionnez le code » + bordure destructive
    • retour automatique à l'état initial après 2,5 s
    • HTML servi : 0 balise dl/dt/dd, 0 occurrence de frameborder
  • Normalisation d'URL vérifiée sur https://docflow.ia, https://docflow.ia/ et https://docflow.ia///

Summary by CodeRabbit

  • Améliorations

    • Le bouton de copie du code d’intégration indique désormais clairement si la copie a réussi ou échoué, avec un retour visuel adapté.
    • Le code généré normalise automatiquement l’URL et applique une bordure cohérente au cadre intégré.
    • Les sections relatives au dossier médical et à la sécurité utilisent une structure HTML plus sémantique, améliorant la clarté et l’accessibilité.
  • Traductions

    • Ajout du message d’erreur de copie en français et en anglais.

Copilot AI review requested due to automatic review settings August 2, 2026 03:02
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
doc-flow-ai Ready Ready Preview Aug 2, 2026 3:43am

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Zoubeir23, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 428fb302-157a-40eb-8fe3-89c4d42462c1

📥 Commits

Reviewing files that changed from the base of the PR and between 7899e75 and e184b07.

📒 Files selected for processing (2)
  • components/landing/copy-embed-code-button.tsx
  • components/landing/embed-widget-section.tsx
📝 Walkthrough

Walkthrough

Le bouton de copie gère maintenant les états de succès et d’échec. Le snippet iframe normalise son URL et utilise une bordure CSS. Les traductions couvrent l’échec de copie. Deux sections utilisent une structure HTML sémantique avec <ul>, <li>, <h3> et <p>.

Changes

Mises à jour de la landing page

Layer / File(s) Summary
États et retour du bouton de copie
components/landing/copy-embed-code-button.tsx
Le bouton distingue les états idle, copied et failed. Il vérifie la disponibilité du presse-papiers, réinitialise l’état après 2,5 secondes et expose un retour visuel et accessible.
Génération et intégration du snippet
components/landing/embed-widget-section.tsx, messages/en.json, messages/fr.json
La génération du snippet supprime les slashs finaux de l’URL et remplace frameborder par style="border:0". Le bouton reçoit le libellé d’échec traduit.
Listes sémantiques des sections
components/landing/medical-record-section.tsx, components/landing/security-section.tsx
Les éléments <dl> deviennent des listes <ul> avec des <li>. Les titres et descriptions utilisent <h3> et <p>.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: copilot

Poem

Je suis le lapin du presse-papiers,
Je copie le code sans trébucher.
Si l’outil échoue, je sais l’annoncer,
Avec une alerte bien dessinée.
Les listes sont maintenant mieux structurées,
Et les traductions viennent les accompagner.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Le titre résume clairement les trois corrections principales apportées à la landing : markup, snippet iframe et échec de copie.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
components/landing/copy-embed-code-button.tsx (1)

11-74: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Utilisez useTranslations dans ce composant client.

CopyEmbedCodeButton rend les libellés visibles. Il reçoit actuellement les traductions comme props. Utilisez useTranslations("landing.widget") dans ce composant, puis supprimez copyLabel, copiedLabel et copyFailedLabel de son interface et de l’appelant.

Cette modification réduit aussi la fonction sous la limite de 50 lignes.

Correctif proposé
+import { useTranslations } from "next-intl";

 interface CopyEmbedCodeButtonProps {
   code: string;
-  copyLabel: string;
-  copiedLabel: string;
-  copyFailedLabel: string;
 }

-export function CopyEmbedCodeButton({
-  code,
-  copyLabel,
-  copiedLabel,
-  copyFailedLabel,
-}: CopyEmbedCodeButtonProps) {
+export function CopyEmbedCodeButton({ code }: CopyEmbedCodeButtonProps) {
+  const translations = useTranslations("landing.widget");
   const [copyStatus, setCopyStatus] = useState<CopyStatus>("idle");

   const statusLabel: Record<CopyStatus, string> = {
-    idle: copyLabel,
-    copied: copiedLabel,
-    failed: copyFailedLabel,
+    idle: translations("copy"),
+    copied: translations("copied"),
+    failed: translations("copyFailed"),
   };
 <CopyEmbedCodeButton
   code={embedCode}
-  copyLabel={t("copy")}
-  copiedLabel={t("copied")}
-  copyFailedLabel={t("copyFailed")}
 />

As per coding guidelines, « Utiliser getTranslations côté serveur et useTranslations côté client » et « les fonctions à 50 lignes maximum ».

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/landing/copy-embed-code-button.tsx` around lines 11 - 74, Update
CopyEmbedCodeButton to call useTranslations("landing.widget") and derive the
idle, copied, and failed status labels from that translator. Remove copyLabel,
copiedLabel, and copyFailedLabel from CopyEmbedCodeButtonProps and update its
caller to stop passing them, while preserving the existing status behavior and
keeping the component within the 50-line limit.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/landing/embed-widget-section.tsx`:
- Around line 15-18: Ajoutez dans lib/validations.ts un schéma Zod pour
NEXT_PUBLIC_APP_URL qui n’accepte que des URL HTTPS propres et valides. Validez
cette variable d’environnement avant d’appeler buildEmbedCode, puis transmettez
uniquement la valeur validée afin d’éviter de générer un src vide, invalide ou
mal échappé.

---

Nitpick comments:
In `@components/landing/copy-embed-code-button.tsx`:
- Around line 11-74: Update CopyEmbedCodeButton to call
useTranslations("landing.widget") and derive the idle, copied, and failed status
labels from that translator. Remove copyLabel, copiedLabel, and copyFailedLabel
from CopyEmbedCodeButtonProps and update its caller to stop passing them, while
preserving the existing status behavior and keeping the component within the
50-line limit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b917d1ba-6204-4a02-a8c0-850ea79c113b

📥 Commits

Reviewing files that changed from the base of the PR and between d08cd32 and 7899e75.

📒 Files selected for processing (6)
  • components/landing/copy-embed-code-button.tsx
  • components/landing/embed-widget-section.tsx
  • components/landing/medical-record-section.tsx
  • components/landing/security-section.tsx
  • messages/en.json
  • messages/fr.json

Comment on lines 15 to +18
function buildEmbedCode(appUrl: string): string {
return `<iframe src="${appUrl}/widget/${DEMO_CLINIC_SLUG}" width="100%" height="600" frameborder="0"></iframe>`;
const normalizedAppUrl = appUrl.replace(/\/+$/, "");

return `<iframe src="${normalizedAppUrl}/widget/${DEMO_CLINIC_SLUG}" width="100%" height="600" style="border:0"></iframe>`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate file and validation/env references =="
git ls-files | rg '(^components/landing/embed-widget-section\.tsx$|^lib/validations\.ts$|validations|NEXT_PUBLIC_APP_URL|buildEmbedCode|DEMO_CLINIC_SLUG)$' || true

echo
echo "== target file =="
if [ -f components/landing/embed-widget-section.tsx ]; then
  cat -n components/landing/embed-widget-section.tsx
fi

echo
echo "== validations and env usage =="
if [ -f lib/validations.ts ]; then
  cat -n lib/validations.ts
fi
rg -n "NEXT_PUBLIC_APP_URL|buildEmbedCode|DEMO_CLINIC_SLUG|validations|env" -S components lib app pages .env* 2>/dev/null || true

echo
echo "== deterministic string behavior for sample values =="
node - <<'JS'
function buildEmbedCode(appUrl, slug = 'demo-clinic-slug') {
  const normalizedAppUrl = appUrl.replace(/\/+$/, "");
  return `<iframe src="${normalizedAppUrl}/widget/${slug}" width="100%" height="600" style="border:0"></iframe>`;
}
for (const input of ['', 'invalid', 'https://example.com?q="<img src=x>'] ) {
  console.log(JSON.stringify(buildEmbedCode(input)));
}
JS

Repository: Zoubeir23/DocFlowAI

Length of output: 26356


Validez NEXT_PUBLIC_APP_URL avec Zod avant de générer le snippet.

buildEmbedCode accepte toute valeur de process.env.NEXT_PUBLIC_APP_URL, ce qui peut produire un src vide, invalide ou mal échappé. Ajoutez un schéma lib/validations.ts, autorisez uniquement https et une URL propre, et passez cette valeur validée à buildEmbedCode.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/landing/embed-widget-section.tsx` around lines 15 - 18, Ajoutez
dans lib/validations.ts un schéma Zod pour NEXT_PUBLIC_APP_URL qui n’accepte que
des URL HTTPS propres et valides. Validez cette variable d’environnement avant
d’appeler buildEmbedCode, puis transmettez uniquement la valeur validée afin
d’éviter de générer un src vide, invalide ou mal échappé.

Source: Coding guidelines

@Zoubeir23
Zoubeir23 merged commit 819370f into main Aug 2, 2026
5 checks passed
@Zoubeir23
Zoubeir23 deleted the Fix/065-corrige-les-points-de-review-de-la-landing branch August 2, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants