mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-24 09:01:43 +00:00
Responsive embeds &cursor pointers in some places.
This commit is contained in:
parent
2a7a9cfb0d
commit
61adfad048
9 changed files with 130 additions and 24 deletions
|
|
@ -135,6 +135,7 @@ export default {
|
||||||
margin-right: 1px;
|
margin-right: 1px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.tab:hover{
|
.tab:hover{
|
||||||
background: rgba(255, 255, 255, 0.096);
|
background: rgba(255, 255, 255, 0.096);
|
||||||
|
|
|
||||||
|
|
@ -497,6 +497,7 @@ export default {
|
||||||
2500
|
2500
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
this.scrollDown(true);
|
||||||
|
|
||||||
bus.$on("newMessage", this.hideTypingStatus);
|
bus.$on("newMessage", this.hideTypingStatus);
|
||||||
bus.$on("emojiSuggestions:Selected", this.enterEmojiSuggestion);
|
bus.$on("emojiSuggestions:Selected", this.enterEmojiSuggestion);
|
||||||
|
|
|
||||||
|
|
@ -163,16 +163,22 @@ export default {
|
||||||
return { width: srcWidth*ratio, height: srcHeight*ratio };
|
return { width: srcWidth*ratio, height: srcHeight*ratio };
|
||||||
},
|
},
|
||||||
imageSize() {
|
imageSize() {
|
||||||
|
const files = this.$props.files;
|
||||||
|
if (!files || files.length === 0 || !files[0].dimensions)
|
||||||
|
return undefined;
|
||||||
|
|
||||||
const messageLog = document.querySelector('.scroll');
|
const messageLog = document.querySelector('.scroll');
|
||||||
const w = messageLog.offsetWidth;
|
const w = messageLog.offsetWidth;
|
||||||
const h = messageLog.offsetHeight;
|
const h = messageLog.offsetHeight;
|
||||||
|
|
||||||
const minWidth = w / 2;
|
let minWidth = w / 4;
|
||||||
const minHeight = h / 2;
|
let minHeight = h / 4;
|
||||||
|
if (w <= 800) {
|
||||||
|
minWidth = w / 1.7;
|
||||||
|
minHeight = h / 1.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const files = this.$props.files;
|
|
||||||
if (!files || files.length === 0 || !files[0].dimensions)
|
|
||||||
return undefined;
|
|
||||||
const dimensions = this.$props.files[0].dimensions
|
const dimensions = this.$props.files[0].dimensions
|
||||||
const srcWidth = dimensions.width;
|
const srcWidth = dimensions.width;
|
||||||
const srcHeight = dimensions.height;
|
const srcHeight = dimensions.height;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ export default {
|
||||||
}
|
}
|
||||||
img {
|
img {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
border: solid 1px white;
|
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
|
||||||
|
|
@ -171,9 +171,10 @@ export default {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.box {
|
.box {
|
||||||
margin: auto;
|
|
||||||
max-height: 500px;
|
max-height: 500px;
|
||||||
width: 350px;
|
width: 350px;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="embed" :class="{article: embed.type === 'article' || embed.type === 'video.other', website: embed.type === 'website'}">
|
<div class="embed" ref="embed" :class="{article: embed.type === 'article' || embed.type === 'video.other', website: embed.type === 'website'}">
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<div class="image" v-if="embed.image" @click="embedImgClicked"><img :src="`//images.weserv.nl/?url=${embed.image}`" alt=""></div>
|
<div class="image" v-if="imageURL" @click="embedImgClicked"><img ref="image" :src="`//images.weserv.nl/?url=${imageURL }`" alt=""></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="title" v-if="embed.url"><a target=”_blank” :href="embed.url">{{embed.title}}</a></div>
|
<div class="title" v-if="embed.url"><a target=”_blank” :href="embed.url">{{embed.title}}</a></div>
|
||||||
|
|
@ -12,12 +12,75 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import windowProperties from '@/utils/windowProperties';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ["embed"],
|
props: ["embed"],
|
||||||
methods: {
|
methods: {
|
||||||
embedImgClicked() {
|
embedImgClicked() {
|
||||||
this.$store.dispatch("setImagePreviewURL", "//images.weserv.nl/?url=" + this.embed.image);
|
this.$store.dispatch("setImagePreviewURL", "//images.weserv.nl/?url=" + this.imageURL);
|
||||||
},
|
},
|
||||||
|
clamp(num, min, max) {
|
||||||
|
return num <= min ? min : num >= max ? max : num;
|
||||||
|
},
|
||||||
|
calculateAspectRatioFit(srcWidth, srcHeight, maxWidth, maxHeight) {
|
||||||
|
let ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight);
|
||||||
|
return { width: srcWidth*ratio, height: srcHeight*ratio };
|
||||||
|
},
|
||||||
|
articleSize() {
|
||||||
|
const image = this.embed.image;
|
||||||
|
if (!image || !image.dimensions )
|
||||||
|
return undefined;
|
||||||
|
|
||||||
|
if (this.embed.type !== "article" && this.embed.type !== "video.other")
|
||||||
|
return undefined;
|
||||||
|
|
||||||
|
const embed = this.$refs['embed'];
|
||||||
|
const messageLog = document.querySelector('.scroll');
|
||||||
|
const w = messageLog.offsetWidth;
|
||||||
|
const h = messageLog.offsetHeight;
|
||||||
|
|
||||||
|
const minWidth = this.clamp(w / 2, 0, 200);
|
||||||
|
const minHeight = h / 2;
|
||||||
|
|
||||||
|
const dimensions = image.dimensions
|
||||||
|
const srcWidth = dimensions.width;
|
||||||
|
const srcHeight = dimensions.height;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const newDimentions = this.calculateAspectRatioFit(srcWidth, srcHeight, minWidth, minHeight);
|
||||||
|
|
||||||
|
const imageTag = this.$refs['image'];
|
||||||
|
|
||||||
|
//embed.style.width = this.clamp(newDimentions.width, 0, srcWidth) + "px"
|
||||||
|
|
||||||
|
imageTag.style.width = this.clamp(newDimentions.width, 0, srcWidth) + "px"
|
||||||
|
imageTag.style.height = this.clamp(newDimentions.height, 0, srcHeight) + "px"
|
||||||
|
},
|
||||||
|
onResize(dimensions) {
|
||||||
|
this.articleSize();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.articleSize();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
getWindowWidth(dimensions) {
|
||||||
|
this.onResize(dimensions)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
getWindowWidth() {
|
||||||
|
return {width: windowProperties.resizeWidth, height: windowProperties.resizeHeight};
|
||||||
|
},
|
||||||
|
imageURL() {
|
||||||
|
const image = this.embed.image;
|
||||||
|
if (!image) return undefined;
|
||||||
|
if (typeof image === 'string') return image;
|
||||||
|
if (image.url) return image.url;
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -29,13 +92,13 @@ export default {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
display: flex;
|
display: flex;
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
min-width: 200px;
|
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.embed.article {
|
.embed.article {
|
||||||
flex-direction: column;
|
|
||||||
}
|
}
|
||||||
.embed.website {
|
.embed.website {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
|
|
@ -50,17 +113,17 @@ export default {
|
||||||
.embed.article .image {
|
.embed.article .image {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article .left {
|
.article .left {
|
||||||
order: 1;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
.article .right {
|
.article .right {
|
||||||
order: 2;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
.article .image img {
|
.article .image img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: 100%;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
|
|
@ -69,6 +132,10 @@ export default {
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
.description {
|
.description {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
@ -77,6 +144,11 @@ export default {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 3;
|
-webkit-line-clamp: 3;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
|
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
.image img {
|
.image img {
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|
@ -88,6 +160,22 @@ export default {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.image:after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: rgba(0, 0, 0, 0);
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
.image:hover:after {
|
||||||
|
background: rgba(0, 0, 0, 0.384);
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
color: rgb(86, 159, 253);
|
color: rgb(86, 159, 253);
|
||||||
|
|
@ -96,5 +184,11 @@ a {
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 955px) {
|
||||||
|
.article {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,7 @@ export default {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notifyAnimation{
|
.notifyAnimation{
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ const config = [
|
||||||
fix: [
|
fix: [
|
||||||
"Fixed a bug where messages would appear blurry sometimes.",
|
"Fixed a bug where messages would appear blurry sometimes.",
|
||||||
"Fixed a bug where scrolling would be inverted in some devices.",
|
"Fixed a bug where scrolling would be inverted in some devices.",
|
||||||
|
"Responsive images and embeds."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,12 @@ export default {
|
||||||
animation-iteration-count: infinite;
|
animation-iteration-count: infinite;
|
||||||
animation-fill-mode: forwards;
|
animation-fill-mode: forwards;
|
||||||
}
|
}
|
||||||
|
.box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
@keyframes notifyAnime {
|
@keyframes notifyAnime {
|
||||||
0%{
|
0%{
|
||||||
background: rgba(121, 3, 3, 0.541);
|
background: rgba(121, 3, 3, 0.541);
|
||||||
|
|
@ -301,6 +307,7 @@ export default {
|
||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
-webkit-app-region: no-drag;
|
-webkit-app-region: no-drag;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.tab.selected {
|
.tab.selected {
|
||||||
background: rgba(71, 71, 71, 0.637);
|
background: rgba(71, 71, 71, 0.637);
|
||||||
|
|
@ -348,12 +355,7 @@ export default {
|
||||||
textarea {
|
textarea {
|
||||||
font-family: "Roboto", sans-serif;
|
font-family: "Roboto", sans-serif;
|
||||||
}
|
}
|
||||||
.box {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.background-image {
|
.background-image {
|
||||||
background: url(./../assets/background.jpg);
|
background: url(./../assets/background.jpg);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue