UI/UX redesign: unified refined-glass design system
- Add shared UI primitives: Button, Field/Input/Select, PageHeader, Section, Callout, Tabs, Disclosure - Replace gradient buttons with single blue-accent btn-primary - Reserve gradient text for the brand wordmark only - Rework Scanner page onto the glass system; collapse explainer and glossary into a disclosure, move filters into a glass toolbar - Restructure Ticker Detail into tabs (Analysis / Indicators / S/R) with chart and recommendation always visible - Align Watchlist, Rankings, Admin, Login/Register to shared primitives - Unify stray indigo/violet/gray accents into the blue family Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -188,7 +188,7 @@ export function JobControls() {
|
||||
type="button"
|
||||
onClick={() => triggerJob.mutate(job.name)}
|
||||
disabled={triggerJob.isPending || !job.enabled || anyJobRunning}
|
||||
className="btn-gradient px-3 py-1.5 text-xs disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
className="btn-primary px-3 py-1.5 text-xs disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<span>
|
||||
{job.running
|
||||
|
||||
@@ -89,7 +89,7 @@ export function RecommendationSettings() {
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<button className="btn-gradient px-4 py-2 text-sm" onClick={onSave} disabled={update.isPending}>
|
||||
<button className="btn-primary px-4 py-2 text-sm" onClick={onSave} disabled={update.isPending}>
|
||||
{update.isPending ? 'Saving…' : 'Save Configuration'}
|
||||
</button>
|
||||
<button className="px-4 py-2 text-sm rounded border border-white/[0.1] text-gray-300 hover:text-white" onClick={onReset} disabled={update.isPending}>
|
||||
|
||||
@@ -43,8 +43,8 @@ export function SettingsForm() {
|
||||
type="button"
|
||||
onClick={() => handleToggleRegistration(setting.value)}
|
||||
disabled={updateSetting.isPending}
|
||||
className={`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:ring-offset-[#0a0e1a] disabled:opacity-50 ${
|
||||
setting.value === 'true' ? 'bg-gradient-to-r from-blue-600 to-indigo-600' : 'bg-white/[0.1]'
|
||||
className={`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-[#0a0e1a] disabled:opacity-50 ${
|
||||
setting.value === 'true' ? 'bg-gradient-to-r from-blue-600 to-sky-500' : 'bg-white/[0.1]'
|
||||
}`}
|
||||
role="switch"
|
||||
aria-checked={setting.value === 'true'}
|
||||
@@ -64,7 +64,7 @@ export function SettingsForm() {
|
||||
<button
|
||||
onClick={() => handleSave(setting.key)}
|
||||
disabled={updateSetting.isPending}
|
||||
className="btn-gradient px-3 py-2 text-xs disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
className="btn-primary px-3 py-2 text-xs disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<span>{updateSetting.isPending ? 'Saving…' : 'Save'}</span>
|
||||
</button>
|
||||
|
||||
@@ -36,7 +36,7 @@ export function TickerManagement() {
|
||||
<button
|
||||
type="submit"
|
||||
disabled={addTicker.isPending || !newSymbol.trim()}
|
||||
className="btn-gradient px-4 py-2.5 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
className="btn-primary px-4 py-2.5 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<span>{addTicker.isPending ? 'Adding…' : 'Add Ticker'}</span>
|
||||
</button>
|
||||
|
||||
@@ -78,7 +78,7 @@ export function TickerUniverseBootstrap() {
|
||||
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<button
|
||||
className="btn-gradient px-4 py-2 text-sm disabled:opacity-50"
|
||||
className="btn-primary px-4 py-2 text-sm disabled:opacity-50"
|
||||
onClick={onSaveDefault}
|
||||
disabled={isLoading || updateDefault.isPending || bootstrap.isPending}
|
||||
>
|
||||
|
||||
@@ -64,7 +64,7 @@ export function UserTable() {
|
||||
Access
|
||||
</label>
|
||||
<button type="submit" disabled={createUser.isPending || !newUsername.trim() || !newPassword.trim()}
|
||||
className="btn-gradient px-4 py-2 text-sm disabled:opacity-50 disabled:cursor-not-allowed">
|
||||
className="btn-primary px-4 py-2 text-sm disabled:opacity-50 disabled:cursor-not-allowed">
|
||||
<span>{createUser.isPending ? 'Creating…' : 'Create User'}</span>
|
||||
</button>
|
||||
</form>
|
||||
@@ -103,7 +103,7 @@ export function UserTable() {
|
||||
placeholder="new password" className="w-32 input-glass px-2 py-1 text-xs" />
|
||||
<button onClick={() => handleResetPassword(user.id)}
|
||||
disabled={resetPassword.isPending || !resetPw.trim()}
|
||||
className="btn-gradient px-2 py-1 text-xs disabled:opacity-50">
|
||||
className="btn-primary px-2 py-1 text-xs disabled:opacity-50">
|
||||
<span>Save</span>
|
||||
</button>
|
||||
<button onClick={() => { setResetTarget(null); setResetPw(''); }}
|
||||
|
||||
@@ -52,7 +52,7 @@ export function WeightsForm({ weights }: WeightsFormProps) {
|
||||
step={1}
|
||||
value={sliderValues[key] ?? 0}
|
||||
onChange={(e) => handleChange(key, e.target.value)}
|
||||
className="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-700 accent-indigo-500"
|
||||
className="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-700 accent-blue-500"
|
||||
/>
|
||||
<span className="min-w-[2ch] text-right text-sm font-medium text-gray-300">
|
||||
{sliderValues[key] ?? 0}
|
||||
@@ -69,7 +69,7 @@ export function WeightsForm({ weights }: WeightsFormProps) {
|
||||
<button
|
||||
type="submit"
|
||||
disabled={updateWeights.isPending || allZero}
|
||||
className="mt-4 btn-gradient px-4 py-2 text-sm disabled:opacity-50"
|
||||
className="mt-4 btn-primary px-4 py-2 text-sm disabled:opacity-50"
|
||||
>
|
||||
<span>{updateWeights.isPending ? 'Updating…' : 'Update Weights'}</span>
|
||||
</button>
|
||||
|
||||
@@ -104,7 +104,7 @@ export function TradeTable({ trades, sortColumn, sortDirection, onSort }: TradeT
|
||||
</td>
|
||||
<td className="px-4 py-3.5">
|
||||
<div className="space-y-0.5">
|
||||
<span className="text-xs font-semibold text-indigo-300">{recommendationActionLabel(trade.recommended_action)}</span>
|
||||
<span className="text-xs font-semibold text-blue-300">{recommendationActionLabel(trade.recommended_action)}</span>
|
||||
{recommendationActionDirection(trade.recommended_action) !== 'neutral' && recommendationActionDirection(trade.recommended_action) !== trade.direction && (
|
||||
<div className="text-[10px] text-amber-400">Alternative setup (not preferred)</div>
|
||||
)}
|
||||
|
||||
@@ -127,7 +127,7 @@ export function RecommendationPanel({ symbol, longSetup, shortSetup }: Recommend
|
||||
<h2 className="mb-3 text-xs font-medium uppercase tracking-widest text-gray-500">Recommendation</h2>
|
||||
<div className="glass p-5 space-y-4">
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<span className="text-sm font-semibold text-indigo-300">{recommendationActionLabel(action)}</span>
|
||||
<span className="text-sm font-semibold text-blue-300">{recommendationActionLabel(action)}</span>
|
||||
<span className={`text-sm font-semibold ${riskClass(summary?.risk_level ?? null)}`}>
|
||||
Risk: {summary?.risk_level ?? '—'}
|
||||
</span>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const variantStyles: Record<string, string> = {
|
||||
auto: 'bg-blue-500/15 text-blue-400 border-blue-500/20',
|
||||
manual: 'bg-violet-500/15 text-violet-400 border-violet-500/20',
|
||||
manual: 'bg-sky-500/15 text-sky-400 border-sky-500/20',
|
||||
default: 'bg-white/[0.06] text-gray-400 border-white/[0.08]',
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
||||
|
||||
type Variant = 'primary' | 'ghost' | 'danger';
|
||||
type Size = 'sm' | 'md';
|
||||
|
||||
const variantClasses: Record<Variant, string> = {
|
||||
primary: 'btn-primary',
|
||||
ghost:
|
||||
'border border-white/[0.08] bg-white/[0.03] text-gray-300 hover:bg-white/[0.07] hover:text-gray-100 rounded-lg',
|
||||
danger:
|
||||
'border border-red-500/30 bg-red-500/10 text-red-400 hover:bg-red-500/20 rounded-lg',
|
||||
};
|
||||
|
||||
const sizeClasses: Record<Size, string> = {
|
||||
sm: 'px-3 py-1.5 text-xs',
|
||||
md: 'px-4 py-2 text-sm',
|
||||
};
|
||||
|
||||
export function Spinner({ className = 'h-4 w-4' }: { className?: string }) {
|
||||
return (
|
||||
<svg className={`animate-spin ${className}`} viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
|
||||
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: Variant;
|
||||
size?: Size;
|
||||
loading?: boolean;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export function Button({
|
||||
variant = 'primary',
|
||||
size = 'md',
|
||||
loading = false,
|
||||
disabled,
|
||||
className = '',
|
||||
children,
|
||||
...rest
|
||||
}: ButtonProps) {
|
||||
return (
|
||||
<button
|
||||
disabled={disabled || loading}
|
||||
className={`inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed ${variantClasses[variant]} ${sizeClasses[size]} ${className}`}
|
||||
{...rest}
|
||||
>
|
||||
{loading && <Spinner />}
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
type Variant = 'info' | 'warning' | 'error' | 'empty';
|
||||
|
||||
const variantClasses: Record<Variant, string> = {
|
||||
info: 'border-blue-500/20 bg-blue-500/10 text-blue-300',
|
||||
warning: 'border-amber-500/20 bg-amber-500/10 text-amber-300',
|
||||
error: 'border-red-500/20 bg-red-500/10 text-red-400',
|
||||
empty: 'border-white/[0.06] bg-white/[0.02] text-gray-400 py-8 text-center',
|
||||
};
|
||||
|
||||
interface CalloutProps {
|
||||
variant?: Variant;
|
||||
children: ReactNode;
|
||||
onRetry?: () => void;
|
||||
}
|
||||
|
||||
/** Standard inline message box for info banners, errors, and empty states. */
|
||||
export function Callout({ variant = 'info', children, onRetry }: CalloutProps) {
|
||||
return (
|
||||
<div className={`rounded-xl border px-4 py-3 text-sm ${variantClasses[variant]}`}>
|
||||
{children}
|
||||
{onRetry && (
|
||||
<button
|
||||
onClick={onRetry}
|
||||
className="mt-2 block text-xs font-medium underline opacity-80 hover:opacity-100"
|
||||
>
|
||||
Retry
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
interface DisclosureProps {
|
||||
summary: string;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
/** Collapsible help/explainer block — keeps secondary content out of the way. */
|
||||
export function Disclosure({ summary, children }: DisclosureProps) {
|
||||
return (
|
||||
<details className="glass-sm group">
|
||||
<summary className="flex cursor-pointer select-none items-center gap-2 px-4 py-2.5 text-xs font-medium text-gray-400 transition-colors hover:text-gray-200 [&::-webkit-details-marker]:hidden">
|
||||
<span className="inline-block transition-transform duration-200 group-open:rotate-90">▸</span>
|
||||
{summary}
|
||||
</summary>
|
||||
<div className="px-4 pb-4 pt-1 text-sm text-gray-300">{children}</div>
|
||||
</details>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { InputHTMLAttributes, ReactNode, SelectHTMLAttributes } from 'react';
|
||||
|
||||
interface FieldProps {
|
||||
label: string;
|
||||
htmlFor?: string;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
/** Labeled form control wrapper for filter bars and forms. */
|
||||
export function Field({ label, htmlFor, children }: FieldProps) {
|
||||
return (
|
||||
<div>
|
||||
<label htmlFor={htmlFor} className="mb-1 block text-xs text-gray-400">
|
||||
{label}
|
||||
</label>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Input({ className = '', ...rest }: InputHTMLAttributes<HTMLInputElement>) {
|
||||
return <input className={`input-glass px-3 py-1.5 text-sm ${className}`} {...rest} />;
|
||||
}
|
||||
|
||||
export function Select({ className = '', children, ...rest }: SelectHTMLAttributes<HTMLSelectElement>) {
|
||||
return (
|
||||
<select className={`input-glass px-3 py-1.5 text-sm [&>option]:bg-[#0d1322] ${className}`} {...rest}>
|
||||
{children}
|
||||
</select>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
interface PageHeaderProps {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
actions?: ReactNode;
|
||||
}
|
||||
|
||||
/** Standard page heading: plain title, muted subtitle, actions on the right. */
|
||||
export function PageHeader({ title, subtitle, actions }: PageHeaderProps) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-center justify-between gap-4">
|
||||
<div>
|
||||
<h1 className="text-2xl font-semibold text-gray-100">{title}</h1>
|
||||
{subtitle && <p className="mt-1 text-xs text-gray-500">{subtitle}</p>}
|
||||
</div>
|
||||
{actions && <div className="flex items-center gap-2">{actions}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
interface SectionProps {
|
||||
title: string;
|
||||
hint?: string;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
/** Content section with the standard uppercase tracking label. */
|
||||
export function Section({ title, hint, children }: SectionProps) {
|
||||
return (
|
||||
<section>
|
||||
<h2 className="mb-3 text-xs font-medium uppercase tracking-widest text-gray-500">
|
||||
{title}
|
||||
{hint && <span className="ml-2 normal-case tracking-normal text-gray-600">{hint}</span>}
|
||||
</h2>
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
interface TabsProps<T extends string> {
|
||||
tabs: readonly T[];
|
||||
active: T;
|
||||
onChange: (tab: T) => void;
|
||||
}
|
||||
|
||||
/** Glass pill tab bar. */
|
||||
export function Tabs<T extends string>({ tabs, active, onChange }: TabsProps<T>) {
|
||||
return (
|
||||
<div className="glass-sm flex w-fit gap-1 p-1" role="tablist">
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab}
|
||||
role="tab"
|
||||
aria-selected={active === tab}
|
||||
onClick={() => onChange(tab)}
|
||||
className={`rounded-lg px-4 py-2 text-sm font-medium transition-all duration-200 ${
|
||||
active === tab
|
||||
? 'bg-white/[0.1] text-white shadow-lg shadow-blue-500/10'
|
||||
: 'text-gray-400 hover:bg-white/[0.04] hover:text-gray-200'
|
||||
}`}
|
||||
>
|
||||
{tab}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export function AddTickerForm() {
|
||||
<button
|
||||
type="submit"
|
||||
disabled={addMutation.isPending || !symbol.trim()}
|
||||
className="btn-gradient px-4 py-2 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
className="btn-primary px-4 py-2 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<span>{addMutation.isPending ? 'Adding…' : 'Add'}</span>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user