Continued UI of gifs

This commit is contained in:
Justin Ferrari 2023-02-04 00:28:33 +02:00
parent b7327bafc3
commit 9c1c3f2bdd
6 changed files with 1135 additions and 854 deletions

View File

@ -578,7 +578,8 @@
"cchange82": "My Collections", "cchange82": "My Collections",
"cchange83": "Subscribed Collections", "cchange83": "Subscribed Collections",
"cchange84": "Upload your gif files", "cchange84": "Upload your gif files",
"cchange85": "File should be .Gif" "cchange85": "File should be .Gif",
"cchange86": "Upload Collection"
}, },
"welcomepage": { "welcomepage": {
"wcchange1": "Welcome to Q-Chat", "wcchange1": "Welcome to Q-Chat",

View File

@ -1,167 +1,302 @@
import { css } from 'lit' import { css } from 'lit';
export const gifExplorerStyles = css` export const gifExplorerStyles = css`
.gifs-container { .gifs-container {
position: relative; position: relative;
display: flex; display: flex;
padding: 10px 15px; padding: 10px 15px;
border-radius: 12px; border-radius: 12px;
box-shadow: rgba(0, 0, 0, 0.09) 0px 3px 12px; box-shadow: rgba(0, 0, 0, 0.09) 0px 3px 12px;
background-color: var(--chat-menu-bg); background-color: var(--chat-menu-bg);
width: fit-content; width: fit-content;
justify-self: flex-end; justify-self: flex-end;
place-self: end flex-end; place-self: end flex-end;
min-height: 400px; min-height: 400px;
min-width: 370px; max-height: 95vh;
margin-bottom: 8px; min-width: 370px;
margin-right: 5px; box-shadow: var(--gifs-drop-shadow);
box-shadow: var(--gifs-drop-shadow); }
}
.gif-explorer-container { .gif-explorer-container {
min-height: 400px; min-height: 400px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
width: 100%; width: 100%;
align-items: center; align-items: center;
gap: 15px; gap: 15px;
} }
.title-row { .title-row {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 100%; width: 100%;
} }
.gif-explorer-title { .gif-explorer-title {
flex: 1; flex: 1;
text-align: center; text-align: center;
font-family: Roboto, sans-serif; font-family: Roboto, sans-serif;
letter-spacing: 0.8px; letter-spacing: 0.8px;
font-size: 25px; font-size: 25px;
color: var(--chat-bubble-msg-color); color: var(--chat-bubble-msg-color);
margin: 0; margin: 0;
user-select: none; user-select: none;
} }
.explore-collections-icon { .explore-collections-icon {
margin-left: auto; margin-left: auto;
text-align: right; text-align: right;
font-size: 20px; font-size: 20px;
color: var(--chat-group); color: var(--chat-group);
box-shadow: var(--gif-search-icon-bs); box-shadow: var(--gif-search-icon-bs);
padding: 7px; padding: 7px;
background-color: var(--gif-search-icon); background-color: var(--gif-search-icon);
border: none; border: none;
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;
} }
.create-collections-icon { .create-collections-icon {
position: absolute; position: absolute;
bottom: 5px; bottom: 5px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
padding: 4px; padding: 4px;
font-size: 22px; font-size: 22px;
background-color: var(--mdc-theme-primary); background-color: var(--mdc-theme-primary);
color: white; color: white;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 0 0 rgba(0, 0, 0, 0.2); box-shadow: 0 0 0 rgba(0, 0, 0, 0.2);
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
} }
.create-collections-icon:hover { .create-collections-icon:hover {
cursor: pointer; cursor: pointer;
box-shadow: 0px 4px 5px 0px hsla(0,0%,0%,0.14), 0px 1px 10px 0px hsla(0,0%,0%,0.12), 0px 2px 4px -1px hsla(0,0%,0%,0.2); box-shadow: 0px 4px 5px 0px hsla(0, 0%, 0%, 0.14),
} 0px 1px 10px 0px hsla(0, 0%, 0%, 0.12),
0px 2px 4px -1px hsla(0, 0%, 0%, 0.2);
}
.collections-button-row { .collections-button-row {
width: auto; width: auto;
background-color: var(--gif-button-row-bg); background-color: var(--gif-button-row-bg);
border-radius: 35px; border-radius: 35px;
padding: 2px; padding: 2px;
margin-top: 10px; margin-top: 10px;
} }
.collections-button-innerrow { .collections-button-innerrow {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
} }
.my-collections-button { .my-collections-button {
font-size: 16px; font-size: 16px;
font-family: "Maven Pro", sans-serif; font-family: 'Maven Pro', sans-serif;
letter-spacing: 0.5px; letter-spacing: 0.5px;
color: var(--gif-button-row-color); color: var(--gif-button-row-color);
border-radius: 35px; border-radius: 35px;
padding: 8px 20px; padding: 8px 20px;
margin: 2px 0; margin: 2px 0;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
} }
.subscribed-collections-button { .subscribed-collections-button {
font-size: 16px; font-size: 16px;
font-family: "Maven Pro", sans-serif; font-family: 'Maven Pro', sans-serif;
letter-spacing: 0.5px; letter-spacing: 0.5px;
color: var(--gif-button-row-color); color: var(--gif-button-row-color);
border-radius: 35px; border-radius: 35px;
padding: 8px 20px; padding: 8px 20px;
margin: 2px 0; margin: 2px 0;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
} }
.collections-button-active { .collections-button-active {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: white; background-color: white;
color: var(--mdc-theme-primary); color: var(--mdc-theme-primary);
border-radius: 25px; border-radius: 25px;
padding: 8px 20px; padding: 8px 20px;
margin: 2px 0; margin: 2px 0;
box-shadow: rgb(0 0 0 / 14%) 0px 1px 1px 0px, rgb(0 0 0 / 12%) 0px 2px 1px -1px, rgb(0 0 0 / 20%) 0px 1px 3px 0px; box-shadow: rgb(0 0 0 / 14%) 0px 1px 1px 0px,
/* box-shadow: rgb(99 99 99 / 20%) 0px 2px 8px 0px; */ rgb(0 0 0 / 12%) 0px 2px 1px -1px, rgb(0 0 0 / 20%) 0px 1px 3px 0px;
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
cursor: auto; cursor: auto;
} }
.new-collection-row { .collection-wrapper {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; width: 100%;
} height: 100%;
}
.new-collection-subrow { .new-collection-row {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; height: 100%;
gap: 5px; }
}
.new-collection-title { .new-collection-subrow {
font-family: Maven Pro, sans-serif; display: flex;
color: var(--chat-bubble-msg-color); flex-direction: column;
font-size: 18px; justify-content: center;
letter-spacing: 0.6px; align-items: center;
margin: 0; gap: 5px;
user-select: none; }
}
.new-collection-subtitle { .new-collection-title {
font-family: Roboto, sans-serif; font-family: Maven Pro, sans-serif;
color: var(--chat-bubble-msg-color); color: var(--chat-bubble-msg-color);
font-weight: 300; font-size: 18px;
opacity: 0.9; letter-spacing: 0.6px;
font-size: 14px; margin: 0;
letter-spacing: 0.3px; user-select: none;
margin: 0; }
user-select: none;
} .new-collection-subtitle {
` font-family: Roboto, sans-serif;
color: var(--chat-bubble-msg-color);
font-weight: 300;
opacity: 0.9;
font-size: 14px;
letter-spacing: 0.3px;
margin: 0;
user-select: none;
}
.new-collection-container {
display: flex;
margin: 15px 20px;
border: 3.5px dashed #b898c1;
border-radius: 10px;
background-color: #d7d3db2e;
align-items: center;
justify-content: center;
cursor: pointer;
}
.new-collection-icon {
font-size: 30px;
color: var(--mdc-theme-primary);
}
.gifs-added-col {
flex-direction: column;
justify-content: space-between;
flex: 1 1 0%;
margin-top: 10px;
overflow-y: auto;
max-height: 300px;
}
.gifs-added-col::-webkit-scrollbar-track {
background-color: whitesmoke;
border-radius: 7px;
}
.gifs-added-col::-webkit-scrollbar {
width: 6px;
border-radius: 7px;
background-color: whitesmoke;
}
.gifs-added-col::-webkit-scrollbar-thumb {
background-color: rgb(180, 176, 176);
border-radius: 7px;
transition: all 0.3s ease-in-out;
}
.gifs-added-row {
display: flex;
flex-direction: column;
gap: 5px;
overflow-y: auto;
}
.gifs-added-row .gif-input:last-child {
border-bottom: none;
}
.gif-input {
display: flex;
flex-direction: row;
align-items: center;
gap: 10px;
background-color: transparent;
padding: 15px 5px;
border-bottom: 1px solid #7b787888;
}
.gif-input-img {
width: 70px;
height: 70px;
border-radius: 10px;
}
.gif-input-field {
height: 30px;
background-color: transparent;
border: none;
color: var(--chat-bubble-msg-color);
border-bottom: 1px solid var(--chat-bubble-msg-color);
width: 100%;
padding: 0;
margin: 0;
outline: 0;
font-size: 16px;
font-family: Roboto, sans-serif;
letter-spacing: 0.3px;
font-weight: 300;
}
.upload-collection-row {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
margin-top: 10px;
}
.upload-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;
}
.upload-back-button {
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;
}
.upload-back-button:hover {
cursor: pointer;
background-color: #f4433663;
}
.upload-button:hover {
cursor: pointer;
background-color: #03a8f475;
}
`;

File diff suppressed because it is too large Load Diff

View File

@ -1,97 +1,92 @@
import { LitElement, html, css } from 'lit' import {LitElement, html, css} from 'lit';
import { render } from 'lit/html.js' import {render} from 'lit/html.js';
import { Epml } from '../../../../epml.js' import {Epml} from '../../../../epml.js';
import * as zip from "@zip.js/zip.js"; import * as zip from '@zip.js/zip.js';
import { saveAs } from 'file-saver'; import {saveAs} from 'file-saver';
import '@material/mwc-icon' import '@material/mwc-icon';
import ShortUniqueId from 'short-unique-id'; import ShortUniqueId from 'short-unique-id';
import { publishData } from '../../../utils/publish-image.js'; import {publishData} from '../../../utils/publish-image.js';
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) const parentEpml = new Epml({type: 'WINDOW', source: window.parent});
class ChatGifsExplore extends LitElement { class ChatGifsExplore extends LitElement {
static get properties() { static get properties() {
return { return {
currentCollection: {type: String}, currentCollection: {type: String},
getMoreExploreGifs: {attribute: false}, getMoreExploreGifs: {attribute: false},
exploreCollections: {type: Array}, exploreCollections: {type: Array},
setCurrentCollection: {attribute: false} setCurrentCollection: {attribute: false},
} };
} }
static get styles() { static get styles() {
return css` return css``;
}
`
}
constructor() { constructor() {
super() super();
this.downObserverElement = '' this.downObserverElement = '';
this.viewElement = '' this.viewElement = '';
this.exploreCollections = [] this.exploreCollections = [];
} }
elementObserver() {
const options = {
root: this.viewElement,
rootMargin: '0px',
threshold: 1,
};
// identify an element to observe
const elementToObserve = this.downObserverElement;
// passing it a callback function
const observer = new IntersectionObserver(
this.observerHandler,
options
);
// call `observe()` on that MutationObserver instance,
// passing it the element to observe, and the options object
observer.observe(elementToObserve);
}
observerHandler(entries) {
if (!entries[0].isIntersecting) {
return;
} else {
if (this.exploreCollections.length < 20) {
return;
}
elementObserver() { this.getMoreExploreGifs();
const options = { }
root: this.viewElement, }
rootMargin: '0px',
threshold: 1
}
// identify an element to observe
const elementToObserve = this.downObserverElement;
// passing it a callback function
const observer = new IntersectionObserver(this.observerHandler, options);
// call `observe()` on that MutationObserver instance,
// passing it the element to observe, and the options object
observer.observe(elementToObserve);
}
observerHandler(entries) { async firstUpdated() {
if (!entries[0].isIntersecting) { this.viewElement = this.shadowRoot.getElementById('viewElement');
return this.downObserverElement =
} else { this.shadowRoot.getElementById('downObserver');
if(this.exploreCollections.length < 20){ this.elementObserver();
return }
}
this.getMoreExploreGifs()
}
}
render() {
return html`
async firstUpdated() { <div id="viewElement" class="container-body">
this.viewElement = this.shadowRoot.getElementById('viewElement'); ${this.exploreCollections.map((collection) => {
this.downObserverElement = this.shadowRoot.getElementById('downObserver'); return html`
this.elementObserver(); <div>
} <p
@click=${() => {
this.setCurrentCollection(collection);
}}
render() { >
${collection.identifier}
return html` </p>
<div id="viewElement" class="container-body"> </div>
${this.exploreCollections.map((collection)=> { `;
return html` })}
<div> <div id="downObserver"></div>
<p @click=${()=> { </div>
this.setCurrentCollection(collection) `;
}}>${collection.identifier}</p> }
</div>
`
})}
<div id='downObserver'></div>
</div>
`
}
} }
window.customElements.define('chat-gifs-explore', ChatGifsExplore) window.customElements.define('chat-gifs-explore', ChatGifsExplore);

