Skip to content

Commit

Permalink
v0.5.7 - Improvements and Fixes (#230)
Browse files Browse the repository at this point in the history
* feat: add biome configuration and improve Lockscreen component logic

* fix: update ChannelItemUtils key check and improve warning message for missing components

* chore: bump version to 0.5.7 and update changelog with improvements and fixes
  • Loading branch information
JustOptimize authored Feb 2, 2025
1 parent 434c259 commit 00f5d6b
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 189 deletions.
190 changes: 64 additions & 126 deletions ShowHiddenChannels.plugin.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files": {
"ignore": [
"ShowHiddenChannels.plugin.js"
]
}
}
13 changes: 7 additions & 6 deletions src/components/Lockscreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ export const Lockscreen = React.memo(({ chat, channel, settings }) => {
>
<div className="shc-hidden-notice">
<img
alt='Hidden Channel Icon'
style={{
WebkitUserDrag: 'none',
maxHeight: 128,
margin: '0 auto',
}}
src={
settings['hiddenChannelIcon'] == 'eye'
settings.hiddenChannelIcon === 'eye'
? 'https://raw.githubusercontent.com/JustOptimize/ShowHiddenChannels/main/assets/eye.png'
: '/assets/755d4654e19c105c3cd108610b78d01c.svg'
}
Expand All @@ -59,11 +60,11 @@ export const Lockscreen = React.memo(({ chat, channel, settings }) => {
marginTop: 8,
}}
>
You cannot see the contents of this channel. {channel.topic && channel.type != 15 && 'However, you may see its topic.'}
You cannot see the contents of this channel. {channel.topic && channel.type !== 15 && 'However, you may see its topic.'}
</TextElement>
{/* Topic */}
{channel.topic &&
channel.type != 15 &&
channel.type !== 15 &&
(ChannelUtils?.renderTopic(channel, guild) || "ChannelUtils module is missing, topic won't be shown.")}

{/* Icon Emoji */}
Expand All @@ -82,7 +83,7 @@ export const Lockscreen = React.memo(({ chat, channel, settings }) => {
{/* Slowmode */}
{channel.rateLimitPerUser > 0 && (
<TextElement color={TextElement.Colors.INTERACTIVE_NORMAL} size={TextElement.Sizes.SIZE_14}>
Slowmode: {convertToHMS(channel.rateLimitPerUser)}
Slowmode: {convertToHMS(Number(channel.rateLimitPerUser))}
</TextElement>
)}

Expand All @@ -94,7 +95,7 @@ export const Lockscreen = React.memo(({ chat, channel, settings }) => {
)}

{/* Bitrate */}
{channel.bitrate && channel.type == 2 && (
{channel.bitrate && channel.type === 2 && (
<TextElement color={TextElement.Colors.INTERACTIVE_NORMAL} size={TextElement.Sizes.SIZE_14}>
Bitrate: {channel.bitrate / 1000}kbps
</TextElement>
Expand All @@ -119,7 +120,7 @@ export const Lockscreen = React.memo(({ chat, channel, settings }) => {
)}

{/* Permissions */}
{settings['showPerms'] && channel.permissionOverwrites && (
{settings.showPerms && channel.permissionOverwrites && (
<div
style={{
margin: '16px auto 0 auto',
Expand Down
2 changes: 1 addition & 1 deletion src/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ShowHiddenChannels",
"displayName": "Show Hidden Channels (SHC)",
"version": "0.5.6",
"version": "0.5.7",
"author": "JustOptimize (Oggetto)",
"authorId": "619203349954166804",
"source": "https://github.com/JustOptimize/ShowHiddenChannels",
Expand Down
107 changes: 54 additions & 53 deletions src/index.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/utils/date.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const { Logger, LocaleManager } = require('./modules').ModuleStore;

export function convertToHMS(timeInSeconds) {
timeInSeconds = Number(timeInSeconds);

const hours = Math.floor(timeInSeconds / 3600);
const minutes = Math.floor((timeInSeconds % 3600) / 60);
const seconds = Math.floor((timeInSeconds % 3600) % 60);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const ChannelItemUtils = WebpackModules?.getModule(
);

const ChannelItemUtilsKey = Object.keys(ChannelItemUtils || {}).find((k) => {
return ChannelItemUtils[k]?.toString()?.includes('.AnnouncementsWarningIcon');
return ChannelItemUtils[k]?.toString()?.includes(',textFocused:');
});

const RolePill = WebpackModules?.getModule(
Expand Down

0 comments on commit 00f5d6b

Please sign in to comment.