mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-25 15:58:31 +00:00
update profile component
This commit is contained in:
parent
b098286197
commit
365ca0ef57
1 changed files with 24 additions and 16 deletions
|
@ -21,9 +21,11 @@ import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption,
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
||||||
import { React, UserStore } from "@webpack/common";
|
import { React, Text, UserStore } from "@webpack/common";
|
||||||
import { Message, User } from "discord-types/general";
|
import { Message, User } from "discord-types/general";
|
||||||
|
const EditIcon = findByCodeLazy("M19.2929 9.8299L19.9409 9.18278C21.353 7.77064 21.353 5.47197 19.9409");
|
||||||
|
const classNames = findByPropsLazy("customStatusSection");
|
||||||
|
|
||||||
import { getTimeString, getUserTimezone } from "./Utils";
|
import { getTimeString, getUserTimezone } from "./Utils";
|
||||||
const styles = findByPropsLazy("timestampInline");
|
const styles = findByPropsLazy("timestampInline");
|
||||||
|
@ -120,10 +122,11 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "().popoutNoBannerPremium",
|
find: "().customStatusSection",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /return(\(0,.\.jsx\)\(.\..,\{.*\}\))/,
|
// Inserts the timezone component right below the custom status.
|
||||||
replace: "return [$1, Vencord.Plugins.plugins.Timezones.getProfileTimezonesComponent(e)]"
|
match: /user:(\w),nickname:\w,.*?children.*?\(\)\.customStatusSection.*?\}\),/,
|
||||||
|
replace: "$&$self.getProfileTimezonesComponent({user:$1}),"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -138,22 +141,27 @@ export default definePlugin({
|
||||||
getUserTimezone(user.id).then(timezone => setTimezone(timezone));
|
getUserTimezone(user.id).then(timezone => setTimezone(timezone));
|
||||||
}, [user.id]);
|
}, [user.id]);
|
||||||
|
|
||||||
if (!Vencord.Settings.plugins.Timezones.showTimezonesInProfile || !timezone) {
|
if (!Vencord.Settings.plugins.Timezones.showTimezonesInProfile) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// thank you arjix very cool
|
||||||
return (
|
return (
|
||||||
<span style={{
|
<Text variant="text-sm/normal" className={classNames.customStatusSection} onClick={() => {
|
||||||
position: "absolute",
|
return console.log("ahhh!");
|
||||||
top: "10px",
|
// TODO create a modal to set timezone and make text clickable h
|
||||||
right: "10px",
|
}} style={{
|
||||||
zIndex: 5,
|
alignItems: "center",
|
||||||
background: "white",
|
// make it clickable
|
||||||
borderRadius: "5px",
|
cursor: "pointer",
|
||||||
border: "4px solid white"
|
|
||||||
}}>
|
}}>
|
||||||
{getTimeString(timezone)}
|
{(timezone) ? getTimeString(timezone) : "Click to set timezone"}
|
||||||
</span>
|
<span
|
||||||
|
style={{ cursor: "pointer", position: "absolute" }}
|
||||||
|
>
|
||||||
|
<EditIcon color="var(--primary-330)" height="16" width="16" style={{ marginLeft: "0.25vw" }} />
|
||||||
|
</span>
|
||||||
|
</Text>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
Loading…
Add table
Reference in a new issue