From 7c25245e6f251de45ec0a8c3c836e4774617781d Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sat, 1 Aug 2026 01:25:57 +0200 Subject: [PATCH] Refactor message icon component: separate margin utilities from icon styling to fix badge positioning issues. --- web/components/messaging/messages-icon.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/components/messaging/messages-icon.tsx b/web/components/messaging/messages-icon.tsx index 21b55f16..fcf96e22 100644 --- a/web/components/messaging/messages-icon.tsx +++ b/web/components/messaging/messages-icon.tsx @@ -45,11 +45,16 @@ export function PrivateMessagesIcon(props: { const {solid, className, bubbleClassName} = props const privateUser = usePrivateUser() const Icon = solid ? BiSolidEnvelope : BiEnvelope + // Margin utilities (`mx-auto`, `my-1`, ...) belong on the wrapper, everything else (size, color) + // stays on the icon. Otherwise the wrapper stretches to the full width of its parent — e.g. the + // bottom-nav item — and the badge anchors to that far edge instead of the envelope's corner. + const classes = (className ?? '').split(/\s+/).filter(Boolean) + const isMargin = (c: string) => /^-?m[xytrbl]?-/.test(c) return ( // Sized to the icon itself so the count badge can anchor to its top-right corner instead of // being centered on top of the envelope. - - + + !isMargin(c)))} /> {privateUser && (