Skip to content

Commit 3bdc344

Browse files
committed
Update ChatBar.tsx
1 parent 3489ece commit 3bdc344

File tree

1 file changed

+19
-4
lines changed
  • apps/dashboard/src/app/nebula-app/(app)/components

1 file changed

+19
-4
lines changed

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export function ChatBar(props: {
110110
images.map(async (image) => {
111111
const b64 = await uploadImageMutation.mutateAsync(image);
112112
return { file: image, b64: b64 };
113-
}),
113+
})
114114
);
115115

116116
setImages((prev) => [...prev, ...urls]);
@@ -127,8 +127,15 @@ export function ChatBar(props: {
127127
<div
128128
className={cn(
129129
"overflow-hidden rounded-2xl border border-border bg-card",
130-
props.className,
130+
props.className
131131
)}
132+
onDrop={(e) => {
133+
e.preventDefault();
134+
if (!props.allowImageUpload) return;
135+
const files = Array.from(e.dataTransfer.files);
136+
if (files.length > 0) handleImageUpload(files);
137+
}}
138+
onDragOver={(e) => e.preventDefault()}
132139
>
133140
{images.length > 0 && (
134141
<ImagePreview
@@ -146,6 +153,14 @@ export function ChatBar(props: {
146153
placeholder={props.placeholder}
147154
value={message}
148155
onChange={(e) => setMessage(e.target.value)}
156+
onPaste={(e) => {
157+
if (!props.allowImageUpload) return;
158+
const files = Array.from(e.clipboardData.files);
159+
if (files.length > 0) {
160+
e.preventDefault();
161+
handleImageUpload(files);
162+
}
163+
}}
149164
onKeyDown={(e) => {
150165
// ignore if shift key is pressed to allow entering new lines
151166
if (e.shiftKey) {
@@ -266,7 +281,7 @@ export function ChatBar(props: {
266281
`You can only upload up to ${maxAllowedImagesPerMessage} images at a time`,
267282
{
268283
position: "top-right",
269-
},
284+
}
270285
);
271286
return;
272287
}
@@ -543,7 +558,7 @@ function WalletSelector(props: {
543558
key={wallet.address}
544559
className={cn(
545560
"flex cursor-pointer items-center justify-between px-3 py-4 hover:bg-accent/50",
546-
props.selectedAddress === wallet.address && "bg-accent/50",
561+
props.selectedAddress === wallet.address && "bg-accent/50"
547562
)}
548563
onKeyDown={(e) => {
549564
if (e.key === "Enter" || e.key === " ") {

0 commit comments

Comments
 (0)