-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SUPPORT] : Rework Market with ReactQuery in LLD (#6340)
* WIP * WIP 2 * Add tool in settings * Remove MarketDataProvider from LLD * WIP 3 * Clean code 🧹 * fix some lint checks * Fix Search and LiveCompatible filter * 🧹 * fix some bugs * isLiveSupported wasn't used in codebase in both LLM/LLD * Reorg files * Reorg files * Fix BreadCrump * fix loader * Enrich market store * fix type in store * Reorg hook's content * Fix search and stared api call + Countervalue/range in MarketCoin + fix e2E tests * Add FF refreshTime rate for LLD * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot * Fix some reviews comments * Mask graphs * remove darwin * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot * Add Mask EthStacking * fix marketCoin screenshot * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot * Add peerDependency * Add changeset * Only 1 call for range * Mask items + fix screenshots * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot * Mask itemson ethStacking test * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot * Mask items on Coin detail page * Refresh on Scroll or on position page every x time * Add some test on utils * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot * Fix coming back to page and don't refetch everything * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot * Fix refetch * Fix double fetch * Fix color in chart * test(lld): update screenshots (ubuntu-latest) lld, test, screenshot --------- Co-authored-by: live-github-bot[bot] <105061298+live-github-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4ae85cb
commit 433bfec
Showing
61 changed files
with
1,962 additions
and
1,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/live-common": patch | ||
--- | ||
|
||
New hooks to fecth Data from CVS and update Market without using MarketDataProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": patch | ||
--- | ||
|
||
Use new Hook for Market and Remove MarketDataProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { MarketListRequestParams } from "@ledgerhq/live-common/market/types"; | ||
|
||
export const setMarketOptions = (payload: MarketListRequestParams) => ({ | ||
type: "MARKET_SET_VALUES", | ||
payload, | ||
}); | ||
|
||
export const addStarredMarketCoins = (payload: string) => ({ | ||
type: "ADD_STARRED_MARKET_COINS", | ||
payload, | ||
}); | ||
export const removeStarredMarketCoins = (payload: string) => ({ | ||
type: "REMOVE_STARRED_MARKET_COINS", | ||
payload, | ||
}); | ||
|
||
export const setMarketCurrentPage = (payload: number) => ({ | ||
type: "MARKET_SET_CURRENT_PAGE", | ||
payload, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { handleActions } from "redux-actions"; | ||
import { Handlers } from "./types"; | ||
import { MarketListRequestParams } from "@ledgerhq/live-common/market/types"; | ||
|
||
export type MarketState = { | ||
marketParams: MarketListRequestParams; | ||
starredMarketCoins: string[]; | ||
currentPage: number; | ||
}; | ||
|
||
const initialState: MarketState = { | ||
marketParams: { | ||
range: "24h", | ||
limit: 50, | ||
ids: [], | ||
starred: [], | ||
orderBy: "market_cap", | ||
order: "desc", | ||
search: "", | ||
liveCompatible: false, | ||
page: 1, | ||
counterCurrency: "usd", | ||
}, | ||
currentPage: 1, | ||
starredMarketCoins: [], | ||
}; | ||
|
||
type HandlersPayloads = { | ||
MARKET_SET_VALUES: MarketListRequestParams; | ||
ADD_STARRED_MARKET_COINS: string; | ||
REMOVE_STARRED_MARKET_COINS: string; | ||
MARKET_SET_CURRENT_PAGE: number; | ||
}; | ||
|
||
type MarketHandlers<PreciseKey = true> = Handlers<MarketState, HandlersPayloads, PreciseKey>; | ||
|
||
const handlers: MarketHandlers = { | ||
MARKET_SET_VALUES: (state: MarketState, { payload }: { payload: MarketListRequestParams }) => ({ | ||
...state, | ||
marketParams: { | ||
...state.marketParams, | ||
...payload, | ||
}, | ||
}), | ||
ADD_STARRED_MARKET_COINS: (state: MarketState, { payload }: { payload: string }) => ({ | ||
...state, | ||
starredMarketCoins: [...state.starredMarketCoins, payload], | ||
}), | ||
REMOVE_STARRED_MARKET_COINS: (state: MarketState, { payload }: { payload: string }) => ({ | ||
...state, | ||
starredMarketCoins: state.starredMarketCoins.filter(id => id !== payload), | ||
}), | ||
MARKET_SET_CURRENT_PAGE: (state: MarketState, { payload }: { payload: number }) => ({ | ||
...state, | ||
currentPage: payload, | ||
}), | ||
}; | ||
|
||
// Selectors | ||
|
||
export const marketParamsSelector = (state: { market: MarketState }) => state.market.marketParams; | ||
export const starredMarketCoinsSelector = (state: { market: MarketState }) => | ||
state.market.starredMarketCoins; | ||
export const marketCurrentPageSelector = (state: { market: MarketState }) => | ||
state.market.currentPage; | ||
// Exporting reducer | ||
|
||
export default handleActions<MarketState, HandlersPayloads[keyof HandlersPayloads]>( | ||
handlers as unknown as MarketHandlers<false>, | ||
initialState, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.