Skip to content

Commit 4267d17

Browse files
committed
display last updated timestamp on data refresh
1 parent 914fc89 commit 4267d17

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/pages/Space.jsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default function Space({ theme = 'light' }) {
8989
<h2
9090
style={{
9191
textAlign: 'center',
92-
marginBottom: '1.8rem',
92+
marginBottom: '0.8rem',
9393
fontSize: '2rem',
9494
fontWeight: '600',
9595
color: accent,
@@ -99,6 +99,19 @@ export default function Space({ theme = 'light' }) {
9999
🌌 Space & Astronomy Dashboard
100100
</h2>
101101

102+
{lastUpdated && (
103+
<p
104+
style={{
105+
textAlign: 'center',
106+
color: subText,
107+
fontSize: '0.95rem',
108+
marginBottom: '1.2rem',
109+
}}
110+
>
111+
Last updated: {lastUpdated.toLocaleString()}
112+
</p>
113+
)}
114+
102115
<div style={{ display: 'flex', justifyContent: 'center', marginBottom: '1.5rem' }}>
103116
<DashboardControls onRefresh={fetchData} />
104117
</div>
@@ -135,11 +148,6 @@ export default function Space({ theme = 'light' }) {
135148
<p style={{ color: textColor, margin: '0.5rem 0' }}>
136149
<strong>Longitude:</strong> {iss.iss_position.longitude}
137150
</p>
138-
{lastUpdated && (
139-
<p style={{ fontSize: '0.9rem', color: subText, margin: '0.5rem 0' }}>
140-
Last updated: {lastUpdated.toLocaleTimeString()}
141-
</p>
142-
)}
143151
</div>
144152

145153
<div style={{ marginTop: '1rem' }}>
@@ -215,7 +223,7 @@ export default function Space({ theme = 'light' }) {
215223
fontSize: '0.9rem',
216224
color: subText,
217225
}}
218-
>
226+
>
219227
Data sourced from{' '}
220228
<a
221229
href="http://api.open-notify.org"
@@ -224,8 +232,8 @@ export default function Space({ theme = 'light' }) {
224232
textDecoration: 'none',
225233
fontWeight: '500',
226234
}}
227-
onMouseEnter={(e) => e.target.style.textDecoration = 'underline'}
228-
onMouseLeave={(e) => e.target.style.textDecoration = 'none'}
235+
onMouseEnter={(e) => (e.target.style.textDecoration = 'underline')}
236+
onMouseLeave={(e) => (e.target.style.textDecoration = 'none')}
229237
>
230238
Open Notify API
231239
</a>

0 commit comments

Comments
 (0)