videogen/apps/mobile/components/canon/CanonValueFields.tsx
caelum0x d56639a594
Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

120 lines
3.5 KiB
TypeScript

/**
* CanonValueFields — the shared, presentational input group for a canon's value
* surface (style, palette, typography, voice, product, brand). Controlled by the
* parent screen: it renders labelled `TextInput`s and reports edits through
* `onChange(key, value)`. List fields are entered comma-separated. Stateless so
* both the create and lock forms render an identical surface.
*/
import { StyleSheet, Text, TextInput, View } from "react-native";
import { colors } from "@/components/me/theme";
import type { CanonValueFields as Fields } from "@/components/canon/canon-fields";
interface FieldSpec {
key: keyof Fields;
label: string;
placeholder: string;
hint?: string;
multiline?: boolean;
}
const FIELD_SPECS: readonly FieldSpec[] = [
{ key: "style", label: "Style", placeholder: "e.g. cinematic, warm, editorial" },
{
key: "palette",
label: "Palette",
placeholder: "#0B0B0B, #FFD93D, #F5F5F5",
hint: "Comma-separated colors or names",
},
{
key: "typography",
label: "Typography",
placeholder: "Inter, Söhne",
hint: "Comma-separated typefaces",
},
{ key: "voice_id", label: "Voice ID", placeholder: "elevenlabs:…" },
{ key: "voice_tone", label: "Voice tone", placeholder: "confident, calm" },
{ key: "language", label: "Language", placeholder: "en, tr" },
{ key: "product_name", label: "Product name", placeholder: "Menivor" },
{
key: "product_descriptors",
label: "Product descriptors",
placeholder: "fast, private, on-device",
hint: "Comma-separated",
},
{
key: "product_claims",
label: "Product claims",
placeholder: "Renders in seconds, No account needed",
hint: "Comma-separated approved claims",
multiline: true,
},
{
key: "brand_tone",
label: "Brand tone",
placeholder: "direct, playful",
hint: "Comma-separated",
},
{
key: "brand_avoid",
label: "Brand avoid",
placeholder: "hype, jargon",
hint: "Comma-separated words/claims to avoid",
},
];
interface CanonValueFieldsProps {
fields: Fields;
onChange: (key: keyof Fields, value: string) => void;
disabled?: boolean;
}
export function CanonValueFields({ fields, onChange, disabled }: CanonValueFieldsProps) {
return (
<View style={styles.group}>
{FIELD_SPECS.map((spec) => (
<View key={spec.key} style={styles.field}>
<Text style={styles.label}>{spec.label}</Text>
<TextInput
style={[styles.input, spec.multiline && styles.multiline]}
value={fields[spec.key]}
onChangeText={(text) => onChange(spec.key, text)}
placeholder={spec.placeholder}
placeholderTextColor={colors.muted}
editable={!disabled}
multiline={spec.multiline}
autoCapitalize="none"
autoCorrect={false}
/>
{spec.hint ? <Text style={styles.hint}>{spec.hint}</Text> : null}
</View>
))}
</View>
);
}
const styles = StyleSheet.create({
group: { gap: 12 },
field: { gap: 5 },
label: {
color: colors.muted,
fontSize: 11,
fontWeight: "700",
letterSpacing: 0.8,
textTransform: "uppercase",
},
input: {
backgroundColor: colors.cardAlt,
borderColor: colors.border,
borderWidth: 1,
borderRadius: 8,
paddingHorizontal: 12,
paddingVertical: 10,
color: colors.textPrimary,
fontSize: 14,
},
multiline: { minHeight: 72, textAlignVertical: "top" },
hint: { color: colors.muted, fontSize: 11 },
});