.
This commit is contained in:
@@ -7,7 +7,7 @@ import type { Uuid } from "~/lib/api/types"; // Adjust path
|
||||
import { cn, formatFileSize } from "~/lib/utils"; // Adjust path
|
||||
import TextBox from "./custom-ui/text-box"; // Adjust path, assuming TextBox is in ./custom-ui/
|
||||
import { Button } from "./ui/button"; // Adjust path
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip"; // Adjust path
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip"; // Adjust path
|
||||
|
||||
export interface MessageBoxProps {
|
||||
channelId: string;
|
||||
@@ -96,28 +96,26 @@ export default function MessageBox({ channelId }: MessageBoxProps) {
|
||||
>
|
||||
<FileIcon contentType={file.type} className="h-7 w-7 flex-shrink-0 text-muted-foreground" />
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="truncate font-medium text-card-foreground">{file.name}</p>
|
||||
<p className="font-medium text-card-foreground">{file.name}</p>
|
||||
<p className="text-xs text-muted-foreground">{formatFileSize(file.size)}</p>
|
||||
</div>
|
||||
<TooltipProvider delayDuration={100}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-7 w-7 flex-shrink-0 text-muted-foreground hover:text-destructive"
|
||||
onClick={() => removeAttachment(i)}
|
||||
disabled={isLoading}
|
||||
aria-label={`Remove ${file.name}`}
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
<p>Remove attachment</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
<Tooltip disableHoverableContent>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-7 w-7 flex-shrink-0 text-muted-foreground hover:text-destructive"
|
||||
onClick={() => removeAttachment(i)}
|
||||
disabled={isLoading}
|
||||
aria-label={`Remove ${file.name}`}
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
<p>Remove attachment</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -133,40 +131,38 @@ export default function MessageBox({ channelId }: MessageBoxProps) {
|
||||
gridTemplateRows: "auto 1fr",
|
||||
}}
|
||||
>
|
||||
<TooltipProvider delayDuration={100}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div className="self-start row-start-1 col-start-1 row-span-2 col-span-1">
|
||||
<input
|
||||
type="file"
|
||||
multiple
|
||||
className="hidden"
|
||||
ref={fileInputRef}
|
||||
onChange={onFileChange}
|
||||
accept="image/*,application/pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.zip,.rar,audio/*,video/*"
|
||||
disabled={isLoading}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
onClick={addAttachment}
|
||||
disabled={attachments.length >= 10 || isLoading}
|
||||
aria-label="Add attachment"
|
||||
>
|
||||
<Paperclip className="h-5 w-5" />
|
||||
</Button>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
{attachments.length >= 10 ? (
|
||||
<p>Maximum 10 attachments</p>
|
||||
) : (
|
||||
<p>Add attachment ({attachmentsRemaining} remaining)</p>
|
||||
)}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
<Tooltip disableHoverableContent>
|
||||
<TooltipTrigger asChild>
|
||||
<div className="self-start row-start-1 col-start-1 row-span-2 col-span-1">
|
||||
<input
|
||||
type="file"
|
||||
multiple
|
||||
className="hidden"
|
||||
ref={fileInputRef}
|
||||
onChange={onFileChange}
|
||||
accept="image/*,application/pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.zip,.rar,audio/*,video/*"
|
||||
disabled={isLoading}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
onClick={addAttachment}
|
||||
disabled={attachments.length >= 10 || isLoading}
|
||||
aria-label="Add attachment"
|
||||
>
|
||||
<Paperclip className="h-5 w-5" />
|
||||
</Button>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
{attachments.length >= 10 ? (
|
||||
<p>Maximum 10 attachments</p>
|
||||
) : (
|
||||
<p>Add attachment ({attachmentsRemaining} remaining)</p>
|
||||
)}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
<div className="self-center row-start-1 col-start-2 row-span-2 col-span-1">
|
||||
<TextBox
|
||||
|
||||
Reference in New Issue
Block a user