@@ -15,35 +15,29 @@ import { Pencil, Sparkles } from "lucide-react-native";
1515import { useRouter } from "expo-router" ;
1616import { useQuery , useQueryClient } from "@tanstack/react-query" ;
1717import Animated , {
18+ FadeInUp ,
1819 useAnimatedStyle ,
1920 useSharedValue ,
2021 withSpring ,
2122} from "react-native-reanimated" ;
2223import { SafeAreaView } from "react-native-safe-area-context" ;
2324import { supabase } from "../../lib/supabase" ;
2425import { colors , fonts } from "../../lib/theme" ;
26+ import { timeAgo } from "../../lib/utils" ;
2527import type { Conversation } from "../../lib/types" ;
2628
27- function timeAgo ( dateStr : string ) : string {
28- const seconds = Math . floor (
29- ( Date . now ( ) - new Date ( dateStr ) . getTime ( ) ) / 1000
30- ) ;
31- if ( seconds < 60 ) return "just now" ;
32- if ( seconds < 3600 ) return `${ Math . floor ( seconds / 60 ) } m ago` ;
33- if ( seconds < 86400 ) return `${ Math . floor ( seconds / 3600 ) } h ago` ;
34- return `${ Math . floor ( seconds / 86400 ) } d ago` ;
35- }
36-
3729function ConversationItem ( {
3830 item,
3931 onOpen,
4032 onDelete,
4133 timeAgoStr,
34+ index,
4235} : {
4336 item : Conversation ;
4437 onOpen : ( id : string ) => void ;
4538 onDelete : ( id : string ) => void ;
4639 timeAgoStr : string ;
40+ index : number ;
4741} ) {
4842 const scale = useSharedValue ( 1 ) ;
4943 const animStyle = useAnimatedStyle ( ( ) => ( {
@@ -65,7 +59,7 @@ function ConversationItem({
6559 } ;
6660
6761 return (
68- < Animated . View style = { animStyle } >
62+ < Animated . View entering = { FadeInUp . delay ( index * 50 ) . duration ( 200 ) } style = { animStyle } >
6963 < Pressable
7064 onPress = { ( ) => ! isEditing && onOpen ( item . id ) }
7165 onLongPress = { ( ) => ! isEditing && onDelete ( item . id ) }
@@ -93,6 +87,8 @@ function ConversationItem({
9387 onBlur = { ( ) => setIsEditing ( false ) }
9488 autoFocus
9589 style = { styles . editInput }
90+ accessibilityLabel = "Rename conversation"
91+ accessibilityHint = "Type a new name and press return to save"
9692 />
9793 ) : (
9894 < Text style = { styles . conversationTitle } numberOfLines = { 2 } >
@@ -104,6 +100,8 @@ function ConversationItem({
104100 < Pressable
105101 onPress = { ( ) => setIsEditing ( true ) }
106102 style = { ( { hovered } : any ) => [ styles . editButton , hovered && styles . editButtonHovered ] }
103+ accessibilityLabel = "Rename conversation"
104+ accessibilityRole = "button"
107105 >
108106 < Pencil size = { 14 } color = { colors . textGhost } />
109107 </ Pressable >
@@ -152,6 +150,9 @@ export default function MoreScreen() {
152150 } ;
153151
154152 const handleNewChat = ( ) => {
153+ if ( Platform . OS !== "web" ) {
154+ Haptics . impactAsync ( Haptics . ImpactFeedbackStyle . Light ) ;
155+ }
155156 const uniqueId = `new-${ Date . now ( ) } ` ;
156157 router . push ( {
157158 pathname : `/chat/${ uniqueId } ` ,
@@ -209,12 +210,13 @@ export default function MoreScreen() {
209210 < FlatList
210211 data = { conversations }
211212 keyExtractor = { ( item ) => item . id }
212- renderItem = { ( { item } ) => (
213+ renderItem = { ( { item, index } ) => (
213214 < ConversationItem
214215 item = { item }
215216 onOpen = { handleOpen }
216217 onDelete = { handleDelete }
217218 timeAgoStr = { timeAgo ( item . updated_at ) }
219+ index = { index }
218220 />
219221 ) }
220222 contentContainerStyle = { styles . listContent }
@@ -276,8 +278,8 @@ const styles = StyleSheet.create({
276278 paddingHorizontal : 16 ,
277279 } ,
278280 newChatButtonHovered : {
279- backgroundColor : "rgba(138, 43, 226, 0.15)" ,
280- borderColor : "rgba(138, 43, 226, 0.30)" ,
281+ backgroundColor : colors . purpleBorder ,
282+ borderColor : colors . purpleAccent ,
281283 } ,
282284 newChatIcon : {
283285 color : colors . purple ,
@@ -329,11 +331,11 @@ const styles = StyleSheet.create({
329331 fontFamily : fonts . ui ,
330332 } ,
331333 listContent : {
332- paddingHorizontal : 16 ,
334+ paddingHorizontal : 20 ,
333335 paddingBottom : 20 ,
334336 } ,
335337 conversationRow : {
336- paddingVertical : 14 ,
338+ paddingVertical : 16 ,
337339 borderBottomWidth : 1 ,
338340 borderBottomColor : colors . glass ,
339341 } ,
@@ -360,7 +362,7 @@ const styles = StyleSheet.create({
360362 marginTop : 4 ,
361363 } ,
362364 editButton : {
363- padding : 8 ,
365+ padding : 12 ,
364366 } ,
365367 editButtonHovered : {
366368 backgroundColor : colors . glass ,
@@ -381,7 +383,7 @@ const styles = StyleSheet.create({
381383 } ,
382384 footerText : {
383385 color : colors . textGhost ,
384- fontSize : 11 ,
386+ fontSize : 12 ,
385387 fontFamily : fonts . ui ,
386388 letterSpacing : 1 ,
387389 } ,
0 commit comments