← back to Homesonspec

apps/web/src/app/saved/page.tsx

33 lines

"use client";

import { useEffect, useState } from "react";
import Link from "next/link";

/** v1 stub: saved homes live in localStorage; accounts + alert delivery are deferred. */
export default function SavedPage() {
  const [ids, setIds] = useState<string[]>([]);
  useEffect(() => {
    setIds(JSON.parse(localStorage.getItem("homesonspec.saved") ?? "[]"));
  }, []);

  return (
    <div className="mx-auto max-w-4xl px-4 py-10">
      <h1 className="text-3xl font-bold">Saved homes</h1>
      {ids.length === 0 ? (
        <p className="mt-4 text-neutral-600">
          No saved homes yet. Save from the <Link href="/search" className="text-teal-700 underline">search page</Link>.
          Price and availability alerts arrive with accounts (deferred in v1).
        </p>
      ) : (
        <ul className="mt-4 space-y-2">
          {ids.map((id) => (
            <li key={id}>
              <Link href={`/homes/${id}`} className="text-teal-700 underline">Saved home {id.slice(0, 8)}…</Link>
            </li>
          ))}
        </ul>
      )}
    </div>
  );
}