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

Fix time filters and default to D3 #6362

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/Discover/TrendingTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ function NetworkFilter() {

function TimeFilter() {
const timeframe = useTrendingTokensStore(state => state.timeframe);
const shouldAbbreviate = timeframe === Timeframe.H24;
const shouldAbbreviate = timeframe === Timeframe.H24 || timeframe === Timeframe.H12;

return (
<DropdownMenu
Expand All @@ -578,7 +578,7 @@ function TimeFilter() {
onPressMenuItem={timeframe => useTrendingTokensStore.getState().setTimeframe(timeframe)}
>
<FilterButton
selected={timeframe !== Timeframe.H24}
selected={timeframe !== Timeframe.D3}
iconColor={undefined}
highlightedBackgroundColor={undefined}
label={shouldAbbreviate ? i18n.t(t.filters.time[`${timeframe}_ABBREVIATED`]) : i18n.t(t.filters.time[timeframe])}
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3063,7 +3063,7 @@
"H24": "24 Hours",
"H24_ABBREVIATED": "24h",
"D7": "1 Week",
"D3": "1 Month"
"D3": "3 Days"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/state/trendingTokens/trendingTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const sortFilters = [
ArcTrendingSort.TopLosers,
] as const;
export type TrendingSort = (typeof sortFilters)[number];
export const timeFilters = [ArcTimeframe.H24, ArcTimeframe.D7, ArcTimeframe.D3] as const;
export const timeFilters = [ArcTimeframe.H12, ArcTimeframe.H24, ArcTimeframe.D3, ArcTimeframe.D7] as const;
export type TrendingTimeframe = (typeof timeFilters)[number];

type TrendingTokensState = {
Expand All @@ -36,7 +36,7 @@ export const useTrendingTokensStore = createRainbowStore<TrendingTokensState>(
set => ({
category: ArcTrendingCategory.Trending,
chainId: undefined,
timeframe: ArcTimeframe.H24,
timeframe: ArcTimeframe.D3,
sort: ArcTrendingSort.Recommended,
setCategory: category => set({ category }),
setChainId: chainId => {
Expand Down
Loading