Merge branch 'feat/vendor-tag'

pull/1154/head
NanoAim 2025-09-17 14:05:48 +08:00
commit 23993e1064
3 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_12" data-name="Layer 12" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000">
<defs>
<style>
.cls-1 {
fill: #652d90;
}
.cls-2 {
fill: #ffde17;
}
</style>
</defs>
<g>
<path class="cls-2" d="M500,224.206c0-74.5345-194.9003-17.3066-150.6048,44.2215-44.2955-61.5281-177.3163,91.9861-102.7888,118.6246-74.5275-26.6385-103.4357,174.4223-22.3381,155.3652-81.0976,19.0571,3.285,203.8292,65.2047,142.7784-61.9197,61.0508,108.9628,170.8703,132.0456,84.8605-23.0828,86.0097,180.0456,86.0097,156.9629,0,23.0828,86.0097,193.9653-23.8098,132.0456-84.8605,61.9197,61.0508,146.3023-123.7213,65.2047-142.7784,81.0976,19.0571,52.1894-182.0037-22.3381-155.3652,74.5275-26.6385-58.4933-180.1527-102.7888-118.6246,44.2955-61.5281-150.6048-118.756-150.6048-44.2215Z"/>
<polygon class="cls-1" points="680.2813 428.2256 624.5839 374.5166 447.929 557.7138 379.2446 491.4722 325.5312 547.1663 449.8956 667.1077 453.7317 663.1302 453.7493 663.1472 680.2813 428.2256"/>
</g>
<g>
<path class="cls-2" d="M500,224.206c0-74.5345-194.9003-17.3066-150.6048,44.2215-44.2955-61.5281-177.3163,91.9861-102.7888,118.6246-74.5275-26.6385-103.4357,174.4223-22.3381,155.3652-81.0976,19.0571,3.285,203.8292,65.2047,142.7784-61.9197,61.0508,108.9628,170.8703,132.0456,84.8605-23.0828,86.0097,180.0456,86.0097,156.9629,0,23.0828,86.0097,193.9653-23.8098,132.0456-84.8605,61.9197,61.0508,146.3023-123.7213,65.2047-142.7784,81.0976,19.0571,52.1894-182.0037-22.3381-155.3652,74.5275-26.6385-58.4933-180.1527-102.7888-118.6246,44.2955-61.5281-150.6048-118.756-150.6048-44.2215Z"/>
<polygon class="cls-1" points="680.2813 428.2256 624.5839 374.5166 447.929 557.7138 379.2446 491.4722 325.5312 547.1663 449.8956 667.1077 453.7317 663.1302 453.7493 663.1472 680.2813 428.2256"/>
</g>
<g>
<path class="cls-2" d="M500,224.206c0-74.5345-194.9003-17.3066-150.6048,44.2215-44.2955-61.5281-177.3163,91.9861-102.7888,118.6246-74.5275-26.6385-103.4357,174.4223-22.3381,155.3652-81.0976,19.0571,3.285,203.8292,65.2047,142.7784-61.9197,61.0508,108.9628,170.8703,132.0456,84.8605-23.0828,86.0097,180.0456,86.0097,156.9629,0,23.0828,86.0097,193.9653-23.8098,132.0456-84.8605,61.9197,61.0508,146.3023-123.7213,65.2047-142.7784,81.0976,19.0571,52.1894-182.0037-22.3381-155.3652,74.5275-26.6385-58.4933-180.1527-102.7888-118.6246,44.2955-61.5281-150.6048-118.756-150.6048-44.2215Z"/>
<polygon class="cls-1" points="680.2813 428.2256 624.5839 374.5166 447.929 557.7138 379.2446 491.4722 325.5312 547.1663 449.8956 667.1077 453.7317 663.1302 453.7493 663.1472 680.2813 428.2256"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -192,7 +192,7 @@ const Message = observer(
(content ? content.length > 0 : false)
}
/>
))}
))}
{message.embeds?.map((embed, index) => (
<Embed key={index} embed={embed} />
))}

View File

@ -20,6 +20,14 @@ import UserIcon from "./UserIcon";
// Configuration constant for easy adjustment
const NEW_MEMBER_THRESHOLD_DAYS = 14;
// Vendor badge flags - reusing existing enum values
const TRUSTED_SELLER_BADGE = 8; // ResponsibleDisclosure
const VERIFIED_VENDOR_BADGE = 512; // ReservedRelevantJokeBadge1
const VERIFIED_MANUFACTURER_BADGE = 1024; // ReservedRelevantJokeBadge2
// Combined mask to check for any vendor badge
const VENDOR_BADGES_MASK = TRUSTED_SELLER_BADGE | VERIFIED_VENDOR_BADGE | VERIFIED_MANUFACTURER_BADGE;
const BotBadge = styled.div`
display: inline-block;
flex-shrink: 0;
@ -48,6 +56,13 @@ const NewHereBadge = styled.div`
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
`;
const TrustedSellerBadge = styled.img`
width: 18px;
height: 18px;
flex-shrink: 0;
vertical-align: middle;
`;
const BadgeWrapper = styled.span`
display: flex;
align-items: center;
@ -142,6 +157,9 @@ export const Username = observer(
isNewHere = accountAge <= NEW_MEMBER_THRESHOLD_DAYS;
}
// Check if user has any vendor badge
const hasVendorBadge = user && user.badges && (user.badges & VENDOR_BADGES_MASK);
const el = (
<>
<Name {...otherProps} ref={innerRef} colour={color}>
@ -208,6 +226,18 @@ export const Username = observer(
);
}
// Add vendor badge (for any of the three vendor types)
if (hasVendorBadge) {
return (
<BadgeWrapper>
{el}
<Tooltip content="Verified Vendor">
<TrustedSellerBadge src="/assets/badges/verifiedvendor.svg" />
</Tooltip>
</BadgeWrapper>
);
}
return el;
},
);