Skip to content

Commit 63a3eb4

Browse files
committed
feat: add navigation links to entity names across screens
Add clickable links to patient and doctor names for quick navigation. Fix broken command palette routes for surgeries and doctors.
1 parent e53dbf5 commit 63a3eb4

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/renderer/src/components/command-palette/CommandPalette.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
121121
<CommandItem
122122
key={`surgery-${surgery.id}`}
123123
value={`surgery ${surgery.title} ${surgery.bht}`}
124-
onSelect={() => runCommand(() => navigate(`/surgeries/${surgery.id}`))}
124+
onSelect={() => runCommand(() => navigate(`/patients/${surgery.patient_id}/surgeries/${surgery.id}`))}
125125
>
126126
<Stethoscope className="mr-2 h-4 w-4 text-green-500" />
127127
<div className="flex flex-col">
@@ -140,7 +140,7 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
140140
<CommandItem
141141
key={`doctor-${doctor.id}`}
142142
value={`doctor ${doctor.name} ${doctor.slmc_reg_no}`}
143-
onSelect={() => runCommand(() => navigate(`/doctors/${doctor.id}`))}
143+
onSelect={() => runCommand(() => navigate(`/doctors/${doctor.id}/edit`))}
144144
>
145145
<UserCog className="mr-2 h-4 w-4 text-purple-500" />
146146
<div className="flex flex-col">

src/renderer/src/components/surgery/SelectedPatientSidebar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { cn } from '@renderer/lib/utils'
33
import { User, Hash, Calendar, MapPin, Phone, ArrowLeft } from 'lucide-react'
44
import { Button } from '@renderer/components/ui/button'
55
import { Card, CardContent, CardHeader, CardTitle } from '@renderer/components/ui/card'
6+
import { Link } from 'react-router-dom'
67

78
interface SelectedPatientSidebarProps {
89
patient: Patient
@@ -58,7 +59,9 @@ export function SelectedPatientSidebar({
5859
<CardContent className="pt-0 space-y-4">
5960
{/* Patient Name & Gender Badge */}
6061
<div>
61-
<h3 className="text-lg font-semibold truncate">{patient.name}</h3>
62+
<Link to={`/patients/${patient.id}`} className="text-lg font-semibold truncate hover:text-primary hover:underline transition-colors block">
63+
{patient.name}
64+
</Link>
6265
<span
6366
className={cn(
6467
'inline-flex px-2 py-0.5 rounded text-xs font-medium mt-1',

src/renderer/src/routes/patients/edit-patient.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { format } from 'date-fns'
1010
import { Save, UserCog, Hash, Cake, User, Building2, Calendar, Eye } from 'lucide-react'
1111
import { useEffect, useRef } from 'react'
1212
import { toast } from '@renderer/components/ui/sonner'
13-
import { useParams } from 'react-router-dom'
13+
import { Link, useParams } from 'react-router-dom'
1414
import { Patient } from 'src/shared/types/db'
1515
import womenIcon from '../../../../../resources/woman.png?asset'
1616
import manIcon from '../../../../../resources/man.png?asset'
@@ -112,7 +112,9 @@ export const EditPatient = () => {
112112
</div>
113113
</div>
114114
<div className="min-w-0 flex-1">
115-
<p className="font-semibold truncate">{data.name || 'Unknown'}</p>
115+
<Link to={`/patients/${data.id}`} className="font-semibold truncate hover:text-primary hover:underline transition-colors block">
116+
{data.name || 'Unknown'}
117+
</Link>
116118
<p className="text-sm text-muted-foreground font-mono">{data.phn}</p>
117119
</div>
118120
</div>

src/renderer/src/routes/surgeries/view-surgery.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ const DoctorList = ({ doctors, emptyMessage }: DoctorListProps) => {
118118
<li key={doctor.id} className="flex items-center gap-2 text-sm">
119119
<div className="h-1.5 w-1.5 rounded-full bg-emerald-500" />
120120
<span>
121-
Dr. {doctor.name}
121+
<Link
122+
to={`/doctors/${doctor.id}/edit`}
123+
className="hover:text-primary hover:underline transition-colors"
124+
>
125+
Dr. {doctor.name}
126+
</Link>
122127
{doctor.designation && (
123128
<span className="text-muted-foreground ml-1">({doctor.designation})</span>
124129
)}

0 commit comments

Comments
 (0)