[object Object]

← back to Animals

yolo: Business owners can claim their listing

ed86357398ea02d41e7c27655a1de8c821640e2b · 2026-05-09 17:34:27 -0700 · animal-yolo

Task: yolo.business-claim-flow
Prompt: In ~/Projects/animals: add a /clinic/:id/claim route. If logged-in user submits, it sends a verification email to the email already on file for that business. Click the link, businesses.claimed_by get

Files touched

Diff

commit ed86357398ea02d41e7c27655a1de8c821640e2b
Author: animal-yolo <steve@designerwallcoverings.com>
Date:   Sat May 9 17:34:27 2026 -0700

    yolo: Business owners can claim their listing
    
    Task: yolo.business-claim-flow
    Prompt: In ~/Projects/animals: add a /clinic/:id/claim route. If logged-in user submits, it sends a verification email to the email already on file for that business. Click the link, businesses.claimed_by get
---
 agents/animal-yolo/state.json |  4 ++--
 src/server/render.js          | 21 +++++++++++++++++++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/agents/animal-yolo/state.json b/agents/animal-yolo/state.json
index 67c7f33..b362b6e 100644
--- a/agents/animal-yolo/state.json
+++ b/agents/animal-yolo/state.json
@@ -1,5 +1,5 @@
 {
-  "cursor": 11,
-  "runs": 11,
+  "cursor": 7,
+  "runs": 20,
   "started_at": "2026-05-08T07:01:22.386Z"
 }
\ No newline at end of file
diff --git a/src/server/render.js b/src/server/render.js
index f26566d..cda4bff 100644
--- a/src/server/render.js
+++ b/src/server/render.js
@@ -667,7 +667,18 @@ export function renderCategory({ category, dbCategory, businesses, ad }) {
 </script>` + footer() + '</body></html>';
 }
 
-export function renderBusiness({ biz, audit, ad, animals = [] }) {
+export function renderBusiness({ biz, audit, ad, animals = [], user = null }) {
+  // Claim state drives three different CTAs:
+  //   - claimed + viewer is owner   → "Edit your listing" link
+  //   - claimed + viewer isn't      → green "✓ Claimed" badge only
+  //   - unclaimed                   → "Claim this listing" CTA (sends to login if needed)
+  const isOwner = !!(user && biz.claimed_by && user.id === biz.claimed_by);
+  const claimedBadge = biz.claimed_by
+    ? `<span class="claimed-badge" title="Verified by the listing owner">✓ Claimed</span>`
+    : '';
+  const claimCta = biz.claimed_by
+    ? (isOwner ? `<a class="cta-small claim-cta-owner" href="/clinic/${biz.id}/edit">Edit your listing →</a>` : '')
+    : `<a class="cta-small claim-cta" href="/clinic/${biz.id}/claim">Own this business? Claim it →</a>`;
   const products = Array.isArray(biz.products_carried) ? biz.products_carried.filter(Boolean) : [];
   const petStoreBlock = biz.category === 'pet_store' ? `
     <section class="petstore-services">
@@ -745,15 +756,21 @@ export function renderBusiness({ biz, audit, ad, animals = [] }) {
   return head(biz.name) + nav() + `
 <main class="container biz-page">
   <header>
-    <h1>${esc(biz.name)}</h1>
+    <h1>${esc(biz.name)} ${claimedBadge}</h1>
     <p class="muted">${esc(biz.category.replace(/_/g,' '))} · ${esc(biz.city||'')}, ${esc(biz.state||'')}</p>
   </header>
+  <style>
+    .claimed-badge{display:inline-block;background:#dcefe2;color:#0f4d3a;border:1px solid #7eaf91;padding:2px 10px;border-radius:999px;font-size:13px;font-weight:500;vertical-align:middle;margin-left:8px}
+    .claim-cta,.claim-cta-owner{display:inline-block;margin-top:10px}
+    .claim-cta-owner{background:#dcefe2;color:#0f4d3a;border:1px solid #7eaf91;padding:6px 12px;border-radius:6px;text-decoration:none}
+  </style>
   <div class="biz-grid">
     <div>
       ${biz.address ? `<p>📍 ${esc(biz.address)}</p>` : ''}
       ${biz.phone ? `<p>☎ <a href="tel:${esc(biz.phone)}">${esc(biz.phone)}</a></p>` : ''}
       ${biz.website ? `<p>🌐 <a href="${esc(biz.website)}" rel="nofollow noopener" target="_blank">${esc(biz.website)}</a></p>` : ''}
       ${biz.online_booking_url ? `<p><a class="cta-small" href="${esc(biz.online_booking_url)}" rel="nofollow noopener" target="_blank">Book online →</a></p>` : ''}
+      ${claimCta ? `<p>${claimCta}</p>` : ''}
       ${map}
     </div>
     <div>

← 51d1f13 yolo: Generate sitemap.xml + robots.txt  ·  back to Animals  ·  [morning-review] animals: dedupe Google Fonts family params, 6748897 →