1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 08:29:36 +01:00
effigenix/frontend/apps/cli/src/components/shared/FormInput.tsx
Sebastian Frick bbe9e87c33 feat(frontend): TypeScript-Monorepo mit Terminal-UI für Effigenix ERP
Monorepo-Setup (pnpm workspaces) mit vier shared Packages und einer TUI-App:

Shared Packages:
- @effigenix/types: TypeScript-DTOs (UserDTO, RoleDTO, AuthDTO, Enums)
- @effigenix/config: API-Konfiguration und Shared Constants
- @effigenix/validation: Zod-Schemas für Username, E-Mail und Passwort
- @effigenix/api-client: axios-Client mit JWT-Handling (proaktiver + reaktiver
  Token-Refresh), AuthInterceptor, ErrorInterceptor, Resources für auth/users/roles

TUI (apps/cli, Ink 5 / React):
- Authentication: Login/Logout, Session-Restore beim Start, JWT-Refresh
- User Management: Liste, Anlage (Zod-Inline-Validation), Detailansicht,
  Passwort ändern, Sperren/Entsperren mit ConfirmDialog
- Role Management: Liste, Detailansicht, Zuweisen/Entfernen per RoleSelectList (↑↓)
- UX: SuccessDisplay (Auto-Dismiss 3 s), ConfirmDialog (J/N),
  FormInput mit Inline-Fehlern, StatusBar mit API-URL
- Layout: Fullscreen-Modus (alternate screen buffer), Header mit eingeloggtem User
- Tests: vitest + ink-testing-library (15 Tests)
2026-02-18 12:28:16 +01:00

34 lines
972 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import { Box, Text } from 'ink';
import TextInput from 'ink-text-input';
interface FormInputProps {
label: string;
value: string;
onChange: (value: string) => void;
onSubmit?: (value: string) => void;
focus: boolean;
placeholder?: string;
mask?: string;
error?: string;
}
export function FormInput({ label, value, onChange, onSubmit, focus, placeholder, mask, error }: FormInputProps) {
return (
<Box flexDirection="column">
<Text color={focus ? 'cyan' : 'gray'}>{label}</Text>
<Box>
<Text color="gray"> </Text>
<TextInput
value={value}
onChange={onChange}
{...(onSubmit !== undefined ? { onSubmit } : {})}
focus={focus}
{...(placeholder !== undefined ? { placeholder } : {})}
{...(mask !== undefined ? { mask } : {})}
/>
</Box>
{error !== undefined && <Text color="red"> {error}</Text>}
</Box>
);
}