tqff
All checks were successful
Deploy XIP / deploy (push) Successful in 45s

This commit is contained in:
arussac
2026-05-31 15:42:13 +02:00
parent d50f06d65a
commit 0c08e2080f
3 changed files with 35 additions and 10 deletions

View File

@@ -40,18 +40,33 @@ const btnStyle = computed(() => {
}); });
function onRightClick(e: MouseEvent): void { function onRightClick(e: MouseEvent): void {
if (!myPerks.value.elementSkin) return; const skins = myPerks.value.sendSkins ?? [];
const items: import('@/composables/useContextMenu').ContextMenuItem[] = [
...Object.entries(SEND_BUTTON_PRESETS).map(([k, v]) => ({
value: k,
label: v.label,
swatch: v.color,
checked: prefs.sendButton === k,
})),
];
if (skins.length > 0) {
items.push({ value: '__skin_header__', label: 'Skin', isHeader: true });
items.push({ value: '__default_skin__', label: 'Défaut', emoji: '', checked: prefs.sendSkin === '' });
for (const s of skins) {
items.push({ value: s.id, label: s.label ?? s.id.replace('send-skin-', ''), emoji: s.char, checked: prefs.sendSkin === s.id });
}
}
openContextMenu({ openContextMenu({
x: e.clientX, x: e.clientX,
y: e.clientY, y: e.clientY,
title: 'Bouton d\'envoi', title: 'Bouton d\'envoi',
items: Object.entries(SEND_BUTTON_PRESETS).map(([k, v]) => ({ items,
value: k, current: '',
label: v.label, onSelect: (v) => {
swatch: v.color, if (v === '__default_skin__') { prefs.sendSkin = ''; }
})), else if (v.startsWith('send-skin-')) { prefs.sendSkin = v; }
current: prefs.sendButton, else { prefs.sendButton = v as typeof prefs.sendButton; }
onSelect: (v) => { prefs.sendButton = v as typeof prefs.sendButton; }, },
}); });
} }
</script> </script>

View File

@@ -14,10 +14,11 @@
<button <button
v-else v-else
class="ctx-item" class="ctx-item"
:class="{ 'ctx-item--active': item.value === state.current }" :class="{ 'ctx-item--active': item.checked || item.value === state.current }"
@click="pick(item.value)" @click="pick(item.value)"
> >
<span v-if="item.swatch" class="ctx-swatch" :style="{ background: item.swatch }" /> <span v-if="item.emoji" class="ctx-emoji">{{ item.emoji }}</span>
<span v-else-if="item.swatch" class="ctx-swatch" :style="{ background: item.swatch }" />
{{ item.label }} {{ item.label }}
</button> </button>
</template> </template>
@@ -127,4 +128,11 @@ onUnmounted(() => {
flex-shrink: 0; flex-shrink: 0;
border: 1px solid #ffffff22; border: 1px solid #ffffff22;
} }
.ctx-emoji {
font-size: 14px;
line-height: 1;
width: 16px;
text-align: center;
flex-shrink: 0;
}
</style> </style>

View File

@@ -9,7 +9,9 @@ export interface ContextMenuItem {
value: string; value: string;
label: string; label: string;
swatch?: string; // optional color swatch dot swatch?: string; // optional color swatch dot
emoji?: string; // optional emoji shown instead of swatch
isHeader?: boolean; // non-interactive section heading isHeader?: boolean; // non-interactive section heading
checked?: boolean; // explicit checkmark (for multi-group menus)
} }
interface MenuState { interface MenuState {