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>
133 lines
2.6 KiB
TypeScript
133 lines
2.6 KiB
TypeScript
import React, { useEffect, useRef } from 'react';
|
|
import {
|
|
View,
|
|
Text,
|
|
StyleSheet,
|
|
Animated,
|
|
TouchableOpacity,
|
|
} from 'react-native';
|
|
import { Colors } from '../../constants/Colors';
|
|
|
|
interface ToastProps {
|
|
message: string;
|
|
type?: 'success' | 'error' | 'info';
|
|
duration?: number;
|
|
onClose?: () => void;
|
|
}
|
|
|
|
export default function Toast({
|
|
message,
|
|
type = 'info',
|
|
duration = 3000,
|
|
onClose,
|
|
}: ToastProps) {
|
|
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
const slideAnim = useRef(new Animated.Value(-100)).current;
|
|
|
|
useEffect(() => {
|
|
// Fade in and slide down
|
|
Animated.parallel([
|
|
Animated.timing(fadeAnim, {
|
|
toValue: 1,
|
|
duration: 300,
|
|
useNativeDriver: true,
|
|
}),
|
|
Animated.spring(slideAnim, {
|
|
toValue: 0,
|
|
useNativeDriver: true,
|
|
tension: 50,
|
|
friction: 7,
|
|
}),
|
|
]).start();
|
|
|
|
// Auto dismiss
|
|
const timer = setTimeout(() => {
|
|
dismiss();
|
|
}, duration);
|
|
|
|
return () => clearTimeout(timer);
|
|
}, []);
|
|
|
|
const dismiss = () => {
|
|
Animated.parallel([
|
|
Animated.timing(fadeAnim, {
|
|
toValue: 0,
|
|
duration: 200,
|
|
useNativeDriver: true,
|
|
}),
|
|
Animated.timing(slideAnim, {
|
|
toValue: -100,
|
|
duration: 200,
|
|
useNativeDriver: true,
|
|
}),
|
|
]).start(() => {
|
|
onClose?.();
|
|
});
|
|
};
|
|
|
|
const backgroundColor =
|
|
type === 'success'
|
|
? Colors.success
|
|
: type === 'error'
|
|
? Colors.error
|
|
: Colors.info;
|
|
|
|
return (
|
|
<Animated.View
|
|
style={[
|
|
styles.container,
|
|
{
|
|
opacity: fadeAnim,
|
|
transform: [{ translateY: slideAnim }],
|
|
},
|
|
]}
|
|
>
|
|
<View style={[styles.toast, { backgroundColor }]}>
|
|
<Text style={styles.message}>{message}</Text>
|
|
<TouchableOpacity onPress={dismiss} style={styles.closeButton}>
|
|
<Text style={styles.closeText}>✕</Text>
|
|
</TouchableOpacity>
|
|
</View>
|
|
</Animated.View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
position: 'absolute',
|
|
top: 50,
|
|
left: 0,
|
|
right: 0,
|
|
zIndex: 1000,
|
|
paddingHorizontal: 16,
|
|
},
|
|
toast: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
padding: 16,
|
|
borderRadius: 8,
|
|
shadowColor: '#000',
|
|
shadowOffset: { width: 0, height: 2 },
|
|
shadowOpacity: 0.25,
|
|
shadowRadius: 3.84,
|
|
elevation: 5,
|
|
},
|
|
message: {
|
|
flex: 1,
|
|
color: Colors.text,
|
|
fontSize: 14,
|
|
fontWeight: '500',
|
|
},
|
|
closeButton: {
|
|
marginLeft: 12,
|
|
padding: 4,
|
|
},
|
|
closeText: {
|
|
color: Colors.text,
|
|
fontSize: 18,
|
|
fontWeight: 'bold',
|
|
},
|
|
});
|
|
|