From dd44cc864e7ac44881e905c65378b5ab397e1024 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 9 Apr 2024 13:46:15 +0100 Subject: [PATCH] market data refactor, add 24h price change (#8) * new prices data structure * market data refactor, add 24h price change * browser language detection with middleware * middleware tweaks --- app/layout.tsx | 6 +- .../MarketData/MarketData.module.css | 10 - .../components/MarketData/MarketData.tsx | 39 +- .../prices/components/Price/Price.module.css | 9 + features/prices/components/Price/Price.tsx | 26 + .../components/Price/PriceChange.module.css | 33 ++ .../prices/components/Price/PriceChange.tsx | 13 + features/prices/components/Price/index.tsx | 1 + features/prices/hooks/use-prices.tsx | 39 +- features/strategies/components/Buy.tsx | 22 +- .../strategies/components/Swap/Results.tsx | 29 +- middleware.ts | 11 + package-lock.json | 531 +++++++++++++++++- package.json | 1 + 14 files changed, 695 insertions(+), 75 deletions(-) create mode 100644 features/prices/components/Price/Price.module.css create mode 100644 features/prices/components/Price/Price.tsx create mode 100644 features/prices/components/Price/PriceChange.module.css create mode 100644 features/prices/components/Price/PriceChange.tsx create mode 100644 features/prices/components/Price/index.tsx create mode 100644 middleware.ts diff --git a/app/layout.tsx b/app/layout.tsx index 7c6de7b..e817f18 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,6 +3,7 @@ import '@/styles/globals.css' import '@/styles/loading-ui.css' import Script from 'next/script' import { title, description, font, liveUrl, isProduction } from '@/constants' +import { headers } from 'next/headers' export const metadata: Metadata = { title, @@ -16,8 +17,11 @@ export default function RootLayout({ }: Readonly<{ children: React.ReactNode }>) { + const headersList = headers() + const locale = headersList.get('x-locale') + return ( - + {isProduction ? (