mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-23 08:39:24 -05:00
fix(unreadBadgeCount, bannersEverywhere): some fixes (#157)
Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
parent
21e1a960b1
commit
bdd113c47b
2 changed files with 18 additions and 4 deletions
|
@ -1,11 +1,17 @@
|
||||||
/* stylelint-disable property-no-vendor-prefix */
|
/* stylelint-disable property-no-vendor-prefix */
|
||||||
.vc-banners-everywhere-memberlist {
|
.vc-banners-everywhere-memberlist {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
-webkit-mask-image: linear-gradient(to right, transparent 20%, #fff);
|
-webkit-mask-image: linear-gradient(to right, transparent 20%, #fff);
|
||||||
mask-image: linear-gradient(to right, transparent 20%, #fff);
|
mask-image: linear-gradient(to right, transparent 20%, #fff);
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vc-banners-everywhere-memberlist ~ div {
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
|
@ -18,12 +18,13 @@ import { JSX } from "react";
|
||||||
const UserGuildSettingsStore = findStoreLazy("UserGuildSettingsStore");
|
const UserGuildSettingsStore = findStoreLazy("UserGuildSettingsStore");
|
||||||
const JoinedThreadsStore = findStoreLazy("JoinedThreadsStore");
|
const JoinedThreadsStore = findStoreLazy("JoinedThreadsStore");
|
||||||
|
|
||||||
function NumberBadge({ className, count, width }) {
|
function NumberBadge({ className, count, width, padding }) {
|
||||||
// To whoever used svgs here,
|
// To whoever used svgs here,
|
||||||
// Please. svgs bad and buggy unless used as an icon
|
// Please. svgs bad and buggy unless used as an icon
|
||||||
|
// + The css values are directly copied from discord's ping badge
|
||||||
return <div
|
return <div
|
||||||
className={className}
|
className={className}
|
||||||
style={{ width: width }}
|
style={{ minWidth: width, paddingLeft: padding, paddingRight: padding }}
|
||||||
>
|
>
|
||||||
{count}
|
{count}
|
||||||
</div>;
|
</div>;
|
||||||
|
@ -99,6 +100,12 @@ export default definePlugin({
|
||||||
|
|
||||||
// Im not sure if the "dot" ever appends, hence why the css is almost left unmodified for these classes
|
// Im not sure if the "dot" ever appends, hence why the css is almost left unmodified for these classes
|
||||||
const className = `vc-unreadCountBadge${whiteDot ? "-dot" : ""}${channel.threadMetadata ? "-thread" : ""}`;
|
const className = `vc-unreadCountBadge${whiteDot ? "-dot" : ""}${channel.threadMetadata ? "-thread" : ""}`;
|
||||||
|
|
||||||
|
let paddingValue: Number = 0;
|
||||||
|
if (unreadCount >= 100) { paddingValue = 4; } else
|
||||||
|
if (unreadCount >= 10) { paddingValue = 2; } else
|
||||||
|
paddingValue = 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NumberBadge
|
<NumberBadge
|
||||||
className={"vc-unreadCountBadge " + className}
|
className={"vc-unreadCountBadge " + className}
|
||||||
|
@ -108,8 +115,9 @@ export default definePlugin({
|
||||||
: unreadCount
|
: unreadCount
|
||||||
}
|
}
|
||||||
width={
|
width={
|
||||||
unreadCount > 10 ? 22 : 16
|
unreadCount >= 10 ? 22 : 16
|
||||||
}
|
}
|
||||||
|
padding={paddingValue}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}, { noop: true }),
|
}, { noop: true }),
|
||||||
|
|
Loading…
Add table
Reference in a new issue