Skip to content

Commit 8595296

Browse files
committed
Fix styles
1 parent ad0d741 commit 8595296

File tree

3 files changed

+35
-19
lines changed

3 files changed

+35
-19
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM nginx:1.27.3
1+
FROM openresty/openresty:1.21.4.2-alpine
22

3-
COPY ./dist/ /app/
3+
COPY ./dist/ /app/

src/components/Agentic/IncidentTemplate/MCPServerDialog/ToolsStep/index.tsx

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import axios from "axios";
2-
import { useState, type ChangeEvent } from "react";
2+
import { useEffect, useState, type ChangeEvent } from "react";
33
import { useDropzone } from "react-dropzone";
44
import { useFormDataRequest } from "../../../../../hooks/useFormDataRequest";
55
import type { MCPServerIcon } from "../../../../../redux/services/types";
@@ -35,7 +35,7 @@ export const ToolsStep = ({
3535
const [selectedTools, setSelectedTools] = useState(initialSelectedTools);
3636
const [searchInputValue, setSearchInputValue] = useState("");
3737
const [dropzoneError, setDropzoneError] = useState<string>();
38-
const [iconId, setIconId] = useState<string | null>(null);
38+
const [iconId, setIconId] = useState<string | null>(icon?.id ?? null);
3939
const [fileToUpload, setFileToUpload] = useState<File | null>(null);
4040
const {
4141
send: upload,
@@ -65,19 +65,20 @@ export const ToolsStep = ({
6565
}
6666
});
6767

68-
const fileDetails = icon
69-
? {
70-
name: icon.fileName,
71-
size: icon.fileSize,
72-
type: icon.fileName.split(".")[1] ?? ""
73-
}
74-
: fileToUpload
75-
? {
76-
name: fileToUpload.name,
77-
size: fileToUpload.size,
78-
type: fileToUpload.type.split("/")[1]
79-
}
80-
: null;
68+
const fileDetails =
69+
iconId && icon?.id === iconId
70+
? {
71+
name: icon.fileName,
72+
size: icon.fileSize,
73+
type: icon.fileName.split(".")[1] ?? ""
74+
}
75+
: fileToUpload
76+
? {
77+
name: fileToUpload.name,
78+
size: fileToUpload.size,
79+
type: fileToUpload.type.split("/")[1]
80+
}
81+
: null;
8182

8283
const { getRootProps, getInputProps, isDragActive } = useDropzone({
8384
accept: {
@@ -177,6 +178,15 @@ export const ToolsStep = ({
177178
setDropzoneError(undefined);
178179
};
179180

181+
useEffect(() => {
182+
if (icon?.id) {
183+
setFileToUpload(null);
184+
setIconId(icon.id);
185+
} else {
186+
setIconId(null);
187+
}
188+
}, [icon?.id]);
189+
180190
const formattedFileSize = fileDetails
181191
? fileDetails.size >= MAX_ICON_FILE_SIZE
182192
? `${roundTo(fileDetails.size / 1024 / 1024, 0)} MB`

src/components/Agentic/IncidentTemplate/MCPServerDialog/ToolsStep/styles.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ export const DropzoneContent = styled.div<DropzoneContentProps>`
160160

161161
export const FileIconContainer = styled.div`
162162
color: ${({ theme }) => theme.colors.v3.surface.brandSecondary};
163+
position: relative;
164+
display: flex;
163165
`;
164166

165167
export const FileExtension = styled.span`
@@ -172,8 +174,11 @@ export const FileExtension = styled.span`
172174
text-transform: uppercase;
173175
position: absolute;
174176
bottom: 6px;
175-
left: auto;
176-
right: auto;
177+
left: 0;
178+
right: 0;
179+
user-select: none;
180+
width: 100%;
181+
text-align: center;
177182
`;
178183

179184
export const DownloadIconContainer = styled.div<DropzoneContentIconContainerProps>`
@@ -193,6 +198,7 @@ export const DownloadIconContainer = styled.div<DropzoneContentIconContainerProp
193198
$isDragActive
194199
? theme.colors.v3.surface.brandPrimary
195200
: theme.colors.v3.surface.primary};
201+
box-sizing: border-box;
196202
`;
197203

198204
export const DropzoneContentTextContainer = styled.div`

0 commit comments

Comments
 (0)