caelum0x f80b04ae0f feat(ritgram): move GitGram app into railyard as Ritgram, next to Rithub
Moved later/gitgram-ai/gitgram/ to apps/ritgram/ (fresh history; full history stays in caelum0x/gitgram).
AITimeMachine stays separate in later/gitgram-ai per the Rithub master plan.
Logs, pid files and env files are ignored; GPL-3.0 mobile/proximity noted in THIRD_PARTY_NOTICES.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-13 04:18:46 +03:00

102 lines
2.4 KiB
TypeScript

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 EmptyState from '../../components/common/EmptyState';
import Icon from 'react-native-vector-icons/MaterialIcons';
import AsyncStorage from '@react-native-async-storage/async-storage';
const RECENT_SEARCHES_KEY = 'recent_searches';
export default function RecentSearchesScreen() {
const router = useRouter();
const [recentSearches, setRecentSearches] = useState<string[]>([]);
useEffect(() => {
loadRecentSearches();
}, []);
const loadRecentSearches = async () => {
try {
const stored = await AsyncStorage.getItem(RECENT_SEARCHES_KEY);
if (stored) {
setRecentSearches(JSON.parse(stored));
}
} catch (error) {
// Error handled silently
}
};
const handleClear = async () => {
try {
await AsyncStorage.removeItem(RECENT_SEARCHES_KEY);
setRecentSearches([]);
} catch (error) {
// Error handled silently
}
};
const handleSearch = (query: string) => {
router.push(`/(tabs)/explore?query=${encodeURIComponent(query)}`);
};
const renderSearch = ({ item }: { item: string }) => (
<TouchableOpacity
style={styles.searchItem}
onPress={() => handleSearch(item)}
>
<Icon name="history" size={20} color={Colors.textSecondary} />
<Text style={styles.searchText}>{item}</Text>
</TouchableOpacity>
);
return (
<View style={styles.container}>
<Header
title="Recent Searches"
rightIcon="delete"
onRightPress={handleClear}
/>
{recentSearches.length > 0 ? (
<FlatList
data={recentSearches}
renderItem={renderSearch}
keyExtractor={(item, index) => `${item}-${index}`}
/>
) : (
<EmptyState
title="No recent searches"
message="Your recent searches will appear here"
/>
)}
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.background,
},
searchItem: {
flexDirection: 'row',
alignItems: 'center',
padding: 16,
borderBottomWidth: 1,
borderBottomColor: Colors.border,
gap: 12,
},
searchText: {
fontSize: 16,
color: Colors.text,
},
});