Skip to content

Commit f4ac3c2

Browse files
committed
[NEB-245] Limit image format types for upload (#7019)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the `ImageUploadButton` component by allowing it to accept specific image file types and updating the `ChatBar` component to utilize this feature. ### Detailed summary - In `ChatBar.tsx`, added `accept` attribute with value `"image/jpeg,image/png,image/webp"` to the file input. - In `image-upload-button.tsx`, changed `accept` property from a static value `"image/*"` to a dynamic value using `props.accept`. - Updated `ImageUploadButton` to include `accept` in its props definition. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent a3a4bf4 commit f4ac3c2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

apps/dashboard/src/@/components/ui/image-upload-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ interface ImageUploadProps {
1111
variant?: React.ComponentProps<typeof Button>["variant"];
1212
className?: string;
1313
multiple?: boolean;
14+
accept: string;
1415
}
1516

1617
export function ImageUploadButton(props: ImageUploadProps) {
@@ -34,7 +35,7 @@ export function ImageUploadButton(props: ImageUploadProps) {
3435
ref={fileInputRef}
3536
type="file"
3637
multiple={props.multiple}
37-
accept="image/*"
38+
accept={props.accept}
3839
onChange={handleFileChange}
3940
className="hidden"
4041
aria-label="Upload image"

apps/dashboard/src/app/nebula-app/(app)/components/ChatBar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ export function ChatBar(props: {
254254
<ImageUploadButton
255255
multiple
256256
value={undefined}
257+
accept="image/jpeg,image/png,image/webp"
257258
onChange={(files) => {
258259
const totalFiles = files.length + images.length;
259260

0 commit comments

Comments
 (0)