Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
127 lines
2.9 KiB
TypeScript
127 lines
2.9 KiB
TypeScript
import React, { useState, useEffect } from 'react';
|
|
import {
|
|
View,
|
|
Text,
|
|
StyleSheet,
|
|
TouchableOpacity,
|
|
} from 'react-native';
|
|
import { useRouter } from 'expo-router';
|
|
import { Colors } from '../../constants/Colors';
|
|
import { Image } from 'expo-image';
|
|
import { adService } from '../../services/adService';
|
|
import { logger } from '../../utils/logger';
|
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
|
|
interface AdCardProps {
|
|
ad: {
|
|
id: string;
|
|
title: string;
|
|
description?: string;
|
|
imageUrl: string;
|
|
targetUrl: string;
|
|
};
|
|
onReport?: () => void;
|
|
}
|
|
|
|
export default function AdCard({ ad, onReport }: AdCardProps) {
|
|
const router = useRouter();
|
|
const [viewed, setViewed] = useState(false);
|
|
|
|
useEffect(() => {
|
|
// Track view when ad is visible
|
|
if (!viewed) {
|
|
adService.trackView(ad.id).catch((error) => {
|
|
logger.error('Track ad view error:', error);
|
|
});
|
|
setViewed(true);
|
|
}
|
|
}, [ad.id, viewed]);
|
|
|
|
const handleClick = async () => {
|
|
try {
|
|
await adService.trackClick(ad.id);
|
|
// Open target URL (in a real app, this would open in browser or in-app browser)
|
|
// router.push(ad.targetUrl);
|
|
} catch (error) {
|
|
logger.error('Track ad click error:', error);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<View style={styles.adLabel}>
|
|
<Text style={styles.adLabelText}>Ad</Text>
|
|
</View>
|
|
<TouchableOpacity onPress={handleClick} activeOpacity={0.8}>
|
|
<Image source={{ uri: ad.imageUrl }} style={styles.image} />
|
|
<View style={styles.info}>
|
|
<Text style={styles.title}>{ad.title}</Text>
|
|
{ad.description && (
|
|
<Text style={styles.description} numberOfLines={2}>
|
|
{ad.description}
|
|
</Text>
|
|
)}
|
|
</View>
|
|
</TouchableOpacity>
|
|
{onReport && (
|
|
<TouchableOpacity
|
|
style={styles.reportButton}
|
|
onPress={onReport}
|
|
>
|
|
<Icon name="report" size={16} color={Colors.textSecondary} />
|
|
</TouchableOpacity>
|
|
)}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
backgroundColor: Colors.surface,
|
|
borderRadius: 12,
|
|
overflow: 'hidden',
|
|
marginBottom: 16,
|
|
position: 'relative',
|
|
},
|
|
adLabel: {
|
|
position: 'absolute',
|
|
top: 8,
|
|
right: 8,
|
|
backgroundColor: Colors.background,
|
|
paddingHorizontal: 8,
|
|
paddingVertical: 4,
|
|
borderRadius: 4,
|
|
zIndex: 1,
|
|
},
|
|
adLabelText: {
|
|
fontSize: 10,
|
|
fontWeight: '600',
|
|
color: Colors.textSecondary,
|
|
textTransform: 'uppercase',
|
|
},
|
|
image: {
|
|
width: '100%',
|
|
height: 200,
|
|
},
|
|
info: {
|
|
padding: 12,
|
|
},
|
|
title: {
|
|
fontSize: 16,
|
|
fontWeight: '600',
|
|
color: Colors.text,
|
|
marginBottom: 4,
|
|
},
|
|
description: {
|
|
fontSize: 14,
|
|
color: Colors.textSecondary,
|
|
},
|
|
reportButton: {
|
|
position: 'absolute',
|
|
bottom: 8,
|
|
right: 8,
|
|
padding: 8,
|
|
},
|
|
});
|
|
|