From 3e1540b8227675a366482d3d82143afb2377b986 Mon Sep 17 00:00:00 2001 From: sehyunc <41171808+sehyunc@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:14:41 -0700 Subject: [PATCH] initial mobile commit --- app/assets/assets-table/data-table.tsx | 14 +- app/assets/history-table/columns.tsx | 8 +- app/assets/history-table/data-table.tsx | 12 +- app/assets/page-client.tsx | 68 ++-- app/assets/page.tsx | 2 +- app/components/account-menu.tsx | 2 +- app/components/connect-wallet-button.tsx | 8 +- app/components/deposit-banner.tsx | 70 +++- app/components/footer.tsx | 6 +- app/components/header.tsx | 54 ++- app/components/mobile-bottom-bar.tsx | 65 ++++ app/components/mobile-nav-sheet.tsx | 163 +++++++++ app/components/zendesk.tsx | 17 + app/layout.tsx | 25 +- app/orders/columns.tsx | 14 +- app/orders/data-table.tsx | 12 +- app/orders/page-client.tsx | 18 +- app/orders/page.tsx | 2 +- app/stats/page-client.tsx | 38 +- app/stats/page.tsx | 2 +- app/trade/[base]/actions.ts | 3 +- app/trade/[base]/components/bbo-marquee.tsx | 44 +-- .../[base]/components/charts/price-chart.tsx | 2 +- .../components/charts/tradingview/config.ts | 2 + .../components/charts/tradingview/index.tsx | 11 +- .../[base]/components/connect-button.tsx | 10 +- .../mobile-asset-price-accordion.tsx | 96 +++++ .../components/new-order/assets-section.tsx | 42 ++- .../new-order/max-orders-warning.tsx | 24 +- .../components/new-order/new-order-form.tsx | 332 +++++++++--------- .../components/new-order/new-order-panel.tsx | 30 +- .../new-order/no-balance-slot-warning.tsx | 24 +- .../order-details/details-content.tsx | 59 ++-- .../order-details/empty-content.tsx | 40 +-- .../order-details/insufficient-warning.tsx | 20 +- .../order-details/order-details-sheet.tsx | 73 ++-- app/trade/[base]/events/order-events.ts | 5 + app/trade/[base]/page-client.tsx | 85 +++-- app/trade/[base]/page.tsx | 4 +- .../steps/success-without-savings.tsx | 223 ------------ .../desktop}/new-order-stepper.tsx | 79 +---- .../desktop}/steps/default.tsx | 107 +++--- .../desktop/steps/success-without-savings.tsx | 91 +++++ .../desktop}/steps/success.tsx | 6 +- .../mobile/new-order-stepper.tsx | 117 ++++++ .../order-stepper/mobile/steps/confirm.tsx | 80 +++++ .../order-stepper/mobile/steps/default.tsx | 43 +++ .../mobile/steps/success-without-savings.tsx | 75 ++++ .../order-stepper/mobile/steps/success.tsx | 159 +++++++++ components/dialogs/sign-in-dialog.tsx | 136 ++++--- components/dialogs/token-select-dialog.tsx | 23 +- components/dialogs/token-select.tsx | 8 +- .../dialogs/transfer/max-balances-warning.tsx | 20 +- .../dialogs/transfer/transfer-dialog.tsx | 43 ++- components/did-you-know-content.tsx | 70 ++++ components/number-input.tsx | 1 + components/order-status-display.tsx | 45 +++ components/table-empty-state.tsx | 5 +- components/table-select.tsx | 2 +- components/ui/button.tsx | 2 +- components/ui/drawer.tsx | 3 +- components/ui/dropdown-menu.tsx | 3 +- components/ui/popover.tsx | 13 +- components/ui/responsive-tooltip.tsx | 64 ++++ components/ui/sonner.tsx | 3 + components/ui/table.tsx | 44 +-- hooks/use-fees-check.ts | 2 +- hooks/use-shared-media-query.ts | 60 ++++ hooks/use-sign-in-and-connect.ts | 4 +- lib/constants/protocol.ts | 9 +- lib/cookie.ts | 8 +- lib/token.ts | 11 + lib/utils.ts | 19 + middleware.ts | 13 +- package.json | 8 +- pnpm-lock.yaml | 77 +++- providers/wagmi-provider/wagmi-provider.tsx | 5 +- public/static/theme.css | 19 + 78 files changed, 2192 insertions(+), 1014 deletions(-) create mode 100644 app/components/mobile-bottom-bar.tsx create mode 100644 app/components/mobile-nav-sheet.tsx create mode 100644 app/components/zendesk.tsx create mode 100644 app/trade/[base]/components/mobile-asset-price-accordion.tsx create mode 100644 app/trade/[base]/events/order-events.ts delete mode 100644 components/dialogs/new-order-stepper/steps/success-without-savings.tsx rename components/dialogs/{new-order-stepper => order-stepper/desktop}/new-order-stepper.tsx (55%) rename components/dialogs/{new-order-stepper => order-stepper/desktop}/steps/default.tsx (70%) create mode 100644 components/dialogs/order-stepper/desktop/steps/success-without-savings.tsx rename components/dialogs/{new-order-stepper => order-stepper/desktop}/steps/success.tsx (95%) create mode 100644 components/dialogs/order-stepper/mobile/new-order-stepper.tsx create mode 100644 components/dialogs/order-stepper/mobile/steps/confirm.tsx create mode 100644 components/dialogs/order-stepper/mobile/steps/default.tsx create mode 100644 components/dialogs/order-stepper/mobile/steps/success-without-savings.tsx create mode 100644 components/dialogs/order-stepper/mobile/steps/success.tsx create mode 100644 components/did-you-know-content.tsx create mode 100644 components/order-status-display.tsx create mode 100644 components/ui/responsive-tooltip.tsx create mode 100644 hooks/use-shared-media-query.ts diff --git a/app/assets/assets-table/data-table.tsx b/app/assets/assets-table/data-table.tsx index 283c2bd0..e21954c2 100644 --- a/app/assets/assets-table/data-table.tsx +++ b/app/assets/assets-table/data-table.tsx @@ -91,14 +91,14 @@ export function DataTable({ return ( <> -
+
Your deposits inside of Renegade. Only you and your connected relayer can see your balances.
-
+
- + ({ - + ({ - + ({
-
+
{table.getHeaderGroups().map((headerGroup) => ( diff --git a/app/assets/history-table/columns.tsx b/app/assets/history-table/columns.tsx index 662b6667..b00f3bb9 100644 --- a/app/assets/history-table/columns.tsx +++ b/app/assets/history-table/columns.tsx @@ -30,7 +30,7 @@ export const columns: ColumnDef[] = [ }, { accessorKey: "mint", - header: () =>
Asset
, + header: () =>
Asset
, cell: ({ row }) => { const mint = row.getValue<`0x${string}`>("mint") const token = Token.findByAddress(mint) @@ -56,7 +56,9 @@ export const columns: ColumnDef[] = [ }, { id: "usdValue", - header: () =>
Amount ($)
, + header: () => ( +
Amount ($)
+ ), cell: function Cell({ row }) { const mint = row.getValue<`0x${string}`>("mint") const token = Token.findByAddress(mint) @@ -106,7 +108,7 @@ export const columns: ColumnDef[] = [ cell: ({ row }) => { const timestamp = row.getValue("timestamp") const formatted = formatTimestamp(timestamp) - return
{formatted}
+ return
{formatted}
}, }, ] diff --git a/app/assets/history-table/data-table.tsx b/app/assets/history-table/data-table.tsx index 731168cf..1179f7ba 100644 --- a/app/assets/history-table/data-table.tsx +++ b/app/assets/history-table/data-table.tsx @@ -16,8 +16,6 @@ import { import { TableEmptyState } from "@/components/table-empty-state" import { TableSelect } from "@/components/table-select" import { Button } from "@/components/ui/button" -import { Label } from "@/components/ui/label" -import { Switch } from "@/components/ui/switch" import { Table, TableBody, @@ -122,7 +120,7 @@ export function DataTable({ return ( <> -
+
Filters
({ Clear ) : null} -
+
- + ({
-
+
{table.getHeaderGroups().map((headerGroup) => ( diff --git a/app/assets/page-client.tsx b/app/assets/page-client.tsx index ec3287bb..4cc7fdaa 100644 --- a/app/assets/page-client.tsx +++ b/app/assets/page-client.tsx @@ -17,10 +17,10 @@ import { DataTable as AssetTable } from "@/app/assets/assets-table/data-table" import { DataTable as TransferHistoryTable } from "@/app/assets/history-table/data-table" import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from "@/components/ui/tooltip" + ResponsiveTooltip, + ResponsiveTooltipContent, + ResponsiveTooltipTrigger, +} from "@/components/ui/responsive-tooltip" import { usePriceQueries } from "@/hooks/use-price-queries" import { useRefreshOnBlock } from "@/hooks/use-refresh-on-block" @@ -157,36 +157,36 @@ export function PageClient() { }, [transferHistory]) return ( -
-
-
-

- Assets -

- - - - - - Where are my assets? - - - -

{ASSETS_TOOLTIP}

-
-
-
-
-

- Transfer History -

+
+
+

+ Assets +

+ + + + + + Where are my assets? + + + +

{ASSETS_TOOLTIP}

+
+
+
+
+

+ Transfer History +

+
+
diff --git a/app/components/account-menu.tsx b/app/components/account-menu.tsx index 88501b06..e4660249 100644 --- a/app/components/account-menu.tsx +++ b/app/components/account-menu.tsx @@ -40,7 +40,7 @@ export function AccountDropdown({ children }: { children: React.ReactNode }) { return ( {children} - + diff --git a/app/components/connect-wallet-button.tsx b/app/components/connect-wallet-button.tsx index e6e51a27..99c8585b 100644 --- a/app/components/connect-wallet-button.tsx +++ b/app/components/connect-wallet-button.tsx @@ -2,14 +2,18 @@ import { SignInDialog } from "@/components/dialogs/sign-in-dialog" import { Button } from "@/components/ui/button" import { useSignInAndConnect } from "@/hooks/use-sign-in-and-connect" +import { cn } from "@/lib/utils" -export function ConnectWalletButton() { +export function ConnectWalletButton({ className }: { className?: string }) { const { handleClick, content, open, onOpenChange } = useSignInAndConnect() return ( <> + + +
+
+ ) + } return (
-
-
- Welcome to Renegade! Deposit your Arbitrum tokens to get started. -
+
- +
+ Welcome to Renegade! Deposit your Arbitrum tokens to get started. +
+ + + +
+
+ {address ? ( + + + + ) : ( + + )} + {status === "in relayer" && ( + + + + )} +
+
+
+
@@ -105,7 +150,7 @@ export function Header() { Stats -
+
{status === "in relayer" && ( <> {/* @@ -142,7 +187,6 @@ export function Header() { {status === "in relayer" && ( + + + + + + + ) : ( + <> + + + + )} +
+
+ ) +} diff --git a/app/components/mobile-nav-sheet.tsx b/app/components/mobile-nav-sheet.tsx new file mode 100644 index 00000000..e2e04397 --- /dev/null +++ b/app/components/mobile-nav-sheet.tsx @@ -0,0 +1,163 @@ +import { useState } from "react" + +import Image from "next/image" +import Link from "next/link" +import { usePathname } from "next/navigation" + +import { VisuallyHidden } from "@radix-ui/react-visually-hidden" +import { Book } from "lucide-react" + +import { Button } from "@/components/ui/button" +import { Separator } from "@/components/ui/separator" +import { + Sheet, + SheetContent, + SheetDescription, + SheetHeader, + SheetTitle, + SheetTrigger, +} from "@/components/ui/sheet" + +export function MobileNavSheet({ children }: { children: React.ReactNode }) { + const [open, setOpen] = useState(false) + const pathname = usePathname() + + const handleLinkClick = (href: string) => { + if (pathname.includes(href)) { + setOpen(false) + } + } + + return ( + + {children} + + + + Menu + Click on a link! + + +
+ handleLinkClick("/trade")} + > + + + handleLinkClick("/trade")} + > + Trade + + handleLinkClick("/assets")} + > + Assets + + handleLinkClick("/orders")} + > + Orders + + handleLinkClick("/stats")} + > + Stats + +
+ +
+ + + + +
+
+
+ ) +} diff --git a/app/components/zendesk.tsx b/app/components/zendesk.tsx new file mode 100644 index 00000000..42ceab89 --- /dev/null +++ b/app/components/zendesk.tsx @@ -0,0 +1,17 @@ +"use client" + +import Script from "next/script" + +import { useMediaQuery } from "@/hooks/use-media-query" + +export function Zendesk() { + const isDesktop = useMediaQuery("(min-width: 1024px)") + if (!isDesktop) return <> + return ( +