[object Object]

← back to AbramsOS

claims: add California Unclaimed Property (claimit.ca.gov) resource card with per-household-name copy-to-search

ef35bef015dc6902d71e22c01647ec47a50c105a · 2026-07-11 10:05:02 -0700 · Steve Abrams

Files touched

Diff

commit ef35bef015dc6902d71e22c01647ec47a50c105a
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sat Jul 11 10:05:02 2026 -0700

    claims: add California Unclaimed Property (claimit.ca.gov) resource card with per-household-name copy-to-search
---
 routes/claims.js | 12 +++++++++++-
 views/claims.ejs | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/routes/claims.js b/routes/claims.js
index be584cf..fe86d0e 100644
--- a/routes/claims.js
+++ b/routes/claims.js
@@ -13,7 +13,17 @@ router.get('/claims', async (_req, res) => {
        FROM claim_case WHERE user_id = $1 ORDER BY created_at DESC LIMIT 200`,
     [DEV_USER_ID]
   );
-  res.render('claims', { claims: r.rows });
+  // Household names to suggest against the CA unclaimed-property search.
+  // Defensive: never let a missing/renamed table break the claims page.
+  let household = [];
+  try {
+    const p = await db.query(
+      `SELECT full_name FROM person WHERE user_id = $1 AND full_name IS NOT NULL ORDER BY (relation <> 'self'), full_name`,
+      [DEV_USER_ID]
+    );
+    household = p.rows.map(x => x.full_name).filter(Boolean);
+  } catch (_e) { household = []; }
+  res.render('claims', { claims: r.rows, household });
 });
 
 // HTML — detail view
diff --git a/views/claims.ejs b/views/claims.ejs
index 4de608f..19b4835 100644
--- a/views/claims.ejs
+++ b/views/claims.ejs
@@ -5,6 +5,42 @@
   <p class="subtle" style="margin:0;color:var(--text-dim);font-size:13px">Drafts only. Nothing leaves AbramsOS without your explicit approval per action.</p>
 </section>
 
+<%
+  var household = (typeof household !== 'undefined' && household) ? household : [];
+  var claimitUrl = 'https://claimit.ca.gov/app/claim-search';
+%>
+<section class="glass" style="padding:16px 18px;margin-bottom:20px;display:flex;flex-direction:column;gap:12px">
+  <header style="display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap">
+    <span class="name" style="display:flex;align-items:center;gap:10px">
+      <span class="icon">🐻</span>
+      <strong>California Unclaimed Property</strong>
+    </span>
+    <a class="button" href="<%= claimitUrl %>" target="_blank" rel="noopener noreferrer">Search claimit.ca.gov ↗</a>
+  </header>
+  <p class="desc" style="margin:0;color:var(--text-dim);font-size:13px">
+    Free official search from the California State Controller for money owed to you —
+    forgotten bank accounts, refunds, uncashed checks, insurance, deposits. Search each
+    household name (and prior addresses / maiden names). Filing a claim is always free.
+  </p>
+  <% if (household.length) { %>
+    <div style="display:flex;flex-direction:column;gap:6px">
+      <span class="subtle" style="font-size:11px;color:var(--text-dim);text-transform:uppercase;letter-spacing:.05em">Names to search</span>
+      <div style="display:flex;flex-wrap:wrap;gap:8px">
+        <% household.forEach(function (name) { %>
+          <button type="button" class="chip" data-copy="<%= name %>"
+            style="cursor:pointer;border:1px solid var(--border,#3a3a3a);background:transparent;color:inherit;border-radius:999px;padding:5px 12px;font-size:12px"
+            title="Copy name, then paste into claimit.ca.gov">
+            <%= name %>
+          </button>
+        <% }); %>
+      </div>
+      <span class="subtle" style="font-size:11px;color:var(--text-dim)">Tap a name to copy it, then paste into the search on claimit.ca.gov (it opens in a new tab).</span>
+    </div>
+  <% } else { %>
+    <span class="subtle" style="font-size:12px;color:var(--text-dim)">Tip: add people in <a href="/household">Household</a> and their names will appear here as one-tap searches.</span>
+  <% } %>
+</section>
+
 <% if (!claims.length) { %>
   <section class="empty glass">
     <p>No claims yet. Claims are created automatically when a reminder fires (returns window closing, warranty expiry, recall match).</p>
@@ -34,4 +70,26 @@
   </section>
 <% } %>
 
+<script>
+  // Copy a household name to the clipboard so it can be pasted into claimit.ca.gov.
+  document.querySelectorAll('.chip[data-copy]').forEach(function (btn) {
+    btn.addEventListener('click', function () {
+      var name = btn.getAttribute('data-copy') || '';
+      var done = function () {
+        var prev = btn.textContent;
+        btn.textContent = 'Copied ✓';
+        setTimeout(function () { btn.textContent = prev; }, 1200);
+      };
+      if (navigator.clipboard && navigator.clipboard.writeText) {
+        navigator.clipboard.writeText(name).then(done).catch(done);
+      } else {
+        var ta = document.createElement('textarea');
+        ta.value = name; document.body.appendChild(ta); ta.select();
+        try { document.execCommand('copy'); } catch (e) {}
+        document.body.removeChild(ta); done();
+      }
+    });
+  });
+</script>
+
 <%- include('partials/footer') %>

← 1192d3c chore: lint (node --check ✓), untrack runtime state, v0.2.0  ·  back to AbramsOS  ·  auto-save: 2026-07-12T23:51:20 (1 files) — backups/ 367d888 →