8000 refactor: simplify NFTView container by joonchoi0918 · Pull Request #424 · zer0-os/zNS-dapp · GitHub
[go: up one dir, main page]

Skip to content

refactor: simplify NFTView container - #424

Merged
colbr merged 3 commits into
refactor/component-simplificationfrom
feat/joon/refactor-nftview-component
Mar 25, 2022
Merged

colbr merged 3 commits into
refactor/component-simplificationfrom
feat/joon/refactor-nftview-component

Conversation

@joonchoi0918
@joonchoi0918 joonchoi0918 commented Mar 18, 2022 •
Copy link
Copy Markdown
Contributor

Associated Notion Card


1. Pull request checklist

  • Notion card has been moved to the Code Review column
  • Notion card has a link to this PR
  • A reviewer has been assigned to the Notion card

2. PR type

3. What is the old behaviour?

4. What is the new behaviour?

5. Other information

@netlify
netlify Bot commented Mar 18, 2022 •
Copy link
Copy Markdown

✅ Deploy Preview for wilderworld-app ready!

🔨 Explore the source changes: 47fb0bd

🔍 Inspect the deploy log: https://app.netlify.com/sites/wilderworld-app/deploys/6237d7d67126450009a6c570

😎 Browse the preview: https://deploy-preview-424--wilderworld-app.netlify.app/

@joonchoi0918
joonchoi0918 force-pushed the feat/joon/refactor-nftview-component branch from 53ad18d to b1bc295 Compare March 18, 2022 09:48
@eric-zero-dev eric-zero-dev left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Nice refactoring. I left a few comments @joonchoi0918

Comment thread src/config.ts Resolved
Comment on lines +35 to +39
if (znsDomain?.animation_url || znsDomain?.image_full || znsDomain?.image) {
// Get hash from asset
const url = (znsDomain.animation_url ||
znsDomain.image_full ||
znsDomain.image)!;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you can just use url?: string as the parameter of this function. Then this function will be more simple. But its up to you.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

True - could be cleaner to take a string parameter pass it znsDomain?.animation_url || znsDomain?.image_full || znsDomain?.image.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will fix it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

8000

@colbr colbr left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

8000

Looking really nice, good job. The only required changes are the Histories ones I mentioned in feedback :)

I'm also about to push a few changes to NFTView.tsx in develop which will probably give you some conflicts - I'm happy to resolve them

