kintex/mobile/components/AiImage.tsx
zio 6c9891c7e2 feat: mobile harness + design v2.1 (84 screens) + PLANNING v3.1 + deliverables + Stitch screens
- Harness: kintex-mobile-dev agent + kintex-mobile-orchestrator skill (WISE mobile ref, Stitch-first design rule, dual app targets B2B/B2C)
- design.md v2.1: full 84-screen inventory (web 51 / admin 10 / public 8 / mobile 15) with Stitch prompts incl. ticketing (SCR-P7/P8, M14/M15)
- PLANNING v3.1: unified account + split signup tracks (2FA required for staff, light signup/guest for visitors), one codebase / two app targets
- Deliverables: dev plan (21s), user/operator/developer guides (17/14/15s), program spec (44s, 65 programs, 8 flowcharts), DA (DB design 14s + table spec xlsx 35 tables/299 cols)
- Benchmark: ticketing-app-benchmark.md (7 apps) -> IMPLEMENTATION_BACKLOG Phase F (14 items)
- Stitch: 23 generated screens saved (mobile 10, admin 6, web core 5, ticket 2)
- mobile/: Expo scaffold (SDK 51, expo-router, secure store JWT)
- frontend: SCR-13~17 QA fixes, icons.tsx, kintexEvents, V10 seed migration
- ci/: KINTEX CI logo assets

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 23:31:45 +09:00

123 lines
3.5 KiB
TypeScript

/*
* AI 생성 이미지 — 워터마크 상시 오버레이 + "AI 생성 예상 이미지" 고지문(제거 불가).
* 계약: 01_backend_contracts.md §0-3 (watermarkRequired/watermarkText/notice 항상 포함).
* design.md §1-4: 생성 이미지는 카드 하단 고지문 항상 노출.
*/
import React from 'react';
import { Image, StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';
import { AI_IMAGE_NOTICE } from '../lib/config';
import { colors, radius, type } from '../theme';
interface Props {
uri: string | null;
/** 상태: 생성 중/실패 표시. */
status?: 'DONE' | 'QUEUED' | 'RUNNING' | 'FAILED';
watermarkText?: string;
notice?: string;
shotBadge?: string; // 예: "S2 야간"
height?: number;
style?: StyleProp<ViewStyle>;
}
export function AiImage({
uri,
status = 'DONE',
watermarkText,
notice,
shotBadge,
height = 200,
style,
}: Props) {
const wm = watermarkText ?? AI_IMAGE_NOTICE;
const loading = status === 'QUEUED' || status === 'RUNNING';
const failed = status === 'FAILED';
return (
<View style={[styles.wrap, style]}>
<View style={[styles.frame, { height }]}>
{uri && status === 'DONE' ? (
<Image source={{ uri }} style={styles.img} resizeMode="cover" />
) : (
<View style={[styles.img, styles.placeholder]}>
<Text style={styles.placeholderText}>
{loading ? '생성 중… 평균 40초' : failed ? '생성 실패 — 다시 생성' : '이미지 없음'}
</Text>
</View>
)}
{/* 워터마크 (상시, 제거 불가) */}
<View pointerEvents="none" style={styles.watermarkLayer}>
<Text style={styles.watermark}>{wm}</Text>
</View>
{/* AI 라벨 칩 */}
<View style={styles.aiChip}>
<Text style={styles.aiChipText}>AI </Text>
</View>
{shotBadge ? (
<View style={styles.shotBadge}>
<Text style={styles.shotBadgeText}>{shotBadge}</Text>
</View>
) : null}
</View>
{/* 하단 고지문 (제거 불가) */}
<Text style={styles.notice}>{notice ?? wm}</Text>
</View>
);
}
const styles = StyleSheet.create({
wrap: { gap: 6 },
frame: {
width: '100%',
borderRadius: radius.md,
overflow: 'hidden',
backgroundColor: colors.neutral050,
borderWidth: 1,
borderColor: colors.neutral200,
},
img: { width: '100%', height: '100%' },
placeholder: {
alignItems: 'center',
justifyContent: 'center',
backgroundColor: colors.aiSurface,
},
placeholderText: { color: colors.neutral500, fontSize: type.body.fontSize },
watermarkLayer: {
...StyleSheet.absoluteFillObject,
alignItems: 'center',
justifyContent: 'center',
},
watermark: {
color: 'rgba(16,24,40,0.28)',
fontSize: 13,
fontWeight: '700',
transform: [{ rotate: '-18deg' }],
textAlign: 'center',
paddingHorizontal: 12,
},
aiChip: {
position: 'absolute',
top: 8,
left: 8,
backgroundColor: colors.aiAccent,
borderRadius: radius.pill,
paddingHorizontal: 8,
paddingVertical: 2,
},
aiChipText: { color: colors.white, fontSize: 11, fontWeight: '700' },
shotBadge: {
position: 'absolute',
top: 8,
right: 8,
backgroundColor: 'rgba(28,37,54,0.8)',
borderRadius: radius.sm,
paddingHorizontal: 8,
paddingVertical: 2,
},
shotBadgeText: { color: colors.white, fontSize: 11, fontWeight: '600' },
notice: { color: colors.neutral500, fontSize: type.caption.fontSize },
});