mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-19 05:43:35 -05:00
Add back ServerSearch & DeadMembers
This commit is contained in:
parent
eea964b7e2
commit
026d39aef2
3 changed files with 159 additions and 0 deletions
62
src/equicordplugins/deadMembers/index.tsx
Normal file
62
src/equicordplugins/deadMembers/index.tsx
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { ChannelStore, GuildMemberStore, useStateFromStores } from "@webpack/common";
|
||||
|
||||
export default definePlugin({
|
||||
name: "DeadMembers",
|
||||
description: "Shows when the sender of a message has left the guild",
|
||||
authors: [Devs.Kyuuhachi],
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: '.BADGES=1]="BADGES"',
|
||||
replacement: {
|
||||
match: /(\i)=\{className:\i.username,style:.*?onContextMenu:\i,children:.*?\};/,
|
||||
replace: "$&$1.children=$self.wrapMessageAuthor(arguments[0],$1.children);"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: "Messages.FORUM_POST_AUTHOR_A11Y_LABEL",
|
||||
replacement: {
|
||||
match: /(?<=\}=(\i),\{(user:\i,author:\i)\}=.{0,400}?\(\i\.Fragment,{children:)\i(?=}\),)/,
|
||||
replace: "$self.wrapForumAuthor({...$1,$2},$&)"
|
||||
}
|
||||
},
|
||||
],
|
||||
|
||||
wrapMessageAuthor({ message }, text) {
|
||||
const channel = ChannelStore.getChannel(message.channel_id);
|
||||
return message.webhookId
|
||||
? text
|
||||
: <DeadIndicator
|
||||
channel={channel}
|
||||
userId={message.author.id}
|
||||
text={text}
|
||||
/>;
|
||||
},
|
||||
|
||||
wrapForumAuthor({ channel, user }, text) {
|
||||
return !user
|
||||
? text
|
||||
: <DeadIndicator
|
||||
channel={channel}
|
||||
userId={user.id}
|
||||
text={text}
|
||||
/>;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
function DeadIndicator({ channel, userId, text }) {
|
||||
const isMember = useStateFromStores(
|
||||
[GuildMemberStore],
|
||||
() => GuildMemberStore.isMember(channel?.guild_id, userId),
|
||||
);
|
||||
return channel?.guild_id && !isMember ? <s className="c98-author-dead">{text}</s> : text;
|
||||
}
|
64
src/equicordplugins/serverSearch/index.tsx
Normal file
64
src/equicordplugins/serverSearch/index.tsx
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2023 Vendicated, camila314, and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import "./styles.css";
|
||||
|
||||
import { addServerListElement, removeServerListElement, ServerListRenderPosition } from "@api/ServerList";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { FluxDispatcher } from "@webpack/common";
|
||||
import { Tooltip } from "webpack/common/components";
|
||||
|
||||
function SearchIcon() {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" id="vc-searchbutton-icon">
|
||||
<path
|
||||
fill="currentColor"
|
||||
fill-rule="evenodd"
|
||||
d="M15.62 17.03a9 9 0 1 1 1.41-1.41l4.68 4.67a1 1 0 0 1-1.421.42l-4.67-4.68ZM17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "ServerSearch",
|
||||
authors: [EquicordDevs.camila314],
|
||||
description: "Navigate your servers better with a quick search button",
|
||||
|
||||
renderButton() {
|
||||
return <ErrorBoundary noop>
|
||||
<div id="vc-searchbutton-container">
|
||||
<Tooltip text="Search" position="right">
|
||||
{({ onMouseEnter, onMouseLeave }) => (
|
||||
<div
|
||||
id="vc-searchbutton"
|
||||
onMouseEnter={onMouseEnter}
|
||||
onMouseLeave={onMouseLeave}
|
||||
onClick={() =>
|
||||
FluxDispatcher.dispatch({
|
||||
type: "QUICKSWITCHER_SHOW",
|
||||
query: "",
|
||||
queryMode: null
|
||||
})
|
||||
}>
|
||||
<SearchIcon />
|
||||
</div>
|
||||
)}
|
||||
</Tooltip>
|
||||
</div>
|
||||
</ErrorBoundary>;
|
||||
},
|
||||
|
||||
start() {
|
||||
addServerListElement(ServerListRenderPosition.Above, this.renderButton);
|
||||
},
|
||||
|
||||
stop() {
|
||||
removeServerListElement(ServerListRenderPosition.Above, this.renderButton);
|
||||
}
|
||||
});
|
33
src/equicordplugins/serverSearch/styles.css
Normal file
33
src/equicordplugins/serverSearch/styles.css
Normal file
|
@ -0,0 +1,33 @@
|
|||
#vc-searchbutton-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
#vc-searchbutton {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--background-primary);
|
||||
height: 48px;
|
||||
width: 48px;
|
||||
border-radius: 100%;
|
||||
transition: border-radius 0.15s ease-out, background-color 0.15s ease-out;
|
||||
}
|
||||
|
||||
#vc-searchbutton-icon {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
#vc-searchbutton:hover {
|
||||
border-radius: 34%;
|
||||
background-color: var(--green-360);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#vc-searchbutton:hover #vc-searchbutton-icon {
|
||||
color: var(--white-500);
|
||||
}
|
Loading…
Reference in a new issue