View File

@ -824,7 +824,9 @@ class ChatPage extends LitElement {
} }
.chat-gifs { .chat-gifs {
position: relative; position: absolute;
right: 15px;
bottom: 100px;
justify-self: flex-end; justify-self: flex-end;
width: fit-content; width: fit-content;
height: auto; height: auto;
@ -1050,26 +1052,26 @@ console.log({zipFileBlob})
` : ` :
this.renderChatScroller()} this.renderChatScroller()}
</div> </div>
<!-- gif div --> <div
<div class="gifs-backdrop"
class="gifs-backdrop" @click=${() => {
@click=${() => { this.setOpenGifModal(false);
this.setOpenGifModal(false); this.editor.commands.focus("end");
this.editor.commands.focus("end"); this.shadowRoot.querySelector("chat-gifs").clearGifSelections();
this.shadowRoot.querySelector("chat-gifs").clearGifSelections(); }}
}}
style=${this.openGifModal ? "visibility: visible; z-index: 4" : "visibility: hidden; z-index: -100"}> style=${this.openGifModal ? "visibility: visible; z-index: 4" : "visibility: hidden; z-index: -100"}>
</div> </div>
<chat-gifs
class="chat-gifs"
style=${this.openGifModal ? "display: flex;" : "display: none;"}
.webWorkerImage=${this.webWorkerImage}>
</chat-gifs>
<!-- main chat bar --> <!-- main chat bar -->
<div class="chat-text-area" style="${`${(this.repliedToMessageObj || this.editedMessageObj) && "min-height: 120px"}`}"> <div class="chat-text-area" style="${`${(this.repliedToMessageObj || this.editedMessageObj) && "min-height: 120px"}`}">
<!-- gif div -->
<chat-gifs
class="chat-gifs"
style=${this.openGifModal ? "display: flex;" : "display: none;"}
.webWorkerImage=${this.webWorkerImage}>
</chat-gifs>
<div <div
class='last-message-ref' class='last-message-ref'
style=${(this.lastMessageRefVisible && !this.imageFile) ? 'opacity: 1;' : 'opacity: 0;'}> style=${(this.lastMessageRefVisible && !this.imageFile && !this.openGifModal) ? 'opacity: 1;' : 'opacity: 0;'}>
<vaadin-icon class='arrow-down-icon' icon='vaadin:arrow-circle-down' slot='icon' @click=${() => { <vaadin-icon class='arrow-down-icon' icon='vaadin:arrow-circle-down' slot='icon' @click=${() => {
this.shadowRoot.querySelector("chat-scroller").shadowRoot.getElementById("downObserver") this.shadowRoot.querySelector("chat-scroller").shadowRoot.getElementById("downObserver")
.scrollIntoView({ .scrollIntoView({

View File

@ -1,69 +1,69 @@
import { css } from 'lit' import { css } from 'lit'
export const userInfoStyles = css` export const userInfoStyles = css`
.user-info-header { .user-info-header {
font-family: Montserrat, sans-serif; font-family: Montserrat, sans-serif;
text-align: center; text-align: center;
font-size: 28px; font-size: 28px;
color: var(--chat-bubble-msg-color); color: var(--chat-bubble-msg-color);
margin-bottom: 10px; margin-bottom: 10px;
padding: 10px 0; padding: 10px 0;
user-select: none; user-select: none;
} }
.avatar-container { .avatar-container {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.user-info-avatar { .user-info-avatar {
width: 100px; width: 100px;
height: 100px; height: 100px;
border-radius: 50%; border-radius: 50%;
margin: 10px 0; margin: 10px 0;
} }
.user-info-no-avatar { .user-info-no-avatar {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
text-transform: capitalize; text-transform: capitalize;
font-size: 50px; font-size: 50px;
font-family: Roboto, sans-serif; font-family: Roboto, sans-serif;
width: 100px; width: 100px;
height: 100px; height: 100px;
border-radius:50%; border-radius:50%;
background: var(--chatHeadBg); background: var(--chatHeadBg);
color: var(--chatHeadText); color: var(--chatHeadText);
} }
.send-message-button {
font-family: Roboto, sans-serif;
letter-spacing: 0.3px;
font-weight: 300;
padding: 8px 5px;
border-radius: 3px;
text-align: center;
color: var(--mdc-theme-primary);
transition: all 0.3s ease-in-out;
}
.send-message-button:hover { .send-message-button {
cursor: pointer; font-family: Roboto, sans-serif;
background-color: #03a8f485; letter-spacing: 0.3px;
} font-weight: 300;
padding: 8px 5px;
border-radius: 3px;
text-align: center;
color: var(--mdc-theme-primary);
transition: all 0.3s ease-in-out;
}
.close-icon { .send-message-button:hover {
position: absolute; cursor: pointer;
top: 3px; background-color: #03a8f485;
right: 5px; }
color: #676b71;
width: 14px;
transition: all 0.1s ease-in-out;
}
.close-icon:hover { .close-icon {
cursor: pointer; position: absolute;
color: #494c50; top: 3px;
} right: 5px;
` color: #676b71;
width: 14px;
transition: all 0.1s ease-in-out;
}
.close-icon:hover {
cursor: pointer;
color: #494c50;
}
`