diff --git a/bun.lockb b/bun.lockb index 9b9612a..b04ce0f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components.json b/components.json index 5fd5e49..dc58f0a 100644 --- a/components.json +++ b/components.json @@ -14,4 +14,4 @@ }, "typescript": true, "registry": "https://next.shadcn-svelte.com/registry" -} \ No newline at end of file +} diff --git a/package.json b/package.json index 99618ce..a0d7b5a 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@sveltejs/kit": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^4.0.0", "autoprefixer": "^10.4.20", - "bits-ui": "^1.0.0-next.34", + "bits-ui": "^1.0.0-next.64", "clsx": "^2.1.1", "formsnap": "^2.0.0-next.1", "lucide-svelte": "^0.454.0", @@ -36,6 +36,7 @@ "zod": "^3.23.8" }, "dependencies": { + "axios": "^1.7.7", "mode-watcher": "^0.4.1" } } diff --git a/src/lib/components/ui/card/card-content.svelte b/src/lib/components/ui/card/card-content.svelte new file mode 100644 index 0000000..1f52856 --- /dev/null +++ b/src/lib/components/ui/card/card-content.svelte @@ -0,0 +1,16 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/card/card-description.svelte b/src/lib/components/ui/card/card-description.svelte new file mode 100644 index 0000000..da02664 --- /dev/null +++ b/src/lib/components/ui/card/card-description.svelte @@ -0,0 +1,16 @@ + + +

+ {@render children?.()} +

