forked from Qortal/qortal-ui
Continued Chat Search Results
This commit is contained in:
parent
8a044c37b6
commit
87f4ebff96
BIN
qortal-ui-core/font/Montserrat.ttf
Normal file
BIN
qortal-ui-core/font/Montserrat.ttf
Normal file
Binary file not shown.
@ -2,19 +2,28 @@
|
|||||||
font-family: 'Material Icons';
|
font-family: 'Material Icons';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(MaterialIcons-Regular.eot); /* For IE6-8 */
|
src: url(MaterialIcons-Regular.eot);
|
||||||
|
/* For IE6-8 */
|
||||||
src: local('Material Icons'),
|
src: local('Material Icons'),
|
||||||
local('MaterialIcons-Regular'),
|
local('MaterialIcons-Regular'),
|
||||||
url(MaterialIcons-Regular.woff2) format('woff2'),
|
url(MaterialIcons-Regular.woff2) format('woff2'),
|
||||||
url(MaterialIcons-Regular.woff) format('woff'),
|
url(MaterialIcons-Regular.woff) format('woff'),
|
||||||
url(MaterialIcons-Regular.ttf) format('truetype');
|
url(MaterialIcons-Regular.ttf) format('truetype');
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Montserrat';
|
||||||
|
src: local('Montserrat'),
|
||||||
|
local('Montserrat'),
|
||||||
|
url(Montserrat.ttf) format('truetype');
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-icons {
|
.material-icons {
|
||||||
font-family: 'Material Icons';
|
font-family: 'Material Icons';
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-size: 24px; /* Preferred icon size */
|
font-size: 24px;
|
||||||
|
/* Preferred icon size */
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
@ -33,4 +42,4 @@
|
|||||||
|
|
||||||
/* Support for IE. */
|
/* Support for IE. */
|
||||||
font-feature-settings: 'liga';
|
font-feature-settings: 'liga';
|
||||||
}
|
}
|
@ -465,7 +465,7 @@
|
|||||||
"cchange3": "Blocked Users",
|
"cchange3": "Blocked Users",
|
||||||
"cchange4": "New Message",
|
"cchange4": "New Message",
|
||||||
"cchange5": "(Click to scroll down)",
|
"cchange5": "(Click to scroll down)",
|
||||||
"cchange6": "Type the name or address of who you want to chat with to send a private message!",
|
"cchange6": "Type the name or address of who you want to chat with to send a private message! You can validate the person's name by clicking on the book icon.",
|
||||||
"cchange7": "Name / Address",
|
"cchange7": "Name / Address",
|
||||||
"cchange8": "Message...",
|
"cchange8": "Message...",
|
||||||
"cchange9": "Send",
|
"cchange9": "Send",
|
||||||
@ -492,7 +492,10 @@
|
|||||||
"cchange30": "Uploading image. This may take up to one minute.",
|
"cchange30": "Uploading image. This may take up to one minute.",
|
||||||
"cchange31": "Deleting image. This may take up to one minute.",
|
"cchange31": "Deleting image. This may take up to one minute.",
|
||||||
"cchange33": "Cancel",
|
"cchange33": "Cancel",
|
||||||
"cchange34": "This chat message is using an older message version and cannot use this feature."
|
"cchange34": "This chat message is using an older message version and cannot use this feature.",
|
||||||
|
"cchange35": "Error when trying to fetch the user's name. Please try again!",
|
||||||
|
"cchange36": "Search Results",
|
||||||
|
"cchange37": "No Results Found"
|
||||||
},
|
},
|
||||||
"welcomepage": {
|
"welcomepage": {
|
||||||
"wcchange1": "Welcome to Q-Chat",
|
"wcchange1": "Welcome to Q-Chat",
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
import { LitElement, html } from 'lit';
|
import { LitElement, html } from 'lit';
|
||||||
import { render } from 'lit/html.js';
|
import { render } from 'lit/html.js';
|
||||||
import { chatSearchResultsStyles } from './ChatSearchResults-css.js'
|
import { chatSearchResultsStyles } from './ChatSearchResults-css.js'
|
||||||
|
import { translate } from 'lit-translate';
|
||||||
export class ChatSearchResults extends LitElement {
|
export class ChatSearchResults extends LitElement {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
onClickFunc: { attribute: false },
|
onClickFunc: { attribute: false },
|
||||||
|
closeFunc: { attribute: false },
|
||||||
searchResults: { type: Array },
|
searchResults: { type: Array },
|
||||||
|
isOpen: { type: Boolean },
|
||||||
loading: { type: Boolean }
|
loading: { type: Boolean }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,9 +16,16 @@ export class ChatSearchResults extends LitElement {
|
|||||||
static styles = [chatSearchResultsStyles]
|
static styles = [chatSearchResultsStyles]
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
console.log(this.searchResults, "search results here");
|
console.log(10, "search results here");
|
||||||
return html`
|
return html`
|
||||||
<div class="chat-results-card">
|
<div class="chat-results-card" style=${this.isOpen ? "display: block;" : "display: none;"}>
|
||||||
|
<vaadin-icon
|
||||||
|
@click=${() => this.closeFunc()}
|
||||||
|
icon="vaadin:close-small"
|
||||||
|
slot="icon"
|
||||||
|
class="close-icon"
|
||||||
|
>
|
||||||
|
</vaadin-icon>
|
||||||
${this.loading ? (
|
${this.loading ? (
|
||||||
html`
|
html`
|
||||||
<div class="spinner-container">
|
<div class="spinner-container">
|
||||||
@ -25,19 +34,30 @@ export class ChatSearchResults extends LitElement {
|
|||||||
`
|
`
|
||||||
) : (
|
) : (
|
||||||
html`
|
html`
|
||||||
${this.searchResults.map((result) => {
|
<p class="chat-result-header">${translate("chatpage.cchange36")}</p>
|
||||||
return (
|
<div class="divider"></div>
|
||||||
|
<div class="chat-result-container">
|
||||||
|
${this.searchResults.length === 0 ? (
|
||||||
|
html`<p class="no-results">${translate("chatpage.cchange37")}</p>`
|
||||||
|
) : (
|
||||||
html`
|
html`
|
||||||
<div class="chat-result-container" @click=${() => {
|
${this.searchResults.map((result) => {
|
||||||
this.onClickFunc();
|
return (
|
||||||
}}>
|
html`
|
||||||
<p class="chat-result">
|
<div class="chat-result-card" @click=${() => {
|
||||||
${result}
|
this.shadowRoot.querySelector(".chat-result-card").classList.add("active");
|
||||||
</p>
|
this.onClickFunc(result);
|
||||||
</div>
|
}}>
|
||||||
`
|
<p class="chat-result">
|
||||||
)}
|
${result}
|
||||||
)}
|
</p>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
)}
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
`
|
`
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,7 +2,8 @@ import { css } from 'lit'
|
|||||||
|
|
||||||
export const chatSearchResultsStyles = css`
|
export const chatSearchResultsStyles = css`
|
||||||
.chat-results-card {
|
.chat-results-card {
|
||||||
padding: 10px 20px;
|
position: relative;
|
||||||
|
padding: 25px 20px;
|
||||||
box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
|
box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
min-height: 200px;
|
min-height: 200px;
|
||||||
@ -11,28 +12,90 @@ export const chatSearchResultsStyles = css`
|
|||||||
background-color: var(--white);
|
background-color: var(--white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-result-header {
|
||||||
|
color: var(--chat-bubble-msg-color);
|
||||||
|
font-size: 18px;
|
||||||
|
font-family: Montserrat, sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 0 10px 0;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
height: 1px;
|
||||||
|
background: var(--chat-bubble-msg-color);
|
||||||
|
margin: 0 40px;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-results {
|
||||||
|
font-family: Roboto, sans-serif;
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: 0.3px;
|
||||||
|
font-size: 16px;
|
||||||
|
color: var(--chat-bubble-msg-color);
|
||||||
|
text-align: center;
|
||||||
|
margin: 20px 0 0 0;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
.chat-result-container {
|
.chat-result-container {
|
||||||
padding: 5px;
|
height: 200px;
|
||||||
margin-bottom: 5px;
|
overflow-y: auto;
|
||||||
transition: box-shadow 0.1s ease-in-out;
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-result-container::-webkit-scrollbar-track {
|
||||||
|
background-color: whitesmoke;
|
||||||
|
border-radius: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-result-container::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
border-radius: 7px;
|
||||||
|
background-color: whitesmoke;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-result-container::-webkit-scrollbar-thumb {
|
||||||
|
background-color: rgb(180, 176, 176);
|
||||||
|
border-radius: 7px;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-result-container::-webkit-scrollbar-thumb:hover {
|
||||||
|
background-color: rgb(148, 146, 146);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-result-card {
|
||||||
|
padding: 12px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
margin-top: 15px;
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-result-container:hover {
|
.chat-result-card:active {
|
||||||
|
background-color: #09b814;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat-result-card:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
-webkit-box-shadow: 0px 0px 6px -1px rgba(0, 0, 0, 0.397);
|
-webkit-box-shadow: rgba(132, 132, 132, 40%) 0px 0px 6px -1px;
|
||||||
box-shadow: 0px 0px 6px -1px rgba(0, 0, 0, 0.397);
|
box-shadow: rgba(132, 132, 132, 40%) 0px 0px 6px -1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-result {
|
.chat-result {
|
||||||
font-family: Roboto, sans-serif;
|
font-family: Roboto, sans-serif;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
letter-spacing: 0.3px;
|
letter-spacing: 0.3px;
|
||||||
font-size: 14px;
|
font-size: 15px;
|
||||||
color: var(--chat-bubble-msg-color);
|
color: var(--chat-bubble-msg-color);
|
||||||
|
margin: 0;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spinner-container {
|
.spinner-container {
|
||||||
@ -40,4 +103,18 @@ export const chatSearchResultsStyles = css`
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: center
|
justify-content: center
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.close-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 5px;
|
||||||
|
color: var(--chat-bubble-msg-color);
|
||||||
|
font-size: 14px;
|
||||||
|
transition: all 0.1s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-icon:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
`
|
`
|
@ -6,7 +6,6 @@ export class WrapperModal extends LitElement {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
onClickFunc: { attribute: false },
|
onClickFunc: { attribute: false },
|
||||||
closePrivateMessage: { attribute: false },
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ export const qchatStyles = css`
|
|||||||
background: none;
|
background: none;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
padding: 6px 3px;
|
padding: 6px 3px;
|
||||||
font-size: 19px;
|
font-size: 21px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-icon:hover {
|
.search-icon:hover {
|
||||||
@ -354,4 +354,15 @@ export const qchatStyles = css`
|
|||||||
top: 25px;
|
top: 25px;
|
||||||
right: 25px;
|
right: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-verified {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 5px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
color: #04aa2e;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
`
|
`
|
@ -44,7 +44,9 @@ class Chat extends LitElement {
|
|||||||
imageFile: { type: Object },
|
imageFile: { type: Object },
|
||||||
activeChatHeadUrl: {type: String},
|
activeChatHeadUrl: {type: String},
|
||||||
openPrivateMessage: { type: Boolean },
|
openPrivateMessage: { type: Boolean },
|
||||||
userFound: { type: Array}
|
userFound: { type: Array},
|
||||||
|
userFoundModalOpen: { type: Boolean },
|
||||||
|
userSelected: { type: String}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +83,8 @@ class Chat extends LitElement {
|
|||||||
this.activeChatHeadUrl = ''
|
this.activeChatHeadUrl = ''
|
||||||
this.openPrivateMessage = false
|
this.openPrivateMessage = false
|
||||||
this.userFound = []
|
this.userFound = []
|
||||||
|
this.userFoundModalOpen = false
|
||||||
|
this.userSelected = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
async setActiveChatHeadUrl(url) {
|
async setActiveChatHeadUrl(url) {
|
||||||
@ -90,7 +94,7 @@ class Chat extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
console.log(6, "here");
|
console.log(22, "here");
|
||||||
return html`
|
return html`
|
||||||
<div class="container clearfix">
|
<div class="container clearfix">
|
||||||
<div class="people-list" id="people-list">
|
<div class="people-list" id="people-list">
|
||||||
@ -126,6 +130,9 @@ class Chat extends LitElement {
|
|||||||
.onClickFunc=${() => {
|
.onClickFunc=${() => {
|
||||||
this.chatEditor.resetValue();
|
this.chatEditor.resetValue();
|
||||||
this.openPrivateMessage = false;
|
this.openPrivateMessage = false;
|
||||||
|
this.shadowRoot.getElementById('sendTo').value = "";
|
||||||
|
this.userFoundModalOpen = false;
|
||||||
|
this.userFound = [];
|
||||||
} }
|
} }
|
||||||
style=${this.openPrivateMessage ? "display: block" : "display: none"}>
|
style=${this.openPrivateMessage ? "display: block" : "display: none"}>
|
||||||
<div style=${"position: relative"}>
|
<div style=${"position: relative"}>
|
||||||
@ -142,13 +149,26 @@ class Chat extends LitElement {
|
|||||||
?disabled=${this.isLoading}
|
?disabled=${this.isLoading}
|
||||||
id="sendTo"
|
id="sendTo"
|
||||||
placeholder="${translate("chatpage.cchange7")}"
|
placeholder="${translate("chatpage.cchange7")}"
|
||||||
|
value=${this.userSelected}
|
||||||
|
@keypress=${() => this.userSelected = ""}
|
||||||
/>
|
/>
|
||||||
<vaadin-icon
|
${this.userSelected ? (
|
||||||
@click=${this.userSearch}
|
html`
|
||||||
slot="icon"
|
<div class="user-verified">
|
||||||
icon="vaadin:search"
|
<p >User Verified</p>
|
||||||
class="search-icon">
|
<vaadin-icon icon="vaadin:check-circle-o" slot="icon"></vaadin-icon>
|
||||||
</vaadin-icon>
|
</div>
|
||||||
|
`
|
||||||
|
) : (
|
||||||
|
html`
|
||||||
|
<vaadin-icon
|
||||||
|
@click=${this.userSearch}
|
||||||
|
slot="icon"
|
||||||
|
icon="vaadin:open-book"
|
||||||
|
class="search-icon">
|
||||||
|
</vaadin-icon>
|
||||||
|
`
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<chat-text-editor
|
<chat-text-editor
|
||||||
@ -189,15 +209,20 @@ class Chat extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-results-div">
|
<div class="search-results-div">
|
||||||
${this.userFound.length > 0 ? (
|
<chat-search-results
|
||||||
html`
|
.onClickFunc=${(result) => {
|
||||||
<chat-search-results
|
this.userSelected = result;
|
||||||
.onClickFunc=${() => console.log('user selected')}
|
this.userFound = [];
|
||||||
.searchResults=${this.userFound}
|
this.userFoundModalOpen = false;
|
||||||
?loading=${this.isLoading}>
|
}}
|
||||||
</chat-search-results>
|
.closeFunc=${() => {
|
||||||
`
|
this.userFoundModalOpen = false;
|
||||||
) : null}
|
this.userFound = [];
|
||||||
|
}}
|
||||||
|
.searchResults=${this.userFound}
|
||||||
|
?isOpen=${this.userFoundModalOpen}
|
||||||
|
?loading=${this.isLoading}>
|
||||||
|
</chat-search-results>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</wrapper-modal>
|
</wrapper-modal>
|
||||||
@ -255,6 +280,7 @@ class Chat extends LitElement {
|
|||||||
const nameInput = this.shadowRoot.getElementById('sendTo');
|
const nameInput = this.shadowRoot.getElementById('sendTo');
|
||||||
|
|
||||||
nameInput.addEventListener('keydown', stopKeyEventPropagation);
|
nameInput.addEventListener('keydown', stopKeyEventPropagation);
|
||||||
|
|
||||||
this.shadowRoot.getElementById('messageBox').addEventListener('keydown', stopKeyEventPropagation);
|
this.shadowRoot.getElementById('messageBox').addEventListener('keydown', stopKeyEventPropagation);
|
||||||
|
|
||||||
// let typingTimer;
|
// let typingTimer;
|
||||||
@ -372,21 +398,36 @@ class Chat extends LitElement {
|
|||||||
if (changedProperties && changedProperties.has('userFound')) {
|
if (changedProperties && changedProperties.has('userFound')) {
|
||||||
console.log(this.userFound, "user found array here");
|
console.log(this.userFound, "user found array here");
|
||||||
}
|
}
|
||||||
|
if (changedProperties && changedProperties.has('userSelected')) {
|
||||||
|
console.log(this.userSelected, "user selected here");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async userSearch() {
|
async userSearch() {
|
||||||
|
const nameValue = this.shadowRoot.getElementById('sendTo').value;
|
||||||
|
if(!nameValue) {
|
||||||
|
this.userFound = [];
|
||||||
|
this.userFoundModalOpen = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
let result = await parentEpml.request('apiCall', {
|
const result = await parentEpml.request('apiCall', {
|
||||||
type: 'api',
|
type: 'api',
|
||||||
url: `/names/${this.shadowRoot.getElementById('sendTo').value}`
|
url: `/names/${nameValue}`
|
||||||
})
|
})
|
||||||
console.log({result});
|
if (result.error === 401) {
|
||||||
this.userFound = [
|
this.userFound = [];
|
||||||
...this.userFound,
|
} else {
|
||||||
result.owner,
|
this.userFound = [
|
||||||
];
|
...this.userFound,
|
||||||
|
result.name,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
this.userFoundModalOpen = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
let err4string = get("chatpage.cchange35");
|
||||||
|
parentEpml.request('showSnackBar', `${err4string}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user