@@ -9,7 +9,10 @@ import {
99 FlatList ,
1010 Dimensions ,
1111 ActivityIndicator ,
12+ TouchableOpacity ,
1213} from "react-native" ;
14+ import { useRouter } from "expo-router" ;
15+ import { Ionicons } from "@expo/vector-icons" ;
1316
1417// Define the shape of each quote, matching QuoteOut from the backend
1518type QuoteItem = {
@@ -18,17 +21,17 @@ type QuoteItem = {
1821} ;
1922
2023export default function NotificationScreen ( ) {
24+ const router = useRouter ( ) ;
2125 const [ notifications , setNotifications ] = useState < QuoteItem [ ] > ( [ ] ) ;
2226 const [ loading , setLoading ] = useState ( true ) ;
2327
2428 useEffect ( ( ) => {
2529 // Fetch the last 7 days of quotes from the backend
26- // Replace localhost with your actual host or LAN IP if testing on device
30+ // Replace " localhost" with your LAN IP or actual host when testing on device
2731 fetch ( "http://localhost:8000/api/v1/notifications/quotes" )
2832 . then ( ( res ) => res . json ( ) )
2933 . then ( ( data : QuoteItem [ ] ) => {
30- // data is an array like [{ date: "2025-06-05", text: "..." }, …]
31- setNotifications ( data ) ;
34+ setNotifications ( data ) ; // data is an array like [{ date: "2025-06-05", text: "..." }, …]
3235 } )
3336 . catch ( ( err ) => {
3437 console . error ( "Error fetching quotes:" , err ) ;
@@ -60,8 +63,20 @@ export default function NotificationScreen() {
6063 return (
6164 < SafeAreaView style = { styles . container } >
6265 < View style = { styles . header } >
66+ < TouchableOpacity
67+ style = { styles . backButton }
68+ onPress = { ( ) => {
69+ // Go back in the navigation stack (like HomeScreen’s notification button did)
70+ router . back ( ) ;
71+ } }
72+ >
73+ < Ionicons name = "arrow-back" size = { 24 } color = "#333" />
74+ </ TouchableOpacity >
6375 < Text style = { styles . headerTitle } > Daily Quotes</ Text >
76+ { /* Dummy view to balance centering (same width as backButton) */ }
77+ < View style = { styles . placeholder } />
6478 </ View >
79+
6580 < FlatList
6681 data = { notifications }
6782 keyExtractor = { ( item ) => item . date }
@@ -73,39 +88,56 @@ export default function NotificationScreen() {
7388 ) ;
7489}
7590
76- const { width, height } = Dimensions . get ( "window" ) ;
91+ const { width } = Dimensions . get ( "window" ) ;
7792
7893const styles = StyleSheet . create ( {
94+ // ——— Container now matches HomeScreen’s container style ———
7995 container : {
8096 flex : 1 ,
81- width,
82- height,
83- backgroundColor : "#ffffff" ,
84- alignItems : "center" ,
85- justifyContent : "center" ,
97+ backgroundColor : "#FFFFFF" ,
8698 } ,
99+
100+ // ——— Header is identical in structure to the back‐arrow version previously shown ———
87101 header : {
88- padding : 16 ,
102+ flexDirection : "row" ,
103+ alignItems : "center" ,
104+ paddingVertical : 12 ,
105+ paddingHorizontal : 8 ,
89106 borderBottomWidth : 1 ,
90107 borderBottomColor : "#ddd" ,
91108 backgroundColor : "#fafafa" ,
92- alignItems : "center" ,
93109 width : "100%" ,
94110 } ,
111+ backButton : {
112+ padding : 4 ,
113+ } ,
95114 headerTitle : {
115+ flex : 1 ,
116+ textAlign : "center" ,
96117 fontSize : 20 ,
97118 fontWeight : "bold" ,
119+ color : "#333" ,
120+ } ,
121+ placeholder : {
122+ width : 32 , // same width as backButton + icon, to keep title centered
98123 } ,
124+
125+ // ——— Make the FlatList’s content match HomeScreen’s padding:16 ———
99126 listContent : {
100- paddingVertical : 8 ,
127+ padding : 16 ,
128+ paddingBottom : 80 , // if you want similar bottom padding (e.g., for any tab bar)
101129 width : "100%" ,
102130 } ,
131+
132+ // ——— Each item in the quote list ———
103133 item : {
104134 flexDirection : "row" ,
105135 alignItems : "center" ,
106136 paddingHorizontal : 16 ,
107137 paddingVertical : 12 ,
108138 backgroundColor : "#fff" ,
139+ borderRadius : 8 , // optional, just to match HomeScreen’s card feel
140+ marginBottom : 8 ,
109141 } ,
110142 itemText : {
111143 flex : 1 ,
0 commit comments