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>
145 lines
3.5 KiB
TypeScript
145 lines
3.5 KiB
TypeScript
import React, { useState } from 'react';
|
|
import {
|
|
View,
|
|
Text,
|
|
StyleSheet,
|
|
TouchableOpacity,
|
|
Alert,
|
|
} from 'react-native';
|
|
import { useLocalSearchParams, useRouter } from 'expo-router';
|
|
import { Colors } from '../../../constants/Colors';
|
|
import Header from '../../../components/navigation/Header';
|
|
import { postService } from '../../../services/postService';
|
|
import { logger } from '../../../utils/logger';
|
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
|
|
export default function PostDeleteScreen() {
|
|
const { id } = useLocalSearchParams<{ id: string }>();
|
|
const router = useRouter();
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
const handleDelete = () => {
|
|
Alert.alert(
|
|
'Delete Post',
|
|
'Are you sure you want to delete this post? This action cannot be undone.',
|
|
[
|
|
{
|
|
text: 'Cancel',
|
|
style: 'cancel',
|
|
},
|
|
{
|
|
text: 'Delete',
|
|
style: 'destructive',
|
|
onPress: confirmDelete,
|
|
},
|
|
]
|
|
);
|
|
};
|
|
|
|
const confirmDelete = async () => {
|
|
setLoading(true);
|
|
try {
|
|
await postService.deletePost(id!);
|
|
Alert.alert('Success', 'Post deleted successfully', [
|
|
{
|
|
text: 'OK',
|
|
onPress: () => router.back(),
|
|
},
|
|
]);
|
|
} catch (error: any) {
|
|
logger.error('Delete post error:', error);
|
|
Alert.alert('Error', error.response?.data?.error || 'Failed to delete post');
|
|
} finally {
|
|
setLoading(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<Header title="Delete Post" />
|
|
<View style={styles.content}>
|
|
<Icon name="delete-outline" size={64} color={Colors.error || '#ff4444'} style={styles.icon} />
|
|
<Text style={styles.title}>Delete Post?</Text>
|
|
<Text style={styles.description}>
|
|
This will permanently delete your post. This action cannot be undone.
|
|
</Text>
|
|
|
|
<TouchableOpacity
|
|
style={[styles.deleteButton, loading && styles.buttonDisabled]}
|
|
onPress={handleDelete}
|
|
disabled={loading}
|
|
>
|
|
<Text style={styles.deleteButtonText}>
|
|
{loading ? 'Deleting...' : 'Delete Post'}
|
|
</Text>
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity
|
|
style={styles.cancelButton}
|
|
onPress={() => router.back()}
|
|
disabled={loading}
|
|
>
|
|
<Text style={styles.cancelButtonText}>Cancel</Text>
|
|
</TouchableOpacity>
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: Colors.background,
|
|
},
|
|
content: {
|
|
flex: 1,
|
|
padding: 20,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
},
|
|
icon: {
|
|
marginBottom: 24,
|
|
},
|
|
title: {
|
|
fontSize: 24,
|
|
fontWeight: '600',
|
|
color: Colors.text,
|
|
marginBottom: 12,
|
|
textAlign: 'center',
|
|
},
|
|
description: {
|
|
fontSize: 16,
|
|
color: Colors.textSecondary,
|
|
textAlign: 'center',
|
|
marginBottom: 32,
|
|
paddingHorizontal: 20,
|
|
},
|
|
deleteButton: {
|
|
backgroundColor: Colors.error || '#ff4444',
|
|
borderRadius: 8,
|
|
padding: 16,
|
|
alignItems: 'center',
|
|
width: '100%',
|
|
marginBottom: 12,
|
|
},
|
|
buttonDisabled: {
|
|
opacity: 0.6,
|
|
},
|
|
deleteButtonText: {
|
|
color: Colors.text,
|
|
fontSize: 16,
|
|
fontWeight: '600',
|
|
},
|
|
cancelButton: {
|
|
padding: 16,
|
|
alignItems: 'center',
|
|
width: '100%',
|
|
},
|
|
cancelButtonText: {
|
|
color: Colors.textSecondary,
|
|
fontSize: 16,
|
|
fontWeight: '600',
|
|
},
|
|
});
|
|
|