Fix Some Types
This commit is contained in:
parent
8281e072f5
commit
d00c41e802
9 changed files with 40 additions and 47 deletions
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2025 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { User } from "@vencord/discord-types";
|
||||
import { CSSProperties, ImgHTMLAttributes, JSX } from "react";
|
||||
import { Application } from "./Application";
|
||||
import { User } from "./User";
|
||||
|
||||
export interface Timestamp {
|
||||
export interface ActivityTimestamp {
|
||||
start?: number;
|
||||
end?: number;
|
||||
}
|
||||
|
||||
export interface Developer {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Activity {
|
||||
created_at: number;
|
||||
id: string;
|
||||
|
|
@ -33,35 +33,19 @@ export interface Activity {
|
|||
small_text?: string;
|
||||
small_image?: string;
|
||||
};
|
||||
timestamps?: Timestamp;
|
||||
buttons?: Array<string>;
|
||||
metadata?: {
|
||||
button_urls?: Array<string>;
|
||||
};
|
||||
timestamps?: ActivityTimestamp;
|
||||
platform?: string;
|
||||
}
|
||||
|
||||
export interface Application {
|
||||
id: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
description: string;
|
||||
summary: string;
|
||||
type: number;
|
||||
hook: boolean;
|
||||
guild_id: string;
|
||||
executables: Executable[];
|
||||
verify_key: string;
|
||||
publishers: Developer[];
|
||||
developers: Developer[];
|
||||
flags: number;
|
||||
}
|
||||
|
||||
export interface Developer {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Executable {
|
||||
os: string;
|
||||
name: string;
|
||||
is_launcher: boolean;
|
||||
export interface ActivityViewProps {
|
||||
activity: Activity | null;
|
||||
user: User;
|
||||
application?: Application;
|
||||
currentUser: User;
|
||||
}
|
||||
|
||||
export interface ApplicationIcon {
|
||||
|
|
@ -73,6 +57,12 @@ export interface ApplicationIcon {
|
|||
application?: Application;
|
||||
}
|
||||
|
||||
export interface Executable {
|
||||
os: string;
|
||||
name: string;
|
||||
is_launcher: boolean;
|
||||
}
|
||||
|
||||
export interface ActivityListIcon {
|
||||
iconElement: JSX.Element;
|
||||
tooltip?: JSX.Element | string;
|
||||
|
|
@ -114,3 +104,11 @@ export interface ActivityViewProps {
|
|||
application?: Application;
|
||||
currentUser: User;
|
||||
}
|
||||
|
||||
export const enum ActivityType {
|
||||
PLAYING = 0,
|
||||
STREAMING = 1,
|
||||
LISTENING = 2,
|
||||
WATCHING = 3,
|
||||
COMPETING = 5
|
||||
}
|
||||
1
packages/discord-types/src/common/index.d.ts
vendored
1
packages/discord-types/src/common/index.d.ts
vendored
|
|
@ -1,3 +1,4 @@
|
|||
export * from "./Activity";
|
||||
export * from "./Application";
|
||||
export * from "./Channel";
|
||||
export * from "./Guild";
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
*/
|
||||
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { ActivityTooltipProps } from "@vencord/discord-types";
|
||||
import { UserStore } from "@webpack/common";
|
||||
|
||||
import { ActivityTooltipProps } from "../types";
|
||||
import { ActivityView, cl } from "../utils";
|
||||
|
||||
export function ActivityTooltip({ activity, application, user }: Readonly<ActivityTooltipProps>) {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { CarouselControlsProps } from "@vencord/discord-types";
|
||||
import { React, Tooltip } from "@webpack/common";
|
||||
|
||||
import { CarouselControlsProps } from "../types";
|
||||
import { cl } from "../utils";
|
||||
import { Caret } from "./Caret";
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { ActivityListIcon, ActivityListProps, ApplicationIcon, IconCSSProperties } from "@vencord/discord-types";
|
||||
import { findComponentByCodeLazy } from "@webpack";
|
||||
import { React, Tooltip } from "@webpack/common";
|
||||
import { JSX } from "react";
|
||||
|
|
@ -12,7 +13,6 @@ import { JSX } from "react";
|
|||
import { ActivityTooltip } from "../components/ActivityTooltip";
|
||||
import { TwitchIcon } from "../components/TwitchIcon";
|
||||
import { settings } from "../settings";
|
||||
import { ActivityListIcon, ActivityListProps, ApplicationIcon, IconCSSProperties } from "../types";
|
||||
import { cl, getApplicationIcons } from "../utils";
|
||||
|
||||
// Discord no longer shows an icon here by default but we use the one from the popout now here
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
*/
|
||||
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Activity, AllActivitiesProps } from "@vencord/discord-types";
|
||||
import { PresenceStore, React, useEffect, useMemo, UserStore, useState, useStateFromStores } from "@webpack/common";
|
||||
import { JSX } from "react";
|
||||
|
||||
import { CarouselControls } from "../components/CarouselControls";
|
||||
import { settings } from "../settings";
|
||||
import { Activity, AllActivitiesProps } from "../types";
|
||||
import { ActivityView, getActivityApplication } from "../utils";
|
||||
|
||||
export function showAllActivitiesComponent({ activity, user, ...props }: Readonly<AllActivitiesProps>): JSX.Element | null {
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
*/
|
||||
|
||||
import { classNameFactory } from "@api/Styles";
|
||||
import { Activity, ActivityViewProps, Application, ApplicationIcon } from "@vencord/discord-types";
|
||||
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
|
||||
|
||||
import { settings } from "./settings";
|
||||
import { Activity, ActivityViewProps, Application, ApplicationIcon } from "./types";
|
||||
|
||||
const ApplicationStore: {
|
||||
getApplication: (id: string) => Application | null;
|
||||
|
|
|
|||
|
|
@ -9,16 +9,10 @@ import { Link } from "@components/Link";
|
|||
import { Devs } from "@utils/constants";
|
||||
import { ModalAPI } from "@utils/modal";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { SelectOption } from "@vencord/discord-types";
|
||||
import { Activity, SelectOption } from "@vencord/discord-types";
|
||||
import { findStoreLazy } from "@webpack";
|
||||
import { PresenceStore, UserStore } from "@webpack/common";
|
||||
|
||||
interface Activity {
|
||||
name: string;
|
||||
application_id?: string;
|
||||
type: number;
|
||||
}
|
||||
|
||||
const settings = definePluginSettings({
|
||||
richPresenceTagging: {
|
||||
type: OptionType.SELECT,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ async function SetNewData() {
|
|||
}
|
||||
|
||||
async function SaveData() {
|
||||
const userData = UserProfileStore.getUserProfile(UserStore.getCurrentUser().id);
|
||||
const userData = UserProfileStore.getUserProfile(UserStore.getCurrentUser().id)!;
|
||||
|
||||
// the getUserProfile function doesn't return all the information we need, so we append the standard user object data to the end
|
||||
const extraUserObject: any = { extraUserObject: UserStore.getCurrentUser() };
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue