Skip to content
Open
Show file tree
Hide file tree
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
31 changes: 25 additions & 6 deletions frontend/src/components/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { useRef } from "react";
import { getChatbotText } from "../data/chatbotTexts";
import { chatbotStyles } from "../styles/styles";
import {
Paperclip,
Image as ImageIcon,
File,
Send,
CircleStop,
} from "lucide-react";

/**
* Props for the Input component.
Expand Down Expand Up @@ -118,9 +125,19 @@ export const Input = ({
>
<span style={chatbotStyles.attachedFileName}>
{file.type.startsWith("image/") ? (
<span data-testid="file-icon-image">🖼️</span>
<span
data-testid="file-icon-image"
style={chatbotStyles.attachedFilePreviewIcon}
>
<ImageIcon size={14} />
</span>
) : (
<span data-testid="file-icon-document">📄</span>
<span
data-testid="file-icon-document"
style={chatbotStyles.attachedFilePreviewIcon}
>
<File size={14} />
</span>
)}{" "}
{file.name}
</span>
Expand Down Expand Up @@ -162,7 +179,7 @@ export const Input = ({
style={chatbotStyles.attachButton}
title="Attach files"
>
📎
<Paperclip size={16} />
</button>
)}

Expand All @@ -181,17 +198,19 @@ export const Input = ({
type="button"
onClick={onCancel}
style={chatbotStyles.sendButton("x")}
aria-label="Cancel message"
aria-label="Cancel"
title="Cancel message"
>
Cancel
<CircleStop size={20} />
</button>
) : (
<button
onClick={onSend}
disabled={!canSend}
aria-label="Send"
style={chatbotStyles.sendButton(canSend ? "x" : "")}
>
{getChatbotText("sendMessage")}
<Send size={20} />
</button>
)}
</div>
Expand Down
25 changes: 18 additions & 7 deletions frontend/src/styles/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ export const chatbotStyles = {
flexWrap: "wrap",
gap: "8px",
padding: "8px 12px",
backgroundColor: "#f8f9fa",
borderBottom: "1px solid #eee",
backgroundColor: "var(--panel-background)",
borderBottom: "1px solid var(--border-color)",
maxHeight: "100px",
overflowY: "auto",
} as CSSProperties,
Expand All @@ -151,7 +151,8 @@ export const chatbotStyles = {
alignItems: "center",
gap: "4px",
padding: "4px 8px",
backgroundColor: "#e9ecef",
backgroundColor: "var(--item-background--hover)",
color: "var(--text-color)",
borderRadius: "16px",
fontSize: "12px",
maxWidth: "200px",
Expand All @@ -164,8 +165,14 @@ export const chatbotStyles = {
maxWidth: "120px",
} as CSSProperties,

attachedFilePreviewIcon: {
display: "flex",
alignItems: "center",
flexShrink: 0,
} as CSSProperties,

attachedFileSize: {
color: "#6c757d",
color: "var(--text-color)",
fontSize: "11px",
flexShrink: 0,
} as CSSProperties,
Expand Down Expand Up @@ -208,9 +215,10 @@ export const chatbotStyles = {
width: "40px",
height: "40px",
padding: 0,
border: "1px solid #ccc",
border: "1px solid var(--border-color)",
borderRadius: "6px",
backgroundColor: "#fff",
backgroundColor: "var(--button-background)",
color: "var(--text-color)",
fontSize: "18px",
cursor: "pointer",
flexShrink: 0,
Expand Down Expand Up @@ -240,8 +248,11 @@ export const chatbotStyles = {

sendButton: (input: string): CSSProperties =>
({
display: "flex",
justifyContent: "center",
alignItems: "center",
width: "14%",
padding: "0.5rem 1rem",
padding: "0.5rem",
backgroundColor: "var(--button-background)",
color: "var(--text-color)",
borderRadius: "0.625rem",
Expand Down
Loading