Skip to content

Commit 53ad0ff

Browse files
committed
♻️ Delete Radix UI Dependency: Tabs
1 parent 3276190 commit 53ad0ff

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

frontend/app/[locale]/chat/components/chatRightPanel.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,23 @@ export function ChatRightPanel({
9393
try {
9494
// Convert image URL to backend API URL
9595
const apiUrl = convertImageUrlToApiUrl(imageUrl);
96-
96+
9797
// Use backend API to get the image
9898
const response = await fetch(apiUrl);
99-
99+
100100
if (!response.ok) {
101101
throw new Error(`Failed to load image: ${response.statusText}`);
102102
}
103103

104104
// Get image as blob and convert to base64
105105
const blob = await response.blob();
106106
const reader = new FileReader();
107-
107+
108108
reader.onloadend = () => {
109109
const base64Data = reader.result as string;
110110
// Remove data URL prefix (e.g., "data:image/png;base64,")
111111
const base64 = base64Data.split(',')[1] || base64Data;
112-
112+
113113
setImageData((prev) => ({
114114
...prev,
115115
[imageUrl]: {
@@ -121,13 +121,13 @@ export function ChatRightPanel({
121121
}));
122122
loadingImages.current.delete(imageUrl);
123123
};
124-
124+
125125
reader.onerror = () => {
126126
log.error("Failed to read image blob");
127127
handleImageLoadFail(imageUrl);
128128
loadingImages.current.delete(imageUrl);
129129
};
130-
130+
131131
reader.readAsDataURL(blob);
132132
} catch (error) {
133133
log.error(t("chatRightPanel.imageProxyError"), error);
@@ -232,7 +232,7 @@ export function ChatRightPanel({
232232
const handleFileDownload = async (e: React.MouseEvent) => {
233233
e.preventDefault();
234234
e.stopPropagation();
235-
235+
236236
if (!filename && !url) {
237237
message.error(t("chatRightPanel.fileDownloadError", "File name or URL is missing"));
238238
return;
@@ -534,8 +534,9 @@ export function ChatRightPanel({
534534
<div className="flex-1 flex flex-col" style={{ maxWidth: "400px", height: "100%" }}>
535535
{/* Tab Headers */}
536536
<div className="flex border-b bg-gray-50">
537-
<button
538-
className={`flex-1 px-3 py-2 text-sm font-medium transition-colors ${
537+
<Button
538+
type={activeTab === "sources" ? "primary" : "text"}
539+
className={`flex-1 px-3 py-2 text-sm font-medium transition-colors rounded-none border-none ${
539540
activeTab === "sources"
540541
? "bg-white text-gray-900 border-b-2 border-blue-500"
541542
: "text-gray-500 hover:text-gray-700 hover:bg-gray-100"
@@ -550,9 +551,10 @@ export function ChatRightPanel({
550551
</span>
551552
)}
552553
</span>
553-
</button>
554-
<button
555-
className={`flex-1 px-3 py-2 text-sm font-medium transition-colors ${
554+
</Button>
555+
<Button
556+
type={activeTab === "images" ? "primary" : "text"}
557+
className={`flex-1 px-3 py-2 text-sm font-medium transition-colors rounded-none border-none ${
556558
activeTab === "images"
557559
? "bg-white text-gray-900 border-b-2 border-blue-500"
558560
: "text-gray-500 hover:text-gray-700 hover:bg-gray-100"
@@ -567,7 +569,7 @@ export function ChatRightPanel({
567569
</span>
568570
)}
569571
</span>
570-
</button>
572+
</Button>
571573
</div>
572574

573575
{/* Tab Content */}

0 commit comments

Comments
 (0)