Style forms

This commit is contained in:
myrmidex 2025-07-13 04:06:37 +02:00
parent 19afa660da
commit c4c21f689c
7 changed files with 118 additions and 75 deletions

View file

@ -16,6 +16,15 @@ .font-digital {
font-family: '7Segment', monospace;
}
.glow-red {
box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
transition: box-shadow 300ms ease;
}
.glow-red:hover {
box-shadow: 0 0 25px rgba(239, 68, 68, 0.6);
}
@custom-variant dark (&:is(.dark *));
@theme {

View file

@ -2,7 +2,6 @@ import AddMilestoneForm from '@/components/Milestones/AddMilestoneForm';
import AddPurchaseForm from '@/components/Transactions/AddPurchaseForm';
import UpdatePriceForm from '@/components/Pricing/UpdatePriceForm';
import { cn } from '@/lib/utils';
import { X } from 'lucide-react';
import ComponentTitle from '@/components/ui/ComponentTitle';
interface InlineFormProps {
@ -35,18 +34,7 @@ export default function InlineForm({
)}
>
{/* Header */}
<div className="w-full border-4 border-red-500 p-2 bg-black space-y-4">
<div className="flex items-center justify-between mb-6">
<ComponentTitle>{title}</ComponentTitle>
<button
onClick={onClose}
className="text-red-400 hover:text-red-300 transition-colors p-1"
aria-label="Close form"
>
<X className="w-5 h-5" />
</button>
</div>
<div className="w-full border-4 border-red-500 p-2 bg-black space-y-4 glow-red">
{/* Form Content */}
<div className="flex justify-center">
@ -56,6 +44,7 @@ export default function InlineForm({
if (onPurchaseSuccess) onPurchaseSuccess();
onClose();
}}
onCancel={onClose}
/>
) : type === 'milestone' ? (
<AddMilestoneForm
@ -63,6 +52,7 @@ export default function InlineForm({
if (onMilestoneSuccess) onMilestoneSuccess();
onClose();
}}
onCancel={onClose}
/>
) : (
<UpdatePriceForm
@ -70,6 +60,7 @@ export default function InlineForm({
if (onPriceSuccess) onPriceSuccess();
onClose();
}}
onCancel={onClose}
/>
)}
</div>

View file

