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

Fix FileUploadDialog overflow | Use ShadCN component #10047

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all 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
47 changes: 32 additions & 15 deletions src/components/Files/FilesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Progress } from "@/components/ui/progress";
import {
Table,
Expand All @@ -38,7 +40,6 @@ import {

import AudioPlayer from "@/components/Common/AudioPlayer";
import Loading from "@/components/Common/Loading";
import TextFormField from "@/components/Form/FormFields/TextFormField";
import { FileUploadModel } from "@/components/Patient/models";

import useFileManager from "@/hooks/useFileManager";
Expand Down Expand Up @@ -576,7 +577,7 @@ const FileUploadDialog = ({
aria-labelledby="file-upload-dialog"
>
<DialogContent
className="mb-8 rounded-lg p-5"
className="mb-8 rounded-lg p-5 max-w-fit"
aria-describedby="file-upload"
>
<DialogHeader>
Expand All @@ -601,19 +602,35 @@ const FileUploadDialog = ({
<CareIcon icon="l-times" />
</Button>
</div>
<TextFormField
name={`file_name_${index}`}
type="text"
label={t("enter_file_name")}
id={`upload-file-name-${index}`}
required
value={fileUpload.fileNames[index] || ""}
disabled={fileUpload.uploading}
onChange={(e) => fileUpload.setFileName(e.value, index)}
error={
index === 0 && fileUpload.error ? fileUpload.error : undefined
}
/>
<div className="space-y-2">
<Label
htmlFor={`upload-file-name-${index}`}
className="text-sm font-medium text-gray-700"
>
{t("enter_file_name")}
</Label>
<Input
name={`file_name_${index}`}
type="text"
id={`upload-file-name-${index}`}
required
className={
index === 0 && fileUpload.error
? "border-red-500 focus:ring-red-500"
: "border-gray-300 focus:ring-primary"
}
value={fileUpload.fileNames[index] || ""}
disabled={fileUpload.uploading}
onChange={(e) =>
fileUpload.setFileName(e.target.value, index)
}
/>
{index === 0 && fileUpload.error && (
<p className="mt-1 text-sm text-red-500">
{fileUpload.error}
</p>
)}
</div>
</div>
))}
</div>
Expand Down
Loading