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",
"cchange83": "Subscribed Collections",
"cchange84": "Upload your gif files",
"cchange85": "File should be .Gif"
"cchange85": "File should be .Gif",
"cchange86": "Upload Collection"
},
"welcomepage": {
"wcchange1": "Welcome to Q-Chat",

View File

@ -1,167 +1,302 @@
import { css } from 'lit'
import { css } from 'lit';
export const gifExplorerStyles = css`
.gifs-container {
position: relative;
display: flex;
padding: 10px 15px;
border-radius: 12px;
box-shadow: rgba(0, 0, 0, 0.09) 0px 3px 12px;
background-color: var(--chat-menu-bg);
width: fit-content;
justify-self: flex-end;
place-self: end flex-end;
min-height: 400px;
min-width: 370px;
margin-bottom: 8px;
margin-right: 5px;
box-shadow: var(--gifs-drop-shadow);
}
.gifs-container {
position: relative;
display: flex;
padding: 10px 15px;
border-radius: 12px;
box-shadow: rgba(0, 0, 0, 0.09) 0px 3px 12px;
background-color: var(--chat-menu-bg);
width: fit-content;
justify-self: flex-end;
place-self: end flex-end;
min-height: 400px;
max-height: 95vh;
min-width: 370px;
box-shadow: var(--gifs-drop-shadow);
}
.gif-explorer-container {
min-height: 400px;
display: flex;
flex-direction: column;
justify-content: flex-start;
width: 100%;
align-items: center;
gap: 15px;
}
.gif-explorer-container {
min-height: 400px;
display: flex;
flex-direction: column;
justify-content: flex-start;
width: 100%;
align-items: center;
gap: 15px;
}
.title-row {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
}
.title-row {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
}
.gif-explorer-title {
flex: 1;
text-align: center;
font-family: Roboto, sans-serif;
letter-spacing: 0.8px;
font-size: 25px;
color: var(--chat-bubble-msg-color);
margin: 0;
user-select: none;
}
.gif-explorer-title {
flex: 1;
text-align: center;
font-family: Roboto, sans-serif;
letter-spacing: 0.8px;
font-size: 25px;
color: var(--chat-bubble-msg-color);
margin: 0;
user-select: none;
}
.explore-collections-icon {
margin-left: auto;
text-align: right;
font-size: 20px;
color: var(--chat-group);
box-shadow: var(--gif-search-icon-bs);
padding: 7px;
background-color: var(--gif-search-icon);
border: none;
border-radius: 8px;
cursor: pointer;
}
.explore-collections-icon {
margin-left: auto;
text-align: right;
font-size: 20px;
color: var(--chat-group);
box-shadow: var(--gif-search-icon-bs);
padding: 7px;
background-color: var(--gif-search-icon);
border: none;
border-radius: 8px;
cursor: pointer;
}
.create-collections-icon {
position: absolute;
bottom: 5px;
left: 50%;
transform: translateX(-50%);
padding: 4px;
font-size: 22px;
background-color: var(--mdc-theme-primary);
color: white;
border-radius: 8px;
box-shadow: 0 0 0 rgba(0, 0, 0, 0.2);
transition: all 0.3s ease-in-out;
}
.create-collections-icon {
position: absolute;
bottom: 5px;
left: 50%;
transform: translateX(-50%);
padding: 4px;
font-size: 22px;
background-color: var(--mdc-theme-primary);
color: white;
border-radius: 8px;
box-shadow: 0 0 0 rgba(0, 0, 0, 0.2);
transition: all 0.3s ease-in-out;
}
.create-collections-icon:hover {
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);
}
.create-collections-icon:hover {
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);
}
.collections-button-row {
width: auto;
background-color: var(--gif-button-row-bg);
border-radius: 35px;
padding: 2px;
margin-top: 10px;
}
.collections-button-row {
width: auto;
background-color: var(--gif-button-row-bg);
border-radius: 35px;
padding: 2px;
margin-top: 10px;
}
.collections-button-innerrow {
display: flex;
flex-direction: row;
align-items: center;
}
.collections-button-innerrow {
display: flex;
flex-direction: row;
align-items: center;
}
.my-collections-button {
font-size: 16px;
font-family: "Maven Pro", sans-serif;
letter-spacing: 0.5px;
color: var(--gif-button-row-color);
border-radius: 35px;
padding: 8px 20px;
margin: 2px 0;
cursor: pointer;
user-select: none;
}
.my-collections-button {
font-size: 16px;
font-family: 'Maven Pro', sans-serif;
letter-spacing: 0.5px;
color: var(--gif-button-row-color);
border-radius: 35px;
padding: 8px 20px;
margin: 2px 0;
cursor: pointer;
user-select: none;
}
.subscribed-collections-button {
font-size: 16px;
font-family: "Maven Pro", sans-serif;
letter-spacing: 0.5px;
color: var(--gif-button-row-color);
border-radius: 35px;
padding: 8px 20px;
margin: 2px 0;
cursor: pointer;
user-select: none;
}
.subscribed-collections-button {
font-size: 16px;
font-family: 'Maven Pro', sans-serif;
letter-spacing: 0.5px;
color: var(--gif-button-row-color);
border-radius: 35px;
padding: 8px 20px;
margin: 2px 0;
cursor: pointer;
user-select: none;
}
.collections-button-active {
display: flex;
align-items: center;
justify-content: center;
background-color: white;
color: var(--mdc-theme-primary);
border-radius: 25px;
padding: 8px 20px;
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(99 99 99 / 20%) 0px 2px 8px 0px; */
transition: all 0.3s ease-in-out;
cursor: auto;
}
.collections-button-active {
display: flex;
align-items: center;
justify-content: center;
background-color: white;
color: var(--mdc-theme-primary);
border-radius: 25px;
padding: 8px 20px;
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;
transition: all 0.3s ease-in-out;
cursor: auto;
}
.new-collection-row {
display: flex;
flex-direction: column;
justify-content: center;
}
.collection-wrapper {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.new-collection-subrow {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 5px;
}
.new-collection-row {
display: flex;
flex-direction: column;
justify-content: center;
height: 100%;
}
.new-collection-title {
font-family: Maven Pro, sans-serif;
color: var(--chat-bubble-msg-color);
font-size: 18px;
letter-spacing: 0.6px;
margin: 0;
user-select: none;
}
.new-collection-subrow {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 5px;
}
.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-title {
font-family: Maven Pro, sans-serif;
color: var(--chat-bubble-msg-color);
font-size: 18px;
letter-spacing: 0.6px;
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 { render } from 'lit/html.js'
import { Epml } from '../../../../epml.js'
import * as zip from "@zip.js/zip.js";
import { saveAs } from 'file-saver';
import '@material/mwc-icon'
import {LitElement, html, css} from 'lit';
import {render} from 'lit/html.js';
import {Epml} from '../../../../epml.js';
import * as zip from '@zip.js/zip.js';
import {saveAs} from 'file-saver';
import '@material/mwc-icon';
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 {
static get properties() {
return {
currentCollection: {type: String},
getMoreExploreGifs: {attribute: false},
exploreCollections: {type: Array},
setCurrentCollection: {attribute: false}
}
}
static get properties() {
return {
currentCollection: {type: String},
getMoreExploreGifs: {attribute: false},
exploreCollections: {type: Array},
setCurrentCollection: {attribute: false},
};
}
static get styles() {
return css`
`
}
static get styles() {
return css``;
}
constructor() {
super()
this.downObserverElement = ''
this.viewElement = ''
this.exploreCollections = []
}
constructor() {
super();
this.downObserverElement = '';
this.viewElement = '';
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() {
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);
}
this.getMoreExploreGifs();
}
}
observerHandler(entries) {
if (!entries[0].isIntersecting) {
return
} else {
if(this.exploreCollections.length < 20){
return
}
this.getMoreExploreGifs()
}
}
async firstUpdated() {
this.viewElement = this.shadowRoot.getElementById('viewElement');
this.downObserverElement =
this.shadowRoot.getElementById('downObserver');
this.elementObserver();
}
async firstUpdated() {
this.viewElement = this.shadowRoot.getElementById('viewElement');
this.downObserverElement = this.shadowRoot.getElementById('downObserver');
this.elementObserver();
}
render() {
return html`
<div id="viewElement" class="container-body">
${this.exploreCollections.map((collection)=> {
return html`
<div>
<p @click=${()=> {
this.setCurrentCollection(collection)
}}>${collection.identifier}</p>
</div>
`
})}
<div id='downObserver'></div>
</div>
`
}
render() {
return html`
<div id="viewElement" class="container-body">
${this.exploreCollections.map((collection) => {
return html`
<div>
<p
@click=${() => {
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 {
position: relative;
position: absolute;
right: 15px;
bottom: 100px;
justify-self: flex-end;
width: fit-content;
height: auto;
@ -1050,26 +1052,26 @@ console.log({zipFileBlob})
` :
this.renderChatScroller()}
</div>
<!-- gif div -->
<div
class="gifs-backdrop"
@click=${() => {
this.setOpenGifModal(false);
this.editor.commands.focus("end");
this.shadowRoot.querySelector("chat-gifs").clearGifSelections();
}}
<div
class="gifs-backdrop"
@click=${() => {
this.setOpenGifModal(false);
this.editor.commands.focus("end");
this.shadowRoot.querySelector("chat-gifs").clearGifSelections();
}}
style=${this.openGifModal ? "visibility: visible; z-index: 4" : "visibility: hidden; z-index: -100"}>
</div>
<chat-gifs
class="chat-gifs"
style=${this.openGifModal ? "display: flex;" : "display: none;"}
.webWorkerImage=${this.webWorkerImage}>
</chat-gifs>
</div>
<!-- main chat bar -->
<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
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=${() => {
this.shadowRoot.querySelector("chat-scroller").shadowRoot.getElementById("downObserver")
.scrollIntoView({

View File

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