Lock voicechanneLog & voiceJoinMessages behind dev

This commit is contained in:
thororen1234 2024-09-16 13:39:07 -04:00
parent 0924537ef5
commit 9cf6bfc0e6
7 changed files with 0 additions and 0 deletions

View file

@ -1,41 +0,0 @@
.vc-voice-channel-log {
list-style-type: none;
height: 50px;
display: grid;
grid-template-columns: 2.25rem 24px 40px max-content;
gap: 4px;
width: 4px;
background-color: var(--background-modifier-active);
}
.vc-voice-channel-log-date-separator,
.vc-voice-channel-log-timestamp {
margin-left: 4px;
height: 48px;
line-height: 48px;
font-size: .75rem;
text-align: center;
display: inline-block;
vertical-align: middle;
color: var(--text-normal, white);
}
.vc-voice-channel-log-avatar {
height: 40px;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
font-weight: 600;
overflow: hidden;
text-align: center;
margin-top: 10px;
padding-left: 10px;
padding-right: 10px
}
.vc-voice-channel-log-icon {
margin: auto 3px;
margin-left: 15px;
}

View file

@ -1,32 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./VoiceChannelLogEntryComponent.css";
import { classes } from "@utils/misc";
import { React, Timestamp, UserStore } from "@webpack/common";
import { Channel } from "discord-types/general";
import { Util } from "Vencord";
import { cl } from "..";
import { VoiceChannelLogEntry } from "../logs";
import Icon from "./VoiceChannelLogEntryIcons";
export function VoiceChannelLogEntryComponent({ logEntry, channel }: { logEntry: VoiceChannelLogEntry; channel: Channel; }) {
const user = UserStore.getUser(logEntry.userId);
return <li className="vc-voice-channel-log">
<Timestamp className={cl("timestamp")} timestamp={new Date(logEntry.timestamp)} compact isInline={false} cozyAlt></Timestamp>
<Icon logEntry={logEntry} channel={channel} className={cl("icon")} />
<img
className={classes(cl("avatar"))}
onClick={() => Util.openUserProfile(logEntry.userId)}
src={user.getAvatarURL(channel.getGuildId())}
/>
<div className={cl("content")}>
{ }
</div>
</li>;
}

View file

@ -1,29 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { classes } from "@utils/misc";
import { React } from "@webpack/common";
import { Channel } from "discord-types/general";
import { cl } from "..";
import { VoiceChannelLogEntry } from "../logs";
export default function Icon({ logEntry, channel, className }: { logEntry: VoiceChannelLogEntry; channel: Channel; className: string; }) {
// Taken from /assets/7378a83d74ce97d83380.svg
const Join = <svg xmlns="http://www.w3.org/2000/svg" height="18" width="18"><g fill="none" fill-rule="evenodd"><path d="m18 0h-18v18h18z" /><path d="m0 8h14.2l-3.6-3.6 1.4-1.4 6 6-6 6-1.4-1.4 3.6-3.6h-14.2" fill="#3ba55c" /></g></svg>;
// Taken from /assets/192510ade1abc3149b46.svg
const Leave = <svg xmlns="http://www.w3.org/2000/svg" height="18" width="18" ><g fill="none" fill-rule="evenodd"><path d="m18 0h-18v18h18z" /><path d="m3.8 8 3.6-3.6-1.4-1.4-6 6 6 6 1.4-1.4-3.6-3.6h14.2v-2" fill="#ed4245" /></g></svg>;
// For other contributors, please DO make specific designs for these instead of how I just copied the join/leave icons and making them orange
const MovedTo = <svg xmlns="http://www.w3.org/2000/svg" height="18" width="18"><g fill="none" fill-rule="evenodd"><path d="m18 0h-18v18h18z" /><path d="m3.8 8 3.6-3.6-1.4-1.4-6 6 6 6 1.4-1.4-3.6-3.6h14.2v-2" fill="#faa61a" /></g></svg>;
const MovedFrom = <svg xmlns="http://www.w3.org/2000/svg" height="18" width="18"><g fill="none" fill-rule="evenodd"><path d="m18 0h-18v18h18z" /><path d="m0 8h14.2l-3.6-3.6 1.4-1.4 6 6-6 6-1.4-1.4 3.6-3.6h-14.2" fill="#faa61a" /></g></svg>;
if (logEntry.newChannel && !logEntry.oldChannel) return React.cloneElement(Join, { className: classes(className, cl("join")) });
if (!logEntry.newChannel && logEntry.oldChannel) return React.cloneElement(Leave, { className: classes(className, cl("leave")) });
if (logEntry.newChannel === channel.id && logEntry.oldChannel) return React.cloneElement(MovedFrom, { className: classes(className, cl("moved-from")) });
if (logEntry.newChannel && logEntry.oldChannel === channel.id) return React.cloneElement(MovedTo, { className: classes(className, cl("moved-to")) });
// we should never get here, this is just here to shut up the type checker
return <svg></svg>;
}

View file

@ -1,67 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { classes } from "@utils/misc";
import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { findStoreLazy } from "@webpack";
import { React, ScrollerThin, Text } from "@webpack/common";
import { Channel } from "discord-types/general";
import { cl } from "..";
import { getVcLogs, vcLogSubscribe } from "../logs";
import { VoiceChannelLogEntryComponent } from "./VoiceChannelLogEntryComponent";
const AccessibilityStore = findStoreLazy("AccessibilityStore");
export function openVoiceChannelLog(channel: Channel) {
return openModal(props => (
<VoiceChannelLogModal
props={props}
channel={channel}
/>
));
}
export function VoiceChannelLogModal({ channel, props }: { channel: Channel; props: ModalProps; }) {
React.useSyncExternalStore(vcLogSubscribe, () => getVcLogs(channel.id));
const vcLogs = getVcLogs(channel.id);
const logElements: (React.ReactNode)[] = [];
if (vcLogs.length > 0) {
for (let i = 0; i < vcLogs.length; i++) {
const logEntry = vcLogs[i];
if (i === 0 || logEntry.timestamp.toDateString() !== vcLogs[i - 1].timestamp.toDateString()) {
logElements.push(<div className={classes(cl("date-separator"))} role="separator" aria-label={logEntry.timestamp.toDateString()}>
<span>
{logEntry.timestamp.toDateString()}
</span>
</div>);
} else {
logElements.push(<VoiceChannelLogEntryComponent logEntry={logEntry} channel={channel} />);
}
}
} else {
logElements.push(<div className={cl("empty")}>No logs to display.</div>);
}
return (
<ModalRoot
{...props}
size={ModalSize.LARGE}
>
<ModalHeader>
<Text className={cl("header")} variant="heading-lg/semibold" style={{ flexGrow: 1 }}>{channel.name} logs</Text>
<ModalCloseButton onClick={props.onClose} />
</ModalHeader>
<ModalContent>
<ScrollerThin fade className={classes(cl("scroller"), `group-spacing-${AccessibilityStore.messageGroupSpacing}`)}>
{logElements}
</ScrollerThin>
</ModalContent>
</ModalRoot >
);
}