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

158 lines
3.9 KiB
TypeScript

import React, { useState, useEffect } 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 Icon from 'react-native-vector-icons/MaterialIcons';
import { reelService } from '../../../services/reelService';
import { logger } from '../../../utils/logger';
import LoadingSpinner from '../../../components/common/LoadingSpinner';
export default function ReelSaveScreen() {
const { id } = useLocalSearchParams<{ id: string }>();
const router = useRouter();
const [isSaved, setIsSaved] = useState(false);
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
useEffect(() => {
checkSavedStatus();
}, [id]);
const checkSavedStatus = async () => {
try {
// Check if reel is saved by trying to get saved reels (if endpoint exists)
// For now, we'll assume not saved and let the user toggle
setIsSaved(false);
} catch (error) {
logger.error('Check saved status error:', error);
} finally {
setLoading(false);
}
};
const handleToggleSave = async () => {
setSaving(true);
try {
if (isSaved) {
await reelService.unsaveReel(id!);
setIsSaved(false);
Alert.alert('Success', 'Reel removed from saved');
} else {
await reelService.saveReel(id!);
setIsSaved(true);
Alert.alert('Success', 'Reel saved');
}
} catch (error) {
logger.error('Toggle save error:', error);
Alert.alert('Error', 'Failed to update save status');
} finally {
setSaving(false);
}
};
if (loading) {
return (
<View style={styles.container}>
<Header title={isSaved ? 'Unsave Reel' : 'Save Reel'} />
<LoadingSpinner fullScreen />
</View>
);
}
return (
<View style={styles.container}>
<Header title={isSaved ? 'Unsave Reel' : 'Save Reel'} />
<View style={styles.content}>
<Icon
name={isSaved ? 'bookmark' : 'bookmark-border'}
size={64}
color={Colors.accent}
style={styles.icon}
/>
<Text style={styles.title}>
{isSaved ? 'Reel Saved' : 'Save Reel?'}
</Text>
<Text style={styles.description}>
{isSaved
? 'This reel is saved to your collection. You can access it anytime from your profile.'
: 'Save this reel to your collection to view it later.'}
</Text>
<TouchableOpacity
style={[
styles.button,
isSaved && styles.unsaveButton,
saving && styles.buttonDisabled,
]}
onPress={handleToggleSave}
disabled={saving}
>
<Text style={styles.buttonText}>
{saving
? 'Updating...'
: isSaved
? 'Remove from Saved'
: 'Save Reel'}
</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,
},
button: {
backgroundColor: Colors.accent,
borderRadius: 8,
padding: 16,
alignItems: 'center',
width: '100%',
},
unsaveButton: {
backgroundColor: Colors.error || '#ff4444',
},
buttonDisabled: {
opacity: 0.6,
},
buttonText: {
color: Colors.text,
fontSize: 16,
fontWeight: '600',
},
});