From 1118bfe80374290445e226fcbd52c19fa6c59f2f Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Fri, 9 Jan 2026 10:58:02 +0100 Subject: [PATCH] chore(orderbook): split orderbook dialog and content --- src/components/orderbook/Orderbook.tsx | 230 +++++++------------ src/components/orderbook/OrderbookDialog.tsx | 22 +- 2 files changed, 88 insertions(+), 164 deletions(-) diff --git a/src/components/orderbook/Orderbook.tsx b/src/components/orderbook/Orderbook.tsx index 8644c3ac..d85a019b 100644 --- a/src/components/orderbook/Orderbook.tsx +++ b/src/components/orderbook/Orderbook.tsx @@ -85,11 +85,11 @@ const offerToTableEntry = ( } } -interface OrderbookProps { - isModal?: boolean +interface OrderbookContentProps { + className?: string } -export const Orderbook = ({ isModal = false }: OrderbookProps) => { +export const OrderbookContent = ({ className }: OrderbookContentProps) => { const { t, i18n } = useTranslation() const nickname = useStore(jmSessionStore, (state) => state.state?.nickname) @@ -248,173 +248,86 @@ export const Orderbook = ({ isModal = false }: OrderbookProps) => { } return ( -
- {/* Header */} - {!isModal && ( -
-
- -

- {searchQuery === '' - ? t('orderbook.text_orderbook_summary', { - count: tableEntries.length, - counterpartyCount: new Set(tableEntries.map((e) => e.counterparty)).size, - }) - : t('orderbook.text_orderbook_summary_filtered', summary)} -

-
+
+
+
+

+ {searchQuery === '' + ? t('orderbook.text_orderbook_summary', { + count: tableEntries.length, + counterpartyCount: new Set(tableEntries.map((e) => e.counterparty)).size, + }) + : t('orderbook.text_orderbook_summary_filtered', summary)} +

+
-
- {showDemoButton && ( +
+ {showDemoButton && ( + + )} + +
+
- )} - -
-
+
-
- - {showRefreshDropdown && ( -
- -
- )} -
+ {showRefreshDropdown && ( +
+ +
+ )}
- - setSearchQuery(e.target.value)} - className="w-64" - disabled={isFetching} - />
+ + setSearchQuery(e.target.value)} + className="w-64" + disabled={isFetching} + />
- )} - - {/* Modal Header with controls */} - {isModal && ( -
-
-

- {searchQuery === '' - ? t('orderbook.text_orderbook_summary', { - count: tableEntries.length, - counterpartyCount: new Set(tableEntries.map((e) => e.counterparty)).size, - }) - : t('orderbook.text_orderbook_summary_filtered', summary)} -

-
- -
- {showDemoButton && ( - - )} - -
-
- -
- - {showRefreshDropdown && ( -
- -
- )} -
-
-
- - setSearchQuery(e.target.value)} - className="w-64" - disabled={isFetching} - /> -
-
- )} +
{/* Controls */} {nickname && ( @@ -480,3 +393,14 @@ export const Orderbook = ({ isModal = false }: OrderbookProps) => {
) } + +export const Orderbook = () => { + const { t } = useTranslation() + + return ( +
+ + +
+ ) +} diff --git a/src/components/orderbook/OrderbookDialog.tsx b/src/components/orderbook/OrderbookDialog.tsx index 89fad1df..4d419016 100644 --- a/src/components/orderbook/OrderbookDialog.tsx +++ b/src/components/orderbook/OrderbookDialog.tsx @@ -1,7 +1,8 @@ import { XIcon } from 'lucide-react' import { useTranslation } from 'react-i18next' import { Button } from '@/components/ui/button' -import { Orderbook } from './Orderbook' +import PageTitle from '../PageTitle' +import { OrderbookContent } from './Orderbook' interface OrderbookDialogProps { open: boolean @@ -10,23 +11,22 @@ interface OrderbookDialogProps { export function OrderbookDialog({ open, onOpenChange }: OrderbookDialogProps) { const { t } = useTranslation() - - if (!open) return null + if (!open) { + return <> + } return ( -
- {/* Header with close button */} +
-

{t('orderbook.title')}

-
- {/* Orderbook content */}
- +
)