From 9e50746d021959ef8771b86ba443c26905fa7b7d Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 21 Feb 2025 00:13:33 -0500 Subject: [PATCH] BetterActivities Remove Broken Section Temp --- .../betterActivities/index.tsx | 167 +----------------- 1 file changed, 4 insertions(+), 163 deletions(-) diff --git a/src/equicordplugins/betterActivities/index.tsx b/src/equicordplugins/betterActivities/index.tsx index 2f90aa26..279e06e0 100644 --- a/src/equicordplugins/betterActivities/index.tsx +++ b/src/equicordplugins/betterActivities/index.tsx @@ -12,11 +12,10 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; -import { PresenceStore, React, Tooltip, useEffect, useMemo, UserStore, useState, useStateFromStores } from "@webpack/common"; +import { React, Tooltip, UserStore } from "@webpack/common"; import { User } from "discord-types/general"; import { JSX } from "react"; -import { Caret } from "./components/Caret"; import { SpotifyIcon } from "./components/SpotifyIcon"; import { TwitchIcon } from "./components/TwitchIcon"; import { Activity, ActivityListIcon, Application, ApplicationIcon, IconCSSProperties } from "./types"; @@ -66,12 +65,6 @@ const settings = definePluginSettings({ }} /> ), }, - userPopout: { - type: OptionType.BOOLEAN, - description: "Show all activities in the profile popout/sidebar", - default: true, - restartNeeded: true, - }, allActivitiesStyle: { type: OptionType.SELECT, description: "Style for showing all activities", @@ -314,167 +307,15 @@ export default definePlugin({ return null; }, - showAllActivitiesComponent({ activity, user, ...props }: Readonly<{ activity: Activity; user: User; application: Application; type: string; }>) { - const currentUser = UserStore.getCurrentUser(); - if (!currentUser) return null; - - const [currentActivity, setCurrentActivity] = useState( - activity?.type !== 4 ? activity! : null - ); - - const activities = useStateFromStores( - [PresenceStore], () => PresenceStore.getActivities(user.id).filter((activity: Activity) => activity.type !== 4) - ) ?? []; - - useEffect(() => { - if (!activities.length) { - setCurrentActivity(null); - return; - } - - if (!currentActivity || !activities.includes(currentActivity)) - setCurrentActivity(activities[0]); - }, [activities]); - - // we use these for other activities, it would be better to somehow get the corresponding activity props - const generalProps = useMemo(() => Object.keys(props).reduce((acc, key) => { - // exclude activity specific props to prevent copying them to all activities (e.g. buttons) - if (key !== "renderActions" && key !== "application") acc[key] = props[key]; - return acc; - }, {}), [props]); - - if (!activities.length) return null; - - if (settings.store.allActivitiesStyle === "carousel") { - return ( -
- {activity && currentActivity?.id === activity?.id ? ( - - ) : ( - - )} - {activities.length > 1 && -
- {({ - onMouseEnter, - onMouseLeave - }) => { - return { - const index = activities.indexOf(currentActivity!); - if (index - 1 >= 0) - setCurrentActivity(activities[index - 1]); - }} - > - - ; - }} - -
- {activities.map((activity, index) => ( -
setCurrentActivity(activity)} - className={`dot ${currentActivity === activity ? "selected" : ""}`} /> - ))} -
- - {({ - onMouseEnter, - onMouseLeave - }) => { - return { - const index = activities.indexOf(currentActivity!); - if (index + 1 < activities.length) - setCurrentActivity(activities[index + 1]); - }} - > - = activities.length - 1} - direction="right" /> - ; - }} -
- } -
- ); - } else { - return ( -
- {activities.map((activity, index) => - index === 0 ? ( - ) : ( - - ))} -
- ); - } - }, - patches: [ { // Patch activity icons find: '"activity-status-web"', replacement: { - match: /\(null==\i?\?void 0:\i.some\(\i\.\i\)\)/, - replace: "$self.patchActivityList(e),false" + match: /(?<=hasQuest:\i\}=(\i).*?)\(null==\i?\?void 0:\i.some\(\i\.\i\)\)/, + replace: "$self.patchActivityList($1),false" }, predicate: () => settings.store.memberList, - }, - { - // Show all activities in the user popout/sidebar - // still broken btw - find: "#{intl::ACTIVITY_REACTION_REPLY_TITLE}", - replacement: { - match: /(?<=void 0:(\i\.type)\).{0,50}\(0,\i\.jsx\)\()(\i\.\i)(?=.{0,10},{activity:\i,user:\i,application:\i)/, - replace: "$1==='BiteSizePopout'?$self.showAllActivitiesComponent:$2" - }, - predicate: () => settings.store.userPopout - }, + } ], });