Comment on lines +35 to +39
if (znsDomain?.animation_url || znsDomain?.image_full || znsDomain?.image) {
// Get hash from asset
const url = (znsDomain.animation_url ||
znsDomain.image_full ||
znsDomain.image)!;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

True - could be cleaner to take a string parameter pass it znsDomain?.animation_url || znsDomain?.image_full || znsDomain?.image.

@colbr
colbr commented Mar 22, 2022
Copy link
Copy Markdown
Contributor

Looking good, thanks for making the requested changes! Will hold off on merging this for a couple of days so we can get the major release out. I will handle any merge conflicts that pop up

@colbr
colbr changed the base branch from develop to refactor/component-simplification March 25, 2022 01:59
@colbr
colbr commented Mar 25, 2022
Copy link
Copy Markdown
Contributor

Pointing this PR to another branch to merge with some other refactoring, then will merge to develop when ready 😊

@colbr colbr changed the title Refactor NFTView component refactor: simplify NFTView component Mar 25, 2022
@colbr colbr changed the title refactor: simplify NFTView component refactor: simplify NFTView container Mar 25, 2022
@colbr
colbr merged commit 7aa008f into refactor/component-simplification Mar 25, 2022
@colbr
colbr deleted the feat/joon/refactor-nftview-component branch March 25, 2022 02:09
@colbr colbr mentioned this pull request Mar 26, 2022
3 tasks done
colbr added a commit that referenced this pull request Mar 31, 2022
* Fix background color issue for BuyTokenRedirect and InfoPanel components in FireFox

* Remove png file

* refactor(profile): use constants for tab names

* test(bid-table-row): change expect value to be more clear

* refactor(bid-table-row): extract constants

* refactor(cancel-bid): reduce complexity

* test(cancel-bid): improve testing coverage

* feat(nft-view): add cancel bid button to NFT view

* fix(bid-table): better spacing of bid table button

* fix: handle 'wilder.' domain names properly

* fix(zAuction): remove caching so user bids can update

* Update Transfer Flow - add step wizard and modify logic/styles

* feat(useZnsDomain): switch to SDK for domain data retrieval

* complete tooltip step and styling touches

* Switch StakingRequestProvider to Redux

* fix(nft-view): change logic for hiding Your Bid

* feat(accept-bid): use zauction sdk method to accept bid

* review changes

* update constants on NFTDetails

* final fixes

* resolve memory leak console error - prevent state update on unmounted component

* feat(accept-bid): handle pending and completed tx
When pending, show pending message in View Bids
When completed, hide View Bids and add notification

* Fix PR feedback

* add background-primary class to resolve firefox blur issue

* add type policies object to inMemoryCache - set merge to domains query to resolve warning

* remove blur class to prevent !important override

* add HoverDropDown common component and adjust styling - update BuyTokenRedirect and InfoPanel

* implement HoverDropDown to status buttons

* resolve build fail

* Fix compile error

* Fix eslint warnnings

* hover state of zero number button and position of dropdown content element

* minor tweaks to style

* rename and resolve merge conflict

* remove commented code

* attempt to resolve build fail

* switch order of dropdown components in index dropdowns file in attempt to resolve failing tests on circle ci build

* update index.js components - remove * export

* revert file changes

* correct import

* name change hack to push file name changes

* hacky name change to resolve build error step 1

* hacky name change to resolve build error step 2

* update zns-sdk

* update rinkeby zauction address

* push package-lock.json changes

* wip/feat(owned-domains-table): switch to GenericTable component

* ensure content dropdown remains open when over gap between elements

* Refactor Page Container component

* update packages

* Fix to show bid button by setting isBiddable as true as default

* Fix zna in MintNewNFT modal

* feat(nft-view): move transfer button to dropdown

* refactor(nft-view): purge some unused css

* Fix znas string value and link in Mint and Transfer modals

* refactor(metadata): migrate code to use sdk method to fetch metadata in useDomainMetadata

* add useAcceptBit and constants

* WIP implementing zauction approval and approve bid using SDK for accept bid

* refactor(make-a-bid): use SDK for getting bid
Also added some simplifications

* feat: add refetch method to useOwnedDomains

* refactor(owned-domains-table): simplify code

* Merge branch 'develop' into feat/dom/accept-bid-sdk

* refactor(owned-domains-table): remove unimportant comment and import

* feat(owned-domains-table): handle action dropdown and modals

* chore: delete legacy DomainTable component
Good riddance

* remove DomainTable from components index

* refactor: remove unused variables and imports

* buid: upgrade zns-sdk to v0.1.12

* feat(domain-data): add contract to queries and types

* feat(sdk-migration): use sdk method for transfer ownership functionality

* feat(sdk-integration): fix minor issue with zns metadata

* feat(sdk-integration): add provider for zauction sdk

* feat(sdk-integration): add missing field lockedby

* feat(Sdk-integration): use library signer instead of registrar provider signer

* accept bid flow & styling

* resolve failing build - update tests

* feat(sdk-integration): update bid provider to use zAuction SDK

* refactor: remove unused imports

* feat(sdk-integration): add error handling for subdomain table row

* refactor: use zAuction SDK directly instead of through zNS SDK

* minor typo fix and remove comment

* build: upgrade zns sdk to v0.1.13

* refactor: remove unused imports, variables and files related to zAuction

* feat(sdk-integration): reload zns data on network change

* build: upgrade zns sdk to v0.1.14

* build: upgrade zauction sdk to v0.0.40

* refactor: remove zns domain data provider & obsolete queries

* refactor: minor optimizations to use bid provider hook

* refactor: remove obsolete queries, imports and variables

* refactor(subdomain-table): better encapsulation

* feat(sdk-integration): update domain search to use sdk methods

* remove unused BidProvider file

* simplify constants - replace one item objects

* improve text style and tidy code

* tidy up handling of step titles on accept bid flow

* tidy up title handling on transfer ownership flow

* remove duplicate code - generic details component

* extract sort by date functionality

* extract utils to global util directory

* break sentence string on notification drawer due to long domains

* requested changes - update order of flow and minor design tweaks

* resolve failing test

* build: upgrade zfi sdk to v0.1.16

* feat: Allow retrieval of buy now price when no wallet connected (#428)

* chore: upgrade zNS-SDK and zAuction-SDK versions

* feat(zns-sdk-provider): add handling for default provider
Some minor refactoring to make the hook more readable, namely by replacing chain ID numbers with NETWORK_TYPES
Removed unused functions to make file thinner

* fix: allow fetch buy now price without wallet connected

* feat(sdk-integration): refactor the zAuction instance creation

* refactor: delete the queries and obsolete files

* Add StepBar to Accept Bid Flow Wizard

* add missing set step

* minor copy change to price format

* minor naming changes to utils and remove console.log

* remove unused var

* custom max character length for truncateDomain util

* rename truncateAddress to truncateWalletAddress

* allow for truncated domain in Wizard NFTDetails with max length set

* edit accept bid wizard nft details to use truncated domain

* truncate make a bid domain name and update domain color

* Make a bid step 3 truncate domain

* refactor: simplify NFTView container (#424)

* refactor NFTView component

* Update by PR feedback

Co-authored-by: Brett <12437916+colbr@users.noreply.github.com>

* fix: missed change in develop merge

* refactor: remove unneeded dependency

* bump sdk and resolve errors

* Make dApp read ‘stakingrequests’ and ‘stakingRequests’

* error messages to prevent owner transferring to their own account

* rename instances of auctionId to bidNonce

* feat(sdk-integration): update change in properties of bid object

* truncate header if 90 characters

* build: fix failing test cases due to change in data type

* tidy up responsiveness for header/nav bar

* chore: fix lint issues

* build: upgrade zns, zauction and zsale sdk to latest version

* refactor: remove log statment

* replace auctionId with bidNonce

* add version property and disable cancel for version 1 bids

* use version property to disable accept bid for v1 zAuction bids

* revert previous changes

* update cancel bid for version 1 bids

* update tests for v1 and v2 bids

* remove console.log

* bump sdk packages

* chore: npm i

* feedback changes - copy and domain

* resolve conflicts

* remove request table from components index file

* filter own bids out of bid list

* revert deletion of RequestTable

* add missing wilder jpeg

* new lines at end of file - lint

* refactor: rename mint wheels to more generic mint drop nft

* refactor: enable mint drop nft banner

* refactor: add zsale sdk provider

* feat(zsale-integration): update existing helpers to use sdk methods

* feat(zsale-integration): update useMint hook to use sdk methods for nft purchase

* refactor(zsale-integration): remove hard coded values and update to use helpers

* refactor: update sdk providers to hooks

* refactor: fix warnings due to missing keys

* feat(zsale-sdk): update banner sale times for testing

* feat(zsale-sdk): update contract address and merkleTreeFileUri

* fix: add missing NFT name to NFTView

* bug: add missing toast notification drawer

* refactor: remove logs

* remove console log

* add toast notifications to buy now and set buy now flows

* build: upgrade zauction sdk to 0.0.48

* feat(zauction-v2): include bid in zauction methods for backwards compatibility

* remove duplicate error line

* remove duplicate line for failed zAuction

* build: update zauction sdk to v0.0.51

* build: upgrade zauction and zns sdk to latest version

* refactor: add any as type for catch error param

* refactor: update dapp to use zauction through zns sdk

* refactor: remove unused hook useZAuctionSDK

* build: upgrade zNS SDK to v0.1.23

* update zAuction sdk

* Fix biddable feature from domain metadata

* feat(sdk-integration): remove registrar and use sdk method to get lock status

* feat(sdk-integration): update etherscan url

* Remove console log and update the sentence to disabled domain make a bid modal

* Use domain metadata parsing at one place

* fix(subdomain-table): show bid button by default (#448)

* Remove console log on bid steps

* fix(nft-view): use proper metadata title (#451)

* feat(domain-search): fix issue with domain search

* build: fix issue with hot reloading - react/create-react-app#11773

* Fix header searching sticky issue

* develop <- master (#457)

* fix: remove 3 from NFTView

* build: increment version number

* fix(history-item): remove cursed 3

* chore: npm i

* chore: bump version number

* build: upgrade zNS SDK to v0.1.27 and zAuction SDK to v0.0.58

* feat: hide banner for now

* chore: SDK version bump, zAuction V2 mainnet address

Co-authored-by: ericlow <eric.l@turing.com>
Co-authored-by: ericlowturing <91501349+ericlowturing@users.noreply.github.com>
Co-authored-by: dominic <domw30@gmail.com>
Co-authored-by: Subrahmanyam Padala <subrahmanyam03@gmail.com>
Co-authored-by: James Earle <j_earle@hotmail.com>
Co-authored-by: Subrahmanyam Padala <subbu@lambda.local>
Co-authored-by: joonchoi0918 <101390821+joonchoi0918@users.noreply.github.com>
Co-authored-by: ericlow <eric.low.dev@gmail.com>
Co-authored-by: eric-zero-dev <91501349+eric-zero-dev@users.noreply.github.com>
colbr added a commit that referenced this pull request Apr 1, 2022
* refactor(cancel-bid): reduce complexity

* test(cancel-bid): improve testing coverage

* feat(nft-view): add cancel bid button to NFT view

* fix(bid-table): better spacing of bid table button

* fix: handle 'wilder.' domain names properly

* fix(zAuction): remove caching so user bids can update

* Update Transfer Flow - add step wizard and modify logic/styles

* feat(useZnsDomain): switch to SDK for domain data retrieval

* complete tooltip step and styling touches

* Switch StakingRequestProvider to Redux

* fix(nft-view): change logic for hiding Your Bid

* feat(accept-bid): use zauction sdk method to accept bid

* review changes

* update constants on NFTDetails

* final fixes

* resolve memory leak console error - prevent state update on unmounted component

* feat(accept-bid): handle pending and completed tx
When pending, show pending message in View Bids
When completed, hide View Bids and add notification

* Fix PR feedback

* add background-primary class to resolve firefox blur issue

* add type policies object to inMemoryCache - set merge to domains query to resolve warning

* remove blur class to prevent !important override

* add HoverDropDown common component and adjust styling - update BuyTokenRedirect and InfoPanel

* implement HoverDropDown to status buttons

* resolve build fail

* Fix compile error

* Fix eslint warnnings

* hover state of zero number button and position of dropdown content element

* minor tweaks to style

* rename and resolve merge conflict

* remove commented code

* attempt to resolve build fail

* switch order of dropdown components in index dropdowns file in attempt to resolve failing tests on circle ci build

* update index.js components - remove * export

* revert file changes

* correct import

* name change hack to push file name changes

* hacky name change to resolve build error step 1

* hacky name change to resolve build error step 2

* update zns-sdk

* update rinkeby zauction address

* push package-lock.json changes

* wip/feat(owned-domains-table): switch to GenericTable component

* ensure content dropdown remains open when over gap between elements

* Refactor Page Container component

* update packages

* Fix to show bid button by setting isBiddable as true as default

* Fix zna in MintNewNFT modal

* feat(nft-view): move transfer button to dropdown

* refactor(nft-view): purge some unused css

* Fix znas string value and link in Mint and Transfer modals

* refactor(metadata): migrate code to use sdk method to fetch metadata in useDomainMetadata

* add useAcceptBit and constants

* WIP implementing zauction approval and approve bid using SDK for accept bid

* refactor(make-a-bid): use SDK for getting bid
Also added some simplifications

* feat: add refetch method to useOwnedDomains

* refactor(owned-domains-table): simplify code

* Merge branch 'develop' into feat/dom/accept-bid-sdk

* refactor(owned-domains-table): remove unimportant comment and import

* feat(owned-domains-table): handle action dropdown and modals

* chore: delete legacy DomainTable component
Good riddance

* remove DomainTable from components index

* refactor: remove unused variables and imports

* buid: upgrade zns-sdk to v0.1.12

* feat(domain-data): add contract to queries and types

* feat(sdk-migration): use sdk method for transfer ownership functionality

* feat(sdk-integration): fix minor issue with zns metadata

* feat(sdk-integration): add provider for zauction sdk

* feat(sdk-integration): add missing field lockedby

* feat(Sdk-integration): use library signer instead of registrar provider signer

* accept bid flow & styling

* resolve failing build - update tests

* feat(sdk-integration): update bid provider to use zAuction SDK

* refactor: remove unused imports

* feat(sdk-integration): add error handling for subdomain table row

* refactor: use zAuction SDK directly instead of through zNS SDK

* minor typo fix and remove comment

* build: upgrade zns sdk to v0.1.13

* refactor: remove unused imports, variables and files related to zAuction

* feat(sdk-integration): reload zns data on network change

* build: upgrade zns sdk to v0.1.14

* build: upgrade zauction sdk to v0.0.40

* refactor: remove zns domain data provider & obsolete queries

* refactor: minor optimizations to use bid provider hook

* refactor: remove obsolete queries, imports and variables

* refactor(subdomain-table): better encapsulation

* feat(sdk-integration): update domain search to use sdk methods

* remove unused BidProvider file

* simplify constants - replace one item objects

* improve text style and tidy code

* tidy up handling of step titles on accept bid flow

* tidy up title handling on transfer ownership flow

* remove duplicate code - generic details component

* extract sort by date functionality

* extract utils to global util directory

* break sentence string on notification drawer due to long domains

* requested changes - update order of flow and minor design tweaks

* resolve failing test

* build: upgrade zfi sdk to v0.1.16

* feat: Allow retrieval of buy now price when no wallet connected (#428)

* chore: upgrade zNS-SDK and zAuction-SDK versions

* feat(zns-sdk-provider): add handling for default provider
Some minor refactoring to make the hook more readable, namely by replacing chain ID numbers with NETWORK_TYPES
Removed unused functions to make file thinner

* fix: allow fetch buy now price without wallet connected

* feat(sdk-integration): refactor the zAuction instance creation

* refactor: delete the queries and obsolete files

* Add StepBar to Accept Bid Flow Wizard

* add missing set step

* minor copy change to price format

* minor naming changes to utils and remove console.log

* remove unused var

* custom max character length for truncateDomain util

* rename truncateAddress to truncateWalletAddress

* allow for truncated domain in Wizard NFTDetails with max length set

* edit accept bid wizard nft details to use truncated domain

* truncate make a bid domain name and update domain color

* Make a bid step 3 truncate domain

* refactor: simplify NFTView container (#424)

* refactor NFTView component

* Update by PR feedback

Co-authored-by: Brett <12437916+colbr@users.noreply.github.com>

* fix: missed change in develop merge

* refactor: remove unneeded dependency

* bump sdk and resolve errors

* Make dApp read ‘stakingrequests’ and ‘stakingRequests’

* error messages to prevent owner transferring to their own account

* rename instances of auctionId to bidNonce

* feat(sdk-integration): update change in properties of bid object

* truncate header if 90 characters

* build: fix failing test cases due to change in data type

* tidy up responsiveness for header/nav bar

* chore: fix lint issues

* build: upgrade zns, zauction and zsale sdk to latest version

* refactor: remove log statment

* replace auctionId with bidNonce

* add version property and disable cancel for version 1 bids

* use version property to disable accept bid for v1 zAuction bids

* revert previous changes

* update cancel bid for version 1 bids

* update tests for v1 and v2 bids

* remove console.log

* bump sdk packages

* chore: npm i

* feedback changes - copy and domain

* resolve conflicts

* remove request table from components index file

* filter own bids out of bid list

* revert deletion of RequestTable

* add missing wilder jpeg

* new lines at end of file - lint

* refactor: rename mint wheels to more generic mint drop nft

* refactor: enable mint drop nft banner

* refactor: add zsale sdk provider

* feat(zsale-integration): update existing helpers to use sdk methods

* feat(zsale-integration): update useMint hook to use sdk methods for nft purchase

* refactor(zsale-integration): remove hard coded values and update to use helpers

* refactor: update sdk providers to hooks

* refactor: fix warnings due to missing keys

* feat(zsale-sdk): update banner sale times for testing

* feat(zsale-sdk): update contract address and merkleTreeFileUri

* fix: add missing NFT name to NFTView

* bug: add missing toast notification drawer

* refactor: remove logs

* remove console log

* add toast notifications to buy now and set buy now flows

* build: upgrade zauction sdk to 0.0.48

* feat(zauction-v2): include bid in zauction methods for backwards compatibility

* remove duplicate error line

* remove duplicate line for failed zAuction

* build: update zauction sdk to v0.0.51

* build: upgrade zauction and zns sdk to latest version

* refactor: add any as type for catch error param

* refactor: update dapp to use zauction through zns sdk

* refactor: remove unused hook useZAuctionSDK

* build: upgrade zNS SDK to v0.1.23

* update zAuction sdk

* Fix biddable feature from domain metadata

* feat(sdk-integration): remove registrar and use sdk method to get lock status

* feat(sdk-integration): update etherscan url

* Remove console log and update the sentence to disabled domain make a bid modal

* Use domain metadata parsing at one place

* fix(subdomain-table): show bid button by default (#448)

* Remove console log on bid steps

* fix(nft-view): use proper metadata title (#451)

* feat(domain-search): fix issue with domain search

* build: fix issue with hot reloading - react/create-react-app#11773

* Fix header searching sticky issue

* develop <- master (#457)

* fix: remove 3 from NFTView

* build: increment version number

* fix(history-item): remove cursed 3

* chore: npm i

* chore: bump version number

* build: upgrade zNS SDK to v0.1.27 and zAuction SDK to v0.0.58

* feat: hide banner for now

* chore: SDK version bump, zAuction V2 mainnet address

* refactor: use context API for SDK use (#454)

* Fix to parse domain metadata from current domain instead of parent domain

* fix: Stake Pool table improvements (#413)

* chore: upgrade zFI-SDK to 0.1.16
This upgrade brings faster pool data loading

* fix(stake-pool): fix infinitely loading user balances

* refactor(stake-pool-table): made code slightly more readable

* chore: remove linter warnings

* feat(stake-pool-table): handle failed load
Also some slight refactoring

* test(stake-pool-table): add tests for table row

* fix(stake-pools): fix bug where stake pools wouldn't load

* fix(deposits): fix total stake not loading if 0

* fix(deposits): consistent stat widget height

* chore: bump version number

Co-authored-by: ericlowturing <91501349+ericlowturing@users.noreply.github.com>
Co-authored-by: dominic <domw30@gmail.com>
Co-authored-by: ericlow <eric.l@turing.com>
Co-authored-by: Subrahmanyam Padala <subrahmanyam03@gmail.com>
Co-authored-by: James Earle <j_earle@hotmail.com>
Co-authored-by: Subrahmanyam Padala <subbu@lambda.local>
Co-authored-by: joonchoi0918 <101390821+joonchoi0918@users.noreply.github.com>
Co-authored-by: ericlow <eric.low.dev@gmail.com>
Co-authored-by: eric-zero-dev <91501349+eric-zero-dev@users.noreply.github.com>
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.

3 participants

0