MessagePeek: Fix Naming
This commit is contained in:
parent
0ed343ab98
commit
a686d6bde4
3 changed files with 15 additions and 9 deletions
|
|
@ -16,7 +16,7 @@ import { classes } from "@utils/misc";
|
|||
import definePlugin from "@utils/types";
|
||||
import { Activity, ApplicationStream, Channel, Message, OnlineStatus, User } from "@vencord/discord-types";
|
||||
import { MessageFlags } from "@vencord/discord-types/enums";
|
||||
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy, findCssClassesLazy, findExportedComponentLazy } from "@webpack";
|
||||
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy, findCssClassesLazy, findExportedComponentLazy, findLazy } from "@webpack";
|
||||
import { ChannelStore, MessageStore, RelationshipStore, SnowflakeUtils, UserStore, useStateFromStores } from "@webpack/common";
|
||||
|
||||
const cl = classNameFactory("vc-message-peek-");
|
||||
|
|
@ -27,6 +27,7 @@ const MessageActions = findByPropsLazy("fetchMessages", "sendMessage");
|
|||
|
||||
const hasRelevantActivity: (props: ActivityCheckProps) => boolean = findByCodeLazy(".OFFLINE||", ".INVISIBLE)return!1");
|
||||
const ActivityText: React.ComponentType<ActivityTextProps> = findComponentByCodeLazy("hasQuest:", "hideEmoji:");
|
||||
const FavoritesServerExperiment = findLazy(m => m?.definition?.id === "2021-09_favorites_server");
|
||||
|
||||
const ONE_HOUR_MS = 60 * 60 * 1000;
|
||||
|
||||
|
|
@ -163,7 +164,7 @@ function MessagePreviewContent({ channel, user }: { channel: Channel; user: User
|
|||
|
||||
const currentUserId = UserStore.getCurrentUser()?.id;
|
||||
const isOwnMessage = lastMessage.author.id === currentUserId;
|
||||
const authorName = isOwnMessage ? "You" : (smynName ?? RelationshipStore.getNickname(lastMessage.author.id) ?? lastMessage.author.globalName ?? lastMessage.author.username);
|
||||
const authorName = isOwnMessage ? "You" : (smynName || RelationshipStore.getNickname(lastMessage.author.id) || lastMessage.author.globalName || lastMessage.author.username);
|
||||
const Icon = content.icon ? Icons[content.icon] : null;
|
||||
|
||||
return (
|
||||
|
|
@ -211,15 +212,13 @@ function SubText({ channel, user, activities, applicationStream, voiceChannel, s
|
|||
}
|
||||
|
||||
function Timestamp({ channel }: { channel: Channel; }) {
|
||||
const lastMessage = useStateFromStores(
|
||||
[MessageStore],
|
||||
() => MessageStore.getLastMessage(channel.id) as Message | undefined
|
||||
);
|
||||
const lastMessage = useStateFromStores([MessageStore], () => MessageStore.getLastMessage(channel.id) as Message | undefined);
|
||||
|
||||
if (!lastMessage) return null;
|
||||
|
||||
const timestamp = SnowflakeUtils.extractTimestamp(lastMessage.id);
|
||||
return <span className={cl("timestamp")}>{formatRelativeTime(timestamp)}</span>;
|
||||
const className = FavoritesServerExperiment.getCurrentConfig().favoritesEnabled ? cl("timestamp-favorites") : cl("timestamp");
|
||||
return <span className={className}>{formatRelativeTime(timestamp)}</span>;
|
||||
}
|
||||
|
||||
function shouldShowActivity(lastMessage: Message | undefined, hasActivity: boolean): boolean {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,13 @@
|
|||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.vc-message-peek-timestamp-favorites {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
line-height: 16px;
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
[class*="interactiveSelected__"] .vc-message-peek-timestamp {
|
||||
color: var(--white);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import "./style.css";
|
||||
|
||||
import { definePluginSettings, migratePluginSetting, Settings } from "@api/Settings";
|
||||
import { definePluginSettings, migratePluginSetting } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { classes } from "@utils/misc";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
|
|
@ -131,7 +131,7 @@ interface PlatformIndicatorProps {
|
|||
}
|
||||
|
||||
const PlatformIndicator = ({ user, isProfile, isMessage, isMemberList }: PlatformIndicatorProps) => {
|
||||
if (user == null || (user.bot && !Settings.plugins.PlatformIndicators.showBots)) return null;
|
||||
if (user == null || (user.bot && !settings.store.showBots)) return null;
|
||||
useEnsureOwnStatus(user);
|
||||
|
||||
const status = useStateFromStores([PresenceStore], () => PresenceStore.getClientStatus(user.id));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue