From 1b1bb7ea1b968ac19679f8b2b102794a911b2e61 Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Fri, 27 Jun 2025 10:20:32 +0200 Subject: [PATCH] Remove display of balance history delta --- components/Home/RscBalanceButton.tsx | 44 ------------------- .../Home/api/postLastTimeClickedRscTab.ts | 23 ---------- 2 files changed, 67 deletions(-) delete mode 100644 components/Home/api/postLastTimeClickedRscTab.ts diff --git a/components/Home/RscBalanceButton.tsx b/components/Home/RscBalanceButton.tsx index 54d2d1c3e1..d0c3ea3ed8 100644 --- a/components/Home/RscBalanceButton.tsx +++ b/components/Home/RscBalanceButton.tsx @@ -3,7 +3,6 @@ import { faChevronDown } from "@fortawesome/pro-regular-svg-icons"; import { connect } from "react-redux"; import { emptyFncWithMsg } from "~/config/utils/nullchecks"; import { getCurrentUser } from "~/config/utils/getCurrentUser"; -import { postLastTimeClickedRscTab } from "./api/postLastTimeClickedRscTab"; import { StyleSheet, css } from "aphrodite"; import { formatBalanceWithDecimals } from "~/config/utils/form"; import { useRouter } from "next/router"; @@ -22,7 +21,6 @@ const RscBalanceButton = ({ auth }: Props): ReactElement => { const router = useRouter(); const tabname = router?.query?.tabName; const currentUser = getCurrentUser(); - const rscDeltaSinceSeen = currentUser?.balance_history ?? 0; const { balance, should_display_rsc_balance_home } = auth?.user ?? {}; const [_count, setBalance] = useState(balance); @@ -31,23 +29,6 @@ const RscBalanceButton = ({ auth }: Props): ReactElement => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); const [shouldDisplayBalanceHome, setShouldDisplayBalanceHome] = useState(should_display_rsc_balance_home ?? true); - const [shouldDisplayRscDelta, setShouldDisplayRscDelta] = useState( - rscDeltaSinceSeen > 0 - ); - - useEffect((): void => { - if (tabname?.includes("rsc")) { - setShouldDisplayRscDelta(false); - postLastTimeClickedRscTab({ - onSuccess: (): void => { - setShouldDisplayRscDelta(false); - }, - onError: emptyFncWithMsg, - }); - } else { - setShouldDisplayRscDelta(rscDeltaSinceSeen > 0); - } - }, [tabname, rscDeltaSinceSeen]); useEffect(() => { if (auth?.isFetchingUser) { @@ -83,10 +64,6 @@ const RscBalanceButton = ({ auth }: Props): ReactElement => { data-for={"reputation-tool-tip"} onClick={(_event: SyntheticEvent): void => { setIsPopoverOpen(!isPopoverOpen); - postLastTimeClickedRscTab({ - onError: emptyFncWithMsg, - onSuccess: (): void => setShouldDisplayRscDelta(false), - }); }} > {/* {!isPopoverOpen && } */} @@ -101,11 +78,6 @@ const RscBalanceButton = ({ auth }: Props): ReactElement => { {formatBalanceWithDecimals(balance ?? 0)} RSC )} - {shouldDisplayRscDelta && ( -
{`+ ${formatBalanceWithDecimals( - Number(rscDeltaSinceSeen.toFixed(2)) - )}`}
- )}
@@ -146,22 +118,6 @@ const styles = StyleSheet.create({ borderRadius: "50%", boxShadow: "0px 2px 4px rgba(185, 185, 185, 0.25)", }, - rscDelta: { - // background: colors.BLUE(1), - // color: "white", - background: colors.LIGHT_GREEN(0.5), - color: colors.PASTEL_GREEN_TEXT, - padding: 4, - top: -6, - right: -8, - fontSize: 10, - fontWeight: 600, - zIndex: 2, - display: "flex", - position: "absolute", - borderRadius: "50px", - boxShadow: "0 0 24px rgba(0, 0, 0, 0.14)", - }, usdAmount: { fontSize: 12, color: colors.LIGHT_GREY_TEXT, diff --git a/components/Home/api/postLastTimeClickedRscTab.ts b/components/Home/api/postLastTimeClickedRscTab.ts deleted file mode 100644 index 893ada29c2..0000000000 --- a/components/Home/api/postLastTimeClickedRscTab.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { buildApiUri } from "~/config/utils/buildApiUri"; -import { Helpers } from "@quantfive/js-web-config"; -import API from "~/config/api"; - -type Args = { - onError: (error: Error) => void; - onSuccess: () => void; -}; - -export function postLastTimeClickedRscTab({ onError, onSuccess }: Args): void { - fetch( - buildApiUri({ - apiPath: `user/update_balance_history_clicked`, - }), - API.POST_CONFIG({}) - ) - .then(Helpers.checkStatus) - .then(Helpers.parseJSON) - .then((): void => onSuccess()) - .catch((error: any): void => { - onError(error); - }); -}