From a63a80b5a2eae162fa16de365f406e3d94bd5ec6 Mon Sep 17 00:00:00 2001 From: Adesojisouljay Date: Thu, 9 May 2024 13:53:20 +0100 Subject: [PATCH] points wallet refactor and community title --- src/common/components/wallet-ecency/index.tsx | 30 +++++++++++-------- src/common/components/wallet-menu/index.tsx | 2 +- src/common/i18n/locales/en-US.json | 10 +++---- src/common/pages/_sign-up.scss | 4 +-- src/common/pages/sign-up.tsx | 2 +- src/common/store/global/index.ts | 1 + src/common/store/global/types.ts | 1 + src/server/state.ts | 4 +++ 8 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/common/components/wallet-ecency/index.tsx b/src/common/components/wallet-ecency/index.tsx index 5ce4a14ac37..2fb79b29700 100644 --- a/src/common/components/wallet-ecency/index.tsx +++ b/src/common/components/wallet-ecency/index.tsx @@ -33,6 +33,7 @@ import {claimPoints, getCurrencyTokenRate} from "../../api/private-api"; import { claimBaPoints} from "../../api/breakaway"; import { dateToFullRelative } from "../../helper/parse-date"; import { getCommunity } from "../../api/bridge"; +import { Community } from "../../store/communities/types"; import { accountGroupSvg, @@ -173,6 +174,7 @@ export class TransactionRow extends Component { interface Props { global: Global; + myCommunity: Community dynamicProps: DynamicProps history: History; activeUser: ActiveUser | null; @@ -222,6 +224,7 @@ export const WalletEcency = (props: Props) => { const {global, activeUser, account, points, history, fetchPoints, updateActiveUser} = props; useEffect(() => { + console.log(props) setIsMounted(true); let user = history.location.pathname.split("/")[1]; user = user.replace('@','') @@ -229,7 +232,7 @@ export const WalletEcency = (props: Props) => { getEstimatedPointsValue(); getCommunityInfo(); if (communityInfo && isMounted ) { - getPointsHistory(user, communityInfo?.title); + getPointsHistory(account.name, communityInfo?.title); getUserPoints(); } @@ -289,7 +292,7 @@ export const WalletEcency = (props: Props) => { const getUserPoints = async (): Promise => { try { - const response: AxiosResponse | any = await getBaUserPoints(activeUser!.username, communityInfo?.title); + const response: AxiosResponse | any = await getBaUserPoints(account!?.name, communityInfo?.title); if (response.status === 200) { const userPoints = response.data.userPoints; setUserPoints(userPoints[0]) @@ -418,7 +421,7 @@ export const WalletEcency = (props: Props) => { )} -
+ {/*
{_t("wallet.estimated-points")}
{_t("wallet.estimated-description-points")}
@@ -428,7 +431,7 @@ export const WalletEcency = (props: Props) => { {estimatedPointsValueLoading ? `${_t("wallet.calculating")}...` : }
-
+ */}
@@ -438,7 +441,7 @@ export const WalletEcency = (props: Props) => {
- { + {/* { (() => { let dropDownConfig: any if(isMyPage) { @@ -472,7 +475,7 @@ export const WalletEcency = (props: Props) => {
) })() - } + } */} {/* {isMyPage && ( @@ -481,7 +484,7 @@ export const WalletEcency = (props: Props) => {
)} */} - <>{userPoints?.pointsBalance}.000 Points + <>{!userPoints ? "Fetching Point..." : userPoints?.pointsBalance + ".000 Points"}
@@ -514,12 +517,12 @@ export const WalletEcency = (props: Props) => { 1 - + {/*
{starOutlineSvg} 0.25
-
+
*/}
{accountOutlineSvg} @@ -532,18 +535,18 @@ export const WalletEcency = (props: Props) => { 10
- + {/*
{ticketSvg} 10
-
- + */} + {/*
{accountGroupSvg} 20
-
+
*/} {/* {isMyPage && ( @@ -601,6 +604,7 @@ export const WalletEcency = (props: Props) => { export default (p: Props) => { const props = { global: p.global, + myCommunity: p.myCommunity, dynamicProps: p.dynamicProps, history: p.history, activeUser: p.activeUser, diff --git a/src/common/components/wallet-menu/index.tsx b/src/common/components/wallet-menu/index.tsx index e49dbe476a0..54a5baf596c 100644 --- a/src/common/components/wallet-menu/index.tsx +++ b/src/common/components/wallet-menu/index.tsx @@ -26,7 +26,7 @@ export default class WalletMenu extends Component { //REMOVE USE PRIVATE FOR POINTS
- {communityInfo?.title} + {global?.communityTitle} Points ecency diff --git a/src/common/i18n/locales/en-US.json b/src/common/i18n/locales/en-US.json index cee215514d1..85f801b32b7 100644 --- a/src/common/i18n/locales/en-US.json +++ b/src/common/i18n/locales/en-US.json @@ -693,12 +693,12 @@ "claim-reward-points": "Claim reward points", "main-description": "Points can be used for in-app services, like Promote, Boost, Gifting.", "earn-points": "How to earn more Points", - "post-desc": "You can earn point by posting regularly. Posting gives you 15 points.", - "comment-desc": "Each comment you make helps you to grow your audience and make friendship but also earns you 5 points.", + "post-desc": "You can earn point by posting regularly. Posting gives you 10 points.", + "comment-desc": "Each comment you make helps you to grow your audience and make friendship but also earns you 10 points.", "checkin-desc": "Checking in on Ecency gives you 0.25 points and helps you stay connected with your friends.", - "vote-desc": "By voting you give reward to other creators and show your appreciation but also earn 0.01 x vote weight points.", - "reblog-desc": "Share what post you like with your friends and earn 1 points.", - "login-desc": "When you login into Ecency you are entitled to earn 10 points automatically.", + "vote-desc": "By voting you give reward to other creators and show your appreciation but also earn 10 points.", + "reblog-desc": "Share what post you like with your friends and earn 10 points.", + "login-desc": "When you login, you are entitled to earn 10 points automatically.", "checkin-extra-desc": "Consistent use of app gives you extra chances to earn more 10 points, be more active and earn more.", "delegation-desc": "You can earn ~100 points per day for each 1000HP delegation.", "community-desc": "Register your community to get 20 points for per post published with Ecency applications.", diff --git a/src/common/pages/_sign-up.scss b/src/common/pages/_sign-up.scss index 334a4d631ab..3da334f98bf 100644 --- a/src/common/pages/_sign-up.scss +++ b/src/common/pages/_sign-up.scss @@ -16,10 +16,10 @@ display: flex; justify-content: center; width: 100%; - margin-top: 200px; + // margin-top: 200px; @media (max-width: 470px) { - margin-top: 500px; + margin-top: 100px; } .success-info { diff --git a/src/common/pages/sign-up.tsx b/src/common/pages/sign-up.tsx index c9b0ae89161..0196a9e1b23 100644 --- a/src/common/pages/sign-up.tsx +++ b/src/common/pages/sign-up.tsx @@ -208,7 +208,7 @@ const SignUpPage = (props: Props | any) => {
{step === 1 && (
-

Sign up with

+ {/*

Sign up with

*/}
handleAccountTypeClick("Hive")} diff --git a/src/common/store/global/index.ts b/src/common/store/global/index.ts index 6d5f27638d2..0a491fa0efb 100644 --- a/src/common/store/global/index.ts +++ b/src/common/store/global/index.ts @@ -56,6 +56,7 @@ export const initialState: Global = { tags: ["spk", "3speak"], hive_id: "hive-112019", baseApiUrl: "https://account-creator.3speak.tv/api", + communityTitle: "" }; export default (state: Global = initialState, action: Actions): Global => { diff --git a/src/common/store/global/types.ts b/src/common/store/global/types.ts index e1766a39e06..c69ed9a1dc0 100644 --- a/src/common/store/global/types.ts +++ b/src/common/store/global/types.ts @@ -68,6 +68,7 @@ export interface Global { ctheme: string; hive_id: string; tags: string[]; + communityTitle: string; } export enum ActionTypes { diff --git a/src/server/state.ts b/src/server/state.ts index 1e612cbe9dd..08da00ddd53 100644 --- a/src/server/state.ts +++ b/src/server/state.ts @@ -15,6 +15,7 @@ import config from "../config"; import { getSearchIndexCount, getDynamicProps } from "./helper"; import { getOperatingSystem } from "../common/util/platform"; +import { getCommunity } from "../common/api/bridge"; export const makePreloadedState = async ( req: express.Request @@ -23,6 +24,8 @@ export const makePreloadedState = async ( const activeUser = _c("active_user") || null; + const communityData = await getCommunity(config.hive_id) + const theme = _c("theme") && Object.values(Theme).includes(_c("theme")) ? _c("theme") @@ -53,6 +56,7 @@ export const makePreloadedState = async ( ctheme: config.theme, tags: [...config.tags], baseApiUrl: config.baseApiUrl, + communityTitle: communityData!.title }; const dynamicProps = await getDynamicProps();