Skip to content

Commit 3a8b7bc

Browse files
RyanHanszRyan Hanszclaude
authored
refactor: Clean up share buttons and UI tweaks on referral page (#130)
Co-authored-by: Ryan Hansz <ryan@Ryans-MacBook-Pro-2.local> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent edbe080 commit 3a8b7bc

6 files changed

Lines changed: 71 additions & 37 deletions

File tree

frontend/src/app/[locale]/generate-referrals/page.tsx

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22
import React, { useEffect, useState } from "react";
3-
import { ChevronLeft, Printer, Sparkles } from "lucide-react";
3+
import { ChevronLeft, Sparkles } from "lucide-react";
44

55
import { Button } from "@/components/ui/button";
66

@@ -16,7 +16,7 @@ import { ActionPlanSection } from "@/components/ActionPlanSection";
1616
import ResourcesList from "@/components/ResourcesList";
1717
import { useSearchParams } from "next/navigation";
1818
import { UploadIntakeTab } from "@/components/UploadIntakeTab";
19-
import { EmailReferralsButton } from "@/components/EmailReferralsButton";
19+
import { ShareButtons } from "@/components/ShareButtons";
2020

2121
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
2222
import { Upload } from "lucide-react";
@@ -345,10 +345,10 @@ export default function Page() {
345345
setUserEmail={setUserEmail}
346346
/>
347347
) : (
348-
<div className="print:hidden">
348+
<div className="print:hidden overflow-x-hidden">
349349
<PilotFeedbackBanner />
350350
<GoodwillReferralToolHeaderPilot />
351-
<div className="flex flex-col gap-2 m-4">
351+
<div className="max-w-5xl mx-auto px-4 flex flex-col gap-2">
352352
<Tabs
353353
value={activeTab}
354354
onValueChange={setActiveTab}
@@ -413,25 +413,11 @@ export default function Page() {
413413
<ChevronLeft className="w-4 h-4" />
414414
Return To Search
415415
</Button>
416-
<div className="flex gap-2">
417-
<Button
418-
onClick={handlePrint}
419-
variant="outline"
420-
className="hover:bg-gray-100 hover:text-gray-900"
421-
>
422-
<Printer
423-
data-testid="printReferralsButton"
424-
className="w-4 h-4"
425-
/>
426-
Print Referrals
427-
</Button>
428-
{resourcesResultId && (
429-
<EmailReferralsButton
430-
resultId={resourcesResultId}
431-
actionPlanResultId={actionPlanResultId || undefined}
432-
/>
433-
)}
434-
</div>
416+
<ShareButtons
417+
onPrint={handlePrint}
418+
resourcesResultId={resourcesResultId}
419+
actionPlanResultId={actionPlanResultId}
420+
/>
435421
</div>
436422
</div>
437423
)}
@@ -463,6 +449,21 @@ export default function Page() {
463449
onGenerateActionPlan={() => void generateActionPlan()}
464450
/>
465451
)}
452+
453+
{readyToPrint && (
454+
<div className="pt-4 border-t mt-6 pb-8">
455+
<h4 className="text-sm font-medium text-gray-700 mb-3 text-right">
456+
Share
457+
</h4>
458+
<ShareButtons
459+
onPrint={handlePrint}
460+
resourcesResultId={resourcesResultId}
461+
actionPlanResultId={actionPlanResultId}
462+
className="justify-end"
463+
testIdSuffix="bottom"
464+
/>
465+
</div>
466+
)}
466467
</div>
467468
</div>
468469
)}

frontend/src/app/[locale]/view.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function View() {
44
const t = useTranslations("home");
55

66
return (
7-
<>
7+
<div className="max-w-5xl mx-auto px-4">
88
<h1>{t("title")}</h1>
99

1010
{/* Demonstration of more complex translated strings, with safe-listed links HTML elements */}
@@ -15,7 +15,7 @@ export function View() {
1515
),
1616
})}
1717
</p>
18-
<div className="measure-6">
18+
<div>
1919
{t.rich("body", {
2020
ul: (content) => <ul>{content}</ul>,
2121
li: (content) => <li>{content}</li>,
@@ -29,6 +29,6 @@ export function View() {
2929
})}
3030
</p>
3131
</div>
32-
</>
32+
</div>
3333
);
3434
}

frontend/src/components/ActionPlanSection.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,9 @@ export function ActionPlanSection({
6464
/>
6565
<label
6666
htmlFor={`resource-${index}`}
67-
className="flex-1 cursor-pointer"
67+
className="flex-1 cursor-pointer font-medium text-gray-900"
6868
>
69-
<div className="font-medium text-gray-900">
70-
{resource.name}
71-
</div>
72-
{resource.description && (
73-
<div className="text-sm text-gray-600">
74-
{resource.description}
75-
</div>
76-
)}
69+
{resource.name}
7770
</label>
7871
</div>
7972
))}

frontend/src/components/EmailReferralsButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function EmailReferralsButton({
7474
data-testid="emailReferralsButton"
7575
>
7676
<Mail className="w-4 h-4" />
77-
Email Referrals
77+
Email
7878
</Button>
7979
</DialogTrigger>
8080
<DialogContent>

frontend/src/components/ResourcesList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const ResourcesList = ({
141141
href={normalizeUrl(r.website)}
142142
rel="noopener noreferrer"
143143
target="_blank"
144-
className="text-base text-gray-800"
144+
className="text-blue-600 hover:underline"
145145
>
146146
{r.website}
147147
</Link>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { Printer } from "lucide-react";
2+
import { Button } from "@/components/ui/button";
3+
import { EmailReferralsButton } from "@/components/EmailReferralsButton";
4+
import { cn } from "@/lib/utils";
5+
6+
interface ShareButtonsProps {
7+
onPrint: () => void;
8+
resourcesResultId: string;
9+
actionPlanResultId: string;
10+
className?: string;
11+
testIdSuffix?: string;
12+
}
13+
14+
export function ShareButtons({
15+
onPrint,
16+
resourcesResultId,
17+
actionPlanResultId,
18+
className,
19+
testIdSuffix,
20+
}: ShareButtonsProps) {
21+
return (
22+
<div className={cn("flex gap-2", className)}>
23+
<Button
24+
onClick={onPrint}
25+
variant="outline"
26+
className="hover:bg-gray-100 hover:text-gray-900"
27+
data-testid={`printReferralsButton${testIdSuffix ? `-${testIdSuffix}` : ""}`}
28+
>
29+
<Printer className="w-4 h-4" aria-hidden="true" />
30+
Print
31+
</Button>
32+
{resourcesResultId && (
33+
<EmailReferralsButton
34+
resultId={resourcesResultId}
35+
actionPlanResultId={actionPlanResultId || undefined}
36+
/>
37+
)}
38+
</div>
39+
);
40+
}

0 commit comments

Comments
 (0)