-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wallet-porfolio #1183
base: development
Are you sure you want to change the base?
wallet-porfolio #1183
Conversation
src/common/api/hive-engine.ts
Outdated
export async function getOtherTransactions(account: string, limit: number, symbol: string, offset: number = 0) { | ||
const url: any = engine.otherTransactionsUrl; | ||
const response = await axios({ | ||
url: url, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may leave just url
instead of url: url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, that's true,
Thanks🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still didn't fixed
|
||
const getMainTransactions = async () => { | ||
const transactions = await getTransactions(params, account.name, 200); | ||
console.log(transactions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove please
const otherTokenTransactions = async () => { | ||
setLoading(true) | ||
const otherTransactions = await getOtherTransactions(account.name, 200, params.toUpperCase()); | ||
console.log(otherTransactions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove please
}; | ||
|
||
const optionChanged = (e: React.ChangeEvent<typeof FormControl & HTMLInputElement>) => { | ||
console.log(e.target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you use this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I haven't used it yet, I'll use it, I'm not done with issue yet, I want to be sure all actions/logic works then I will refactor where necessary
@@ -234,6 +235,7 @@ export const WalletEcency = (props: Props) => { | |||
const initiateOnElectron = (username: string) => { | |||
if (!isMounted && global.isElectron) { | |||
let getPoints = new Promise((res) => fetchPoints(username)); | |||
console.log(getPoints) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove please
@@ -199,6 +199,7 @@ export const WalletEcency = (props: Props) => { | |||
const [showPurchaseDialog, setShowPurchaseDialog] = useState(false); | |||
|
|||
const { global, activeUser, account, points, history, fetchPoints, updateActiveUser } = props; | |||
console.log(points) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove please
|
||
const marketChartInfo = async () => { | ||
const data: any = await marketChart("hive") | ||
console.log(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dkildar, all console.log( ) would be removed, I'm still working on this issue, would clean all and refactor once I'm done
…into feat/redesign-wallet-page
const url = `https://api.coingecko.com/api/v3/coins/${token}/market_chart?vs_currency=usd&days=30`; | ||
const data = await axios.get(url) | ||
.then((r: any) => r.data) | ||
return data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, do not use async/await
and then
constructions together.
It should be:
const { data } = await axis.get(url);
return data;
…into feat/redesign-wallet-page
@@ -4,6 +4,7 @@ import { getMetrics } from "../../api/hive-engine"; | |||
|
|||
export const EngineTokensEstimated = (props: any) => { | |||
const { tokens: userTokens, dynamicProps } = props; | |||
// console.log(userTokens) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove please
const [transactions, setTransactions] = useState([]) | ||
const [otherTransactions, setOtherTransactions] = useState([]) | ||
const [loading, setLoading] = useState(false); | ||
const [loadLimit, setLoadLimit] = useState(10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed semicolons
} from "../../api/hive-engine"; | ||
import LinearProgress from '../linear-progress'; | ||
|
||
export const EngineTransactionList = (props: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not an any
. Please, specify types
return ( | ||
<div className="transaction-list"> | ||
<div className="transaction-list-header"> | ||
<h2>{_t("transactions.title")} </h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space at the end of tag content
</div> | ||
{loading && <LinearProgress />} | ||
{otherTransactions?.slice(0, loadLimit).map((t: any) => { | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip: You can replace
foo() => {
return bar;
}
with
foo() => (bar)
No need to use extra return
<div className="transaction-list-item" key={t?.id}> | ||
<div className="transaction-icon"> | ||
{t?.operation === "tokens_transfer" || t?.operation === "tokens_stake" || t?.operation === "tokens_delegate" ? | ||
TwoUserAvatar({ global: global, from: t?.from, to: t?.to, size: "small" }) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its a component, use as element please
<span> | ||
<strong>{`Txn Id: ${t.transactionId}`}</strong> | ||
<p className='mt-2'> | ||
<strong>{`Block Id: ${t.blockNumber}`}</strong> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These texts should be translated
import { marketChart } from '../../api/misc' | ||
import moment from "moment"; | ||
|
||
export const HiveWalletPortfolioChart = (props: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify types please
export const HiveWalletPortfolioChart = (props: any) => { | ||
const { theme } = props; | ||
|
||
const [prices, setPrices] = useState([]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify types please
|
||
const { global, account, params } = props | ||
|
||
const [transactions, setTransactions] = useState([]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify types please
const { global, account, params } = props | ||
|
||
const [transactions, setTransactions] = useState([]) | ||
const [otherTransactions, setOtherTransactions] = useState([]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify types please
estimatedPointsValueLoading: boolean; | ||
} | ||
|
||
export class WalletPortfolio extends BaseComponent<Props, State> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use functional component instead of class based please
…into feat/redesign-wallet-page
…into feat/redesign-wallet-page
What does this PR?
New wallet view
Shows overall(estimated) wallet value
User can hide or show charts
Users can add or remove hive engine tokens
User can navigate to each token separately (https://ecency.com/@username/wallet/token) to see more transaction info or token info
How to use this feature
Navigate to user profile,
click on wallets then you will see your assets (hive, hive-power, hbd, engine tokens and spk tokens) listed, you can click on each one for more info.
To add more tokens click on add token button, select the token you want to add and confirm. You can also add more than one token. To remove a token from list, you will follow the same procedure and uncheck token.
Screenshot
See video on loom