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

"Main" branch clean-up #12

Merged
merged 14 commits into from
Jan 15, 2024
Merged

"Main" branch clean-up #12

merged 14 commits into from
Jan 15, 2024

Conversation

kpyszkowski
Copy link
Contributor

Ref: #1
Depends on: #7 #8 #10 #11

This pull request aggregates each partial clean-up PR (mentioned above). It's introduced to reduce complexity of merge conflicts and allow continuous work without blocking while waiting for partial PRs to be merged.
Moreover it's a place for general cleanup commits that couldn't be addressed to any of the PRs.

@kpyszkowski kpyszkowski self-assigned this Nov 30, 2023
@kpyszkowski kpyszkowski marked this pull request as draft December 1, 2023 10:42
@kpyszkowski
Copy link
Contributor Author

kpyszkowski commented Dec 1, 2023

@michalsmiarowski
I've spotted an error that doesn't occur on branches #7, #8, #10, #11 but in this one. I might have messed something with resolving conflicts but I can't find the direct origin of the issue.
When you disconnect the wallet using a button (calling disconnect function returned by useWeb3React hook) after few seconds it throws an error from the screenshot. in fact it breaks in this line because as you disconnect the wallet, the account value from useWeb3React hook becomes undefined.
I'm curious how this error didn't occur earlier because from the code perspective that is "expectable" behavior.

Could you investigate it? I’ve already hit the wall, all my efforts in this matter are pointless 😩

image

Edit:
Okay, finally I have found a hint. Actually this happens when you disconnect wallet on /tBTC/(un)mint route.
That's because it tries to render the ActivityItem component that's incorrectly assumes the account value will always be present. When you disconnect wallet on any other route - the route that doesn't render the mentioned component - the error doesn't occur.

I've prepared a patch with testing playground in case you'd like to test it:

git apply ~/Downloads/route-test.patch

Edit 2:
Ahhh, finally I've managed to resolve the issue. The rubber duck method FTW 🤣
Ref commit: 5bf5c773

Component tried to render without the necessary data causing error when
user disconnects the wallet on Mint/Unmint page.
Copy link
Contributor

@michalsmiarowski michalsmiarowski left a comment

Choose a reason for hiding this comment

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

First round of review

src/App.tsx Outdated Show resolved Hide resolved

const combinedReducer = combineReducers({
account: accountSlice.reducer,
modal: modalSlice.reducer,
token: tokenSlice.reducer,
sidebar: sidebarSlice.reducer,
transaction: transactionSlice.reducer,
staking: stakingSlice.reducer,
eth: ethSlice.reducer,
tbtc: tbtcSlice.reducer,
rewards: rewardsSlice.reducer,
Copy link
Contributor

@michalsmiarowski michalsmiarowski Jan 7, 2024

Choose a reason for hiding this comment

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

Non-blocking:

rewards are not needed anymore, because they are related to staking, so let's remove that slice and all things related to that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've made it non-blocking, because I think I can address it in a separate PR too to not distract you from the UI work and to not block this PR.


const combinedReducer = combineReducers({
account: accountSlice.reducer,
modal: modalSlice.reducer,
token: tokenSlice.reducer,
sidebar: sidebarSlice.reducer,
transaction: transactionSlice.reducer,
staking: stakingSlice.reducer,
eth: ethSlice.reducer,
Copy link
Contributor

@michalsmiarowski michalsmiarowski Jan 7, 2024

Choose a reason for hiding this comment

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

Non-blocking:

I'm pretty sure eth is also not needed here since we operate only on bitcoins in base, so we should remove that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've made it non-blocking, because I think I can address it in a separate PR too to not distract you from the UI work and to not block this PR.

import { listenerMiddleware } from "./listener"
import { accountSlice, registerAccountListeners } from "./account"
import { accountSlice } from "./account"

const combinedReducer = combineReducers({
account: accountSlice.reducer,
modal: modalSlice.reducer,
token: tokenSlice.reducer,
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking:

token is needed, but we only need tbtc-v2 and all things realted to that. The rest can be removed.

Let me address it in a separate PR where I will remove useFetchTvl hook. We shouldn't add more changes here.

@kpyszkowski kpyszkowski marked this pull request as ready for review January 11, 2024 12:31
Fetching ETH USD price is not needed in Base app
Copy link
Contributor

@michalsmiarowski michalsmiarowski left a comment

Choose a reason for hiding this comment

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

Left some comments to look at before the merge

src/components/tBTC/BridgeActivity.tsx Outdated Show resolved Hide resolved
src/components/tBTC/BridgeActivity.tsx Outdated Show resolved Hide resolved
src/components/tBTC/BridgeActivity.tsx Outdated Show resolved Hide resolved
Updated conditions to include wallet connection.
Fixed typo: `epmty` => `empty`
Adjust empty state rendering conditions.
Copy link
Contributor

@michalsmiarowski michalsmiarowski left a comment

Choose a reason for hiding this comment

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

Left one more comment

src/components/tBTC/BridgeActivity.tsx Outdated Show resolved Hide resolved
Used dedicated boolean flag instead of the data itself
Copy link
Contributor

@michalsmiarowski michalsmiarowski left a comment

Choose a reason for hiding this comment

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

LGTM 🔥

@michalsmiarowski michalsmiarowski merged commit afbd6b5 into main Jan 15, 2024
@michalsmiarowski michalsmiarowski mentioned this pull request Jan 15, 2024
7 tasks
michalsmiarowski added a commit that referenced this pull request Jan 25, 2024
UI: Header component

Ref: #2 
~Depends on: #12~

This pull request introduces:
- `Logo` component:
- `Header` component
- `SelectWallet` component redesign

Additional changes:
- `Button` component theme adjustments
- `Modal` component theme adjustments 

Note: Since this PR introduces changes widely used in the project eg. `Modal` or
`Button` changes it's recommended to review it and merge primarily.
michalsmiarowski added a commit that referenced this pull request Jan 31, 2024
UI: PageLayout component

Ref: #2
~Depends on: #12

This pull request introduces `PageLayout` component. I decided to rewrite the
component entirely. The major feature is render slots to conditionally render
content in specific areas regarding to designs.

Render slots are wrapped with padding container following design appearance,
children is not wrapped with any container (padding) since it's appears to be
variable in various views.

https://github.com/threshold-network/bitcoin-on-base/assets/11503879/deccabfb-3f6e-4f2f-a07a-76a162635e1b

Note: The TODO regarding Balance component (#17) isn't a blocker. It's just a
placeholder value indicating to put the component there when the view is
composed in separate PR.
michalsmiarowski added a commit that referenced this pull request Feb 14, 2024
UI: Provide Data step

Ref: #2 
Depends on: #12 

This pull request introduces redesigned Provide Data minting flow step
michalsmiarowski added a commit that referenced this pull request Feb 21, 2024
UI: Initiate Minting step

Ref: #5
Depends on: #12

This pull request introduces redesigned Initiate Minting minting flow step.

Additional changes:
- `Toast` component with collapsible details, adjustable position and
orientation,
- `LabeledBadge` component.
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.

2 participants