Skip to content
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

Minor enhancements #9631

Merged
merged 6 commits into from
Jan 2, 2025
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/Common/UserSelector.tsx
Original file line number Diff line number Diff line change
@@ -55,8 +55,8 @@ export default function UserSelector({
const users = data?.results || [];

return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Popover open={open} onOpenChange={setOpen} modal={true}>
<PopoverTrigger asChild className="w-full">
Jacobjeevan marked this conversation as resolved.
Show resolved Hide resolved
<Button
variant="outline"
role="combobox"
@@ -77,7 +77,11 @@ export default function UserSelector({
<CaretDownIcon className="ml-auto" />
</Button>
</PopoverTrigger>
<PopoverContent className="p-0" align="start">
<PopoverContent
className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[--radix-popover-content-available-width]"
align="start"
sideOffset={4}
>
Comment on lines +82 to +86
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix CSS variable syntax in max-width

The responsive width adjustments are good, but there's a syntax error in the CSS variable usage:

Apply this fix:

-        className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[--radix-popover-content-available-width]"
+        className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[var(--radix-popover-content-available-width)]"

The max-width CSS variable needs to be wrapped in var() for proper functionality.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<PopoverContent
className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[--radix-popover-content-available-width]"
align="start"
sideOffset={4}
>
<PopoverContent
className="p-0 w-[var(--radix-popover-trigger-width)] max-w-[var(--radix-popover-content-available-width)]"
align="start"
sideOffset={4}
>

<Command filter={() => 1}>
<CommandInput
placeholder={t("search")}
19 changes: 16 additions & 3 deletions src/pages/Encounters/EncounterList.tsx
Original file line number Diff line number Diff line change
@@ -184,13 +184,23 @@ export function EncounterList({
queryParams: {
...buildQueryParams(status, facilityId, encounterClass, priority),
name,
encounter_id,
external_identifier,
limit: resultsPerPage,
offset: ((qParams.page || 1) - 1) * resultsPerPage,
},
}),
enabled: !propEncounters,
enabled: !propEncounters && !encounter_id,
});

const { data: queryEncounter } = useQuery<Encounter>({
queryKey: ["encounter", encounter_id],
queryFn: query(routes.encounter.get, {
pathParams: { id: encounter_id },
queryParams: {
facility: facilityId,
},
}),
enabled: !!encounter_id,
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
});

const searchOptions = [
@@ -220,7 +230,10 @@ export function EncounterList({
},
];

const encounters = propEncounters || queryEncounters?.results || [];
const encounters =
propEncounters ||
queryEncounters?.results ||
(queryEncounter ? [queryEncounter] : []);

const { t } = useTranslation();

6 changes: 3 additions & 3 deletions src/pages/Encounters/tabs/EncounterFilesTab.tsx
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Tabs, TabsContent } from "@/components/ui/tabs";
import {
Tooltip,
TooltipContent,
@@ -490,7 +490,7 @@ export const EncounterFilesTab = (props: EncounterTabProps) => {
>
<div className="mx-2 flex flex-col flex-wrap gap-3 sm:flex-row justify-between">
<div className="flex sm:flex-row flex-wrap flex-col gap-4 sm:items-center">
<TabsList className="flex flex-row flex-wrap gap-2 h-auto">
{/* <TabsList className="flex flex-row flex-wrap gap-2 h-auto">
{fileCategories.map((category) => (
<TabsTrigger
key={category.value}
@@ -500,7 +500,7 @@ export const EncounterFilesTab = (props: EncounterTabProps) => {
{category.label}
</TabsTrigger>
))}
</TabsList>
</TabsList> */}
<FilterButton />
</div>
<FileUploadButtons />
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ export default function LinkFacilityUserSheet({
Link User
</Button>
</SheetTrigger>
<SheetContent>
<SheetContent className="w-full sm:max-w-md overflow-y-auto p-8">
<SheetHeader>
<SheetTitle>Link User to Facility</SheetTitle>
<SheetDescription>
@@ -172,7 +172,13 @@ export default function LinkFacilityUserSheet({
<SelectTrigger className="h-12">
<SelectValue placeholder="Select a role" />
</SelectTrigger>
<SelectContent>
<SelectContent
position="popper"
className="max-h-[calc(100vh-60vh)] w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] overflow-y-auto"
sideOffset={4}
side="bottom"
avoidCollisions={true}
>
{roles?.results?.map((role) => (
<SelectItem key={role.id} value={role.id}>
<div className="flex flex-col text-left">