@ -43,7 +43,7 @@ export default function ProgressBar({
{/* Progress Bar Container */}
<div className="w-full">
{/* Old-school progress bar with overlaid text */}
<div className="w-full border-4 border-red-500 p-2 bg-black relative overflow-hidden">
<div className="w-full border-4 border-red-500 p-2 bg-black relative overflow-hidden glow-red">
{/* Inner container */}
<div className="relative h-8">
{/* Progress fill */}

View file

@ -70,7 +70,7 @@ export default function StatsBox({
className
)}
>
<div className="w-full border-4 border-red-500 p-2 bg-black space-y-4">
<div className="w-full border-4 border-red-500 p-2 bg-black space-y-4 glow-red">
{/* STATS Title and Current Price */}
<div className="flex justify-between items-center mb-6 relative">
<ComponentTitle>Stats</ComponentTitle>

View file

@ -5,6 +5,7 @@ import InputError from '@/components/InputError';
import { useForm } from '@inertiajs/react';
import { LoaderCircle } from 'lucide-react';
import { FormEventHandler } from 'react';
import ComponentTitle from '@/components/ui/ComponentTitle';
interface MilestoneFormData {
target: string;
@ -14,9 +15,10 @@ interface MilestoneFormData {
interface AddMilestoneFormProps {
onSuccess?: () => void;
onCancel?: () => void;
}
export default function AddMilestoneForm({ onSuccess }: AddMilestoneFormProps) {
export default function AddMilestoneForm({ onSuccess, onCancel }: AddMilestoneFormProps) {
const { data, setData, post, processing, errors, reset } = useForm<MilestoneFormData>({
target: '',
description: '',
@ -36,11 +38,12 @@ export default function AddMilestoneForm({ onSuccess }: AddMilestoneFormProps) {
};
return (
<div className="w-full max-w-md">
<div className="w-full">
<div className="space-y-4">
<ComponentTitle>ADD MILESTONE</ComponentTitle>
<form onSubmit={submit} className="space-y-4">
<div>
<Label htmlFor="target" className="text-red-400">Target Number</Label>
<Label htmlFor="target" className="text-red-400 font-mono text-xs uppercase tracking-wider">&gt; Target Number</Label>
<Input
id="target"
type="number"
@ -49,32 +52,44 @@ export default function AddMilestoneForm({ onSuccess }: AddMilestoneFormProps) {
placeholder="1500"
value={data.target}
onChange={(e) => setData('target', e.target.value)}
className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30"
className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red"
/>
<InputError message={errors.target} />
</div>
<div>
<Label htmlFor="description" className="text-red-400">Description</Label>
<Label htmlFor="description" className="text-red-400 font-mono text-xs uppercase tracking-wider">&gt; Description</Label>
<Input
id="description"
type="text"
placeholder="First milestone"
value={data.description}
onChange={(e) => setData('description', e.target.value)}
className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30"
className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red"
/>
<InputError message={errors.description} />
</div>
<div className="flex gap-3 pt-2">
<Button
type="submit"
disabled={processing}
className="w-full bg-red-600 hover:bg-red-700 text-white border-red-500"
className="flex-1 bg-red-500 hover:bg-red-500 text-black font-mono text-sm font-bold border-red-500 rounded-none border-2 uppercase tracking-wider transition-all glow-red"
>
{processing && <LoaderCircle className="mr-2 h-4 w-4 animate-spin" />}
Add Milestone
[EXECUTE]
</Button>
{onCancel && (
<Button
type="button"
variant="outline"
onClick={onCancel}
className="flex-1 bg-black border-red-500 text-red-400 hover:bg-red-950 hover:text-red-300 font-mono text-sm font-bold rounded-none border-2 uppercase tracking-wider transition-all glow-red"
>
[ABORT]
</Button>
)}
</div>
</form>
</div>
</div>

View file

@ -1,11 +1,11 @@
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import InputError from '@/components/InputError';
import { useForm } from '@inertiajs/react';
import { LoaderCircle } from 'lucide-react';
import { FormEventHandler } from 'react';
import ComponentTitle from '@/components/ui/ComponentTitle';
interface PriceUpdateFormData {
date: string;
@ -17,9 +17,10 @@ interface UpdatePriceFormProps {
currentPrice?: number;
className?: string;
onSuccess?: () => void;
onCancel?: () => void;
}
export default function UpdatePriceForm({ currentPrice, className, onSuccess }: UpdatePriceFormProps) {
export default function UpdatePriceForm({ currentPrice, className, onSuccess, onCancel }: UpdatePriceFormProps) {
const { data, setData, post, processing, errors } = useForm<PriceUpdateFormData>({
date: new Date().toISOString().split('T')[0], // Today's date in YYYY-MM-DD format
price: currentPrice?.toString() || '',
@ -38,31 +39,30 @@ export default function UpdatePriceForm({ currentPrice, className, onSuccess }:
};
return (
<Card className={className}>
<CardHeader>
<CardTitle>Update Asset Price</CardTitle>
<div className="w-full">
<div className="space-y-4">
<ComponentTitle>UPDATE PRICE</ComponentTitle>
{currentPrice && (
<p className="text-sm text-neutral-600 dark:text-neutral-400">
Current price: {currentPrice.toFixed(4)}
<p className="text-sm text-red-400/60 font-mono">
[CURRENT] {currentPrice.toFixed(4)}
</p>
)}
</CardHeader>
<CardContent>
<form onSubmit={submit} className="space-y-4">
<div>
<Label htmlFor="date">Price Date</Label>
<Label htmlFor="date" className="text-red-400 font-mono text-xs uppercase tracking-wider">&gt; Price Date</Label>
<Input
id="date"
type="date"
value={data.date}
onChange={(e) => setData('date', e.target.value)}
max={new Date().toISOString().split('T')[0]}
className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none transition-all glow-red"
/>
<InputError message={errors.date} />
</div>
<div>
<Label htmlFor="price">Asset Price ()</Label>
<Label htmlFor="price" className="text-red-400 font-mono text-xs uppercase tracking-wider">&gt; Asset Price ()</Label>
<Input
id="price"
type="number"
@ -71,23 +71,36 @@ export default function UpdatePriceForm({ currentPrice, className, onSuccess }:
placeholder="123.4567"
value={data.price}
onChange={(e) => setData('price', e.target.value)}
className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none focus:shadow-[0_0_10px_rgba(239,68,68,0.5)] placeholder:text-red-400/40 transition-all"
/>
<p className="text-xs text-neutral-500 mt-1">
Price per unit/share of the asset
<p className="text-xs text-red-400/60 mt-1 font-mono">
[UNIT] price per share
</p>
<InputError message={errors.price} />
</div>
<div className="flex gap-3 pt-2">
<Button
type="submit"
disabled={processing}
className="w-full"
className="flex-1 bg-red-500 hover:bg-red-500 text-black font-mono text-sm font-bold border-red-500 rounded-none border-2 uppercase tracking-wider transition-all glow-red"
>
{processing && <LoaderCircle className="mr-2 h-4 w-4 animate-spin" />}
Update Price
[EXECUTE]
</Button>
{onCancel && (
<Button
type="button"
variant="outline"
onClick={onCancel}
className="flex-1 bg-black border-red-500 text-red-400 hover:bg-red-950 hover:text-red-300 font-mono text-sm font-bold rounded-none border-2 uppercase tracking-wider transition-all glow-red"
>
[ABORT]
</Button>
)}
</div>
</form>
</CardContent>
</Card>
</div>
</div>
);
}

View file

@ -5,6 +5,7 @@ import InputError from '@/components/InputError';
import { useForm } from '@inertiajs/react';
import { LoaderCircle } from 'lucide-react';
import { FormEventHandler, useEffect } from 'react';
import ComponentTitle from '@/components/ui/ComponentTitle';
interface PurchaseFormData {
date: string;
@ -16,9 +17,10 @@ interface PurchaseFormData {
interface AddPurchaseFormProps {
onSuccess?: () => void;
onCancel?: () => void;
}
export default function AddPurchaseForm({ onSuccess }: AddPurchaseFormProps) {
export default function AddPurchaseForm({ onSuccess, onCancel }: AddPurchaseFormProps) {
const { data, setData, post, processing, errors, reset } = useForm<PurchaseFormData>({
date: new Date().toISOString().split('T')[0], // Today's date in YYYY-MM-DD format
shares: '',
@ -54,24 +56,25 @@ export default function AddPurchaseForm({ onSuccess }: AddPurchaseFormProps) {
};
return (
<div className="w-full max-w-md">
<div className="w-full">
<div className="space-y-4">
<ComponentTitle>ADD PURCHASE</ComponentTitle>
<form onSubmit={submit} className="space-y-4">
<div>
<Label htmlFor="date" className="text-red-400">Purchase Date</Label>
<Label htmlFor="date" className="text-red-400 font-mono text-xs uppercase tracking-wider">&gt; Purchase Date</Label>
<Input
id="date"
type="date"
value={data.date}
onChange={(e) => setData('date', e.target.value)}
max={new Date().toISOString().split('T')[0]}
className="bg-black border-red-500/30 text-red-400 focus:border-red-400"
className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none transition-all glow-red"
/>
<InputError message={errors.date} />
</div>
<div>
<Label htmlFor="shares" className="text-red-400">Number of Shares</Label>
<Label htmlFor="shares" className="text-red-400 font-mono text-xs uppercase tracking-wider">&gt; Number of Shares</Label>
<Input
id="shares"
type="number"
@ -80,13 +83,13 @@ export default function AddPurchaseForm({ onSuccess }: AddPurchaseFormProps) {
placeholder="1.234567"
value={data.shares}
onChange={(e) => setData('shares', e.target.value)}
className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30"
className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red"
/>
<InputError message={errors.shares} />
</div>
<div>
<Label htmlFor="price_per_share" className="text-red-400">Price per Share ()</Label>
<Label htmlFor="price_per_share" className="text-red-400 font-mono text-xs uppercase tracking-wider">&gt; Price per Share ()</Label>
<Input
id="price_per_share"
type="number"
@ -95,13 +98,13 @@ export default function AddPurchaseForm({ onSuccess }: AddPurchaseFormProps) {
placeholder="123.45"
value={data.price_per_share}
onChange={(e) => setData('price_per_share', e.target.value)}
className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30"
className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red"
/>
<InputError message={errors.price_per_share} />
</div>
<div>
<Label htmlFor="total_cost" className="text-red-400">Total Cost ()</Label>
<Label htmlFor="total_cost" className="text-red-400 font-mono text-xs uppercase tracking-wider">&gt; Total Cost ()</Label>
<Input
id="total_cost"
type="number"
@ -110,22 +113,34 @@ export default function AddPurchaseForm({ onSuccess }: AddPurchaseFormProps) {
placeholder="1234.56"
value={data.total_cost}
onChange={(e) => setData('total_cost', e.target.value)}
className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30"
className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red"
/>
<p className="text-xs text-red-400/60 mt-1">
Auto-calculated from shares × price
<p className="text-xs text-red-400/60 mt-1 font-mono">
[AUTO-CALC] shares × price
</p>
<InputError message={errors.total_cost} />
</div>
<div className="flex gap-3 pt-2">
<Button
type="submit"
disabled={processing}
className="w-full bg-red-600 hover:bg-red-700 text-white border-red-500"
className="flex-1 bg-red-500 hover:bg-red-500 text-black font-mono text-sm font-bold border-red-500 rounded-none border-2 uppercase tracking-wider transition-all glow-red"
>
{processing && <LoaderCircle className="mr-2 h-4 w-4 animate-spin" />}
Add Purchase
[EXECUTE]
</Button>
{onCancel && (
<Button
type="button"
variant="outline"
onClick={onCancel}
className="flex-1 bg-black border-red-500 text-red-400 hover:bg-red-950 hover:text-red-300 font-mono text-sm font-bold rounded-none border-2 uppercase tracking-wider transition-all glow-red"
>
[ABORT]
</Button>
)}
</div>
</form>
</div>
</div>