minor tweak

This commit is contained in:
Angelos Bouklis 2023-04-10 00:27:04 +03:00 committed by GitHub
parent 5a0fb5b734
commit aeff943207
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -16,7 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
const PreloadedUserSettings = findLazy(m => m.ProtoClass?.typeName === "discord_protos.discord_users.v1.PreloadedUserSettings");
import * as DataStore from "@api/DataStore"; import * as DataStore from "@api/DataStore";
import { VENCORD_USER_AGENT } from "@utils/constants"; import { VENCORD_USER_AGENT } from "@utils/constants";
@ -32,6 +31,7 @@ export interface TimezoneDB {
export const API_URL = "https://timezonedb.catvibers.me"; export const API_URL = "https://timezonedb.catvibers.me";
const Cache: Record<string, string> = {}; const Cache: Record<string, string> = {};
const PreloadedUserSettings = findLazy(m => m.ProtoClass?.typeName === "discord_protos.discord_users.v1.PreloadedUserSettings");
export function getTimeString(timezone: string, timestamp = new Date()): string { export function getTimeString(timezone: string, timestamp = new Date()): string {
const locale = PreloadedUserSettings.getCurrentValue().localization.locale.value; const locale = PreloadedUserSettings.getCurrentValue().localization.locale.value;

View file

@ -73,7 +73,7 @@ export default definePlugin({
], ],
getProfileTimezonesComponent: ({ user }: { user: User; }) => { getProfileTimezonesComponent: ({ user }: { user: User; }) => {
const { preference } = settings.use(["preference"]); const { preference, showTimezonesInProfile } = settings.use(["preference", "showTimezonesInProfile"]);
const [timezone, setTimezone] = React.useState<string | undefined>(); const [timezone, setTimezone] = React.useState<string | undefined>();
const [isInEditMode, setIsInEditMode] = React.useState(false); const [isInEditMode, setIsInEditMode] = React.useState(false);
@ -91,7 +91,7 @@ export default definePlugin({
return () => clearInterval(interval); return () => clearInterval(interval);
}, [preference]); }, [preference]);
if (!Vencord.Settings.plugins.Timezones.showTimezonesInProfile) if (!showTimezonesInProfile)
return null; return null;
return ( return (