Skip to content

Commit

Permalink
Merge pull request #447 from Cognigy/bug/63390-display-properly-uploa…
Browse files Browse the repository at this point in the history
…d-progressbar

Fix file attachment upload progress bar
  • Loading branch information
fabclj authored Jul 18, 2024
2 parents aaa7d45 + 015557f commit f89f413
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const UploadedFilesContainer = styled.div(({ theme }) => ({
}));

const FilePreviewWrapper = styled.div(({ theme }) => ({
position: 'relative',
overflow: 'hidden',
borderRadius: 15,
height: 33,
backgroundColor: theme.black95,
Expand All @@ -44,8 +46,11 @@ const FilePreviewWrapper = styled.div(({ theme }) => ({

const UploadedFilePreview = styled.div(() => ({
display: "flex",
alignItems: "center",
justifyContent: "center",
gap: 12,
padding: "8px 12px",
padding: "0px 12px",
height: "100%",
}));

const FileName = styled(Typography)<Pick<IFile, "hasUploadError">>(({ hasUploadError, theme }) => ({
Expand All @@ -56,11 +61,6 @@ const FileName = styled(Typography)<Pick<IFile, "hasUploadError">>(({ hasUploadE
alignSelf: "center",
}));

const FileExtension = styled(Typography)(({ theme }) => ({
color: theme.black10,
alignSelf: "center",
}));

const FileSize = styled(Typography)(({ theme }) => ({
color: theme.black40,
alignSelf: "center",
Expand Down Expand Up @@ -117,22 +117,15 @@ const PreviewUploadedFiles: FC = () => {
>
<CloseIcon />
</RemoveFileButton>
<span>
<FileName
component="span"
variant="title2-regular"
hasUploadError={item.hasUploadError}
>
{!item.hasUploadError
? getFileName(item.file.name)
: item.uploadErrorReason}
</FileName>
{!item.hasUploadError && (
<FileExtension component="span" variant="title2-regular">
{getFileExtension(item.file.name)}
</FileExtension>
)}
</span>
<FileName
component="span"
variant="title2-regular"
hasUploadError={item.hasUploadError}
>
{!item.hasUploadError
? `${getFileName(item.file.name)}${getFileExtension(item.file.name)}`
: item.uploadErrorReason}
</FileName>
<FileSize component="span" variant="title2-regular">
{item.file.size > 1000000
? `${(item.file.size / 1000000).toFixed(2)} MB`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const ProgressBarContainer = styled.div(() => ({
width: '100%',
backgroundColor: "#e0e0de",
borderRadius: 50,
position: 'absolute',
bottom: 0,
left: 0,
}));

const ProgressBar = styled.div<ILinearProgressBarProps>(({ theme, progressPercentage }) => ({
Expand Down

0 comments on commit f89f413

Please sign in to comment.