mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 09:45:52 +00:00
Reworked qortal requests
This commit is contained in:
parent
525f866447
commit
c0e2935d9b
@ -56,16 +56,20 @@ Base64Message.decode = function (string, keys, ref) {
|
||||
if (responseData.hasOwnProperty('message') && typeof responseData['message'] === 'string' && responseData['message'].length) {
|
||||
const messageRep = responseData.message
|
||||
const messageRep1 = messageRep.split('"').join('<upvote>')
|
||||
const messageRep2 = messageRep1.split('</p><p></p><p>').join('"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep3 = messageRep2.split('</p><p>').join('"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep4 = messageRep3.replace('<p>', '')
|
||||
const messageRep5 = messageRep4.replace('<br></p>', '')
|
||||
const messageRep6 = messageRep5.replace('</p>', '')
|
||||
const messageRep7 = messageRep6.trim()
|
||||
const messageRep8 = messageRep7.split('<br><br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep9 = messageRep8.split('<br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep10 = messageRep9.split('<br>').join('"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
messageStr = messageRep10
|
||||
const messageRep2 = messageRep1.split('</p><p></p><p></p><p></p><p>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep3 = messageRep2.split('</p><p></p><p></p><p>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep4 = messageRep3.split('</p><p></p><p>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep5 = messageRep4.replace('</p><p>', '')
|
||||
const messageRep6 = messageRep5.replace('<p></p>', '')
|
||||
const messageRep7 = messageRep6.replace('<p>', '')
|
||||
const messageRep8 = messageRep7.replace('<br></p>', '')
|
||||
const messageRep9 = messageRep8.replace('</p>', '')
|
||||
const messageRep10 = messageRep9.trim()
|
||||
const messageRep11 = messageRep10.split('<br><br><br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep12 = messageRep11.split('<br><br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep13 = messageRep12.split('<br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep14 = messageRep13.split('<br>').join('"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
messageStr = messageRep14
|
||||
}
|
||||
|
||||
if (responseData.repliedTo) {
|
||||
|
@ -7440,6 +7440,10 @@ export const qchatStyles = css`
|
||||
--mdc-theme-primary: red;
|
||||
}
|
||||
|
||||
.green {
|
||||
--mdc-theme-primary: #198754;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0;
|
||||
}
|
||||
@ -7598,6 +7602,155 @@ export const qchatStyles = css`
|
||||
color: #04aa2e;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.close-check {
|
||||
color: var(--black);
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
top: -15px;
|
||||
right: -15px;
|
||||
}
|
||||
|
||||
.close-check:hover {
|
||||
color: #df3636;
|
||||
}
|
||||
|
||||
paper-dialog.check {
|
||||
width: auto;
|
||||
max-width: 50vw;
|
||||
height: auto;
|
||||
max-height: 30vh;
|
||||
background-color: var(--white);
|
||||
color: var(--black);
|
||||
border: 1px solid var(--black);
|
||||
border-radius: 15px;
|
||||
text-align: center;
|
||||
padding: 15px;
|
||||
line-height: 1.6;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
paper-dialog.close-check {
|
||||
min-width: 550px;
|
||||
max-width: 550px;
|
||||
height: auto;
|
||||
background-color: var(--white);
|
||||
color: var(--black);
|
||||
border: 1px solid var(--black);
|
||||
border-radius: 15px;
|
||||
text-align: center;
|
||||
padding: 15px;
|
||||
font-size: 17px;
|
||||
font-weight: 500;
|
||||
line-height: 20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.check-roller {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.check-roller div {
|
||||
animation: check-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
||||
transform-origin: 40px 40px;
|
||||
}
|
||||
|
||||
.check-roller div:after {
|
||||
content: " ";
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: var(--black);
|
||||
margin: -4px 0 0 -4px;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(1) {
|
||||
animation-delay: -0.036s;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(1):after {
|
||||
top: 63px;
|
||||
left: 63px;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(2) {
|
||||
animation-delay: -0.072s;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(2):after {
|
||||
top: 68px;
|
||||
left: 56px;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(3) {
|
||||
animation-delay: -0.108s;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(3):after {
|
||||
top: 71px;
|
||||
left: 48px;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(4) {
|
||||
animation-delay: -0.144s;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(4):after {
|
||||
top: 72px;
|
||||
left: 40px;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(5) {
|
||||
animation-delay: -0.18s;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(5):after {
|
||||
top: 71px;
|
||||
left: 32px;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(6) {
|
||||
animation-delay: -0.216s;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(6):after {
|
||||
top: 68px;
|
||||
left: 24px;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(7) {
|
||||
animation-delay: -0.252s;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(7):after {
|
||||
top: 63px;
|
||||
left: 17px;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(8) {
|
||||
animation-delay: -0.288s;
|
||||
}
|
||||
|
||||
.check-roller div:nth-child(8):after {
|
||||
top: 56px;
|
||||
left: 12px;
|
||||
}
|
||||
|
||||
@keyframes check-roller {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export const becomeMinterStyles = css`
|
||||
@ -12230,6 +12383,10 @@ export const webBrowserModalStyles = css`
|
||||
z-index: 1000001;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 25px;
|
||||
}
|
||||
|
||||
@keyframes modal_transition {
|
||||
0% {
|
||||
visibility: hidden;
|
||||
@ -12253,8 +12410,30 @@ export const webBrowserModalStyles = css`
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 25px;
|
||||
.modal-content-error {
|
||||
background-color: #ffdddd;
|
||||
border-radius: 15px;
|
||||
border: 1px solid var(--black);
|
||||
padding: 20px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
||||
max-width: 80%;
|
||||
min-width: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.modal-content-success {
|
||||
background-color: #ddffdd;
|
||||
border-radius: 15px;
|
||||
border: 1px solid var(--black);
|
||||
padding: 20px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
||||
max-width: 80%;
|
||||
min-width: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.modal-subcontainer {
|
||||
@ -12266,22 +12445,23 @@ export const webBrowserModalStyles = css`
|
||||
}
|
||||
|
||||
.modal-subcontainer-error {
|
||||
color: var(--black);
|
||||
color: 000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
gap: 1ßpx;
|
||||
overflow: auto;
|
||||
max-height: calc(95vh - 250px);
|
||||
}
|
||||
|
||||
.modal-paragraph-error {
|
||||
font-family: Roboto, sans-serif;
|
||||
font-size: 20px;
|
||||
letter-spacing: 0.3px;
|
||||
font-weight: 700;
|
||||
color: var(--black);
|
||||
margin: 0;
|
||||
.modal-subcontainer-success {
|
||||
color: 000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
overflow: auto;
|
||||
max-height: calc(95vh - 250px);
|
||||
}
|
||||
|
||||
.modal-paragraph {
|
||||
@ -12295,6 +12475,50 @@ export const webBrowserModalStyles = css`
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.modal-paragraph-error {
|
||||
font-family: Roboto, sans-serif;
|
||||
font-size: 16px;
|
||||
letter-spacing: 0.3px;
|
||||
font-weight: 600;
|
||||
color: 000;
|
||||
margin: 0;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-wor
|
||||
}
|
||||
|
||||
.modal-paragraph-success {
|
||||
font-family: Roboto, sans-serif;
|
||||
font-size: 16px;
|
||||
letter-spacing: 0.3px;
|
||||
font-weight: 600;
|
||||
color: 000;
|
||||
margin: 0;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.modal-paragraph-error-header {
|
||||
font-family: Roboto, sans-serif;
|
||||
font-size: 18px;
|
||||
letter-spacing: 0.3px;
|
||||
font-weight: 700;
|
||||
color: 000;
|
||||
margin: 0;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.modal-paragraph-success-header {
|
||||
font-family: Roboto, sans-serif;
|
||||
font-size: 18px;
|
||||
letter-spacing: 0.3px;
|
||||
font-weight: 700;
|
||||
color: 000;
|
||||
margin: 0;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.capitalize-first {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
@ -2812,16 +2812,20 @@ const decode = (string, keys, ref) => {
|
||||
if (responseData.hasOwnProperty('message') && typeof responseData['message'] === 'string' && responseData['message'].length) {
|
||||
const messageRep = responseData.message
|
||||
const messageRep1 = messageRep.split('"').join('<upvote>')
|
||||
const messageRep2 = messageRep1.split('</p><p></p><p>').join('"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep3 = messageRep2.split('</p><p>').join('"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep4 = messageRep3.replace('<p>', '')
|
||||
const messageRep5 = messageRep4.replace('<br></p>', '')
|
||||
const messageRep6 = messageRep5.replace('</p>', '')
|
||||
const messageRep7 = messageRep6.trim()
|
||||
const messageRep8 = messageRep7.split('<br><br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep9 = messageRep8.split('<br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep10 = messageRep9.split('<br>').join('"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
messageStr = messageRep10
|
||||
const messageRep2 = messageRep1.split('</p><p></p><p></p><p></p><p>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep3 = messageRep2.split('</p><p></p><p></p><p>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep4 = messageRep3.split('</p><p></p><p>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep5 = messageRep4.replace('</p><p>', '')
|
||||
const messageRep6 = messageRep5.replace('<p></p>', '')
|
||||
const messageRep7 = messageRep6.replace('<p>', '')
|
||||
const messageRep8 = messageRep7.replace('<br></p>', '')
|
||||
const messageRep9 = messageRep8.replace('</p>', '')
|
||||
const messageRep10 = messageRep9.trim()
|
||||
const messageRep11 = messageRep10.split('<br><br><br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep12 = messageRep11.split('<br><br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep13 = messageRep12.split('<br><br>').join('"},{"type":"hardBreak"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
const messageRep14 = messageRep13.split('<br>').join('"},{"type":"hardBreak"},{"type":"text","text":"')
|
||||
messageStr = messageRep14
|
||||
}
|
||||
|
||||
if (responseData.repliedTo) {
|
||||
|
@ -32,6 +32,10 @@ import '@material/mwc-button'
|
||||
import '@material/mwc-dialog'
|
||||
import '@material/mwc-icon'
|
||||
import '@material/mwc-snackbar'
|
||||
import '@material/mwc-textfield'
|
||||
import '@polymer/paper-dialog/paper-dialog.js'
|
||||
import '@polymer/iron-icons/iron-icons.js'
|
||||
import '@polymer/paper-icon-button/paper-icon-button.js'
|
||||
import '@polymer/paper-spinner/paper-spinner-lite.js'
|
||||
import '@vaadin/grid'
|
||||
import '@vaadin/tooltip'
|
||||
@ -136,6 +140,17 @@ class Chat extends LitElement {
|
||||
</vaadin-tooltip>
|
||||
</div>
|
||||
<div style="display:flex; align-items:center;gap:10px">
|
||||
<div id="viewChat" class="create-chat" @click=${() => { this.shadowRoot.querySelector('#viewChatDialog').show() }}>
|
||||
<mwc-icon style="color: var(--black);">pageview</mwc-icon>
|
||||
<vaadin-tooltip
|
||||
for="viewChat"
|
||||
position="top"
|
||||
hover-delay=${200}
|
||||
hide-delay=${1}
|
||||
text="Switch Chat Over ID"
|
||||
>
|
||||
</vaadin-tooltip>
|
||||
</div>
|
||||
<div id="goToGroup" class="create-chat" @click=${() => { this.openTabToGroupManagement() }}>
|
||||
<mwc-icon style="color: var(--black);">group_add</mwc-icon>
|
||||
<vaadin-tooltip
|
||||
@ -299,6 +314,45 @@ class Chat extends LitElement {
|
||||
${translate("general.close")}
|
||||
</mwc-button>
|
||||
</mwc-dialog>
|
||||
<!-- View Chat Over ID -->
|
||||
<mwc-dialog id="viewChatDialog">
|
||||
<div style="text-align: center;">
|
||||
<h1>Please Enter The Group ID</h1>
|
||||
<hr>
|
||||
<br>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<mwc-textfield
|
||||
style="width: 100%;"
|
||||
required
|
||||
id="groupIdInput"
|
||||
label="Emter Group ID"
|
||||
type="number"
|
||||
auto-validate="false"
|
||||
value=""
|
||||
>
|
||||
</mwc-textfield>
|
||||
</div>
|
||||
<mwc-button slot="primaryAction" dialogAction="cancel" class="red">
|
||||
${translate("general.close")}
|
||||
</mwc-button>
|
||||
<mwc-button slot="secondaryAction" class="green" @click=${this.switchChatID}>
|
||||
${translate("general.view")}
|
||||
</mwc-button>
|
||||
</mwc-dialog>
|
||||
<paper-dialog id="checkIdDialog" class="check" modal>
|
||||
<div class="check-roller">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<h2>Checking</h2>
|
||||
</paper-dialog>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
@ -437,6 +491,48 @@ class Chat extends LitElement {
|
||||
}, 60000)
|
||||
}
|
||||
|
||||
async switchChatID() {
|
||||
let viewGroupID = 0
|
||||
let checkTheID = {}
|
||||
let notFound = 'Group ID not found! Please try again...'
|
||||
let wentWrong = 'Something went wrong! Please try again...'
|
||||
|
||||
viewGroupID = this.shadowRoot.getElementById('groupIdInput').value
|
||||
|
||||
this.shadowRoot.getElementById('checkIdDialog').open()
|
||||
|
||||
await parentEpml.request('apiCall', {
|
||||
url: `/groups/${viewGroupID}`
|
||||
}).then(res => {
|
||||
checkTheID = res
|
||||
})
|
||||
|
||||
if (checkTheID.error) {
|
||||
this.shadowRoot.getElementById('checkIdDialog').close()
|
||||
this.shadowRoot.getElementById('viewChatDialog').close()
|
||||
this.shadowRoot.getElementById('groupIdInput').value = ''
|
||||
parentEpml.request('showSnackBar', `${notFound}`)
|
||||
} else if (checkTheID.groupId) {
|
||||
let switchToID = checkTheID.groupName
|
||||
this.shadowRoot.getElementById('checkIdDialog').close()
|
||||
this.shadowRoot.getElementById('viewChatDialog').close()
|
||||
this.shadowRoot.getElementById('groupIdInput').value = ''
|
||||
parentEpml.request('showSnackBar', `${switchToID}`)
|
||||
this.processChatID(checkTheID.groupId)
|
||||
} else {
|
||||
this.shadowRoot.getElementById('checkIdDialog').close()
|
||||
this.shadowRoot.getElementById('viewChatDialog').close()
|
||||
this.shadowRoot.getElementById('groupIdInput').value = ''
|
||||
parentEpml.request('showSnackBar', `${wentWrong}`)
|
||||
}
|
||||
}
|
||||
|
||||
async processChatID(newID) {
|
||||
let viewNewUrl = 'group/' + newID
|
||||
this.setActiveChatHeadUrl(viewNewUrl)
|
||||
this.resetChatEditor()
|
||||
}
|
||||
|
||||
async setActiveChatHeadUrl(url) {
|
||||
await this.getSymKeyFile(url)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user