-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added scroll and responsiveness to the plots page #9815
Changes from 2 commits
1a6607d
623d7d1
24ce109
b6480b1
fbdad74
8eb6c3e
8b30429
4bf98ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ import { | |
} from "@/components/Common/Charts/ObservationChart"; | ||
import Loading from "@/components/Common/Loading"; | ||
|
||
import useWindowDimensions from "@/hooks/useWindowDimensions"; | ||
|
||
import { EncounterTabProps } from "@/pages/Encounters/EncounterShow"; | ||
|
||
type QueryParams = { | ||
|
@@ -21,6 +23,8 @@ export const EncounterPlotsTab = (props: EncounterTabProps) => { | |
const { t } = useTranslation(); | ||
const [qParams, setQParams] = useQueryParams<QueryParams>(); | ||
|
||
const { width } = useWindowDimensions(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use useBreakpoints instead for standard window sizes. |
||
|
||
const { data, isLoading } = useQuery<ObservationPlotConfig>({ | ||
queryKey: ["plots-config"], | ||
queryFn: () => fetch(careConfig.plotsConfigUrl).then((res) => res.json()), | ||
|
@@ -43,20 +47,22 @@ export const EncounterPlotsTab = (props: EncounterTabProps) => { | |
value={currentTabId} | ||
onValueChange={(value) => setQParams({ plot: value })} | ||
> | ||
Comment on lines
48
to
49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of adding a div with className, we can simply add className to the parent Tabs component ryt? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh my bad. Tried on TabsList? lots of other usages seems to be working fine with TabsList There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it gives a vertical scroll but not a horizontal scroll There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you sure? it's working fine for me There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why does it cut out? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<TabsList> | ||
{data.map((tab) => ( | ||
<TabsTrigger key={tab.id} value={tab.id}> | ||
{tab.name} | ||
</TabsTrigger> | ||
))} | ||
</TabsList> | ||
<div className="overflow-x-scroll w-full"> | ||
<TabsList> | ||
{data.map((tab) => ( | ||
<TabsTrigger key={tab.id} value={tab.id}> | ||
{tab.name} | ||
</TabsTrigger> | ||
))} | ||
</TabsList> | ||
</div> | ||
|
||
{data.map((tab) => ( | ||
<TabsContent key={tab.id} value={tab.id}> | ||
<ObservationVisualizer | ||
patientId={props.patient.id} | ||
codeGroups={tab.groups} | ||
gridCols={2} | ||
gridCols={width >= 768 ? 2 : 1} | ||
/> | ||
</TabsContent> | ||
))} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Add SSR safety check and debounce resize events
The current implementation of
useWindowDimensions
has two issues:Suggested improvements:
undefined
and update in useEffect🔗 Analysis chain
Verify the window dimensions hook implementation
The implementation of
useWindowDimensions
should properly handle:Let's verify the hook implementation:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 73
Script:
Length of output: 66367
Script:
Length of output: 781