Skip to content
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

New deposit page #421

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

New deposit page #421

wants to merge 5 commits into from

Conversation

GoSTEAN
Copy link

@GoSTEAN GoSTEAN commented Dec 21, 2024

Add new page add_deposit
close #404

@whateverfw whateverfw self-requested a review December 21, 2024 16:02
@whateverfw
Copy link
Collaborator

@GoSTEAN nothing changes in this PR, also none of the comments were resolved

@GoSTEAN
Copy link
Author

GoSTEAN commented Dec 21, 2024

@whateverfw Pls which comment are you referring to.

Copy link
Collaborator

@whateverfw whateverfw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some initial comments again, I'm not able to test further, because I can't run an app now, it crashes for me, so please merge with main and fix merge conflcits.

@GoSTEAN

Copy link
Collaborator

@whateverfw whateverfw Dec 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't have 2 token selector files, delete this one and work/use the one you've created

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have deleted this file long ago, I dont know why is still reflecting on the repo. It is not reflecting on my local machine

{ id: 'strkOption', component: <STRK />, label: 'STRK' },
];

const TokenSelectorDeposit = ({ selectedToken, setSelectedToken }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be called TokenSelector

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from TokenSelectorDeposit to TokenSelector in the latest pushed

@djeck1432 djeck1432 self-requested a review December 21, 2024 20:46
@djeck1432
Copy link
Owner

@GoSTEAN Any updates?

Comment on lines +181 to +183
frontend/src/components/TokenSelector.jsx
frontend/src/pages/spotnet/dashboard/add_deposit.jsx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wyt this added to git ignore? just remove files if they are not used.

setError(null);
};

const handleDeposit = async () => {
Copy link
Collaborator

@whateverfw whateverfw Dec 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be done using useMutation of tanstack-query library. Should be put into custom hook inside hooks folder, we already use this across the project for other requests, thanks.
Also use axiosInstance, not fetch

setSelectedToken('STRK');

// Success notification
alert('Deposit successful!');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use browser's alert, we have notify function for that (of react-toastify) library

alert('Deposit successful!');

} catch (err) {
setError(err.message);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need error state, just show error in a toast message in onError callback of useMutation

const TokenSelector = ({ selectedToken, setSelectedToken, onSelect }) => {
const handleTokenChange = (token) => {
setSelectedToken(token.label);
if (onSelect) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think that onSelect is necessary as it is not used anywhere

];

const TokenSelectorDeposit = ({ selectedToken, setSelectedToken }) => {
const TokenSelector = ({ selectedToken, setSelectedToken, onSelect }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure this component used correctly inside Form.jsx

Copy link
Collaborator

@whateverfw whateverfw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoSTEAN please resolve merge conflicts.

@@ -123,7 +123,7 @@ const Form = () => {
</p>
)}
<label className="token-select">Select Token</label>
<TokenSelector selectedToken={selectedToken} setSelectedToken={setSelectedToken} />
<TokenSelectorDeposit selectedToken={selectedToken} setSelectedToken={setSelectedToken} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TokenSelector should be used here as you renamed yoiur file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this file, seems like you already have another one?

@@ -104,6 +106,7 @@ function App() {
element={walletId ? <Navigate to="/" /> : <Login onConnectWallet={handleConnectWallet} />}
/>
<Route path="/dashboard" element={<Dashboard telegramId={window?.Telegram?.WebApp?.initData?.user?.id} />} />
<Route path="/addDeposit" element={<AddDeposit />} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be /add-deposit

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styles do not match figma.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FRONTEND] Add new page add_deposit
3 participants