chore(workspace): move the app to apps/app under a pnpm workspace (step 2)
144 files moved with git mv (pure renames). Root package.json delegates dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager, root devDependency, engine-strict). Dockerfile builds @faunosteo/app on node:24-alpine and copies apps/app/dist; nginx and runtime config unchanged. CI workflow for Gitea Actions. packages/ reserved (README only). Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan. 271/271 tests, typecheck, lint, build green from the root.
This commit is contained in:
1 parent
c8d48ab4cc
commit
8673475293
164 files changed
+348
-128
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
export default function Badge({
|
||||
children,
|
||||
tone = 'neutral',
|
||||
className = '',
|
||||
}: {
|
||||
children: ReactNode
|
||||
tone?: 'neutral' | 'accent' | 'warn' | 'danger'
|
||||
className?: string
|
||||
}) {
|
||||
const map = {
|
||||
neutral: 'bg-[var(--color-surface-strong)] text-[var(--color-ink)]',
|
||||
accent: 'bg-[var(--color-accent)]/10 text-[var(--color-accent-strong)]',
|
||||
warn: 'bg-amber-50 text-amber-700',
|
||||
danger: 'bg-red-50 text-red-700',
|
||||
} as const
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium ${map[tone]} ${className}`}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import type { ButtonHTMLAttributes, ReactNode } from 'react'
|
||||
|
||||
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: 'primary' | 'secondary' | 'ghost' | 'danger'
|
||||
size?: 'sm' | 'md' | 'lg'
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
const VARIANTS: Record<NonNullable<ButtonProps['variant']>, string> = {
|
||||
primary:
|
||||
'bg-[var(--color-accent)] text-white hover:bg-[var(--color-accent-strong)] focus-visible:ring-[var(--color-accent)]',
|
||||
secondary:
|
||||
'bg-[var(--color-surface)] text-[var(--color-ink)] border border-[var(--color-border)] hover:bg-[var(--color-surface-strong)]',
|
||||
ghost:
|
||||
'bg-transparent text-[var(--color-ink)] hover:bg-[var(--color-surface)]',
|
||||
danger:
|
||||
'bg-[var(--color-danger)] text-white hover:bg-[var(--color-danger-strong)]',
|
||||
}
|
||||
|
||||
const SIZES: Record<NonNullable<ButtonProps['size']>, string> = {
|
||||
sm: 'h-9 px-3 text-sm rounded-md',
|
||||
md: 'h-10 px-4 text-sm sm:text-base rounded-lg',
|
||||
lg: 'h-12 px-5 sm:px-6 text-base rounded-lg',
|
||||
}
|
||||
|
||||
export default function Button({
|
||||
variant = 'primary',
|
||||
size = 'md',
|
||||
className = '',
|
||||
children,
|
||||
...rest
|
||||
}: ButtonProps) {
|
||||
return (
|
||||
<button
|
||||
className={[
|
||||
'inline-flex items-center justify-center font-medium transition disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
|
||||
VARIANTS[variant],
|
||||
SIZES[size],
|
||||
className,
|
||||
].join(' ')}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
export interface CardProps {
|
||||
children: ReactNode
|
||||
className?: string
|
||||
as?: 'div' | 'section' | 'article'
|
||||
}
|
||||
|
||||
export default function Card({ children, className = '', as: Tag = 'div' }: CardProps) {
|
||||
return (
|
||||
<Tag
|
||||
className={[
|
||||
'rounded-2xl border border-[var(--color-border)] bg-[var(--color-surface)] shadow-sm',
|
||||
className,
|
||||
].join(' ')}
|
||||
>
|
||||
{children}
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { ButtonHTMLAttributes, ReactNode } from 'react'
|
||||
|
||||
export default function Chip({
|
||||
active = false,
|
||||
children,
|
||||
className = '',
|
||||
...rest
|
||||
}: ButtonHTMLAttributes<HTMLButtonElement> & { active?: boolean; children: ReactNode }) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={active}
|
||||
className={[
|
||||
'inline-flex items-center justify-center min-w-[40px] h-10 px-3 rounded-full border text-sm font-medium transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]/30',
|
||||
active
|
||||
? 'bg-[var(--color-accent)] text-white border-[var(--color-accent)]'
|
||||
: 'bg-white text-[var(--color-ink)] border-[var(--color-border)] hover:bg-[var(--color-surface)]',
|
||||
className,
|
||||
].join(' ')}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { useEffect, type ReactNode } from 'react'
|
||||
import { AnimatePresence, motion } from 'motion/react'
|
||||
import { useT } from '@/i18n/useT'
|
||||
|
||||
export interface DialogProps {
|
||||
open: boolean
|
||||
onClose: () => void
|
||||
title: string
|
||||
children: ReactNode
|
||||
size?: 'sm' | 'md' | 'lg' | 'xl'
|
||||
}
|
||||
|
||||
const SIZE: Record<NonNullable<DialogProps['size']>, string> = {
|
||||
sm: 'max-w-sm',
|
||||
md: 'max-w-md',
|
||||
lg: 'max-w-2xl',
|
||||
xl: 'max-w-4xl',
|
||||
}
|
||||
|
||||
export default function Dialog({ open, onClose, title, children, size = 'md' }: DialogProps) {
|
||||
const t = useT()
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose()
|
||||
window.addEventListener('keydown', onKey)
|
||||
return () => window.removeEventListener('keydown', onKey)
|
||||
}, [open, onClose])
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{open && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4">
|
||||
<motion.div
|
||||
data-testid="dialog-backdrop"
|
||||
className="absolute inset-0 bg-black/40"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ duration: 0.15 }}
|
||||
onClick={onClose}
|
||||
/>
|
||||
<motion.div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={title}
|
||||
initial={{ opacity: 0, scale: 0.96 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
exit={{ opacity: 0, scale: 0.96 }}
|
||||
transition={{ duration: 0.18 }}
|
||||
className={`relative w-full ${SIZE[size]} max-h-[85vh] overflow-y-auto rounded-2xl bg-[var(--color-surface)] shadow-xl`}
|
||||
>
|
||||
<header className="flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b border-[var(--color-border)]">
|
||||
<h2 className="text-lg font-semibold text-[var(--color-ink)]">{title}</h2>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t('common.close')}
|
||||
onClick={onClose}
|
||||
className="rounded-md p-1 text-[var(--color-ink-muted)] hover:bg-[var(--color-surface-strong)]"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</header>
|
||||
<div className="px-4 sm:px-6 py-3 sm:py-4">{children}</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { forwardRef, type InputHTMLAttributes } from 'react'
|
||||
|
||||
const Input = forwardRef<HTMLInputElement, InputHTMLAttributes<HTMLInputElement>>(
|
||||
({ className = '', ...rest }, ref) => (
|
||||
<input
|
||||
ref={ref}
|
||||
className={[
|
||||
'h-10 w-full rounded-lg border border-[var(--color-border)] bg-white px-3 text-base text-[var(--color-ink)] placeholder:text-[var(--color-ink-muted)] focus-visible:border-[var(--color-accent)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]/30',
|
||||
className,
|
||||
].join(' ')}
|
||||
{...rest}
|
||||
/>
|
||||
),
|
||||
)
|
||||
Input.displayName = 'Input'
|
||||
export default Input
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { LabelHTMLAttributes, ReactNode } from 'react'
|
||||
|
||||
export default function Label({
|
||||
children,
|
||||
className = '',
|
||||
...rest
|
||||
}: LabelHTMLAttributes<HTMLLabelElement> & { children: ReactNode }) {
|
||||
return (
|
||||
<label
|
||||
className={[
|
||||
'block text-sm font-medium text-[var(--color-ink)] mb-1',
|
||||
className,
|
||||
].join(' ')}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
</label>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { forwardRef, type SelectHTMLAttributes } from 'react'
|
||||
|
||||
const Select = forwardRef<HTMLSelectElement, SelectHTMLAttributes<HTMLSelectElement>>(
|
||||
({ className = '', children, ...rest }, ref) => (
|
||||
<select
|
||||
ref={ref}
|
||||
className={[
|
||||
'h-10 w-full rounded-lg border border-[var(--color-border)] bg-white px-3 text-base text-[var(--color-ink)] focus-visible:border-[var(--color-accent)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]/30',
|
||||
className,
|
||||
].join(' ')}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
</select>
|
||||
),
|
||||
)
|
||||
Select.displayName = 'Select'
|
||||
export default Select
|
||||
@@ -0,0 +1,16 @@
|
||||
import { forwardRef, type TextareaHTMLAttributes } from 'react'
|
||||
|
||||
const Textarea = forwardRef<HTMLTextAreaElement, TextareaHTMLAttributes<HTMLTextAreaElement>>(
|
||||
({ className = '', ...rest }, ref) => (
|
||||
<textarea
|
||||
ref={ref}
|
||||
className={[
|
||||
'w-full min-h-[96px] rounded-lg border border-[var(--color-border)] bg-white p-3 text-base text-[var(--color-ink)] placeholder:text-[var(--color-ink-muted)] focus-visible:border-[var(--color-accent)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]/30',
|
||||
className,
|
||||
].join(' ')}
|
||||
{...rest}
|
||||
/>
|
||||
),
|
||||
)
|
||||
Textarea.displayName = 'Textarea'
|
||||
export default Textarea
|
||||
Reference in new issue
Block a user