Skip to content

Commit e754aba

Browse files
committed
feat: redesign view surgery page and update sheet components
- Redesign view surgery with card-based layout matching other pages - Add emerald-themed header with clickable patient link - Organize surgery details, team, notes into visual cards - Update follow-up sheet with cyan-themed header and wider width - Update add doctor sheet with blue-themed header - Add gradient buttons and better visual hierarchy to all sheets
1 parent d14ebac commit e754aba

3 files changed

Lines changed: 459 additions & 287 deletions

File tree

src/renderer/src/components/doctor/DoctorAutoComplete.tsx

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ import { queryOptions, useQueries, useQuery } from '@tanstack/react-query'
55
import { queries } from '../../lib/queries'
66
import { useCallback, useRef, useState } from 'react'
77
import { Badge } from '../ui/badge'
8-
import { X } from 'lucide-react'
8+
import { X, UserPlus, Save } from 'lucide-react'
99
import {
1010
Sheet,
11-
SheetClose,
1211
SheetContent,
13-
SheetDescription,
1412
SheetFooter,
15-
SheetHeader
13+
SheetHeader,
14+
SheetTitle
1615
} from '../ui/sheet'
1716
import { Button } from '../ui/button'
1817
import { AddOrEditDoctor, AddOrEditDoctorRef } from './AddOrEditDoctor'
@@ -53,7 +52,7 @@ const SelectedDoctorChips = ({
5352

5453
return (
5554
<div className="flex flex-wrap">
56-
{results.map((result, _i) => {
55+
{results.map((result) => {
5756
const doctor = result.data
5857
if (!doctor) return null
5958
return (
@@ -127,25 +126,36 @@ export const DoctorAutoComplete = ({ onSelected, selectedDoctorIds }: DoctorAuto
127126
<SelectedDoctorChips selectedDoctorIds={selected} onDelete={handleDelete} />
128127
</div>
129128
</div>
130-
<Sheet open={addNewSheetOpen} onOpenChange={() => setAddNewSheetOpen(false)}>
131-
<SheetContent>
132-
<SheetHeader>Add New Doctor</SheetHeader>
133-
<SheetDescription> Add a new doctor to the system</SheetDescription>
129+
<Sheet open={addNewSheetOpen} onOpenChange={setAddNewSheetOpen}>
130+
<SheetContent className="sm:max-w-none w-[480px] flex flex-col">
131+
<SheetHeader className="pb-4 border-b">
132+
<div className="flex items-center gap-3">
133+
<div className="h-10 w-10 rounded-xl bg-blue-500/10 flex items-center justify-center">
134+
<UserPlus className="h-5 w-5 text-blue-500" />
135+
</div>
136+
<div>
137+
<SheetTitle className="text-lg">Add New Doctor</SheetTitle>
138+
<p className="text-sm text-muted-foreground mt-0.5">
139+
Add a new doctor to the system
140+
</p>
141+
</div>
142+
</div>
143+
</SheetHeader>
134144

135-
<div className="my-2">
145+
<div className="flex-1 py-4">
136146
<AddOrEditDoctor ref={addDoctorFormRef} onUpdated={handleNewDoctor} />
137147
</div>
138148

139-
<SheetFooter>
140-
<SheetClose asChild>
141-
<Button
142-
onClick={() => {
143-
addDoctorFormRef.current?.submit()
144-
}}
145-
>
146-
Save
147-
</Button>
148-
</SheetClose>
149+
<SheetFooter className="pt-4 border-t">
150+
<Button
151+
variant="gradient"
152+
onClick={() => {
153+
addDoctorFormRef.current?.submit()
154+
}}
155+
>
156+
<Save className="h-4 w-4 mr-2" />
157+
Save Doctor
158+
</Button>
149159
</SheetFooter>
150160
</SheetContent>
151161
</Sheet>

src/renderer/src/components/surgery/AddOrEditFollowup.tsx

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Followup } from 'src/shared/types/db'
22
import {
33
Sheet,
44
SheetContent,
5-
SheetDescription,
65
SheetFooter,
76
SheetHeader,
87
SheetTitle,
@@ -18,6 +17,7 @@ import { unwrapResult } from '@renderer/lib/utils'
1817
import toast from 'react-hot-toast'
1918
import { useMutation, useQueryClient } from '@tanstack/react-query'
2019
import { queries } from '@renderer/lib/queries'
20+
import { ChevronRight, Save } from 'lucide-react'
2121

2222
export interface AddOrEditFollowupProps {
2323
surgeryId?: number
@@ -27,13 +27,13 @@ export interface AddOrEditFollowupProps {
2727
trigger?: React.ReactNode
2828
}
2929

30-
const followupSchema = z.object({
30+
const _followupSchema = z.object({
3131
notes: z.string().min(1, {
3232
message: 'Note is required'
3333
})
3434
})
3535

36-
type FollowupSchema = z.infer<typeof followupSchema>
36+
type FollowupSchema = z.infer<typeof _followupSchema>
3737

3838
export const AddOrEditFollowup = ({
3939
trigger,
@@ -111,7 +111,7 @@ export const AddOrEditFollowup = ({
111111
} else {
112112
await createNewFollowup(values)
113113
}
114-
} catch (error) {
114+
} catch {
115115
toast.error('Failed to save followup')
116116
}
117117
}
@@ -121,23 +121,32 @@ export const AddOrEditFollowup = ({
121121
return (
122122
<Sheet open={sheetOpen} onOpenChange={setSheetOpen}>
123123
<SheetTrigger asChild>{trigger}</SheetTrigger>
124-
<SheetContent className="sm:max-w-none w-[600px]">
124+
<SheetContent className="sm:max-w-none w-[720px] flex flex-col">
125125
<Form {...form}>
126-
<SheetHeader>
127-
<SheetTitle>{!isUpdate ? <>Add Followup</> : <>Edit Followup</>}</SheetTitle>
128-
<SheetDescription>
129-
{!isUpdate ? (
130-
<>Add a new followup for this surgery</>
131-
) : (
132-
<>Edit the followup for this surgery</>
133-
)}
134-
</SheetDescription>
126+
<SheetHeader className="pb-4 border-b">
127+
<div className="flex items-center gap-3">
128+
<div className="h-10 w-10 rounded-xl bg-cyan-500/10 flex items-center justify-center">
129+
<ChevronRight className="h-5 w-5 text-cyan-500" />
130+
</div>
131+
<div>
132+
<SheetTitle className="text-lg">
133+
{!isUpdate ? 'Add Follow-up' : 'Edit Follow-up'}
134+
</SheetTitle>
135+
<p className="text-sm text-muted-foreground mt-0.5">
136+
{!isUpdate
137+
? 'Record a new follow-up note for this surgery'
138+
: 'Update the follow-up details'}
139+
</p>
140+
</div>
141+
</div>
142+
</SheetHeader>
135143

144+
<div className="flex-1 py-4 overflow-hidden">
136145
<FormField
137146
name="notes"
138147
control={form.control}
139148
render={({ field }) => (
140-
<FormItem>
149+
<FormItem className="h-full">
141150
<FormControl>
142151
<RichTextEditor
143152
initialContent={field.value || undefined}
@@ -148,14 +157,17 @@ export const AddOrEditFollowup = ({
148157
</FormItem>
149158
)}
150159
/>
151-
</SheetHeader>
152-
<SheetFooter>
160+
</div>
161+
162+
<SheetFooter className="pt-4 border-t">
153163
<Button
154164
type="submit"
165+
variant="gradient"
155166
onClick={submitForm}
156167
isLoading={createNewFollowupMutation.isPending || updateFollowupMutation.isPending}
157168
>
158-
Save changes
169+
<Save className="h-4 w-4 mr-2" />
170+
{isUpdate ? 'Save Changes' : 'Add Follow-up'}
159171
</Button>
160172
</SheetFooter>
161173
</Form>

0 commit comments

Comments
 (0)