(fix:message-input) no badge buttons when shared

This commit is contained in:
ManishMadan2882
2025-05-09 20:02:49 +05:30
parent e1aa2cc0b8
commit d873539856
2 changed files with 24 additions and 26 deletions

View File

@@ -34,8 +34,7 @@ type MessageInputProps = {
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
onSubmit: () => void;
loading: boolean;
showSourceButton?: boolean;
showToolButton?: boolean;
isShared?: boolean;
autoFocus?: boolean;
};
@@ -44,8 +43,7 @@ export default function MessageInput({
onChange,
onSubmit,
loading,
showSourceButton = true,
showToolButton = true,
isShared = false,
autoFocus = true,
}: MessageInputProps) {
const { t } = useTranslation();
@@ -345,8 +343,8 @@ export default function MessageInput({
</div>
<div className="flex items-center px-3 py-1.5 sm:px-4 sm:py-2">
<div className="flex flex-grow flex-wrap gap-1 sm:gap-2">
{showSourceButton && (
{!isShared && (
<div className="flex flex-grow flex-wrap gap-1 sm:gap-2">
<button
ref={sourceButtonRef}
className="xs:px-3 xs:py-1.5 flex max-w-[130px] items-center rounded-[32px] border border-[#AAAAAA] px-2 py-1 transition-colors hover:bg-gray-100 dark:border-purple-taupe dark:hover:bg-[#2C2E3C] sm:max-w-[150px]"
@@ -373,9 +371,7 @@ export default function MessageInput({
</span>
)}
</button>
)}
{showToolButton && (
<button
ref={toolButtonRef}
className="xs:px-3 xs:py-1.5 xs:max-w-[150px] flex max-w-[130px] items-center rounded-[32px] border border-[#AAAAAA] px-2 py-1 transition-colors hover:bg-gray-100 dark:border-purple-taupe dark:hover:bg-[#2C2E3C]"
@@ -390,25 +386,26 @@ export default function MessageInput({
{t('settings.tools.label')}
</span>
</button>
)}
<label className="xs:px-3 xs:py-1.5 flex cursor-pointer items-center rounded-[32px] border border-[#AAAAAA] px-2 py-1 transition-colors hover:bg-gray-100 dark:border-purple-taupe dark:hover:bg-[#2C2E3C]">
<img
src={ClipIcon}
alt="Attach"
className="mr-1 h-3.5 w-3.5 sm:mr-1.5 sm:h-4 sm:w-4"
/>
<span className="xs:text-[12px] text-[10px] font-medium text-[#5D5D5D] dark:text-bright-gray sm:text-[14px]">
Attach
</span>
<input
type="file"
className="hidden"
onChange={handleFileAttachment}
/>
</label>
{/* Additional badges can be added here in the future */}
</div>
<label className="xs:px-3 xs:py-1.5 flex cursor-pointer items-center rounded-[32px] border border-[#AAAAAA] px-2 py-1 transition-colors hover:bg-gray-100 dark:border-purple-taupe dark:hover:bg-[#2C2E3C]">
<img
src={ClipIcon}
alt="Attach"
className="mr-1 h-3.5 w-3.5 sm:mr-1.5 sm:h-4 sm:w-4"
/>
<span className="xs:text-[12px] text-[10px] font-medium text-[#5D5D5D] dark:text-bright-gray sm:text-[14px]">
Attach
</span>
<input
type="file"
className="hidden"
onChange={handleFileAttachment}
/>
</label>
{/* Additional badges can be added here in the future */}
</div>
)}
<button
onClick={loading ? undefined : handleSubmit}