mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
render upload error
This commit is contained in:
parent
f51ed1563f
commit
95e6af18b2
@ -111,6 +111,19 @@ export function useUploadContext() {
|
||||
cancelContactTopic: (cardId, channelId, topicId) => {
|
||||
abort(`${cardId}:${channelId}`, topicId);
|
||||
},
|
||||
clearErrors: (cardId, channelId) => {
|
||||
const key = cardId ? `${cardId}:${channelId}` : `:${channelId}`;
|
||||
const topics = channels.current.get(key);
|
||||
if (topics) {
|
||||
topics.forEach((topic, topicId) => {
|
||||
if (topic.error) {
|
||||
topic.cancel.abort();
|
||||
topics.delete(topicId);
|
||||
updateProgress();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
clear: () => {
|
||||
channels.current.forEach((topics, channelId) => {
|
||||
topics.forEach((assets, topicId) => {
|
||||
|
@ -58,7 +58,10 @@ export function Conversation({ closeConversation, openDetails, cardId, channelId
|
||||
</div>
|
||||
<div class="divider">
|
||||
<div class="line" />
|
||||
{ state.upload && (
|
||||
{ state.uploadError && (
|
||||
<div class="progress-error" />
|
||||
)}
|
||||
{ state.upload && !state.uploadError && (
|
||||
<div class="progress-active" style={{ width: state.uploadPercent + '%' }} />
|
||||
)}
|
||||
{ !state.upload && (
|
||||
@ -67,6 +70,17 @@ export function Conversation({ closeConversation, openDetails, cardId, channelId
|
||||
</div>
|
||||
<div class="topic">
|
||||
<AddTopic cardId={cardId} channelId={channelId} />
|
||||
{ state.uploadError && (
|
||||
<div class="upload-error">
|
||||
<Tooltip placement="bottom" title="upload error">
|
||||
<StatusError>
|
||||
<div onClick={() => actions.clearUploadErrors(cardId, channelId)}>
|
||||
<ExclamationCircleOutlined />
|
||||
</div>
|
||||
</StatusError>
|
||||
</Tooltip>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</ConversationWrapper>
|
||||
);
|
||||
|
@ -77,15 +77,34 @@ export const ConversationWrapper = styled.div`
|
||||
|
||||
.progress-idle {
|
||||
border-top: 1px solid ${Colors.divider};
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
.progress-active {
|
||||
border-top: 1px solid ${Colors.primary};
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
.progress-error {
|
||||
border-top: 1px solid ${Colors.alert};
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.topic {
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
|
||||
.upload-error {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin-right: 16px;
|
||||
cursor-pointer;
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
|
@ -133,7 +133,8 @@ export function useConversation(cardId, channelId) {
|
||||
resync: () => {
|
||||
conversation.actions.resync();
|
||||
},
|
||||
clearUploadError: () => {
|
||||
clearUploadErrors: (cardId, channelId) => {
|
||||
upload.actions.clearErrors(cardId, channelId);
|
||||
},
|
||||
cancelUpload: () => {
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user