Compare commits

...

3 commits

Author SHA1 Message Date
3b2136789e
style: set danger context menu items to use danger-text-color CSS variable
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
2025-08-03 20:29:39 +02:00
74f74083a6
feat: add danger text color to themes 2025-08-03 20:29:01 +02:00
7f98992839
feat: add type property to ContextMenu and set delete message item to danger 2025-08-03 20:28:14 +02:00
7 changed files with 15 additions and 4 deletions

View file

@ -146,18 +146,18 @@ console.log("media links:", mediaLinks);
//} //}
const menuItems: ContextMenuItem[] = [ const menuItems: ContextMenuItem[] = [
{ name: "Reply", icon: "lucide:reply", callback: () => { if (messageElement.value) replyToMessage(messageElement.value, props) } } { name: "Reply", icon: "lucide:reply", type: "normal", callback: () => { if (messageElement.value) replyToMessage(messageElement.value, props) } }
] ]
console.log("me:", props.me); console.log("me:", props.me);
if (props.author?.uuid == props.me.uuid) { if (props.author?.uuid == props.me.uuid) {
// Inserts "edit" option at index 1 (below the "reply" option) // Inserts "edit" option at index 1 (below the "reply" option)
menuItems.splice(1, 0, { name: "Edit (WIP)", icon: "lucide:square-pen", callback: () => { /* if (messageElement.value) editMessage(messageElement.value, props) */ } }); menuItems.splice(1, 0, { name: "Edit (WIP)", icon: "lucide:square-pen", type: "normal", callback: () => { /* if (messageElement.value) editMessage(messageElement.value, props) */ } });
} }
if (props.author?.uuid == props.me.uuid /* || check message delete permission*/) { if (props.author?.uuid == props.me.uuid /* || check message delete permission*/) {
// Inserts "edit" option at index 2 (below the "edit" option) // Inserts "edit" option at index 2 (below the "edit" option)
menuItems.splice(2, 0, { name: "Delete (WIP)", icon: "lucide:trash", callback: () => {} }); menuItems.splice(2, 0, { name: "Delete (WIP)", icon: "lucide:trash", type: "danger", callback: () => {} });
} }
function getDayDifference(date1: Date, date2: Date) { function getDayDifference(date1: Date, date2: Date) {

View file

@ -1,6 +1,8 @@
<template> <template>
<div id="context-menu"> <div id="context-menu">
<button v-for="item of props.menuItems" class="context-menu-item" @click="runCallback(item)"> <button v-for="item of props.menuItems" class="context-menu-item"
:class="'context-menu-item-' + item.type"
@click="runCallback(item)">
{{ item.name }} <Icon v-if="item.icon" :name="item.icon" /> {{ item.name }} <Icon v-if="item.icon" :name="item.icon" />
</button> </button>
</div> </div>
@ -59,4 +61,8 @@ function runCallback(item: ContextMenuItem) {
background-color: rgb(50, 50, 50); background-color: rgb(50, 50, 50);
} }
.context-menu-item-danger {
color: var(--danger-text-color);
}
</style> </style>

View file

@ -2,6 +2,7 @@
--text-color: #f0e5e0; --text-color: #f0e5e0;
--secondary-text-color: #e8e0db; --secondary-text-color: #e8e0db;
--reply-text-color: #969696; --reply-text-color: #969696;
--danger-text-color: #ff0000;
--chat-background-color: #2f2e2d; --chat-background-color: #2f2e2d;
--chat-highlighted-background-color: #3f3b38; --chat-highlighted-background-color: #3f3b38;

View file

@ -2,6 +2,7 @@
--text-color: #f7eee8; --text-color: #f7eee8;
--secondary-text-color: #f0e8e4; --secondary-text-color: #f0e8e4;
--reply-text-color: #969696; --reply-text-color: #969696;
--danger-text-color: #ff0000;
--chat-background-color: #1f1e1d; --chat-background-color: #1f1e1d;
--chat-highlighted-background-color: #2f2b28; --chat-highlighted-background-color: #2f2b28;

View file

@ -2,6 +2,7 @@
--text-color: #170f08; --text-color: #170f08;
--secondary-text-color: #2f2b28; --secondary-text-color: #2f2b28;
--reply-text-color: #969696; --reply-text-color: #969696;
--danger-text-color: #ff0000;
--chat-background-color: #f0ebe8; --chat-background-color: #f0ebe8;
--chat-highlighted-background-color: #e8e4e0; --chat-highlighted-background-color: #e8e4e0;

View file

@ -2,6 +2,7 @@
--text-color: #161518; --text-color: #161518;
--secondary-text-color: #2b2930; --secondary-text-color: #2b2930;
--reply-text-color: #969696; --reply-text-color: #969696;
--danger-text-color: #ff0000;
--chat-background-color: #80808000; --chat-background-color: #80808000;
--chat-highlighted-background-color: #ffffff20; --chat-highlighted-background-color: #ffffff20;

View file

@ -102,6 +102,7 @@ export interface ModalProps {
export interface ContextMenuItem { export interface ContextMenuItem {
name: string, name: string,
icon?: string, icon?: string,
type: "normal" | "danger"
callback: (...args: any[]) => any; callback: (...args: any[]) => any;
} }