This commit is contained in:
ThatOneCalculator 2022-11-04 15:20:15 -07:00
parent 2c38b497ee
commit 338cbac563
2 changed files with 146 additions and 152 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "calckey", "name": "calckey",
"version": "12.119.0-calc.7-rc.3", "version": "12.119.0-calc.7-rc.4",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -6,37 +6,35 @@
<MkButton primary class="start" @click="start"><i class="fas fa-plus"></i> {{ i18n.ts.startMessaging }}</MkButton> <MkButton primary class="start" @click="start"><i class="fas fa-plus"></i> {{ i18n.ts.startMessaging }}</MkButton>
<div v-if="messages.length > 0" class="history"> <div v-if="messages.length > 0" class="history">
<!-- <MkPagination v-slot="{items}" ref="list" :pagination="pagination"> --> <MkA
<MkA v-for="(message, i) in messages"
v-for="message in items" :key="message.id"
:key="message.id" v-anim="i"
class="message _block" class="message _block"
:class="{ isMe: isMe(message), isRead: message.groupId ? message.reads.includes($i?.id) : message.isRead }" :class="{ isMe: isMe(message), isRead: message.groupId ? message.reads.includes($i.id) : message.isRead }"
:to="message.groupId ? `/my/messaging/group/${message.groupId}` : `/my/messaging/${getAcct(isMe(message) ? message.recipient : message.user)}`" :to="message.groupId ? `/my/messaging/group/${message.groupId}` : `/my/messaging/${getAcct(isMe(message) ? message.recipient : message.user)}`"
> :data-index="i"
<div> >
<MkAvatar class="avatar" :user="message.groupId ? message.user : isMe(message) ? message.recipient : message.user" :show-indicator="true"/> <div>
<header v-if="message.groupId"> <MkAvatar class="avatar" :user="message.groupId ? message.user : isMe(message) ? message.recipient : message.user" :show-indicator="true"/>
<span class="name">{{ message.group.name }}</span> <header v-if="message.groupId">
<MkTime :time="message.createdAt" class="time"/> <span class="name">{{ message.group.name }}</span>
</header> <MkTime :time="message.createdAt" class="time"/>
<header v-else> </header>
<span class="name"> <header v-else>
<MkUserName :user="isMe(message) ? message.recipient : message.user"/> <span class="name"><MkUserName :user="isMe(message) ? message.recipient : message.user"/></span>
</span> <span class="username">@{{ acct(isMe(message) ? message.recipient : message.user) }}</span>
<span class="username">@{{ acct(isMe(message) ? message.recipient : message.user) }}</span> <MkTime :time="message.createdAt" class="time"/>
<MkTime :time="message.createdAt" class="time"/> </header>
</header> <div class="body">
<div class="body"> <p class="text">
<p class="text"> <span v-if="isMe(message)" class="me">{{ i18n.ts.you }}: </span>
<span v-if="isMe(message)" class="me">{{ i18n.ts.you }}: </span> <span v-if="message.text != null && message.text.length > 0">{{ message.text }}</span>
<span v-if="message.text != null && message.text.length > 0">{{ message.text }}</span> <span v-else> 📎</span>
<span v-else> 📎</span> </p>
</p>
</div>
</div> </div>
</MkA> </div>
<!-- </MkPagination> --> </MkA>
</div> </div>
<div v-if="!fetching && messages.length == 0" class="_fullinfo"> <div v-if="!fetching && messages.length == 0" class="_fullinfo">
<img src="/static-assets/badges/info.png" class="_ghost" alt="Info"/> <img src="/static-assets/badges/info.png" class="_ghost" alt="Info"/>
@ -69,10 +67,6 @@ let connection = $ref(null);
const getAcct = Acct.toString; const getAcct = Acct.toString;
const props = defineProps<{
pagination: any;
}>();
function isMe(message) { function isMe(message) {
return message.userId === $i.id; return message.userId === $i.id;
} }
@ -81,7 +75,7 @@ function onMessage(message) {
if (message.recipientId) { if (message.recipientId) {
messages = messages.filter(m => !( messages = messages.filter(m => !(
(m.recipientId === message.recipientId && m.userId === message.userId) || (m.recipientId === message.recipientId && m.userId === message.userId) ||
(m.recipientId === message.userId && m.userId === message.recipientId))); (m.recipientId === message.userId && m.userId === message.recipientId)));
messages.unshift(message); messages.unshift(message);
} else if (message.groupId) { } else if (message.groupId) {
@ -172,54 +166,45 @@ definePageMetadata({
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.yweeujhr { .yweeujhr {
> .start { > .start {
margin: 0 auto var(--margin) auto; margin: 0 auto var(--margin) auto;
} }
> .history { > .history {
> .message { > .message {
display: block;
text-decoration: none;
margin-bottom: var(--margin);
* {
pointer-events: none;
user-select: none;
}
&:hover {
.avatar {
filter: saturate(200%);
}
}
&:active {
}
&.isRead,
&.isMe {
opacity: 0.8;
}
&:not(.isMe):not(.isRead) {
> div {
background-image: url("/client-assets/unread.svg");
background-repeat: no-repeat;
background-position: 0 center;
}
}
&:after {
content: "";
display: block; display: block;
clear: both; text-decoration: none;
} margin-bottom: var(--margin);
> div { * {
padding: 20px 30px; pointer-events: none;
user-select: none;
}
&:hover {
.avatar {
filter: saturate(200%);
}
}
&:active {
}
&.isRead,
&.isMe {
opacity: 0.8;
}
&:not(.isMe):not(.isRead) {
> div {
background-image: url("/client-assets/unread.svg");
background-repeat: no-repeat;
background-position: 0 center;
}
}
&:after { &:after {
content: ""; content: "";
@ -227,87 +212,96 @@ definePageMetadata({
clear: both; clear: both;
} }
> header { > div {
display: flex; padding: 20px 30px;
align-items: center;
margin-bottom: 2px;
white-space: nowrap;
overflow: hidden;
> .name { &:after {
margin: 0; content: "";
padding: 0;
overflow: hidden;
text-overflow: ellipsis;
font-size: 1em;
font-weight: bold;
transition: all 0.1s ease;
}
> .username {
margin: 0 8px;
}
> .time {
margin: 0 0 0 auto;
}
}
> .avatar {
float: left;
width: 54px;
height: 54px;
margin: 0 16px 0 0;
border-radius: 8px;
transition: all 0.1s ease;
}
> .body {
> .text {
display: block; display: block;
margin: 0 0 0 0; clear: both;
padding: 0; }
overflow: hidden;
overflow-wrap: break-word;
font-size: 1.1em;
color: var(--faceText);
.me { > header {
opacity: 0.7; display: flex;
align-items: center;
margin-bottom: 2px;
white-space: nowrap;
overflow: hidden;
> .name {
margin: 0;
padding: 0;
overflow: hidden;
text-overflow: ellipsis;
font-size: 1em;
font-weight: bold;
transition: all 0.1s ease;
}
> .username {
margin: 0 8px;
}
> .time {
margin: 0 0 0 auto;
} }
} }
> .image {
display: block;
max-width: 100%;
max-height: 512px;
}
}
}
}
}
&.max-width_400px {
> .history {
> .message {
&:not(.isMe):not(.isRead) {
> div {
background-image: none;
border-left: solid 4px #3aa2dc;
}
}
> div {
padding: 16px;
font-size: 0.9em;
> .avatar { > .avatar {
margin: 0 12px 0 0; float: left;
width: 54px;
height: 54px;
margin: 0 16px 0 0;
border-radius: 8px;
transition: all 0.1s ease;
}
> .body {
> .text {
display: block;
margin: 0 0 0 0;
padding: 0;
overflow: hidden;
overflow-wrap: break-word;
font-size: 1.1em;
color: var(--faceText);
.me {
opacity: 0.7;
}
}
> .image {
display: block;
max-width: 100%;
max-height: 512px;
}
}
}
}
}
&.max-width_400px {
> .history {
> .message {
&:not(.isMe):not(.isRead) {
> div {
background-image: none;
border-left: solid 4px #3aa2dc;
}
}
> div {
padding: 16px;
font-size: 0.9em;
> .avatar {
margin: 0 12px 0 0;
}
} }
} }
} }
} }
} }
} </style>
</style>