This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
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>
2026-06-23 14:14:09 +03:00

167 lines
4.3 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { useState, useEffect } from 'react';
import {
View,
Text,
StyleSheet,
FlatList,
TouchableOpacity,
} from 'react-native';
import { useRouter } from 'expo-router';
import { Colors } from '../../constants/Colors';
import Header from '../../components/navigation/Header';
import LoadingSpinner from '../../components/common/LoadingSpinner';
import EmptyState from '../../components/common/EmptyState';
import { logger } from '../../utils/logger';
import { Image } from 'expo-image';
import { analyticsService } from '../../services/analyticsService';
import { postService } from '../../services/postService';
export default function PostAnalyticsScreen() {
const router = useRouter();
const [posts, setPosts] = useState<any[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
loadPostAnalytics();
}, []);
const loadPostAnalytics = async () => {
try {
setLoading(true);
// Get user's posts first
const postsResponse = await postService.getPosts(1, 50);
const userPosts = postsResponse.posts || [];
// For each post, get analytics
const postsWithAnalytics = await Promise.all(
userPosts.map(async (post: any) => {
try {
const analytics = await analyticsService.getPostAnalytics(post.id);
return {
...post,
likesCount: analytics.analytics?.likes || post.likesCount || 0,
commentsCount: analytics.analytics?.comments || post.commentsCount || 0,
viewsCount: analytics.analytics?.views || 0,
};
} catch (error) {
return post;
}
})
);
setPosts(postsWithAnalytics);
} catch (error) {
logger.error('Load post analytics error:', error);
} finally {
setLoading(false);
}
};
const renderPost = ({ item }: { item: any }) => (
<TouchableOpacity
style={styles.postItem}
onPress={() => router.push(`/post/${item.id}`)}
>
{item.mediaUrl && (
<Image source={{ uri: item.mediaUrl }} style={styles.postImage} />
)}
<View style={styles.postInfo}>
<Text style={styles.postDate}>
{new Date(item.createdAt).toLocaleDateString()}
</Text>
<View style={styles.postStats}>
<View style={styles.statItem}>
<Text style={styles.statIcon}>❤️</Text>
<Text style={styles.statValue}>{item.likesCount || 0}</Text>
</View>
<View style={styles.statItem}>
<Text style={styles.statIcon}>💬</Text>
<Text style={styles.statValue}>{item.commentsCount || 0}</Text>
</View>
<View style={styles.statItem}>
<Text style={styles.statIcon}>👁️</Text>
<Text style={styles.statValue}>{item.viewsCount || 0}</Text>
</View>
</View>
</View>
</TouchableOpacity>
);
if (loading) {
return (
<View style={styles.container}>
<Header title="Post Analytics" />
<LoadingSpinner fullScreen />
</View>
);
}
return (
<View style={styles.container}>
<Header title="Post Analytics" />
{posts.length > 0 ? (
<FlatList
data={posts}
renderItem={renderPost}
keyExtractor={(item) => item.id}
contentContainerStyle={styles.listContent}
/>
) : (
<EmptyState
title="No post analytics"
message="Analytics for your posts will appear here"
/>
)}
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
},
listContent: {
padding: 16,
},
postItem: {
flexDirection: 'row',
padding: 16,
borderBottomWidth: 1,
borderBottomColor: Colors.border,
gap: 12,
},
postImage: {
width: 80,
height: 80,
borderRadius: 8,
},
postInfo: {
flex: 1,
justifyContent: 'space-between',
},
postDate: {
fontSize: 14,
color: Colors.textSecondary,
marginBottom: 8,
},
postStats: {
flexDirection: 'row',
gap: 16,
},
statItem: {
flexDirection: 'row',
alignItems: 'center',
gap: 4,
},
statIcon: {
fontSize: 16,
},
statValue: {
fontSize: 14,
color: Colors.text,
fontWeight: '500',
},
});