Compare commits
23 commits
context-me
...
main
Author | SHA1 | Date | |
---|---|---|---|
1af3462188 | |||
014dff9c2d | |||
53ec803f2c | |||
01423951bc | |||
8a77cb9a1d | |||
2d8516885d | |||
5a15bd5ddb | |||
c95f13ff18 | |||
d76abd428c | |||
82502d99ef | |||
55ce7fea45 | |||
d1161cc096 | |||
26ef3671e9 | |||
f38f26a602 | |||
a5f0576a12 | |||
395dd6cf9b | |||
307969ffe5 | |||
a646279b46 | |||
62156a1049 | |||
76f77f7bfe | |||
02479072f6 | |||
31b0d2e7eb | |||
d5f1ecfd26 |
12 changed files with 120 additions and 122 deletions
|
@ -12,8 +12,4 @@ export default class Message {
|
|||
this.userUuid = user_uuid;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
getTimestamp() {
|
||||
return uuidToTimestamp(this.uuid);
|
||||
}
|
||||
}
|
|
@ -1,24 +1,22 @@
|
|||
<template>
|
||||
<div v-if="props.type == 'normal' || props.replyMessage" ref="messageElement" @contextmenu="showContextMenu($event, contextMenu, menuItems)" :id="props.last ? 'last-message' : undefined"
|
||||
class="message normal-message" :class="{ 'mentioned': (props.replyMessage || props.isMentioned) && props.message.member.user.uuid != props.me.uuid && props.replyMessage?.member.user.uuid == props.me.uuid }" :data-message-id="props.messageId"
|
||||
:editing.sync="props.editing" :replying-to.sync="props.replyingTo">
|
||||
<div v-if="props.type == 'normal' || props.replyMessage" ref="messageElement" @contextmenu="showContextMenu($event, contextMenu, menuItems)"
|
||||
class="message normal-message" :class="{ 'highlighted': (props.isMentioned || (props.replyMessage && props.message.member.user.uuid != me!.uuid && props.replyMessage?.member.user.uuid == me!.uuid)) }"
|
||||
:data-message-id="props.message.uuid" :editing.sync="props.editing">
|
||||
<div v-if="props.replyMessage" class="message-reply-svg">
|
||||
<svg
|
||||
width="1.5em" height="1.5em"
|
||||
viewBox="0 0 150 87.5" version="1.1" id="svg1"
|
||||
style="overflow: visible;">
|
||||
<defs id="defs1" />
|
||||
<g id="layer1"
|
||||
transform="translate(40,-35)">
|
||||
<g id="g3"
|
||||
transform="translate(-35,-20)">
|
||||
<g id="layer1" transform="translate(40,-35)">
|
||||
<g id="g3" transform="translate(-35,-20)">
|
||||
<path
|
||||
style="stroke:var(--reply-text-color);stroke-width:8;stroke-opacity:1"
|
||||
d="m 120.02168,87.850978 100.76157,2.4e-5"
|
||||
d="m 120,87.5 100,2.5e-5"
|
||||
id="path3-5" />
|
||||
<path
|
||||
style="stroke:var(--reply-text-color);stroke-width:8;stroke-opacity:1"
|
||||
d="M 69.899501,174.963 120.2803,87.700931"
|
||||
d="M 70,150 120,87.5"
|
||||
id="path3-5-2" />
|
||||
</g>
|
||||
</g>
|
||||
|
@ -29,36 +27,36 @@
|
|||
:text="props.replyMessage?.message"
|
||||
:reply-id="props.replyMessage.uuid" max-width="reply" />
|
||||
<div class="left-column">
|
||||
<Avatar :profile="props.author" class="message-author-avatar"/>
|
||||
<Avatar :profile="props.message.member" class="message-author-avatar"/>
|
||||
</div>
|
||||
<div class="message-data">
|
||||
<div class="message-metadata">
|
||||
<span class="message-author-username" tabindex="0" :style="`color: ${props.authorColor}`">
|
||||
{{ getDisplayName(props.author) }}
|
||||
<span class="message-author-username" tabindex="0" :style="`color: ${generateIrcColor(props.message.member.user.uuid)}`">
|
||||
{{ getDisplayName(props.message.member) }}
|
||||
</span>
|
||||
<span class="message-date" :title="date.toString()">
|
||||
<span v-if="getDayDifference(date, currentDate) === 1">Yesterday at</span>
|
||||
<span v-else-if="getDayDifference(date, currentDate) > 1 ">{{ date.toLocaleDateString(undefined) }},</span>
|
||||
|
||||
{{ date.toLocaleTimeString(undefined, { hour12: props.format == "12", timeStyle: "short" }) }}
|
||||
{{ date.toLocaleTimeString(undefined, { hour12: getPreferredTimeFormat() == "12", timeStyle: "short" }) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="message-text" v-html="sanitized" :hidden="hasEmbed" tabindex="0"></div>
|
||||
</div>
|
||||
<div class="message-text" v-html="sanitized" :hidden="hideText" tabindex="0"></div>
|
||||
<MessageMedia v-if="mediaLinks.length" :links="mediaLinks" />
|
||||
</div>
|
||||
<div v-else ref="messageElement" @contextmenu="showContextMenu($event, contextMenu, menuItems)" :id="props.last ? 'last-message' : undefined"
|
||||
class="message grouped-message" :class="{ 'message-margin-bottom': props.marginBottom, 'mentioned': props.replyMessage || props.isMentioned }"
|
||||
:data-message-id="props.messageId" :editing.sync="props.editing" :replying-to.sync="props.replyingTo">
|
||||
</div>
|
||||
<div v-else ref="messageElement" @contextmenu="showContextMenu($event, contextMenu, menuItems)"
|
||||
class="message grouped-message" :class="{ 'mentioned': props.replyMessage || props.isMentioned }"
|
||||
:data-message-id="props.message.uuid" :editing.sync="props.editing">
|
||||
<div class="left-column">
|
||||
<span :class="{ 'invisible': dateHidden }" class="message-date side-message-date" :title="date.toString()">
|
||||
{{ date.toLocaleTimeString(undefined, { hour12: props.format == "12", timeStyle: "short" }) }}
|
||||
{{ date.toLocaleTimeString(undefined, { hour12: getPreferredTimeFormat() == "12", timeStyle: "short" }) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="message-data">
|
||||
<div class="message-text" :class="$style['message-text']" v-html="sanitized" :hidden="hasEmbed" tabindex="0"></div>
|
||||
<div class="message-text" :class="$style['message-text']" v-html="sanitized" :hidden="hideText" tabindex="0"></div>
|
||||
<MessageMedia v-if="mediaLinks.length" :links="mediaLinks"/>
|
||||
</div>
|
||||
<MessageMedia v-if="mediaLinks.length" :links="mediaLinks" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -71,33 +69,37 @@ import MessageReply from './UserInterface/MessageReply.vue';
|
|||
import type { ContextMenuInterface, ContextMenuItem } from '~/types/interfaces';
|
||||
|
||||
const { getDisplayName } = useProfile()
|
||||
const { getUser } = useAuth()
|
||||
|
||||
const props = defineProps<MessageProps>();
|
||||
|
||||
const me = await getUser()
|
||||
|
||||
const contextMenu = useState<ContextMenuInterface>("contextMenu", () => ({ show: false, pointerX: 0, pointerY: 0, items: [] }));
|
||||
|
||||
const messageElement = ref<HTMLDivElement>();
|
||||
|
||||
const dateHidden = ref<boolean>(true);
|
||||
|
||||
const date = new Date(props.timestamp);
|
||||
const date = uuidToDate(props.message.uuid);
|
||||
|
||||
const currentDate: Date = new Date()
|
||||
|
||||
console.log("[MSG] message to render:", props.message);
|
||||
console.log("author:", props.author);
|
||||
console.log("author:", props.message.member);
|
||||
console.log("[MSG] reply message:", props.replyMessage);
|
||||
|
||||
const linkRegex = /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)/g;
|
||||
const linkMatches = props.message.message.matchAll(linkRegex).map(link => link[0]);
|
||||
const mediaLinks: string[] = [];
|
||||
const mediaLinks = ref<string[]>([]);
|
||||
console.log("link matches:", linkMatches);
|
||||
|
||||
const hasEmbed = ref(false);
|
||||
const hideText = ref(false);
|
||||
|
||||
const sanitized = ref<string>();
|
||||
|
||||
onMounted(async () => {
|
||||
const parsed = await parse(props.text, { gfm: true });
|
||||
const parsed = await parse(props.message.message, { gfm: true });
|
||||
sanitized.value = DOMPurify.sanitize(parsed, {
|
||||
ALLOWED_TAGS: [
|
||||
"strong", "em", "br", "blockquote",
|
||||
|
@ -121,23 +123,35 @@ onMounted(async () => {
|
|||
console.log("added listeners");
|
||||
}
|
||||
|
||||
const links: string[] = [];
|
||||
for (const link of linkMatches) {
|
||||
console.log("link:", link);
|
||||
try {
|
||||
const res = await $fetch.raw(link);
|
||||
if (res.ok && res.headers.get("content-type")?.match(/^image\/(apng|gif|jpeg|png|webp)$/)) {
|
||||
console.log("link is image");
|
||||
mediaLinks.push(link);
|
||||
links.push(link);
|
||||
}
|
||||
if (mediaLinks.length) {
|
||||
hasEmbed.value = true
|
||||
};
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("media links:", mediaLinks);
|
||||
mediaLinks.value = [...links];
|
||||
}
|
||||
|
||||
if (mediaLinks.value.length) {
|
||||
const nonLinks = props.message.message.split(linkRegex);
|
||||
let invalidContent = false;
|
||||
for (const nonLink of nonLinks) {
|
||||
if (nonLink != "" && nonLink != "\n" && nonLink != "<br>") {
|
||||
invalidContent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
hideText.value = !invalidContent;
|
||||
};
|
||||
|
||||
console.log("media links:", mediaLinks);
|
||||
});
|
||||
|
||||
//function toggleTooltip(e: Event) {
|
||||
|
@ -148,13 +162,13 @@ const menuItems: ContextMenuItem[] = [
|
|||
{ name: "Reply", icon: "lucide:reply", type: "normal", callback: () => { if (messageElement.value) replyToMessage(messageElement.value, props) } }
|
||||
]
|
||||
|
||||
console.log("me:", props.me);
|
||||
if (props.author?.user.uuid == props.me.uuid) {
|
||||
console.log("me:", me);
|
||||
if (props.message.member.user.uuid == me!.uuid) {
|
||||
// Inserts "edit" option at index 1 (below the "reply" option)
|
||||
menuItems.splice(1, 0, { name: "Edit (WIP)", icon: "lucide:square-pen", type: "normal", callback: () => { /* if (messageElement.value) editMessage(messageElement.value, props) */ } });
|
||||
}
|
||||
|
||||
if (props.author?.user.uuid == props.me.uuid /* || check message delete permission*/) {
|
||||
if (props.message.member.user.uuid == me!.uuid /* || check message delete permission*/) {
|
||||
// Inserts "edit" option at index 2 (below the "edit" option)
|
||||
menuItems.splice(2, 0, { name: "Delete (WIP)", icon: "lucide:trash", type: "danger", callback: () => {} });
|
||||
}
|
||||
|
@ -174,14 +188,20 @@ function getDayDifference(date1: Date, date2: Date) {
|
|||
|
||||
<style scoped>
|
||||
.message {
|
||||
text-align: left;
|
||||
/* border: 1px solid lightcoral; */
|
||||
display: grid;
|
||||
grid-template-columns: 2rem 1fr;
|
||||
grid-template-columns: 4rem 1fr;
|
||||
align-items: center;
|
||||
column-gap: 1dvw;
|
||||
width: 100%;
|
||||
|
||||
text-align: left;
|
||||
/* -4 dvw due to 2dvw of padding on both sides */
|
||||
width: calc(100% - 4dvw);
|
||||
overflow-wrap: anywhere;
|
||||
|
||||
padding-top: .2rem;
|
||||
padding-bottom: .2rem;
|
||||
padding-left: 2dvw;
|
||||
padding-right: 1dvw;
|
||||
border-radius: 0 var(--minor-radius) var(--minor-radius) 0;
|
||||
}
|
||||
|
||||
.message-reply-preview {
|
||||
|
@ -197,14 +217,6 @@ function getDayDifference(date1: Date, date2: Date) {
|
|||
margin-top: 1dvh;
|
||||
}
|
||||
|
||||
.grouped-message {
|
||||
margin-top: .3em;
|
||||
}
|
||||
|
||||
#last-message {
|
||||
margin-bottom: 2dvh;
|
||||
}
|
||||
|
||||
.message-metadata {
|
||||
display: flex;
|
||||
gap: .5dvw;
|
||||
|
@ -213,10 +225,9 @@ function getDayDifference(date1: Date, date2: Date) {
|
|||
|
||||
.message-data {
|
||||
/* border: 1px solid white; */
|
||||
margin-left: .5dvw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: fit-content;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
grid-row: 2;
|
||||
grid-column: 2;
|
||||
|
@ -228,10 +239,10 @@ function getDayDifference(date1: Date, date2: Date) {
|
|||
}
|
||||
|
||||
.message-author-avatar {
|
||||
min-height: 2em;
|
||||
max-height: 2em;
|
||||
min-width: 2em;
|
||||
max-width: 2em;
|
||||
min-height: 2.5em;
|
||||
max-height: 2.5em;
|
||||
min-width: 2.5em;
|
||||
max-width: 2.5em;
|
||||
}
|
||||
|
||||
.left-column {
|
||||
|
@ -242,8 +253,11 @@ function getDayDifference(date1: Date, date2: Date) {
|
|||
white-space: nowrap;
|
||||
grid-row: 2;
|
||||
grid-column: 1;
|
||||
height: 100%;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
|
||||
.author-username {
|
||||
margin-right: .5dvw;
|
||||
color: white;
|
||||
|
@ -257,9 +271,7 @@ function getDayDifference(date1: Date, date2: Date) {
|
|||
|
||||
.side-message-date {
|
||||
font-size: .625em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
margin-top: .4em;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -269,11 +281,11 @@ function getDayDifference(date1: Date, date2: Date) {
|
|||
}
|
||||
*/
|
||||
|
||||
.mentioned {
|
||||
.highlighted {
|
||||
background-color: var(--chat-important-background-color);
|
||||
}
|
||||
|
||||
.mentioned:hover {
|
||||
.highlighted:hover {
|
||||
background-color: var(--chat-important-highlighted-background-color);
|
||||
}
|
||||
|
||||
|
@ -298,6 +310,7 @@ function getDayDifference(date1: Date, date2: Date) {
|
|||
|
||||
<style>
|
||||
|
||||
/* class used in utils/replyToMessage.ts */
|
||||
.replying-to {
|
||||
background-color: var(--chat-featured-message-color);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
<template>
|
||||
<div id="message-area">
|
||||
<div id="messages" ref="messagesElement">
|
||||
<Message v-for="(message, i) of messages" :username="getDisplayName(message.member.user)" :key="message.uuid"
|
||||
:text="message.message" :timestamp="messageTimestamps[message.uuid]" :img="message.member.user.avatar"
|
||||
:format="timeFormat" :type="messagesType[message.uuid]"
|
||||
:margin-bottom="(messages[i + 1] && messagesType[messages[i + 1].uuid] == 'normal') ?? false"
|
||||
:last="i == messages.length - 1" :message-id="message.uuid" :author="message.member" :me="me"
|
||||
<Message v-for="(message, i) of messages" :key="message.uuid"
|
||||
:message="message" :is-reply="message.reply_to"
|
||||
:author-color="`${generateIrcColor(message.member.user.uuid)}`"
|
||||
:reply-message="message.reply_to ? getReplyMessage(message.reply_to) : undefined" />
|
||||
:reply-message="message.reply_to ? getReplyMessage(message.reply_to) : undefined"
|
||||
:type="messagesType[message.uuid]"
|
||||
:editing="false"
|
||||
:is-mentioned="false" />
|
||||
</div>
|
||||
<div id="message-box" class="rounded-corners">
|
||||
<form id="message-form" @submit="sendMessage">
|
||||
|
@ -320,8 +318,6 @@ router.beforeEach((to, from, next) => {
|
|||
#message-area {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 1dvw;
|
||||
padding-right: 1dvw;
|
||||
overflow: hidden;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
@ -329,8 +325,8 @@ router.beforeEach((to, from, next) => {
|
|||
#message-box {
|
||||
margin-top: auto; /* force it to the bottom of the screen */
|
||||
margin-bottom: 2dvh;
|
||||
margin-left: 1dvw;
|
||||
margin-right: 1dvw;
|
||||
margin-left: 2dvw;
|
||||
margin-right: 2dvw;
|
||||
|
||||
padding-left: 2%;
|
||||
padding-right: 2%;
|
||||
|
@ -382,8 +378,7 @@ router.beforeEach((to, from, next) => {
|
|||
overflow-y: scroll;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 1dvw;
|
||||
padding-right: 1dvw;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.message-box-button {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<template>
|
||||
<div class="media-container">
|
||||
<NuxtImg v-for="link of props.links" class="media-item" :src="link" @click.prevent="createModal(link)" />
|
||||
<NuxtImg v-for="link of props.links"
|
||||
class="media-item"
|
||||
:src="link"
|
||||
@click.prevent="createModal(link)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -8,7 +11,6 @@
|
|||
import { ModalBase } from '#components';
|
||||
import { render } from 'vue';
|
||||
|
||||
|
||||
const props = defineProps<{ links: string[] }>();
|
||||
|
||||
function createModal(link: string) {
|
||||
|
@ -34,14 +36,14 @@ function createModal(link: string) {
|
|||
<style scoped>
|
||||
|
||||
.media-container {
|
||||
grid-column: 2;
|
||||
grid-row: 3;
|
||||
margin-left: .5dvw;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: .2rem;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.media-item {
|
||||
cursor: pointer;
|
||||
max-width: 15dvw;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -40,7 +40,8 @@ function copyInvite(type: "link" | "code") {
|
|||
if (!invite.value) return;
|
||||
|
||||
if (type == "link") {
|
||||
const inviteUrl = URL.parse(`invite/${invite.value}`, `${window.location.protocol}//${window.location.host}`);
|
||||
const runtimeConfig = useRuntimeConfig();
|
||||
const inviteUrl = URL.parse(`invite/${invite.value}`, `${window.location.protocol}//${window.location.host}${runtimeConfig.app.baseURL}`);
|
||||
if (inviteUrl) {
|
||||
navigator.clipboard.writeText(inviteUrl.href);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
<span class="theme-title" :style="{color:`${layout.complementaryColor}`}">
|
||||
{{ layout.displayName }}
|
||||
</span>
|
||||
<NuxtImg class="layout-preview" :src="layout.previewImageUrl"></NuxtImg>
|
||||
<!-- this breaks if it's a nuxtimg, i don't know why -->
|
||||
<img class="layout-preview" :src="layout.previewImageUrl"></img>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -60,8 +61,8 @@ import { settingSave, settingsLoad } from '#imports';
|
|||
|
||||
const runtimeConfig = useRuntimeConfig()
|
||||
const baseURL = runtimeConfig.app.baseURL;
|
||||
const styleFolder = `${baseURL}themes/style`
|
||||
const layoutFolder = `${baseURL}themes/layout`
|
||||
const styleFolder = `${baseURL}/themes/style`
|
||||
const layoutFolder = `${baseURL}/themes/layout`
|
||||
|
||||
const timeFormatTextStrings = ["Auto", "12-Hour", "24-Hour"]
|
||||
|
||||
|
@ -115,6 +116,7 @@ async function parseTheme(url: string): Promise<Theme | void> {
|
|||
break
|
||||
case "previewImageUrl":
|
||||
previewImageUrl = `${layoutFolder}/${lineArray[1].trim()}`
|
||||
console.log(previewImageUrl)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ complementaryColor = white
|
|||
--sidebar-icon-gap: .25em;
|
||||
--sidebar-margin: .5em;
|
||||
|
||||
--minor-radius: .35em;
|
||||
--standard-radius: .5em;
|
||||
--button-radius: .6em;
|
||||
--guild-icon-radius: 15%;
|
||||
|
|
|
@ -10,15 +10,15 @@ complementaryColor = white
|
|||
--reply-text-color: #969696;
|
||||
--danger-text-color: #ff0000;
|
||||
|
||||
--chat-background-color: #2f2e2d;
|
||||
--chat-highlighted-background-color: #3f3b38;
|
||||
--chat-background-color: #383432;
|
||||
--chat-highlighted-background-color: #4c4a48;
|
||||
--chat-important-background-color: #ffcf5f38;
|
||||
--chat-important-highlighted-background-color: #ffa86f4f;
|
||||
--chat-featured-message-color: #4f3f2f60;
|
||||
--popup-background-color: #2f2828;
|
||||
--popup-highlighted-background-color: #382f2f;
|
||||
|
||||
--sidebar-background-color: #3e3a37;
|
||||
--sidebar-background-color: #322f2d;
|
||||
--sidebar-highlighted-background-color: #46423b;
|
||||
--topbar-background-color: #3a3733;
|
||||
--chatbox-background-color: #3a3733;
|
||||
|
|
|
@ -10,16 +10,16 @@ complementaryColor = white
|
|||
--reply-text-color: #969696;
|
||||
--danger-text-color: #ff0000;
|
||||
|
||||
--chat-background-color: #1f1e1d;
|
||||
--chat-highlighted-background-color: #2f2b28;
|
||||
--chat-background-color: #282624;
|
||||
--chat-highlighted-background-color: #383430;
|
||||
--chat-important-background-color: #ffc44f2f;
|
||||
--chat-important-highlighted-background-color: #ffa45f4a;
|
||||
--chat-featured-message-color: #4f2f1f58;
|
||||
--popup-background-color: #2f1f1f;
|
||||
--popup-highlighted-background-color: #3f2f2f;
|
||||
|
||||
--sidebar-background-color: #2e2a27;
|
||||
--sidebar-highlighted-background-color: #36322b;
|
||||
--sidebar-background-color: #1f1e1d;
|
||||
--sidebar-highlighted-background-color: #2f2b28;
|
||||
--topbar-background-color: #2a2723;
|
||||
--chatbox-background-color: #1a1713;
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@ complementaryColor = black
|
|||
--reply-text-color: #969696;
|
||||
--danger-text-color: #ff0000;
|
||||
|
||||
--chat-background-color: #f0ebe8;
|
||||
--chat-highlighted-background-color: #e8e4e0;
|
||||
--chat-background-color: #f0edeb;
|
||||
--chat-highlighted-background-color: #aba8a4;
|
||||
--chat-important-background-color: #df5f0b26;
|
||||
--chat-important-hightlighted-background-color: #df5f0b3d;
|
||||
--chat-featured-message-color: #e8ac841f;
|
||||
--popup-background-color: #e8e4e0;
|
||||
--popup-highlighted-background-color: #dfdbd6;
|
||||
--popup-background-color: #b8b4b0;
|
||||
--popup-highlighted-background-color: #a6a4a2;
|
||||
|
||||
--sidebar-background-color: #dbd8d4;
|
||||
--sidebar-highlighted-background-color: #d4d0ca;
|
||||
|
|
|
@ -1,21 +1,9 @@
|
|||
import type { GuildMemberResponse, MessageResponse, UserResponse } from "./interfaces";
|
||||
import type { MessageResponse, UserResponse } from "./interfaces";
|
||||
|
||||
export interface MessageProps {
|
||||
class?: string,
|
||||
img?: string | null,
|
||||
author: GuildMemberResponse
|
||||
text: string,
|
||||
timestamp: number,
|
||||
format: "12" | "24",
|
||||
type: "normal" | "grouped",
|
||||
marginBottom: boolean,
|
||||
authorColor: string,
|
||||
last: boolean,
|
||||
messageId: string,
|
||||
replyingTo?: boolean,
|
||||
editing?: boolean,
|
||||
me: UserResponse
|
||||
message: MessageResponse,
|
||||
replyMessage?: MessageResponse
|
||||
replyMessage?: MessageResponse,
|
||||
type: "normal" | "grouped",
|
||||
editing?: boolean,
|
||||
isMentioned?: boolean,
|
||||
}
|
|
@ -9,7 +9,7 @@ export default (element: HTMLDivElement, props: MessageProps) => {
|
|||
const messageBox = document.getElementById("message-box") as HTMLDivElement;
|
||||
if (messageBox) {
|
||||
const div = document.createElement("div");
|
||||
const messageReply = h(MessageReply, { author: getDisplayName(props.author), text: props.text || "", id: props.message.uuid, replyId: props.replyMessage?.uuid || element.dataset.messageId!, maxWidth: "full" });
|
||||
const messageReply = h(MessageReply, { author: getDisplayName(props.message.member), text: props.message.message || "", id: props.message.uuid, replyId: props.replyMessage?.uuid || element.dataset.messageId!, maxWidth: "full" });
|
||||
messageBox.prepend(div);
|
||||
render(messageReply, div);
|
||||
const message = document.querySelector(`.message[data-message-id='${props.message.uuid}']`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue