feat: v1.0.0 — UX polish, security hardening, code quality
UI/UX: - Bill detail page tab UI (Analysis / Timeline / Votes / Notes) - Topic tag pills on bill detail and listing pages — filtered to known topics, clickable, properly labelled via shared lib/topics.ts - Notes panel always-open in Notes tab; sign-in prompt for guests - Collapsible sidebar with icon-only mode and localStorage persistence - Bills page defaults to has-text filter enabled - Follow mode dropdown transparency fix - Favicon (Landmark icon, blue background) Security: - Fernet encryption for ntfy passwords at rest (app/core/crypto.py) - Separate ENCRYPTION_SECRET_KEY env var; falls back to JWT derivation - ntfy_password no longer returned in GET response — replaced with ntfy_password_set: bool; NotificationSettingsUpdate type for writes - JWT_SECRET_KEY fail-fast on startup if using default placeholder - get_optional_user catches (JWTError, ValueError) only, not Exception Bug fixes & code quality: - Dashboard N+1 topic query replaced with single OR query - notification_utils.py topic follower N+1 replaced with batch query - Note query in bill detail page gated on token (enabled: !!token) - search.py max_length=500 guard against oversized queries - CollectionCreate.validate_name wired up with @field_validator - LLM_RATE_LIMIT_RPM default raised from 10 to 50 Authored by: Jack Levy
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { use, useEffect, useRef } from "react";
|
||||
import { use, useEffect, useRef, useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import Link from "next/link";
|
||||
import { ArrowLeft, ExternalLink, FileX, User } from "lucide-react";
|
||||
import { ArrowLeft, ExternalLink, FileX, Tag, User } from "lucide-react";
|
||||
import { useBill, useBillNews, useBillTrend } from "@/lib/hooks/useBills";
|
||||
import { useAuthStore } from "@/stores/authStore";
|
||||
import { BriefPanel } from "@/components/bills/BriefPanel";
|
||||
import { DraftLetterPanel } from "@/components/bills/DraftLetterPanel";
|
||||
import { NotesPanel } from "@/components/bills/NotesPanel";
|
||||
@@ -15,28 +16,34 @@ import { NewsPanel } from "@/components/bills/NewsPanel";
|
||||
import { FollowButton } from "@/components/shared/FollowButton";
|
||||
import { CollectionPicker } from "@/components/bills/CollectionPicker";
|
||||
import { billLabel, chamberBadgeColor, congressLabel, formatDate, partyBadgeColor, cn } from "@/lib/utils";
|
||||
import { TOPIC_LABEL, TOPIC_TAGS } from "@/lib/topics";
|
||||
|
||||
const TABS = [
|
||||
{ id: "analysis", label: "Analysis" },
|
||||
{ id: "timeline", label: "Timeline" },
|
||||
{ id: "votes", label: "Votes" },
|
||||
{ id: "notes", label: "Notes" },
|
||||
] as const;
|
||||
type TabId = typeof TABS[number]["id"];
|
||||
|
||||
export default function BillDetailPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = use(params);
|
||||
const billId = decodeURIComponent(id);
|
||||
const [activeTab, setActiveTab] = useState<TabId>("analysis");
|
||||
|
||||
const token = useAuthStore((s) => s.token);
|
||||
const { data: bill, isLoading } = useBill(billId);
|
||||
const { data: trendData } = useBillTrend(billId, 30);
|
||||
const { data: newsArticles, refetch: refetchNews } = useBillNews(billId);
|
||||
|
||||
// Fetch the user's note so we know if it's pinned before rendering
|
||||
const { data: note } = useQuery({
|
||||
queryKey: ["note", billId],
|
||||
queryFn: () => import("@/lib/api").then((m) => m.notesAPI.get(billId)),
|
||||
enabled: true,
|
||||
enabled: !!token,
|
||||
retry: false,
|
||||
throwOnError: false,
|
||||
});
|
||||
|
||||
// When the bill page is opened with no stored articles, the backend queues
|
||||
// a Celery news-fetch task that takes a few seconds to complete.
|
||||
// Retry up to 3 times (every 6 s) so articles appear without a manual refresh.
|
||||
// newsRetryRef resets on bill navigation so each bill gets its own retry budget.
|
||||
const newsRetryRef = useRef(0);
|
||||
useEffect(() => { newsRetryRef.current = 0; }, [billId]);
|
||||
useEffect(() => {
|
||||
@@ -119,60 +126,103 @@ export default function BillDetailPage({ params }: { params: Promise<{ id: strin
|
||||
|
||||
{/* Content grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-6">
|
||||
<div className="md:col-span-2 space-y-6">
|
||||
{/* Pinned note floats above briefs */}
|
||||
<div className="md:col-span-2 space-y-4">
|
||||
{/* Pinned note always visible above tabs */}
|
||||
{note?.pinned && <NotesPanel billId={bill.bill_id} />}
|
||||
|
||||
{bill.briefs.length > 0 ? (
|
||||
<>
|
||||
<BriefPanel briefs={bill.briefs} />
|
||||
<DraftLetterPanel billId={bill.bill_id} brief={bill.briefs[0]} chamber={bill.chamber} />
|
||||
{!note?.pinned && <NotesPanel billId={bill.bill_id} />}
|
||||
</>
|
||||
) : bill.has_document ? (
|
||||
<>
|
||||
<div className="bg-card border border-border rounded-lg p-6 text-center space-y-2">
|
||||
<p className="text-sm font-medium text-muted-foreground">Analysis pending</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Bill text was retrieved but has not yet been analyzed. Check back shortly.
|
||||
</p>
|
||||
</div>
|
||||
{!note?.pinned && <NotesPanel billId={bill.bill_id} />}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="bg-card border border-border rounded-lg p-6 space-y-3">
|
||||
<div className="flex items-center gap-2 text-muted-foreground">
|
||||
<FileX className="w-4 h-4 shrink-0" />
|
||||
<span className="text-sm font-medium">No bill text published</span>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
As of {new Date().toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" })},{" "}
|
||||
no official text has been received for{" "}
|
||||
<span className="font-medium">{billLabel(bill.bill_type, bill.bill_number)}</span>.
|
||||
Analysis will be generated automatically once text is published on Congress.gov.
|
||||
</p>
|
||||
{bill.congress_url && (
|
||||
<a
|
||||
href={bill.congress_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs text-primary hover:underline"
|
||||
>
|
||||
Check status on Congress.gov <ExternalLink className="w-3 h-3" />
|
||||
</a>
|
||||
{/* Tab bar */}
|
||||
<div className="flex gap-0 border-b border-border">
|
||||
{TABS.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
className={cn(
|
||||
"px-4 py-2.5 text-sm font-medium transition-colors border-b-2 -mb-px",
|
||||
activeTab === tab.id
|
||||
? "border-primary text-foreground"
|
||||
: "border-transparent text-muted-foreground hover:text-foreground"
|
||||
)}
|
||||
</div>
|
||||
{!note?.pinned && <NotesPanel billId={bill.bill_id} />}
|
||||
</>
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Topic tags — only show tags that have a matching topic page */}
|
||||
{bill.briefs[0]?.topic_tags && bill.briefs[0].topic_tags.filter((t) => TOPIC_TAGS.has(t)).length > 0 && (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{bill.briefs[0].topic_tags.filter((t) => TOPIC_TAGS.has(t)).map((tag) => (
|
||||
<Link
|
||||
key={tag}
|
||||
href={`/bills?topic=${encodeURIComponent(tag)}`}
|
||||
className="inline-flex items-center gap-0.5 text-xs px-1.5 py-0.5 rounded-full bg-accent text-accent-foreground hover:bg-accent/70 transition-colors"
|
||||
>
|
||||
<Tag className="w-2.5 h-2.5" />
|
||||
{TOPIC_LABEL[tag] ?? tag}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Tab content */}
|
||||
{activeTab === "analysis" && (
|
||||
<div className="space-y-6">
|
||||
{bill.briefs.length > 0 ? (
|
||||
<>
|
||||
<BriefPanel briefs={bill.briefs} />
|
||||
<DraftLetterPanel billId={bill.bill_id} brief={bill.briefs[0]} chamber={bill.chamber} />
|
||||
</>
|
||||
) : bill.has_document ? (
|
||||
<div className="bg-card border border-border rounded-lg p-6 text-center space-y-2">
|
||||
<p className="text-sm font-medium text-muted-foreground">Analysis pending</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Bill text was retrieved but has not yet been analyzed. Check back shortly.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="bg-card border border-border rounded-lg p-6 space-y-3">
|
||||
<div className="flex items-center gap-2 text-muted-foreground">
|
||||
<FileX className="w-4 h-4 shrink-0" />
|
||||
<span className="text-sm font-medium">No bill text published</span>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
As of {new Date().toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" })},{" "}
|
||||
no official text has been received for{" "}
|
||||
<span className="font-medium">{billLabel(bill.bill_type, bill.bill_number)}</span>.
|
||||
Analysis will be generated automatically once text is published on Congress.gov.
|
||||
</p>
|
||||
{bill.congress_url && (
|
||||
<a
|
||||
href={bill.congress_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs text-primary hover:underline"
|
||||
>
|
||||
Check status on Congress.gov <ExternalLink className="w-3 h-3" />
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeTab === "timeline" && (
|
||||
<ActionTimeline
|
||||
actions={bill.actions}
|
||||
latestActionDate={bill.latest_action_date}
|
||||
latestActionText={bill.latest_action_text}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeTab === "votes" && (
|
||||
<VotePanel billId={bill.bill_id} alwaysRender />
|
||||
)}
|
||||
|
||||
{activeTab === "notes" && (
|
||||
<NotesPanel billId={bill.bill_id} />
|
||||
)}
|
||||
<ActionTimeline
|
||||
actions={bill.actions}
|
||||
latestActionDate={bill.latest_action_date}
|
||||
latestActionText={bill.latest_action_text}
|
||||
/>
|
||||
<VotePanel billId={bill.bill_id} />
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<TrendChart data={trendData} />
|
||||
<NewsPanel articles={newsArticles} />
|
||||
|
||||
@@ -5,21 +5,16 @@ import { useSearchParams } from "next/navigation";
|
||||
import { FileText, Search } from "lucide-react";
|
||||
import { useBills } from "@/lib/hooks/useBills";
|
||||
import { BillCard } from "@/components/shared/BillCard";
|
||||
import { TOPICS } from "@/lib/topics";
|
||||
|
||||
const CHAMBERS = ["", "House", "Senate"];
|
||||
const TOPICS = [
|
||||
"", "healthcare", "taxation", "defense", "education", "immigration",
|
||||
"environment", "housing", "infrastructure", "technology", "agriculture",
|
||||
"judiciary", "foreign-policy", "veterans", "social-security", "trade",
|
||||
"budget", "energy", "banking", "transportation", "labor",
|
||||
];
|
||||
|
||||
export default function BillsPage() {
|
||||
const searchParams = useSearchParams();
|
||||
const [q, setQ] = useState(searchParams.get("q") ?? "");
|
||||
const [chamber, setChamber] = useState(searchParams.get("chamber") ?? "");
|
||||
const [topic, setTopic] = useState(searchParams.get("topic") ?? "");
|
||||
const [hasText, setHasText] = useState(false);
|
||||
const [hasText, setHasText] = useState(true);
|
||||
const [page, setPage] = useState(1);
|
||||
|
||||
// Sync URL params → state so tag/topic links work when already on this page
|
||||
@@ -75,7 +70,7 @@ export default function BillsPage() {
|
||||
className="px-3 py-2 text-sm bg-card border border-border rounded-md focus:outline-none"
|
||||
>
|
||||
<option value="">All Topics</option>
|
||||
{TOPICS.slice(1).map((t) => <option key={t} value={t}>{t}</option>)}
|
||||
{TOPICS.map((t) => <option key={t.tag} value={t.tag}>{t.label}</option>)}
|
||||
</select>
|
||||
<button
|
||||
onClick={() => { setHasText((v) => !v); setPage(1); }}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Link from "next/link";
|
||||
import {
|
||||
BarChart2,
|
||||
Bell,
|
||||
Bookmark,
|
||||
Calendar,
|
||||
@@ -8,9 +9,15 @@ import {
|
||||
Filter,
|
||||
Heart,
|
||||
HelpCircle,
|
||||
ListChecks,
|
||||
Mail,
|
||||
MessageSquare,
|
||||
Rss,
|
||||
Shield,
|
||||
Share2,
|
||||
StickyNote,
|
||||
TrendingUp,
|
||||
Users,
|
||||
Zap,
|
||||
} from "lucide-react";
|
||||
|
||||
@@ -63,11 +70,16 @@ export default function HowItWorksPage() {
|
||||
{/* Jump links */}
|
||||
<div className="flex flex-wrap gap-2 mt-3">
|
||||
{[
|
||||
{ href: "#follow", label: "Following" },
|
||||
{ href: "#collections", label: "Collections" },
|
||||
{ href: "#notifications", label: "Notifications" },
|
||||
{ href: "#briefs", label: "AI Briefs" },
|
||||
{ href: "#bills", label: "Bills" },
|
||||
{ href: "#follow", label: "Following" },
|
||||
{ href: "#collections", label: "Collections" },
|
||||
{ href: "#notifications", label: "Notifications" },
|
||||
{ href: "#briefs", label: "AI Briefs" },
|
||||
{ href: "#votes", label: "Votes" },
|
||||
{ href: "#alignment", label: "Alignment" },
|
||||
{ href: "#notes", label: "Notes" },
|
||||
{ href: "#bills", label: "Bills" },
|
||||
{ href: "#members-topics", label: "Members & Topics" },
|
||||
{ href: "#dashboard", label: "Dashboard" },
|
||||
].map(({ href, label }) => (
|
||||
<a
|
||||
key={href}
|
||||
@@ -143,7 +155,7 @@ export default function HowItWorksPage() {
|
||||
</Item>
|
||||
<Item icon={Share2} color="bg-purple-100 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400" title="Sharing">
|
||||
Every collection has a unique share link. Anyone with the link can view the collection —
|
||||
no account required. The link works whether the collection is public or private.
|
||||
no account required.
|
||||
</Item>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
@@ -156,37 +168,40 @@ export default function HowItWorksPage() {
|
||||
{/* Notifications */}
|
||||
<Section id="notifications" title="Notifications" icon={Bell}>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
PocketVeto delivers alerts through two independent channels — use either or both.
|
||||
PocketVeto delivers alerts through three independent channels — use any combination.
|
||||
</p>
|
||||
<div className="space-y-3">
|
||||
<Item icon={Bell} color="bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400" title="Push via ntfy">
|
||||
<a href="https://ntfy.sh" target="_blank" rel="noopener noreferrer" className="text-primary hover:underline">
|
||||
ntfy
|
||||
</a>
|
||||
<a href="https://ntfy.sh" target="_blank" rel="noopener noreferrer" className="text-primary hover:underline">ntfy</a>
|
||||
{" "}is a free, open-source push notification service. Configure a topic URL in{" "}
|
||||
<Link href="/notifications" className="text-primary hover:underline">Notifications</Link>{" "}
|
||||
and receive real-time alerts on any device with the ntfy app.
|
||||
</Item>
|
||||
<Item icon={Clock} color="bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400" title="Quiet hours">
|
||||
Pause push notifications during set hours (e.g. 10 PM – 8 AM). Events that arrive
|
||||
during quiet hours are queued and sent as a batch when the window ends.
|
||||
</Item>
|
||||
<Item icon={Calendar} color="bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400" title="Digest mode">
|
||||
Instead of one push per event, receive a single bundled summary on a daily or weekly
|
||||
schedule. Your RSS feed is always real-time regardless of this setting.
|
||||
<Item icon={Mail} color="bg-indigo-100 text-indigo-600 dark:bg-indigo-900/30 dark:text-indigo-400" title="Email">
|
||||
Receive alerts as plain-text emails. Add your address in{" "}
|
||||
<Link href="/notifications" className="text-primary hover:underline">Notifications → Email</Link>.
|
||||
Every email includes a one-click unsubscribe link, and your address is never used for
|
||||
anything other than bill alerts.
|
||||
</Item>
|
||||
<Item icon={Rss} color="bg-orange-100 text-orange-600 dark:bg-orange-900/30 dark:text-orange-400" title="RSS feed">
|
||||
A private, tokenized RSS feed of all your bill alerts. Subscribe in any RSS reader
|
||||
(Feedly, NetNewsWire, etc.). Completely independent of ntfy.
|
||||
(Feedly, NetNewsWire, etc.). Always real-time, completely independent of the other channels.
|
||||
</Item>
|
||||
<Item icon={Filter} color="bg-teal-100 text-teal-700 dark:bg-teal-900/30 dark:text-teal-400" title="Discovery alerts">
|
||||
<Item icon={Clock} color="bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400" title="Quiet hours">
|
||||
Pause push and email notifications during set hours (e.g. 10 PM – 8 AM). Events that
|
||||
arrive during quiet hours are queued and sent as a batch when the window ends.
|
||||
</Item>
|
||||
<Item icon={Calendar} color="bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400" title="Digest mode">
|
||||
Instead of one alert per event, receive a single bundled summary on a daily or weekly
|
||||
schedule. Your RSS feed is always real-time regardless of this setting.
|
||||
</Item>
|
||||
<Item icon={MessageSquare} color="bg-teal-100 text-teal-700 dark:bg-teal-900/30 dark:text-teal-400" title="Discovery alerts">
|
||||
Member and topic follows generate Discovery alerts — separate from the bills you follow
|
||||
directly. In{" "}
|
||||
<Link href="/notifications" className="text-primary hover:underline">Alert Filters → Discovery</Link>,
|
||||
you can enable or disable these independently, tune which event types trigger them, and
|
||||
mute specific members or topics you'd rather not hear about without unfollowing them.
|
||||
Each notification also shows a “why” line so you always know which follow
|
||||
triggered it.
|
||||
mute specific members or topics without unfollowing them. Each notification includes a
|
||||
“why” line so you always know which follow triggered it.
|
||||
</Item>
|
||||
</div>
|
||||
</Section>
|
||||
@@ -194,29 +209,86 @@ export default function HowItWorksPage() {
|
||||
{/* AI Briefs */}
|
||||
<Section id="briefs" title="AI Briefs" icon={FileText}>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
For bills with published official text, PocketVeto generates a plain-English AI brief.
|
||||
For bills with published official text, PocketVeto generates a plain-English AI brief
|
||||
automatically — no action needed on your part.
|
||||
</p>
|
||||
<div className="space-y-3">
|
||||
<Item icon={FileText} color="bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400" title="What's in a brief">
|
||||
A plain-English summary, key policy points with references to specific bill sections
|
||||
(§ chips), and a risks section that flags potential unintended consequences or contested
|
||||
provisions.
|
||||
(§ chips you can expand to see the quoted source text), and a risks section that flags
|
||||
potential unintended consequences or contested provisions.
|
||||
</Item>
|
||||
<Item icon={Share2} color="bg-purple-100 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400" title="Sharing a brief">
|
||||
Click the share icon in the brief panel to copy a public link. Anyone can read the
|
||||
brief at that URL — no login required.
|
||||
</Item>
|
||||
<Item icon={Zap} color="bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400" title="Draft a letter">
|
||||
Use the Draft Letter panel (below the brief) to generate a personalised letter to your
|
||||
representative based on the brief's key points.
|
||||
Use the Draft Letter panel in the Analysis tab to generate a personalised letter to
|
||||
your representative based on the brief's key points.
|
||||
</Item>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Briefs are only generated for bills where GovInfo has published official text. Bills
|
||||
without text show a “No text” badge on their card.
|
||||
without text show a “No text” badge on their card. When a bill is amended,
|
||||
a new “What Changed” brief is generated automatically alongside the original.
|
||||
</p>
|
||||
</Section>
|
||||
|
||||
{/* Votes */}
|
||||
<Section id="votes" title="Roll-call votes" icon={ListChecks}>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
The <strong>Votes</strong> tab on any bill page shows every recorded roll-call vote for
|
||||
that bill, fetched directly from official House and Senate XML sources.
|
||||
</p>
|
||||
<div className="space-y-3">
|
||||
<Item icon={ListChecks} color="bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400" title="Vote breakdown">
|
||||
Each vote shows the result, chamber, roll number, date, and a visual Yea/Nay bar with
|
||||
exact counts.
|
||||
</Item>
|
||||
<Item icon={Users} color="bg-purple-100 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400" title="Followed member positions">
|
||||
If any of your followed members voted on the bill, their individual Yea/Nay positions
|
||||
are surfaced directly in the vote row — no need to dig through the full member list.
|
||||
</Item>
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
{/* Alignment */}
|
||||
<Section id="alignment" title="Representation Alignment" icon={BarChart2}>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
The <Link href="/alignment" className="text-primary hover:underline">Alignment</Link> page
|
||||
shows how often your followed members vote in line with your stated bill positions.
|
||||
</p>
|
||||
<div className="space-y-3">
|
||||
<Item icon={Zap} color="bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400" title="How it's calculated">
|
||||
For every bill you follow with Pocket Boost or Pocket Veto, PocketVeto checks how each
|
||||
of your followed members voted. A Yea on a boosted bill counts as aligned; a Nay on a
|
||||
vetoed bill counts as aligned. Not Voting and Present are excluded.
|
||||
</Item>
|
||||
<Item icon={BarChart2} color="bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400" title="Alignment score">
|
||||
Each followed member gets an alignment percentage based on all overlapping votes. Members
|
||||
are ranked from most to least aligned with your positions.
|
||||
</Item>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Alignment only appears for members who have actually voted on bills you've stanced.
|
||||
Follow more members and stake positions on more bills to build a fuller picture.
|
||||
</p>
|
||||
</Section>
|
||||
|
||||
{/* Notes */}
|
||||
<Section id="notes" title="Notes" icon={StickyNote}>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Add a personal note to any bill — visible only to you. Find it in the{" "}
|
||||
<strong>Notes</strong> tab on any bill detail page.
|
||||
</p>
|
||||
<div className="space-y-3">
|
||||
<Item icon={StickyNote} color="bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400" title="Pinning">
|
||||
Pin a note to float it above the tab bar so it's always visible when you open the
|
||||
bill, regardless of which tab you're on.
|
||||
</Item>
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
{/* Bills */}
|
||||
<Section id="bills" title="Browsing bills" icon={FileText}>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
@@ -227,13 +299,55 @@ export default function HowItWorksPage() {
|
||||
<p><strong className="text-foreground">Search</strong> — matches bill ID, title, and short title.</p>
|
||||
<p><strong className="text-foreground">Chamber</strong> — House or Senate.</p>
|
||||
<p><strong className="text-foreground">Topic</strong> — AI-tagged policy area (healthcare, defense, etc.).</p>
|
||||
<p><strong className="text-foreground">Has text</strong> — show only bills with published official text available for AI briefing.</p>
|
||||
<p><strong className="text-foreground">Has text</strong> — show only bills with published official text. On by default.</p>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Clicking a topic tag on any bill or following page takes you directly to that filtered
|
||||
view on the Bills page.
|
||||
Each bill page is organised into four tabs: <strong>Analysis</strong> (AI brief + draft
|
||||
letter), <strong>Timeline</strong> (action history), <strong>Votes</strong> (roll-call
|
||||
records), and <strong>Notes</strong> (your personal note).
|
||||
Topic tags appear just below the tab bar — click any tag to jump to that filtered view.
|
||||
</p>
|
||||
</Section>
|
||||
|
||||
{/* Members & Topics */}
|
||||
<Section id="members-topics" title="Members & Topics" icon={Users}>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Browse and follow legislators and policy topics independently of specific bills.
|
||||
</p>
|
||||
<div className="space-y-3">
|
||||
<Item icon={Users} color="bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400" title="Members">
|
||||
The <Link href="/members" className="text-primary hover:underline">Members</Link> page
|
||||
lists all current members of Congress. Each member page shows their sponsored bills,
|
||||
news coverage, voting trend, and — once enough votes are recorded —
|
||||
an <strong>effectiveness score</strong> ranking how often their sponsored bills advance.
|
||||
</Item>
|
||||
<Item icon={Filter} color="bg-teal-100 text-teal-700 dark:bg-teal-900/30 dark:text-teal-400" title="Topics">
|
||||
The <Link href="/topics" className="text-primary hover:underline">Topics</Link> page
|
||||
lists all AI-tagged policy areas. Following a topic sends you a Discovery alert whenever
|
||||
a new bill is tagged with it — useful for staying on top of a policy area without
|
||||
tracking individual bills.
|
||||
</Item>
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
{/* Dashboard */}
|
||||
<Section id="dashboard" title="Dashboard" icon={TrendingUp}>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
The <Link href="/" className="text-primary hover:underline">Dashboard</Link> is your
|
||||
personalised home view, split into two areas.
|
||||
</p>
|
||||
<div className="space-y-3">
|
||||
<Item icon={Heart} color="bg-red-100 text-red-600 dark:bg-red-900/30 dark:text-red-400" title="Your feed">
|
||||
Bills from your follows — directly followed bills, bills sponsored by followed members,
|
||||
and bills matching followed topics — sorted by latest activity.
|
||||
</Item>
|
||||
<Item icon={TrendingUp} color="bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400" title="Trending">
|
||||
The top 10 bills by composite trend score, calculated nightly from news article volume
|
||||
(NewsAPI + Google News) and Google Trends interest. A bill climbing here is getting real
|
||||
public attention regardless of whether you follow it.
|
||||
</Item>
|
||||
</div>
|
||||
</Section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
11
frontend/app/icon.svg
Normal file
11
frontend/app/icon.svg
Normal file
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||
<rect width="32" height="32" rx="6" fill="#1e40af"/>
|
||||
<g stroke="white" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" fill="none">
|
||||
<line x1="4" y1="28" x2="28" y2="28"/>
|
||||
<line x1="8" y1="24" x2="8" y2="15"/>
|
||||
<line x1="13" y1="24" x2="13" y2="15"/>
|
||||
<line x1="19" y1="24" x2="19" y2="15"/>
|
||||
<line x1="24" y1="24" x2="24" y2="15"/>
|
||||
<polygon points="16,5 27,13 5,13"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 488 B |
@@ -297,7 +297,7 @@ export default function NotificationsPage() {
|
||||
setAuthMethod(settings.ntfy_auth_method ?? "none");
|
||||
setToken(settings.ntfy_token ?? "");
|
||||
setUsername(settings.ntfy_username ?? "");
|
||||
setPassword(settings.ntfy_password ?? "");
|
||||
setPassword(""); // never pre-fill — password_set bool shows whether one is stored
|
||||
setEmailAddress(settings.email_address ?? "");
|
||||
setEmailEnabled(settings.email_enabled ?? false);
|
||||
setDigestEnabled(settings.digest_enabled ?? false);
|
||||
@@ -333,7 +333,7 @@ export default function NotificationsPage() {
|
||||
ntfy_auth_method: authMethod,
|
||||
ntfy_token: authMethod === "token" ? token : "",
|
||||
ntfy_username: authMethod === "basic" ? username : "",
|
||||
ntfy_password: authMethod === "basic" ? password : "",
|
||||
ntfy_password: authMethod === "basic" ? (password || undefined) : "",
|
||||
ntfy_enabled: enabled,
|
||||
},
|
||||
{ onSuccess: () => { setNtfySaved(true); setTimeout(() => setNtfySaved(false), 2000); } }
|
||||
@@ -565,7 +565,9 @@ export default function NotificationsPage() {
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-sm font-medium">Password</label>
|
||||
<input type="password" placeholder="your-password" value={password}
|
||||
<input type="password"
|
||||
placeholder={settings?.ntfy_password_set && !password ? "••••••• (saved — leave blank to keep)" : "your-password"}
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
className="w-full px-3 py-2 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-primary" />
|
||||
</div>
|
||||
|
||||
@@ -3,29 +3,7 @@
|
||||
import Link from "next/link";
|
||||
import { Tags } from "lucide-react";
|
||||
import { FollowButton } from "@/components/shared/FollowButton";
|
||||
|
||||
const TOPICS = [
|
||||
{ tag: "healthcare", label: "Healthcare", desc: "Health policy, insurance, Medicare, Medicaid" },
|
||||
{ tag: "taxation", label: "Taxation", desc: "Tax law, IRS, fiscal policy" },
|
||||
{ tag: "defense", label: "Defense", desc: "Military, NDAA, national security" },
|
||||
{ tag: "education", label: "Education", desc: "Schools, student loans, higher education" },
|
||||
{ tag: "immigration", label: "Immigration", desc: "Border, visas, asylum, citizenship" },
|
||||
{ tag: "environment", label: "Environment", desc: "Climate, EPA, conservation, energy" },
|
||||
{ tag: "housing", label: "Housing", desc: "Affordable housing, mortgages, HUD" },
|
||||
{ tag: "infrastructure", label: "Infrastructure", desc: "Roads, bridges, broadband, transit" },
|
||||
{ tag: "technology", label: "Technology", desc: "AI, cybersecurity, telecom, internet" },
|
||||
{ tag: "agriculture", label: "Agriculture", desc: "Farm bill, USDA, food policy" },
|
||||
{ tag: "judiciary", label: "Judiciary", desc: "Courts, criminal justice, civil rights" },
|
||||
{ tag: "foreign-policy", label: "Foreign Policy", desc: "Diplomacy, foreign aid, sanctions" },
|
||||
{ tag: "veterans", label: "Veterans", desc: "VA, veteran benefits, military families" },
|
||||
{ tag: "social-security", label: "Social Security", desc: "SS, Medicare, retirement benefits" },
|
||||
{ tag: "trade", label: "Trade", desc: "Tariffs, trade agreements, WTO" },
|
||||
{ tag: "budget", label: "Budget", desc: "Appropriations, debt ceiling, spending" },
|
||||
{ tag: "energy", label: "Energy", desc: "Oil, gas, renewables, nuclear" },
|
||||
{ tag: "banking", label: "Banking", desc: "Financial regulation, Fed, CFPB" },
|
||||
{ tag: "transportation", label: "Transportation", desc: "FAA, DOT, aviation, rail" },
|
||||
{ tag: "labor", label: "Labor", desc: "Minimum wage, unions, OSHA, employment" },
|
||||
];
|
||||
import { TOPICS } from "@/lib/topics";
|
||||
|
||||
export default function TopicsPage() {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user