diff --git a/web/src/components/EntryForm.tsx b/web/src/components/EntryForm.tsx index cf5d82e..2536abc 100644 --- a/web/src/components/EntryForm.tsx +++ b/web/src/components/EntryForm.tsx @@ -5,17 +5,15 @@ import { tradingRuntime } from '../lib/runtime'; import { createManualEntry, updateManualEntry } from '../lib/manualEntriesApi'; import { getPlatformAccessToken } from '../lib/authSession'; import { createRequestId } from '../../../shared/request-id.js'; -import { Button } from './ui/button'; -import { Input } from './ui/input'; +import { Button, Checkbox, Input } from './ui/Primitives'; interface EntryFormProps { onSuccess: () => void; initialData?: any; } -const tableInputClass = 'h-9 rounded border-[var(--border)] bg-[var(--input)] px-2 py-1 text-sm'; -const numericInputClass = `${tableInputClass} font-mono text-right`; -const checkboxLabelClass = 'flex cursor-pointer items-center text-[10px] text-[var(--muted-foreground)] hover:text-[var(--foreground)]'; +const numericInputClass = 'font-mono text-right'; +const checkboxLabelClass = 'flex min-h-10 cursor-pointer items-center gap-2 rounded-[var(--bl-radius-control)] border border-[var(--border)] bg-[var(--card-elevated)] px-3 text-sm text-[var(--foreground)] transition hover:border-[var(--primary)]'; export function EntryForm({ onSuccess, initialData }: EntryFormProps) { const { user } = useAuth(); @@ -180,210 +178,93 @@ export function EntryForm({ onSuccess, initialData }: EntryFormProps) { )} -
- - - - - - - - - - - - - - - - - - {/* Symbol */} - + +
+
+
Instrument
+

Name the opportunity and choose whether it is a watch item, trade journal entry, or crypto setup.

+
+
+ + +
+
+
+ +
+
+ +
+
+ +
+
+
- {/* Label */} - +
+
+
Pricing and risk
+

Capture the planned entry, size, stop loss, take profit, and optional exit price.

+
+
+ + + + + + +
+
- {/* Options (Real/Crypto) */} - +
+ +
- {/* Buy Price */} - - - {/* Qty */} - - - {/* SL */} - - - {/* TP */} - - - {/* Time */} - - - {/* Sell Price (Exit) */} - - - {/* Actions */} - - - {/* Notes Row */} - - - - -
SymbolTagOptionsBuy PriceQtyStop LossTake ProfitBuy TimeExit PriceActions
- - - - -
- -
- - -
-
-
- - - - - - - - - setFormData(prev => ({ ...prev, buy_time: new Date(e.target.value).toISOString() }))} - className="h-9 rounded border-[var(--border)] bg-[var(--input)] px-2 py-1 font-mono text-xs" - /> - - - {formData.sell_price && formData.buy_price && ( -
= 0 - ? 'text-green-500' - : 'text-red-500' - }`}> - ${((Number(formData.sell_price) - Number(formData.buy_price)) * Number(formData.quantity || 1)).toFixed(2)} -
- )} -
-
- {initialData && ( - - )} - -
-
- -
+
+

Review the symbol, sizing, and risk fields before saving this manual entry.

+
+ {initialData && ( + + )} + +
+
); diff --git a/web/src/components/ui/Primitives.tsx b/web/src/components/ui/Primitives.tsx index bc04df5..b2b9370 100644 --- a/web/src/components/ui/Primitives.tsx +++ b/web/src/components/ui/Primitives.tsx @@ -49,6 +49,10 @@ export interface BadgeProps extends Omit { variant?: ProductBadgeVariant; } +export interface CheckboxProps extends Omit, 'type'> { + label?: React.ReactNode; +} + export type ProductStatus = | 'active' | 'approved' @@ -208,6 +212,27 @@ export const Textarea = React.forwardRef( Textarea.displayName = 'Textarea'; +export const Checkbox = React.forwardRef( + ({ className, label, id, ...props }, ref) => { + const generatedId = React.useId(); + const checkboxId = id ?? (label ? `checkbox-${generatedId}` : undefined); + return ( + + ); + }, +); + +Checkbox.displayName = 'Checkbox'; + export function Badge({ variant = 'neutral', ...props }: BadgeProps) { return ; }