mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 15:35:11 +00:00
fixes
This commit is contained in:
parent
1b145a5695
commit
9b64d9b033
3 changed files with 16 additions and 21 deletions
|
@ -58,15 +58,17 @@ function LocalTimestampInner(props: LocalTimestampProps): JSX.Element | null {
|
||||||
|
|
||||||
const longTime = formatTimestamp(timezone, timestamp, true);
|
const longTime = formatTimestamp(timezone, timestamp, true);
|
||||||
const shortTime = formatTimestamp(timezone, timestamp, false);
|
const shortTime = formatTimestamp(timezone, timestamp, false);
|
||||||
|
|
||||||
|
if (props.type === "message" && !shortTime)
|
||||||
|
return null;
|
||||||
|
|
||||||
const shortTimeFormatted = props.type === "message"
|
const shortTimeFormatted = props.type === "message"
|
||||||
? `• ${shortTime}`
|
? `• ${shortTime}`
|
||||||
: shortTime;
|
: shortTime ?? "Error";
|
||||||
|
|
||||||
const classes = props.type === "message"
|
const classes = props.type === "message"
|
||||||
? `timezone-message-item ${messageClasses.timestamp}`
|
? `timezone-message-item ${messageClasses.timestamp}`
|
||||||
: "timezone-profile-item";
|
: "timezone-profile-item";
|
||||||
|
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
position="top"
|
position="top"
|
||||||
|
@ -76,6 +78,7 @@ function LocalTimestampInner(props: LocalTimestampProps): JSX.Element | null {
|
||||||
spacing={8}
|
spacing={8}
|
||||||
hideOnClick={true}
|
hideOnClick={true}
|
||||||
tooltipClassName="timezone-tooltip"
|
tooltipClassName="timezone-tooltip"
|
||||||
|
hide={!longTime}
|
||||||
text={longTime}
|
text={longTime}
|
||||||
>
|
>
|
||||||
{toolTipProps => <>
|
{toolTipProps => <>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
import { UserStore } from "@webpack/common";
|
||||||
import { Message, User } from "discord-types/general";
|
import { Message, User } from "discord-types/general";
|
||||||
|
|
||||||
import { LocalTimestamp } from "./components";
|
import { LocalTimestamp } from "./components";
|
||||||
|
@ -30,23 +31,6 @@ export default definePlugin({
|
||||||
],
|
],
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
// {
|
|
||||||
// find: "copyMetaData:\"User Tag\"",
|
|
||||||
// replacement: {
|
|
||||||
// match: /return(\(0.+?}\)}\)]}\))}/,
|
|
||||||
// replace: "return [$1, $self.getProfileTimezonesComponent(arguments[0])] }",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// // TODO: fix this
|
|
||||||
// // thank you https://github.com/Syncxv/vc-timezones/blob/master/index.tsx for saving me from painful work
|
|
||||||
// find: ".badgesContainer,{",
|
|
||||||
// replacement: {
|
|
||||||
// match: /id:\(0,\i\.getMessageTimestampId\)\(\i\),timestamp.{1,50}}\),/,
|
|
||||||
// replace: "$&,$self.getTimezonesComponent(arguments[0]),",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
|
|
||||||
// Based on Syncxv's vc-timezones user plugin //
|
// Based on Syncxv's vc-timezones user plugin //
|
||||||
...[".NITRO_BANNER,", "=!1,canUsePremiumCustomization:"].map(find => ({
|
...[".NITRO_BANNER,", "=!1,canUsePremiumCustomization:"].map(find => ({
|
||||||
find,
|
find,
|
||||||
|
@ -76,6 +60,7 @@ export default definePlugin({
|
||||||
|
|
||||||
renderMessageTimezone: (props?: { message?: Message; }) => {
|
renderMessageTimezone: (props?: { message?: Message; }) => {
|
||||||
if (!settings.store.displayInChat || !props?.message) return null;
|
if (!settings.store.displayInChat || !props?.message) return null;
|
||||||
|
if (UserStore.getCurrentUser().id === props?.message?.id) return null;
|
||||||
|
|
||||||
return <LocalTimestamp
|
return <LocalTimestamp
|
||||||
userId={props.message.author.id}
|
userId={props.message.author.id}
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
/** Based on Syncxv's vc-timezones user plugin **/
|
/** Based on Syncxv's vc-timezones user plugin **/
|
||||||
|
|
||||||
.timezone-profile-item {
|
.timezone-profile-item {
|
||||||
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin: 28px 16px 4px;
|
margin: 28px 14px 10px;
|
||||||
background: var(--profile-body-background-color, var(--background-primary));
|
background: var(--profile-body-background-color, var(--background-primary));
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 0.25rem 0.5rem;
|
padding: 0.25rem 0.5rem;
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
color: var(--text-normal);
|
color: var(--text-normal);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
filter: brightness(130%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[class*="topSection"] .timezone-profile-item {
|
[class*="topSection"] .timezone-profile-item {
|
||||||
|
|
Loading…
Add table
Reference in a new issue