diff --git a/src/lib/components/ui/card/card-footer.svelte b/src/lib/components/ui/card/card-footer.svelte new file mode 100644 index 0000000..6894149 --- /dev/null +++ b/src/lib/components/ui/card/card-footer.svelte @@ -0,0 +1,16 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/card/card-header.svelte b/src/lib/components/ui/card/card-header.svelte new file mode 100644 index 0000000..1baa92c --- /dev/null +++ b/src/lib/components/ui/card/card-header.svelte @@ -0,0 +1,16 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/card/card-title.svelte b/src/lib/components/ui/card/card-title.svelte new file mode 100644 index 0000000..f7d59c1 --- /dev/null +++ b/src/lib/components/ui/card/card-title.svelte @@ -0,0 +1,25 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/card/card.svelte b/src/lib/components/ui/card/card.svelte new file mode 100644 index 0000000..3e3a4ed --- /dev/null +++ b/src/lib/components/ui/card/card.svelte @@ -0,0 +1,20 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/card/index.ts b/src/lib/components/ui/card/index.ts new file mode 100644 index 0000000..0f9084d --- /dev/null +++ b/src/lib/components/ui/card/index.ts @@ -0,0 +1,22 @@ +import Root from "./card.svelte"; +import Content from "./card-content.svelte"; +import Description from "./card-description.svelte"; +import Footer from "./card-footer.svelte"; +import Header from "./card-header.svelte"; +import Title from "./card-title.svelte"; + +export { + Root, + Content, + Description, + Footer, + Header, + Title, + // + Root as Card, + Content as CardContent, + Description as CardDescription, + Footer as CardFooter, + Header as CardHeader, + Title as CardTitle, +}; diff --git a/src/lib/components/ui/scroll-area/index.ts b/src/lib/components/ui/scroll-area/index.ts new file mode 100644 index 0000000..e86a25b --- /dev/null +++ b/src/lib/components/ui/scroll-area/index.ts @@ -0,0 +1,10 @@ +import Scrollbar from "./scroll-area-scrollbar.svelte"; +import Root from "./scroll-area.svelte"; + +export { + Root, + Scrollbar, + //, + Root as ScrollArea, + Scrollbar as ScrollAreaScrollbar, +}; diff --git a/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte b/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte new file mode 100644 index 0000000..b436056 --- /dev/null +++ b/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte @@ -0,0 +1,29 @@ + + + + {@render children?.()} + + diff --git a/src/lib/components/ui/scroll-area/scroll-area.svelte b/src/lib/components/ui/scroll-area/scroll-area.svelte new file mode 100644 index 0000000..9943f83 --- /dev/null +++ b/src/lib/components/ui/scroll-area/scroll-area.svelte @@ -0,0 +1,32 @@ + + + + + {@render children?.()} + + {#if orientation === "vertical" || orientation === "both"} + + {/if} + {#if orientation === "horizontal" || orientation === "both"} + + {/if} + + diff --git a/src/lib/components/ui/tabs/index.ts b/src/lib/components/ui/tabs/index.ts new file mode 100644 index 0000000..f1ab372 --- /dev/null +++ b/src/lib/components/ui/tabs/index.ts @@ -0,0 +1,18 @@ +import { Tabs as TabsPrimitive } from "bits-ui"; +import Content from "./tabs-content.svelte"; +import List from "./tabs-list.svelte"; +import Trigger from "./tabs-trigger.svelte"; + +const Root = TabsPrimitive.Root; + +export { + Root, + Content, + List, + Trigger, + // + Root as Tabs, + Content as TabsContent, + List as TabsList, + Trigger as TabsTrigger, +}; diff --git a/src/lib/components/ui/tabs/tabs-content.svelte b/src/lib/components/ui/tabs/tabs-content.svelte new file mode 100644 index 0000000..f1c0515 --- /dev/null +++ b/src/lib/components/ui/tabs/tabs-content.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/ui/tabs/tabs-list.svelte b/src/lib/components/ui/tabs/tabs-list.svelte new file mode 100644 index 0000000..f03e5fc --- /dev/null +++ b/src/lib/components/ui/tabs/tabs-list.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/ui/tabs/tabs-trigger.svelte b/src/lib/components/ui/tabs/tabs-trigger.svelte new file mode 100644 index 0000000..f1f5825 --- /dev/null +++ b/src/lib/components/ui/tabs/tabs-trigger.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/routes/(components)/bingx.svelte b/src/routes/(components)/bingx.svelte new file mode 100644 index 0000000..89cdf4a --- /dev/null +++ b/src/routes/(components)/bingx.svelte @@ -0,0 +1,289 @@ + + +
+ + + {#snippet children({ props })} + Symbol + + {/snippet} + + Symbol + + + + + {#snippet children({ props })} + Limit + + {/snippet} + + Limit + + + + + {#snippet children({ props })} + Interval + + + {$formData.interval ?? 'Select a interval'} + + + {#each intervals as interval} + + {/each} + + + {/snippet} + + Interval + + + + + {#snippet children({ props })} + Start Date + + + {start + ? df.format(start.toDate(getLocalTimeZone())) + : 'Pick a date'} + + + + { + if (v) { + $formData.start = v.toString() + } else { + $formData.start = '' + } + }} /> + + + Start Date + + + {/snippet} + + + + + {#snippet children({ props })} + Start Time + + {/snippet} + + Start Time + + + + + {#snippet children({ props })} + End Date + + + {end + ? df.format(end.toDate(getLocalTimeZone())) + : 'Pick a date'} + + + + { + if (v) { + $formData.end = v.toString() + } else { + $formData.end = '' + } + }} /> + + + End Date + + + {/snippet} + + + + + {#snippet children({ props })} + End Time + + {/snippet} + + End Time + + + Submit +
diff --git a/src/routes/(components)/schema.ts b/src/routes/(components)/schema.ts new file mode 100644 index 0000000..b4155f4 --- /dev/null +++ b/src/routes/(components)/schema.ts @@ -0,0 +1,46 @@ +import { z } from 'zod' + +export type Interval = + | '1m' + | '3m' + | '5m' + | '15m' + | '30m' + | '1h' + | '2h' + | '4h' + | '6h' + | '8h' + | '12h' + | '1d' + | '3d' + | '1w' + | '1M' + +export const intervals: Interval[] = [ + '1m', + '3m', + '5m', + '15m', + '30m', + '1h', + '2h', + '4h', + '6h', + '8h', + '12h', + '1d', + '3d', + '1w', + '1M', +] + +export const bingxAPISchema = z.object({ + symbol: z.string(), + interval: z.custom(), + start: z.string().min(1), + startTime: z.string().min(1), + end: z.string().min(1), + endTime: z.string().min(1), + limit: z.number().int().min(1).max(1000).optional(), +}) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index ae0c079..26cae85 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -9,6 +9,8 @@ import { CalendarIcon } from 'lucide-svelte' import { Calendar } from '$lib/components/ui/calendar/index.js' import * as Popover from '$lib/components/ui/popover/index.js' + import * as Card from '$lib/components/ui/card/index.js' + import * as Tabs from '$lib/components/ui/tabs/index.js' import { CalendarDate, DateFormatter, @@ -19,6 +21,8 @@ } from '@internationalized/date' import { cn } from '$lib/utils.js' import { buttonVariants } from '$lib/components/ui/button' + import Bingx from './(components)/bingx.svelte' + import { ScrollArea } from '$lib/components/ui/scroll-area' let { data } = $props() @@ -100,183 +104,208 @@ let placeholder = $state(today(getLocalTimeZone())) -
- - - {#snippet children({ props })} - Symbol - - {/snippet} - - Symbol - - - - - {#snippet children({ props })} - Limit - - {/snippet} - - Limit - - - - - {#snippet children({ props })} - Category - - - {$formData.category ?? 'Select a category'} - - - {#each categories as category} - - {/each} - - - {/snippet} - - Category - - - - - {#snippet children({ props })} - Interval - - - {$formData.interval ?? 'Select a interval'} - - - {#each intervals as interval} - - {/each} - - - {/snippet} - - Category - - - - - {#snippet children({ props })} - Start Date - - - {start - ? df.format(start.toDate(getLocalTimeZone())) - : 'Pick a date'} - - - - { - if (v) { - $formData.start = v.toString() - } else { - $formData.start = '' - } - }} /> - - - - Your date of birth is used to calculator your age - - - - {/snippet} - - - - - {#snippet children({ props })} - Start Time - - {/snippet} - - Limit - - - - - {#snippet children({ props })} - End Date - - - {end - ? df.format(end.toDate(getLocalTimeZone())) - : 'Pick a date'} - - - - { - if (v) { - $formData.end = v.toString() - } else { - $formData.end = '' - } - }} /> - - - - Your date of birth is used to calculator your age - - - - {/snippet} - - - - - {#snippet children({ props })} - End Time - - {/snippet} - - Limit - - - Submit -
+
+ + + + + ByBit + BingX + + +
+ + + {#snippet children({ props })} + Symbol + + {/snippet} + + Symbol + + + + + {#snippet children({ props })} + Limit + + {/snippet} + + Limit + + + + + {#snippet children({ props })} + Category + + + {$formData.category ?? 'Select a category'} + + + {#each categories as category} + + {/each} + + + {/snippet} + + Category + + + + + {#snippet children({ props })} + Interval + + + {$formData.interval ?? 'Select a interval'} + + + {#each intervals as interval} + + {/each} + + + {/snippet} + + Interval + + + + + {#snippet children({ props })} + Start Date + + + {start + ? df.format(start.toDate(getLocalTimeZone())) + : 'Pick a date'} + + + + { + if (v) { + $formData.start = v.toString() + } else { + $formData.start = '' + } + }} /> + + + Start Time + + + {/snippet} + + + + + {#snippet children({ props })} + Start Time + + {/snippet} + + Start Time + + + + + {#snippet children({ props })} + End Date + + + {end + ? df.format(end.toDate(getLocalTimeZone())) + : 'Pick a date'} + + + + { + if (v) { + $formData.end = v.toString() + } else { + $formData.end = '' + } + }} /> + + + End Date + + + {/snippet} + + + + + {#snippet children({ props })} + End Time + + {/snippet} + + End Time + + + Submit +
+
+ + + +
+
+
+
diff --git a/src/routes/api/bingx/+server.ts b/src/routes/api/bingx/+server.ts new file mode 100644 index 0000000..533f62b --- /dev/null +++ b/src/routes/api/bingx/+server.ts @@ -0,0 +1,10 @@ +import { json } from '@sveltejs/kit' +import type { RequestHandler } from '../$types' + +export const POST: RequestHandler = async ({ request }) => { + const body = await request.json() + + const response = await fetch(body.url) + + return json(await response.json()) +}