Skip to content

Commit 54b06e9

Browse files
committed
Fix rendering issues with policy comparisons
1 parent 05de411 commit 54b06e9

File tree

7 files changed

+141
-135
lines changed

7 files changed

+141
-135
lines changed

app/analysis/[id]/analysis-page.tsx

Lines changed: 62 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
"use client"
22

3-
import { useState, useEffect } from "react"
4-
import { useParams, useRouter } from "next/navigation"
5-
import { SidebarInset, SidebarTrigger } from "@/components/ui/sidebar"
6-
import { Separator } from "@/components/ui/separator"
7-
import { Breadcrumb, BreadcrumbItem, BreadcrumbList, BreadcrumbPage, BreadcrumbLink } from "@/components/ui/breadcrumb"
8-
import { Button } from "@/components/ui/button"
9-
import { ArrowLeft, User, Loader2 } from "lucide-react"
10-
import Link from "next/link"
113
import PolicyComparison from "@/components/policy-comparison"
4+
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage } from "@/components/ui/breadcrumb"
5+
import { Button } from "@/components/ui/button"
6+
import { Separator } from "@/components/ui/separator"
7+
import { SidebarInset, SidebarTrigger } from "@/components/ui/sidebar"
128
import { useAnalysisStore } from "@/lib/analysis-store"
139
import type { ProcessSBCResponse } from "@/lib/sbc-schema"
10+
import { ArrowLeft, Loader2, User } from "lucide-react"
11+
import Link from "next/link"
12+
import { useParams, useRouter } from "next/navigation"
13+
import { useEffect, useState } from "react"
1414

1515
export default function AnalysisPage() {
1616
const params = useParams()
@@ -122,58 +122,61 @@ export default function AnalysisPage() {
122122
? `${analysisName.substring(0, 20)}...`
123123
: analysisName || "Analysis"
124124

125+
125126
return (
126-
<SidebarInset>
127-
<header className="sticky top-0 z-10 flex h-14 sm:h-16 shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4">
128-
<SidebarTrigger className="-ml-1" />
129-
<Separator orientation="vertical" className="mr-2 h-4" />
130-
<div className="flex-1 min-w-0">
131-
<Breadcrumb>
132-
<BreadcrumbList>
133-
<BreadcrumbItem className="hidden sm:block">
134-
<BreadcrumbLink href="/analyze-compare">Analyze & Compare</BreadcrumbLink>
135-
</BreadcrumbItem>
136-
<BreadcrumbItem>
137-
<BreadcrumbPage className="truncate max-w-[150px] sm:max-w-none">
138-
{displayName}
139-
</BreadcrumbPage>
140-
</BreadcrumbItem>
141-
</BreadcrumbList>
142-
</Breadcrumb>
143-
</div>
144-
<div className="flex items-center gap-1 sm:gap-2">
145-
<Button
146-
variant="outline"
147-
size="sm"
148-
onClick={() => router.push("/analyze-compare")}
149-
className="hidden sm:flex"
150-
>
151-
<ArrowLeft className="w-4 h-4 mr-2" />
152-
Back
153-
</Button>
154-
<Button
155-
variant="ghost"
156-
size="sm"
157-
onClick={() => router.push("/analyze-compare")}
158-
className="sm:hidden h-8 w-8 p-0"
159-
>
160-
<ArrowLeft className="w-4 h-4" />
161-
</Button>
162-
<Button variant="outline" size="sm" asChild className="hidden sm:flex">
163-
<Link href="/health-profile">
164-
<User className="w-4 h-4 mr-2" />
165-
Health Profile
166-
</Link>
167-
</Button>
168-
<Button variant="ghost" size="sm" asChild className="sm:hidden h-8 w-8 p-0">
169-
<Link href="/health-profile">
170-
<User className="w-4 h-4" />
171-
</Link>
172-
</Button>
127+
128+
<SidebarInset>
129+
<header className="sticky top-0 z-10 flex h-14 sm:h-16 shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4">
130+
<SidebarTrigger className="-ml-1" />
131+
<Separator orientation="vertical" className="mr-2 h-4" />
132+
<div className="flex-1 min-w-0">
133+
<Breadcrumb>
134+
<BreadcrumbList>
135+
<BreadcrumbItem className="hidden sm:block">
136+
<BreadcrumbLink href="/analyze-compare">Analyze & Compare</BreadcrumbLink>
137+
</BreadcrumbItem>
138+
<BreadcrumbItem>
139+
<BreadcrumbPage className="truncate max-w-[150px] sm:max-w-none">
140+
{displayName}
141+
</BreadcrumbPage>
142+
</BreadcrumbItem>
143+
</BreadcrumbList>
144+
</Breadcrumb>
145+
</div>
146+
<div className="flex items-center gap-1 sm:gap-2">
147+
<Button
148+
variant="outline"
149+
size="sm"
150+
onClick={() => router.push("/analyze-compare")}
151+
className="hidden sm:flex"
152+
>
153+
<ArrowLeft className="w-4 h-4 mr-2" />
154+
Back
155+
</Button>
156+
<Button
157+
variant="ghost"
158+
size="sm"
159+
onClick={() => router.push("/analyze-compare")}
160+
className="sm:hidden h-8 w-8 p-0"
161+
>
162+
<ArrowLeft className="w-4 h-4" />
163+
</Button>
164+
<Button variant="outline" size="sm" asChild className="hidden sm:flex">
165+
<Link href="/health-profile">
166+
<User className="w-4 h-4 mr-2" />
167+
Health Profile
168+
</Link>
169+
</Button>
170+
<Button variant="ghost" size="sm" asChild className="sm:hidden h-8 w-8 p-0">
171+
<Link href="/health-profile">
172+
<User className="w-4 h-4" />
173+
</Link>
174+
</Button>
175+
</div>
176+
</header>
177+
<div className="p-4">
178+
<PolicyComparison results={analysisResults} />
173179
</div>
174-
</header>
175-
176-
<PolicyComparison results={analysisResults} />
177-
</SidebarInset>
180+
</SidebarInset>
178181
)
179182
}

app/analysis/[id]/page.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1-
// Re-export the simplified page as the default
2-
export { default } from './analysis-page'
3-
export const runtime = 'edge'
1+
'use client'
2+
3+
import { AssistantRuntimeProvider } from '@assistant-ui/react';
4+
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
5+
import AnalysisPage from './analysis-page';
6+
7+
export default function Page({ params }: { params: { id: string } }) {
8+
const runtime = useChatRuntime({
9+
api: "/api/chat",
10+
});
11+
12+
return (
13+
<AssistantRuntimeProvider runtime={runtime}>
14+
<AnalysisPage />
15+
</AssistantRuntimeProvider>
16+
)
17+
}

app/assistant.tsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { useIsMobile } from "@/hooks/use-mobile";
2929
import { useHealthProfileStore } from "@/lib/health-profile-store";
3030
import { AssistantRuntimeProvider } from "@assistant-ui/react";
3131
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
32-
import Link from "next/link";
3332

3433
/**
3534
* Main Assistant Application Component
@@ -107,31 +106,6 @@ export const Assistant = () => {
107106
<AssistantPolicyAnalysis />
108107
</div> */}
109108

110-
{/* Footer */}
111-
<footer className="mt-12 pt-6 border-t bg-muted/20">
112-
<div className="flex items-center justify-center py-4">
113-
<Link
114-
className="flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors px-4 py-2 rounded-md hover:bg-muted/50"
115-
href="https://github.com/aaln/health-insurance-coverage"
116-
target="_blank"
117-
rel="noopener noreferrer"
118-
>
119-
<svg
120-
className="w-4 h-4"
121-
fill="currentColor"
122-
viewBox="0 0 24 24"
123-
aria-hidden="true"
124-
>
125-
<path
126-
fillRule="evenodd"
127-
d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
128-
clipRule="evenodd"
129-
/>
130-
</svg>
131-
<span>View Open Source Repo on GitHub</span>
132-
</Link>
133-
</div>
134-
</footer>
135109
</main>
136110

137111
{/* Mobile Chat Modal - Only shown on mobile devices */}

app/layout.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import type React from "react"
21
import type { Metadata } from "next"
32
import { Inter } from "next/font/google"
3+
import type React from "react"
44
import "./globals.css"
55

6-
import { SidebarProvider } from "@/components/ui/sidebar"
76
import { AppSidebar } from "@/components/app-sidebar"
7+
import { PolicyProvider } from "@/components/policy-context"
8+
import { SidebarProvider } from "@/components/ui/sidebar"
89

910
const inter = Inter({ subsets: ["latin"] })
1011

