From b6c9c46da61ade9e640456ad28c41fb34ffa8db0 Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Sat, 12 Oct 2024 23:20:54 +0200 Subject: [PATCH 01/22] added settings page, account selection menu styling, --- playground/src/app/settings/page.tsx | 63 +++++++++++++++++++++ playground/src/components/AccountMenu.tsx | 47 +++++++++++---- playground/src/components/MobileOverlay.tsx | 4 +- playground/src/components/wallet-styles.css | 2 +- 4 files changed, 102 insertions(+), 14 deletions(-) create mode 100644 playground/src/app/settings/page.tsx diff --git a/playground/src/app/settings/page.tsx b/playground/src/app/settings/page.tsx new file mode 100644 index 00000000..6b81ed23 --- /dev/null +++ b/playground/src/app/settings/page.tsx @@ -0,0 +1,63 @@ +"use client"; + +import React from 'react'; +import { useForm } from 'react-hook-form'; +import PageContentWrapper from "@/components/PageContentWrapper"; +import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; +import { Input } from "@/components/ui/input"; +import { Button } from "@/components/ui/button"; +import { Save } from "lucide-react"; +import { zodResolver } from '@hookform/resolvers/zod'; +import * as z from 'zod'; + +// Define the schema for our form +const formSchema = z.object({ + productName: z.string().min(1, { message: "Product name is required" }), +}); + +// Infer the type from our schema +type FormValues = z.infer; + +const RPCClientForm: React.FC = () => { + const form = useForm({ + resolver: zodResolver(formSchema), + defaultValues: { + productName: '', + }, + }); + + const onSubmit = (data: FormValues) => { + console.log(data); + // Handle form submission + }; + + return ( + +
+
+ + ( + + Custom RPC URL + + + + {/*This is the RPC URL.*/} + + + )} + /> + + + +
+
+ ); +}; + +export default RPCClientForm; diff --git a/playground/src/components/AccountMenu.tsx b/playground/src/components/AccountMenu.tsx index fffe9df2..19f83416 100644 --- a/playground/src/components/AccountMenu.tsx +++ b/playground/src/components/AccountMenu.tsx @@ -2,12 +2,7 @@ import { EffectiveTheme } from "@/utils/EffectiveTheme"; import * as React from "react"; import { - CaretSortIcon, - CheckIcon, - ChevronDownIcon, - PlusCircledIcon, - PlusIcon, - UpdateIcon, + GearIcon, CheckIcon, ChevronDownIcon, PlusCircledIcon, PlusIcon, UpdateIcon, EnvelopeClosedIcon, ChatBubbleIcon } from "@radix-ui/react-icons"; import { cn } from "@/lib/utils"; @@ -56,6 +51,7 @@ import Sparkle from "@/utils/Sparkle"; import TruncateAddress from "@/utils/TruncateAddress"; import { WalletMultiButton } from "@solana/wallet-adapter-react-ui"; import { useGlam } from "@glam/anchor/react"; +import Link from "next/link"; const groups = [ { @@ -141,7 +137,7 @@ export default function ProductSwitcher({ className }: ProductSwitcherProps) { - + {/**/} @@ -153,7 +149,7 @@ export default function ProductSwitcher({ className }: ProductSwitcherProps) { setActiveFund(product); setOpen(false); }} - className="text-sm" + className="text-sm cursor-pointer" > {product ? ( @@ -181,15 +177,43 @@ export default function ProductSwitcher({ className }: ProductSwitcherProps) { + + { + setOpen(false); + }} + > + + +

Settings

+ + +
+ { + setOpen(false); + }} + > + + +

Feedback

+ + +
+ +
+ + + + > +
diff --git a/playground/src/components/MobileOverlay.tsx b/playground/src/components/MobileOverlay.tsx index b414311f..26311787 100644 --- a/playground/src/components/MobileOverlay.tsx +++ b/playground/src/components/MobileOverlay.tsx @@ -1,7 +1,7 @@ "use client"; import React, { useState, useEffect } from 'react'; -import { DesktopIcon } from "@radix-ui/react-icons"; +import { DesktopIcon, MobileIcon } from "@radix-ui/react-icons"; import { Button } from "@/components/ui/button"; const MobileOverlay = () => { @@ -56,7 +56,7 @@ const MobileOverlay = () => { return (
- +

Not Accessible on Mobile

GLAM is currently not available on mobile devices. Please use a desktop for the best experience. diff --git a/playground/src/components/wallet-styles.css b/playground/src/components/wallet-styles.css index 515d5531..82c99731 100644 --- a/playground/src/components/wallet-styles.css +++ b/playground/src/components/wallet-styles.css @@ -52,7 +52,7 @@ } .wallet-adapter-button-start-icon { - margin-right: 12px; + margin-right: 8px; } .wallet-adapter-collapse { From fddd8c1b0197cc6992559f01030a0821f54c99be Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Sun, 13 Oct 2024 00:31:20 +0200 Subject: [PATCH 02/22] re-enabled detail links, removed outline from tabs, disabled tabs on detail page, added openfunds csv/json links (disabled) as preview --- .../src/app/products/[product]/page.tsx | 38 ++++++++++++++++--- .../app/products/components/data-table.tsx | 17 ++++----- playground/src/components/ui/tabs.tsx | 2 +- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/playground/src/app/products/[product]/page.tsx b/playground/src/app/products/[product]/page.tsx index 751a784f..082dede0 100644 --- a/playground/src/app/products/[product]/page.tsx +++ b/playground/src/app/products/[product]/page.tsx @@ -387,11 +387,21 @@ export default function ProductPage() { Overview - Holdings - Details - Policies - Integrations - Access + + Holdings + + + Details + + + Policies + + + Integrations + + + Access + @@ -672,13 +682,29 @@ export default function ProductPage() { Openfunds + - (download) + XLSX + + CSV + + + JSON + +

diff --git a/playground/src/app/products/components/data-table.tsx b/playground/src/app/products/components/data-table.tsx index 26adbb0f..63b5317b 100644 --- a/playground/src/app/products/components/data-table.tsx +++ b/playground/src/app/products/components/data-table.tsx @@ -25,7 +25,6 @@ import { TableRow, } from "@/components/ui/table"; -import { DataTablePagination } from "./data-table-pagination"; import { DataTableToolbar } from "./data-table-toolbar"; import { columns as defaultColumns } from "./columns"; import { Product } from "../data/productSchema"; @@ -33,17 +32,17 @@ import { Product } from "../data/productSchema"; // Number of skeleton rows to display const SKELETON_ROW_COUNT = 10; -interface DataTableProps { +interface DataTableProps { columns?: ColumnDef[]; data: TData[]; isLoading: boolean; } -export function DataTable({ - columns = defaultColumns as ColumnDef[], - data, - isLoading, - }: DataTableProps) { +export function DataTable({ + columns = defaultColumns as ColumnDef[], + data, + isLoading, + }: DataTableProps) { const [rowSelection, setRowSelection] = React.useState({}); const [columnVisibility, setColumnVisibility] = React.useState({}); const [columnFilters, setColumnFilters] = React.useState([]); @@ -113,8 +112,8 @@ export function DataTable({ handleRowClick((row.original as Product).id)} + className="cursor-pointer" // Make cursor pointer + onClick={() => handleRowClick((row.original as Product).id)} > {row.getVisibleCells().map((cell) => ( diff --git a/playground/src/components/ui/tabs.tsx b/playground/src/components/ui/tabs.tsx index 26eb1091..670f1010 100644 --- a/playground/src/components/ui/tabs.tsx +++ b/playground/src/components/ui/tabs.tsx @@ -29,7 +29,7 @@ const TabsTrigger = React.forwardRef< Date: Sun, 13 Oct 2024 10:25:56 +0200 Subject: [PATCH 03/22] styling chages, typo fix, capitalization of key facts --- .../src/app/products/[product]/page.tsx | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/playground/src/app/products/[product]/page.tsx b/playground/src/app/products/[product]/page.tsx index 082dede0..f5656643 100644 --- a/playground/src/app/products/[product]/page.tsx +++ b/playground/src/app/products/[product]/page.tsx @@ -266,7 +266,7 @@ export default function ProductPage() { NAV per Share - + {/* - + {/* - Holders + Supply
- {fund.shareClasses[0]?.shareClassLaunchDate} + {fund.shareClasses[0]?.shareClassCurrency}
@@ -598,13 +598,13 @@ export default function ProductPage() {
Lifecycle Stage
-
{fund.shareClasses[0]?.shareClassLifecycle}
+
{fund.shareClasses[0]?.shareClassLifecycle?.charAt(0).toUpperCase() + fund.shareClasses[0]?.shareClassLifecycle?.slice(1)}
- Investment Satus + Investment Status
-
{fund.shareClasses[0]?.investmentStatus}
+
{fund.shareClasses[0]?.investmentStatus?.charAt(0).toUpperCase() + fund.shareClasses[0]?.investmentStatus?.slice(1)}
@@ -630,12 +630,7 @@ export default function ProductPage() {
Distribution Policy
-
- { - fund.shareClasses[0] - ?.shareClassDistributionPolicy - } -
+
{fund.shareClasses[0]?.shareClassDistributionPolicy?.charAt(0).toUpperCase() + fund.shareClasses[0]?.shareClassDistributionPolicy?.slice(1)}
@@ -682,25 +677,25 @@ export default function ProductPage() { Openfunds - + XLSX CSV JSON From 2549711ba223a9ba1da81a0934260a1137afd873 Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Sun, 13 Oct 2024 11:15:53 +0200 Subject: [PATCH 04/22] combined settings + cluster page, ability to add custom endpoint, data stored in local storage --- playground/src/app/settings/page.tsx | 278 ++++++++++++++++++++++++--- 1 file changed, 246 insertions(+), 32 deletions(-) diff --git a/playground/src/app/settings/page.tsx b/playground/src/app/settings/page.tsx index 6b81ed23..eae2edc6 100644 --- a/playground/src/app/settings/page.tsx +++ b/playground/src/app/settings/page.tsx @@ -1,58 +1,272 @@ "use client"; -import React from 'react'; +import React, { useState, useEffect } from 'react'; import { useForm } from 'react-hook-form'; +import { zodResolver } from '@hookform/resolvers/zod'; +import * as z from 'zod'; +import { Check, ChevronsUpDown, X } from "lucide-react"; +import { cn } from "@/lib/utils"; import PageContentWrapper from "@/components/PageContentWrapper"; -import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; +import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; -import { Save } from "lucide-react"; -import { zodResolver } from '@hookform/resolvers/zod'; -import * as z from 'zod'; +import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { useCluster } from "@/components/solana-cluster-provider"; +import { toast } from "@/components/ui/use-toast"; +import { PlusIcon } from "@radix-ui/react-icons"; -// Define the schema for our form const formSchema = z.object({ - productName: z.string().min(1, { message: "Product name is required" }), + customLabel: z.string().min(1, "Label is required"), + customEndpoint: z.string().url("Must be a valid URL"), + activeEndpoint: z.string().min(1, "Active endpoint is required"), }); -// Infer the type from our schema type FormValues = z.infer; -const RPCClientForm: React.FC = () => { +type Endpoint = { + value: string; + label: string; + url: string; + isCustom?: boolean; +}; + +// Helper function to capitalize the first letter of each word +const capitalizeWords = (str: string) => { + return str.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' '); +}; + +// Helper function to truncate URL for privacy +const truncateUrl = (url: string) => { + const parsedUrl = new URL(url); + if (parsedUrl.hostname === 'localhost') { + return `${parsedUrl.protocol}//${parsedUrl.hostname}:${parsedUrl.port}`; + } + return `${parsedUrl.protocol}//${parsedUrl.hostname}`; +}; + +const SettingsPage: React.FC = () => { + const { cluster, clusters, setCluster } = useCluster(); + const [endpoints, setEndpoints] = useState([]); + const [open, setOpen] = useState(false); + const form = useForm({ resolver: zodResolver(formSchema), defaultValues: { - productName: '', + customLabel: '', + customEndpoint: '', + activeEndpoint: cluster.endpoint, }, }); + useEffect(() => { + const clusterEndpoints = clusters.map(c => ({ + value: c.endpoint, + label: capitalizeWords(c.name), + url: truncateUrl(c.endpoint), + })); + + const storedEndpoints = localStorage.getItem('customEndpoints'); + const customEndpoints = storedEndpoints + ? JSON.parse(storedEndpoints).map((ce: {label: string, endpoint: string}) => ({ + value: ce.endpoint, + label: capitalizeWords(ce.label), + url: truncateUrl(ce.endpoint), + isCustom: true, + })) + : []; + + setEndpoints([...clusterEndpoints, ...customEndpoints]); + }, [clusters]); + const onSubmit = (data: FormValues) => { - console.log(data); - // Handle form submission + const newCustomEndpoint = { + value: data.customEndpoint, + label: capitalizeWords(data.customLabel), + url: truncateUrl(data.customEndpoint), + isCustom: true, + }; + const updatedEndpoints = [...endpoints, newCustomEndpoint]; + setEndpoints(updatedEndpoints); + localStorage.setItem('customEndpoints', JSON.stringify(updatedEndpoints.filter(e => e.isCustom))); + + // Automatically set the new endpoint as active + handleEndpointChange(data.customEndpoint); + + form.reset({ customLabel: '', customEndpoint: '' }); + + toast({ + title: "Custom endpoint added", + description: `${newCustomEndpoint.label} has been added and set as your active endpoint.`, + }); + }; + + const handleEndpointChange = (value: string) => { + const selectedEndpoint = endpoints.find(e => e.value === value); + if (selectedEndpoint) { + form.setValue('activeEndpoint', value); + const clusterEndpoint = clusters.find(c => c.endpoint === value); + if (clusterEndpoint) { + setCluster(clusterEndpoint); + } + toast({ + title: "Endpoint changed", + description: `Active endpoint set to ${selectedEndpoint.label}`, + }); + } + }; + + const deleteCustomEndpoint = (endpointToDelete: string) => { + const updatedEndpoints = endpoints.filter(e => e.value !== endpointToDelete); + setEndpoints(updatedEndpoints); + localStorage.setItem('customEndpoints', JSON.stringify(updatedEndpoints.filter(e => e.isCustom))); + + if (form.getValues('activeEndpoint') === endpointToDelete) { + form.setValue('activeEndpoint', clusters[0].endpoint); + setCluster(clusters[0]); + } + + toast({ + title: "Custom endpoint deleted", + description: "The selected custom endpoint has been removed.", + }); }; return ( -
+
- - ( - - Custom RPC URL - - - - {/*This is the RPC URL.*/} - - - )} - /> - + +
+ ( + + Network Endpoint + + + + + + + + + No endpoint found. + + {endpoints.map((endpoint) => ( + { + handleEndpointChange( + currentValue === field.value + ? "" + : currentValue + ); + setOpen(false); + }} + > +
+
+ +
+ + {endpoint.label} + + + {endpoint.url} + +
+
+ {endpoint.isCustom && ( + + )} +
+
+ ))} +
+
+
+
+
+ +
+ )} + /> +
+ +
+
+ ( + + Label + + + + + + )} + /> + ( + + RPC Endpoint + + + + + + )} + /> + +
+
@@ -60,4 +274,4 @@ const RPCClientForm: React.FC = () => { ); }; -export default RPCClientForm; +export default SettingsPage; From 64f3f13bda6849497b586ef691d44d3b2f97901d Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Sun, 13 Oct 2024 12:28:25 +0200 Subject: [PATCH 05/22] beta warning styling and mobile fix --- playground/src/components/BetaWarning.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/playground/src/components/BetaWarning.tsx b/playground/src/components/BetaWarning.tsx index 4b451886..e52a50f2 100644 --- a/playground/src/components/BetaWarning.tsx +++ b/playground/src/components/BetaWarning.tsx @@ -6,20 +6,21 @@ import Link from "next/link"; const BetaWarning = () => { return ( -
+
-

Unaudited Beta

-

+

Unaudited Beta

+

Active development; breaking changes. Use at your own risk. Possible losses. No guarantees. GLAM not liable for any losses.{" "} +

+

See full disclaimer .

-
- ); +
); }; export default BetaWarning; From 39c2eae1a25516b67d18a5c0df2210d92dfe96f2 Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Sun, 13 Oct 2024 12:58:21 +0200 Subject: [PATCH 06/22] detail page styling --- playground/src/app/products/[product]/page.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/playground/src/app/products/[product]/page.tsx b/playground/src/app/products/[product]/page.tsx index f5656643..c7cb3aac 100644 --- a/playground/src/app/products/[product]/page.tsx +++ b/playground/src/app/products/[product]/page.tsx @@ -240,27 +240,27 @@ export default function ProductPage() {
{/* Top row */} - - + + - + {fund.name} - + {fund.investmentObjective} - + NAV per Share @@ -278,7 +278,7 @@ export default function ProductPage() { - + Assets Under Management @@ -298,7 +298,7 @@ export default function ProductPage() { {/* Bottom row */}
- +

Symbol

From 53d06d4aac7e9448724dae6634dfa17a14cb3a5d Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Sun, 13 Oct 2024 13:24:53 +0200 Subject: [PATCH 07/22] sparkle sizing, added redirect if invalid pubkey --- playground/src/app/products/[product]/page.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/playground/src/app/products/[product]/page.tsx b/playground/src/app/products/[product]/page.tsx index c7cb3aac..bcae81c7 100644 --- a/playground/src/app/products/[product]/page.tsx +++ b/playground/src/app/products/[product]/page.tsx @@ -25,7 +25,7 @@ import { } from "@/components/ui/chart"; import { useGlam } from "@glam/anchor/react"; -import { useParams } from "next/navigation"; +import { redirect, useParams } from "next/navigation"; import { useEffect, useMemo, useRef, useState } from "react"; import { PublicKey } from "@solana/web3.js"; import Sparkle from "@/utils/Sparkle"; @@ -126,7 +126,7 @@ export default function ProductPage() { }, [product]); if (!publicKey) { - return
Error loading product
; + redirect('/'); } const { allFunds } = useGlam(); @@ -240,8 +240,8 @@ export default function ProductPage() {
{/* Top row */} - - + + Date: Sun, 13 Oct 2024 13:44:54 +0200 Subject: [PATCH 08/22] sparkle sizing, added redirect if invalid pubkey --- playground/src/app/products/[product]/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/src/app/products/[product]/page.tsx b/playground/src/app/products/[product]/page.tsx index bcae81c7..285e53de 100644 --- a/playground/src/app/products/[product]/page.tsx +++ b/playground/src/app/products/[product]/page.tsx @@ -232,7 +232,7 @@ export default function ProductPage() { }, []); if (!fund) { - return; + redirect('/'); } return ( From 3f032aa14cac076ef052f7fc841fe0b3ee660393 Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Sun, 13 Oct 2024 14:30:46 +0200 Subject: [PATCH 09/22] fixed content height no detail page, fixed button menu --- playground/next-env.d.ts | 2 +- .../src/app/products/[product]/page.tsx | 4 +-- playground/src/components/AccountMenu.tsx | 29 ++++++++++--------- playground/src/components/ui/command.tsx | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/playground/next-env.d.ts b/playground/next-env.d.ts index 40c3d680..4f11a03d 100644 --- a/playground/next-env.d.ts +++ b/playground/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/playground/src/app/products/[product]/page.tsx b/playground/src/app/products/[product]/page.tsx index 285e53de..03a4026b 100644 --- a/playground/src/app/products/[product]/page.tsx +++ b/playground/src/app/products/[product]/page.tsx @@ -406,7 +406,7 @@ export default function ProductPage() {
- + @@ -539,7 +539,7 @@ export default function ProductPage() { - + diff --git a/playground/src/components/AccountMenu.tsx b/playground/src/components/AccountMenu.tsx index 19f83416..c59bd25c 100644 --- a/playground/src/components/AccountMenu.tsx +++ b/playground/src/components/AccountMenu.tsx @@ -98,16 +98,18 @@ export default function ProductSwitcher({ className }: ProductSwitcherProps) { const [open, setOpen] = React.useState(false); return !wallet ? ( + + ) : !activeFund ? null : ( @@ -123,7 +125,7 @@ export default function ProductSwitcher({ className }: ProductSwitcherProps) { ) : null} - + {activeFund ? ( activeFund.name ? ( {activeFund.name} @@ -140,7 +142,7 @@ export default function ProductSwitcher({ className }: ProductSwitcherProps) { {/**/} - + {fundsList.map((product) => ( - + diff --git a/playground/src/components/ui/command.tsx b/playground/src/components/ui/command.tsx index de8bc582..5664e6ac 100644 --- a/playground/src/components/ui/command.tsx +++ b/playground/src/components/ui/command.tsx @@ -62,7 +62,7 @@ const CommandList = React.forwardRef< >(({ className, ...props }, ref) => ( )); From a6347ad667e874549b55b570f683bba2f8241802 Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Mon, 14 Oct 2024 08:17:12 +0200 Subject: [PATCH 10/22] resolve conflicts --- playground/src/app/trade/page.tsx | 312 ++++++++++++++++++------------ 1 file changed, 185 insertions(+), 127 deletions(-) diff --git a/playground/src/app/trade/page.tsx b/playground/src/app/trade/page.tsx index e6b4a11e..8c471bba 100644 --- a/playground/src/app/trade/page.tsx +++ b/playground/src/app/trade/page.tsx @@ -174,7 +174,7 @@ const swapSchema = z.object({ }); const spotSchema = z.object({ - venue: z.enum(["Jupiter", "Drift"]), + venue: z.enum(["Drift"]), spotMarket: z.enum(DRIFT_SPOT_MARKETS), spotType: z.enum(DRIFT_ORDER_TYPES), side: z.enum(["Buy", "Sell"]), @@ -1159,7 +1159,39 @@ export default function Trade() { />
- ) : spotOrderType === "Trigger Limit" ? ( + ) : spotOrderType === "Market" ? ( + <> +
+ + + ({ + name: t.name, + symbol: t.symbol, + address: t.address, + decimals: t.decimals, + balance: 0, + } as Asset) + )} + balance={NaN} + selectedAsset={toAsset} + onSelectAsset={setToAsset} + /> +
+ + ) : spotOrderType === "Trigger Limit" ? ( <>
)} -
-
- {/**/} - {/* */} - {/* */} - {/* */} - {/*

Margin Trading Disabled

*/} - {/*
*/} - {/* */} - {/* Please view the Risk Management configuration of the*/} - {/* Venue Integration.*/} - {/* */} - {/*
*/} - {/*
*/} -
- -
- ( - - - - - - Reduce Only - - - )} - /> - ( - - - - - - Post - - - )} - /> -
- - {/* (*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Show Confirmation*/} - {/* */} - {/* )}*/} - {/*/>*/} -
+ {/*
*/} + {/*
*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/*

Margin Trading Disabled

*/} + {/*
*/} + {/* */} + {/* Please view the Risk Management configuration of the*/} + {/* Venue Integration.*/} + {/* */} + {/*
*/} + {/*
*/} + {/*
*/} + + {/*
*/} + {/* (*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/* Reduce Only*/} + {/* */} + {/* */} + {/* )}*/} + {/* />*/} + {/* (*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/* Post*/} + {/* */} + {/* */} + {/* )}*/} + {/* />*/} + {/*
*/} + + {/* (*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* Show Confirmation*/} + {/* */} + {/* )}*/} + {/* />*/} + {/*
*/}
- - ) : perpsOrderType === "Trigger Limit" ? ( + ) : perpsOrderType === "Market" ? ( <> +
+ + + ({ + name: t.name, + symbol: t.symbol, + address: t.address, + decimals: t.decimals, + balance: 0, + } as Asset) + )} + balance={NaN} + selectedAsset={toAsset} + onSelectAsset={setToAsset} + /> +
+ + ) : perpsOrderType === "Trigger Limit" ? (<>
-
- ( - - - - - - Reduce Only - - - )} - /> - ( - - - - - - Post - - - )} - /> -
+ {/*
*/} + {/* (*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* Reduce Only*/} + {/* */} + {/* )}*/} + {/* />*/} + {/* (*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* Post*/} + {/* */} + {/* )}*/} + {/* />*/} + {/*
*/} {/* Date: Sun, 13 Oct 2024 15:44:05 +0200 Subject: [PATCH 11/22] add space --- playground/src/components/BetaWarning.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/playground/src/components/BetaWarning.tsx b/playground/src/components/BetaWarning.tsx index e52a50f2..f5cd845a 100644 --- a/playground/src/components/BetaWarning.tsx +++ b/playground/src/components/BetaWarning.tsx @@ -13,6 +13,7 @@ const BetaWarning = () => {

Active development; breaking changes. Use at your own risk. Possible losses. No guarantees. GLAM not liable for any losses.{" "}

+  

See full disclaimer From 6aa1ed90ca15aaf602d9c2610de65b69d26027b6 Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Mon, 14 Oct 2024 08:20:43 +0200 Subject: [PATCH 12/22] resolve conflicts --- playground/src/app/trade/page.tsx | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/playground/src/app/trade/page.tsx b/playground/src/app/trade/page.tsx index 8c471bba..de817c74 100644 --- a/playground/src/app/trade/page.tsx +++ b/playground/src/app/trade/page.tsx @@ -715,7 +715,7 @@ export default function Trade() {

- Venues + Venues
( + Side ( + Side
- - - - + + + +
@@ -1773,10 +1764,10 @@ export default function Trade() {
Account Details
    -
  • - - Drift Page - +
  • + + Drift Page +

    Date: Sun, 13 Oct 2024 20:36:18 +0200 Subject: [PATCH 13/22] truncate account name --- playground/src/components/AccountMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/src/components/AccountMenu.tsx b/playground/src/components/AccountMenu.tsx index c59bd25c..c666f58e 100644 --- a/playground/src/components/AccountMenu.tsx +++ b/playground/src/components/AccountMenu.tsx @@ -125,7 +125,7 @@ export default function ProductSwitcher({ className }: ProductSwitcherProps) { ) : null} - + {activeFund ? ( activeFund.name ? ( {activeFund.name} From 9f646ae21fd2c05283b98e053863fd592f8a4421 Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Sun, 13 Oct 2024 22:01:27 +0200 Subject: [PATCH 14/22] fixed market order type input fields, added slippage input --- playground/src/app/trade/page.tsx | 108 ++++++++++++---------- playground/src/components/AssetInput.tsx | 2 +- playground/src/components/BetaWarning.tsx | 2 +- 3 files changed, 59 insertions(+), 53 deletions(-) diff --git a/playground/src/app/trade/page.tsx b/playground/src/app/trade/page.tsx index de817c74..422e4386 100644 --- a/playground/src/app/trade/page.tsx +++ b/playground/src/app/trade/page.tsx @@ -670,28 +670,36 @@ export default function Trade() { > - (*/} + {/* */} + {/* Slippage*/} + {/* */} + {/* */} + {/* field.onChange(parseFloat(e.target.value))*/} + {/* }*/} + {/* value={field.value}*/} + {/* />*/} + {/* */} + {/* /!* *!/*/} + {/* */} + {/* */} + {/* )}*/} + {/*/>*/} + ( - - Slippage - - - field.onChange(parseFloat(e.target.value)) - } - value={field.value} - /> - - {/* */} - - - )} + label="Slippage" + balance={NaN} + selectedAsset="%" + hideBalance={true} + disableAssetChange={true} />

    + - ({ - name: t.name, - symbol: t.symbol, - address: t.address, - decimals: t.decimals, - balance: 0, - } as Asset) - )} + disableAssetChange={true} balance={NaN} selectedAsset={toAsset} - onSelectAsset={setToAsset} />
    @@ -1540,7 +1547,7 @@ export default function Trade() { name="limitPrice" label="Limit Price" balance={NaN} - selectedAsset="$" + selectedAsset="USDC" hideBalance={true} disableAssetChange={true} /> @@ -1565,31 +1572,30 @@ export default function Trade() { <>
    + - ({ - name: t.name, - symbol: t.symbol, - address: t.address, - decimals: t.decimals, - balance: 0, - } as Asset) - )} balance={NaN} - selectedAsset={toAsset} - onSelectAsset={setToAsset} + selectedAsset={"USDC"} + disableAssetChange={true} />
    diff --git a/playground/src/components/AssetInput.tsx b/playground/src/components/AssetInput.tsx index a426128f..21f97aeb 100644 --- a/playground/src/components/AssetInput.tsx +++ b/playground/src/components/AssetInput.tsx @@ -40,7 +40,7 @@ interface AssetInputProps { label: string; balance: number; assets?: Asset[]; - selectedAsset: string; + selectedAsset?: string; onSelectAsset?: (value: string) => void; className?: string; disableAssetChange?: boolean; diff --git a/playground/src/components/BetaWarning.tsx b/playground/src/components/BetaWarning.tsx index f5cd845a..c3ab219a 100644 --- a/playground/src/components/BetaWarning.tsx +++ b/playground/src/components/BetaWarning.tsx @@ -6,7 +6,7 @@ import Link from "next/link"; const BetaWarning = () => { return ( -
    +

    Unaudited Beta

    From 1bb7ff1b9be2b2d23202512a183b089e1a4ab37a Mon Sep 17 00:00:00 2001 From: Fabio Federici Date: Mon, 14 Oct 2024 08:22:40 +0200 Subject: [PATCH 15/22] resolve conflicts --- playground/src/app/trade/page.tsx | 263 +++++++++++++++++++++--------- 1 file changed, 184 insertions(+), 79 deletions(-) diff --git a/playground/src/app/trade/page.tsx b/playground/src/app/trade/page.tsx index 422e4386..6e697172 100644 --- a/playground/src/app/trade/page.tsx +++ b/playground/src/app/trade/page.tsx @@ -558,6 +558,9 @@ export default function Trade() { } }; + const [cancelValue, setCancelValue] = React.useState("cancelAll"); + const [settleValue, setSettleValue] = React.useState("settlePnL"); + return (
    @@ -1169,47 +1172,47 @@ export default function Trade() {
    ) : spotOrderType === "Market" ? ( - <> -
    - - - - ({ - name: t.name, - symbol: t.symbol, - address: t.address, - decimals: t.decimals, - balance: 0, - } as Asset) - )} - balance={NaN} - selectedAsset={toAsset} - onSelectAsset={setToAsset} - /> -
    - - ) : spotOrderType === "Trigger Limit" ? ( + <> +
    + + + + ({ + name: t.name, + symbol: t.symbol, + address: t.address, + decimals: t.decimals, + balance: 0, + } as Asset) + )} + balance={NaN} + selectedAsset={toAsset} + onSelectAsset={setToAsset} + /> +
    + + ) : spotOrderType === "Trigger Limit" ? ( <>
    ) : null} - {spotOrderType !== "Trigger Limit" && !spotReduceOnly && ( - //
    - // - //
    - - )} + {spotOrderType !== "Trigger Limit" && + !spotReduceOnly && ( //
    + // + //
    + + )} {/*
    */} {/*
    */} @@ -1362,6 +1365,47 @@ export default function Trade() { Submit
    +
    +
    + + { + if (value) setCancelValue(value); + }} + className="border border-l-0 rounded-l-none h-10 gap-0 w-1/2" + > + + All + + + + {perpsForm + .watch("perpsMarket") + .replace("-PERP", "")} + + + +
    + + {/**/} +
    @@ -1379,7 +1423,17 @@ export default function Trade() { name="venue" render={({ field }) => ( - Venue +
    + Venue + {field.value === "Drift" && ( + + )} +
    +