feat: landing redesign in resources aesthetic; fix KB search crash

Landing:
- Rebuilt app/(landing)/page.tsx from a 539-line client monolith to a
  ~150-line server component in the /resources editorial style.
- New scoped app/(landing)/landing.css mirrors the resources palette
  (#0c0c0c / lime #d4ff00 / #252525), IBM Plex Mono + Libre
  Baskerville loaded in (landing)/layout.tsx, faint grid overlay.
- Removed the animated Mini* previews and inline Ico* set (clashed
  with the editorial look). Split into components/landing/icons.tsx
  and components/landing/resource-showcase.tsx for separation.
- Resource showcase: one row of six square tiles with the real
  project SVG logos linking to atlas/space-after-dark/proposal-duel/
  zine/learner/governance. Responsive 6 -> 3 -> 2.
- BrandMark accepts an optional style prop.

Fix:
- KB search crashed the Ops page. filteredLeads referenced
  l.member_name (the column is lead_handle), so undefined.toLowerCase()
  threw on every keystroke since the filter memos recompute on shared
  search state across tabs. All Ops filter predicates are now
  null-safe via a shared has() helper; filteredSecrets no longer
  assumes a non-null title.

Docs:
- docs/PERMISSIONS_DESIGN.md: concrete plan for customizable
  permissions, per-item Ops ACLs, and area-lead roles. That work is
  security-sensitive (RLS rewrites on secrets/knowledge_base) and is
  scoped as its own next pass, not bundled here.

266/266 tests pass. Production build clean. No migration this pass.
This commit is contained in:
Moheeb Zara
2026-05-15 16:15:56 -07:00
parent 71d5e243cf
commit 43f9c09d70
10 changed files with 534 additions and 506 deletions
+12 -4
View File
@@ -519,11 +519,19 @@ export function OpsClient({ member, spaceId, kbEntries: initial, areaLeads: init
const [showLeadModal, setShowLeadModal] = useState(false)
const [editingLead, setEditingLead] = useState<AreaLead | null>(null)
// Every predicate is null-safe: title/content/area/handle can all be null
// in the database. These memos recompute on every keystroke of the shared
// `search` state regardless of the active tab, so an unguarded
// .toLowerCase() on a null field throws and takes the whole page down
// (this is why KB search appeared broken: filteredLeads referenced a
// non-existent `member_name` column).
const has = (v: string | null | undefined, q: string) => !!v && v.toLowerCase().includes(q)
const filteredKb = useMemo(() => {
const q = search.toLowerCase()
return kbEntries.filter(e =>
!e.tags?.includes('process') &&
(!q || e.title.toLowerCase().includes(q) || e.content?.toLowerCase().includes(q) || e.area?.toLowerCase().includes(q)),
(!q || has(e.title, q) || has(e.content, q) || has(e.area, q)),
)
}, [kbEntries, search])
@@ -531,18 +539,18 @@ export function OpsClient({ member, spaceId, kbEntries: initial, areaLeads: init
const q = search.toLowerCase()
return kbEntries.filter(e =>
e.tags?.includes('process') &&
(!q || e.title.toLowerCase().includes(q) || e.content?.toLowerCase().includes(q) || e.area?.toLowerCase().includes(q)),
(!q || has(e.title, q) || has(e.content, q) || has(e.area, q)),
)
}, [kbEntries, search])
const filteredSecrets = useMemo(() => {
const q = search.toLowerCase()
return secrets.filter(s => !q || s.title.toLowerCase().includes(q) || s.area?.toLowerCase().includes(q))
return secrets.filter(s => !q || has(s.title, q) || has(s.label, q) || has(s.area, q))
}, [secrets, search])
const filteredLeads = useMemo(() => {
const q = search.toLowerCase()
return areaLeads.filter(l => !q || l.area_name.toLowerCase().includes(q) || l.member_name.toLowerCase().includes(q))
return areaLeads.filter(l => !q || has(l.area_name, q) || has(l.lead_handle, q))
}, [areaLeads, search])
async function deleteLeadFn(id: string) {