@@ -22,10 +23,12 @@ export default function RootLayout({
2223
return (
2324
<html lang="en">
2425
<body className={inter.className}>
25-
<SidebarProvider>
26-
<AppSidebar />
27-
{children}
28-
</SidebarProvider>
26+
<PolicyProvider>
27+
<SidebarProvider>
28+
<AppSidebar />
29+
{children}
30+
</SidebarProvider>
31+
</PolicyProvider>
2932
</body>
3033
</html>
3134
)

components/app-sidebar.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
"use client"
22

33
import type React from "react"
4-
import { useState, useEffect } from "react"
4+
import { useEffect, useState } from "react"
55

6-
import { FileText, Github, Home, Info, MoreHorizontal, Trash2, Eye, HeartCrack, Wrench, History, Stethoscope, DollarSign, Heart } from "lucide-react"
6+
import { Eye, FileText, Github, Heart, HeartCrack, Info, MoreHorizontal, Stethoscope, Trash2, Wrench } from "lucide-react"
77

8+
import { AboutModal } from "@/components/about-modal"
9+
import { SbcInfoModal } from "@/components/sbc-info-modal"
10+
import { Button } from "@/components/ui/button"
11+
import {
12+
DropdownMenu,
13+
DropdownMenuContent,
14+
DropdownMenuItem,
15+
DropdownMenuTrigger,
16+
} from "@/components/ui/dropdown-menu"
817
import {
918
Sidebar,
1019
SidebarContent,
@@ -17,17 +26,8 @@ import {
1726
SidebarMenuItem,
1827
SidebarRail,
1928
} from "@/components/ui/sidebar"
20-
import { SbcInfoModal } from "@/components/sbc-info-modal"
21-
import { AboutModal } from "@/components/about-modal"
22-
import { useAnalysisStore } from "@/lib/analysis-store"
2329
import { useAnalysisHistoryStore } from "@/lib/analysis-history-store"
24-
import {
25-
DropdownMenu,
26-
DropdownMenuContent,
27-
DropdownMenuItem,
28-
DropdownMenuTrigger,
29-
} from "@/components/ui/dropdown-menu"
30-
import { Button } from "@/components/ui/button"
30+
import { useAnalysisStore } from "@/lib/analysis-store"
3131
import { useRouter } from "next/navigation"
3232

3333
// Define proper types for the navigation items
@@ -75,12 +75,12 @@ const data = {
7575
// icon: FileText,
7676
// isActive: false,
7777
// },
78-
// {
79-
// title: "Find Optimal Providers",
80-
// url: "/find-providers",
81-
// icon: Stethoscope,
82-
// isActive: false,
83-
// },
78+
{
79+
title: "Find Optimal Providers",
80+
url: "/find-providers",
81+
icon: Stethoscope,
82+
isActive: false,
83+
},
8484
] as NavigationItem[],
8585
},
8686
{

components/policy-analysis.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ import { Badge } from "@/components/ui/badge"
2727
import { Button } from "@/components/ui/button"
2828
import { Skeleton } from "@/components/ui/skeleton"
2929
import {
30-
useCategoryAnalysis,
31-
useInsuranceSettings,
32-
useSituationSuggestions
30+
useCategoryAnalysis,
31+
useInsuranceSettings,
32+
useSituationSuggestions
3333
} from "@/hooks"
34-
import { useComposerRuntime } from "@assistant-ui/react"
3534
import { ChevronRight, Home } from "lucide-react"
3635
import { useCallback } from "react"
3736
import { Thread } from "./assistant-ui/thread"
@@ -54,7 +53,7 @@ export default function PolicyAnalysis() {
5453
const { policy } = usePolicy();
5554

5655
/** Get composer runtime for chat integration */
57-
const composerRuntime = useComposerRuntime();
56+
// const composerRuntime = useComposerRuntime();
5857

5958
/** Centralized insurance settings management */
6059
const {
@@ -100,8 +99,8 @@ export default function PolicyAnalysis() {
10099
onSuggestionClick: (suggestion: string) => {
101100
// Send suggestion to chat interface
102101
console.log("Suggestion clicked:", suggestion);
103-
composerRuntime.setText(suggestion);
104-
composerRuntime.send();
102+
// composerRuntime.setText(suggestion);
103+
// composerRuntime.send();
105104
},
106105
});
107106

0 commit comments

Comments
 (0)