Delete Image Modal Completed

This commit is contained in:
Justin Ferrari 2022-12-26 15:49:08 -05:00
parent 831492301a
commit 30cf0b1569
3 changed files with 87 additions and 15 deletions

View File

@ -804,7 +804,7 @@ class ChatPage extends LitElement {
.onClickFunc=${() => { .onClickFunc=${() => {
this.chatEditorNewChat.resetValue(); this.chatEditorNewChat.resetValue();
this.removeImage(); this.removeImage();
} } }}
style=${(this.imageFile && !this.isUploadingImage) ? "display: block" : "display: none"}> style=${(this.imageFile && !this.isUploadingImage) ? "display: block" : "display: none"}>
<div> <div>
<div class="dialog-container"> <div class="dialog-container">

View File

@ -446,4 +446,52 @@ export const chatStyles = css`
width: 100%; width: 100%;
justify-content: center justify-content: center
} }
.delete-image-msg {
font-family: Livvic, sans-serif;
font-size: 20px;
color: var(--chat-bubble-msg-color);
letter-spacing: 0.3px;
font-weight: 300;
text-align: center;
}
.modal-button-row {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.modal-button {
font-family: Roboto, sans-serif;
font-size: 16px;
color: var(--mdc-theme-primary);
background-color: transparent;
padding: 8px 10px;
border-radius: 5px;
border: none;
transition: all 0.3s ease-in-out;
}
.modal-button-red {
font-family: Roboto, sans-serif;
font-size: 16px;
color: #F44336;
background-color: transparent;
padding: 8px 10px;
border-radius: 5px;
border: none;
transition: all 0.3s ease-in-out;
}
.modal-button-red:hover {
cursor: pointer;
background-color: #f4433663;
}
.modal-button:hover {
cursor: pointer;
background-color: #03a8f475;
}
` `

View File

@ -226,15 +226,16 @@ class MessageTemplate extends LitElement {
emojiPicker: { attribute: false }, emojiPicker: { attribute: false },
escapeHTML: { attribute: false }, escapeHTML: { attribute: false },
hideMessages: { type: Array }, hideMessages: { type: Array },
openDialogPrivateMessage: {type: Boolean}, openDialogPrivateMessage: { type: Boolean },
openDialogBlockUser: {type: Boolean}, openDialogBlockUser: { type: Boolean },
showBlockAddressIcon: { type: Boolean }, showBlockAddressIcon: { type: Boolean },
setRepliedToMessageObj: {attribute: false}, setRepliedToMessageObj: { attribute: false },
setEditedMessageObj: {attribute: false}, setEditedMessageObj: { attribute: false },
focusChatEditor: {attribute: false}, focusChatEditor: { attribute: false },
sendMessage: {attribute: false}, sendMessage: { attribute: false },
sendMessageForward: {attribute: false}, sendMessageForward: { attribute: false },
openDialogImage: {attribute: false}, openDialogImage: { attribute: false },
openDeleteImage: { type: Boolean },
isImageLoaded: { type: Boolean }, isImageLoaded: { type: Boolean },
isFirstMessage: { type: Boolean }, isFirstMessage: { type: Boolean },
isSingleMessageInGroup: { type: Boolean }, isSingleMessageInGroup: { type: Boolean },
@ -468,12 +469,10 @@ class MessageTemplate extends LitElement {
class=${[`image-container`, !this.isImageLoaded ? 'defaultSize' : ''].join(' ')} class=${[`image-container`, !this.isImageLoaded ? 'defaultSize' : ''].join(' ')}
style=${this.isFirstMessage && "margin-top: 10px;"}> style=${this.isFirstMessage && "margin-top: 10px;"}>
${imageHTML}<vaadin-icon ${imageHTML}<vaadin-icon
@click=${() => this.sendMessage({ @click=${() => {
type: 'delete', this.openDeleteImage = true;
name: image.name, this.chatE
identifier: image.identifier, }}
editedMessageObj: this.messageObj,
})}
class="image-delete-icon" icon="vaadin:close" slot="icon"></vaadin-icon> class="image-delete-icon" icon="vaadin:close" slot="icon"></vaadin-icon>
</div> </div>
` : image && isImageDeleted ? html` ` : image && isImageDeleted ? html`
@ -573,6 +572,31 @@ class MessageTemplate extends LitElement {
${translate("general.close")} ${translate("general.close")}
</mwc-button> </mwc-button>
</mwc-dialog> </mwc-dialog>
<mwc-dialog
hideActions
?open=${this.openDeleteImage}
@closed=${()=> {
this.openDeleteImage = false;
}}>
<div class="delete-image-msg">
<p>Are you sure you want to delete this image?</p>
</div>
<div class="modal-button-row" @click=${() => this.openDeleteImage = false}>
<button class="modal-button-red">
Cancel
</button>
<button
class="modal-button"
@click=${() => this.sendMessage({
type: 'delete',
name: image.name,
identifier: image.identifier,
editedMessageObj: this.messageObj,
})}>
Yes
</button>
</div>
</mwc-dialog>
` `
} }
} }