11import { useNavigation } from '@react-navigation/native' ;
22import { Text } from '@shadcn/components' ;
3+ import { iconWithClassName } from '@shadcn/icons/iconWithClassName' ;
34import { Collections , Screens , Stacks , fireAuth , fireStore } from '@src/constants' ;
45import type { HistoryActivity } from '@src/types' ;
56import type { AppNavigation } from '@src/types' ;
67import { collection , doc , getDocs , updateDoc } from 'firebase/firestore' ;
7- import { UserIcon } from 'lucide-react-native' ;
8+ import { Brain , Heart , House , PenLine , RefreshCw , UserIcon } from 'lucide-react-native' ;
89import React , { useEffect } from 'react' ;
910import { useAuthState } from 'react-firebase-hooks/auth' ;
1011import { Image , ScrollView , TouchableOpacity , View } from 'react-native' ;
11- import FeatherIcon from 'react-native-vector-icons/Feather' ;
12- import type { IconProps } from 'react-native-vector-icons/Icon' ;
13- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons' ;
12+
13+ iconWithClassName ( PenLine ) ;
14+ iconWithClassName ( RefreshCw ) ;
1415
1516export const History : React . FC = ( ) => {
1617 const { navigate } = useNavigation < AppNavigation > ( ) ;
1718 const [ user ] = useAuthState ( fireAuth ) ;
1819 const [ activeTab , setActiveTab ] = React . useState < 'all' | 'favorites' > ( 'all' ) ;
19- const [ items , setItems ] = React . useState ( [ ] as HistoryActivity [ ] ) ;
20-
21- const MCIIcon = MaterialCommunityIcons as unknown as React . FC < IconProps > ;
22- const FeatherIconCasted = FeatherIcon as unknown as React . FC < IconProps > ;
20+ const [ items , setItems ] = React . useState < HistoryActivity [ ] > ( [ ] ) ;
2321
2422 const fetchFavoriteActivities = async ( ) => {
2523 if ( ! user ) {
@@ -104,11 +102,7 @@ export const History: React.FC = () => {
104102 } ;
105103
106104 // Decide which items to show based on activeTab
107- const itemsToShow =
108- activeTab === 'all' ? items : items . filter ( ( item ) => item . isFavourite === true ) ;
109-
110- // Icon color
111- const iconColor = '#620674' ;
105+ const itemsToShow = activeTab === 'all' ? items : items . filter ( ( item ) => item . isFavourite ) ;
112106
113107 return (
114108 < View className = 'flex flex-1 flex-col px-6 gap-y-4' >
@@ -125,7 +119,7 @@ export const History: React.FC = () => {
125119 </ View >
126120
127121 < TouchableOpacity onPress = { onHomeBtnPressed } className = 'ml-auto' >
128- < FeatherIconCasted name = 'home' size = { 27 } color = '#620674 ' />
122+ < House size = { 27 } className = 'text-primary ' />
129123 </ TouchableOpacity >
130124 </ View >
131125
@@ -179,23 +173,22 @@ export const History: React.FC = () => {
179173 < View className = 'flex-row' >
180174 < TouchableOpacity className = 'm-2' onPress = { ( ) => handleToggleFavourite ( item . id ) } >
181175 { /* If isFavourite = true => heart (filled), else => heart-outline */ }
182- < MCIIcon
183- name = { item . isFavourite ? 'heart' : 'heart-outline' }
176+ < Heart
184177 size = { 20 }
185- color = { iconColor }
178+ className = { `text-primary ${ item . isFavourite ? 'fill-primary' : '' } ` }
186179 />
187180 </ TouchableOpacity >
188181 < TouchableOpacity className = 'm-2' >
189- < MCIIcon name = 'brain' size = { 20 } color = { iconColor } />
182+ < Brain size = { 20 } className = 'text-primary' />
190183 </ TouchableOpacity >
191184 </ View >
192185 { /* Bottom row */ }
193186 < View className = 'flex-row' >
194187 < TouchableOpacity className = 'm-2' >
195- < FeatherIconCasted name = 'edit-3' size = { 20 } color = { iconColor } />
188+ < PenLine size = { 20 } className = 'text-primary' />
196189 </ TouchableOpacity >
197190 < TouchableOpacity className = 'm-2' onPress = { ( ) => replayActivity ( item . id ) } >
198- < FeatherIconCasted name = 'refresh-cw' size = { 20 } color = { iconColor } />
191+ < RefreshCw size = { 20 } className = 'text-primary' />
199192 </ TouchableOpacity >
200193 </ View >
201194 </ View >
0 commit comments