Skip to content

Commit 4d28892

Browse files
Merge pull request #74 from techieadi4703/last-updated
Display last updated timestamp on Space & Astronomy Dashboard on data refresh
2 parents 5777823 + 4267d17 commit 4d28892

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
@@ -110,7 +110,7 @@ useEffect(() => {
110110
<h2
111111
style={{
112112
textAlign: 'center',
113-
marginBottom: '1.8rem',
113+
marginBottom: '0.8rem',
114114
fontSize: '2rem',
115115
fontWeight: '600',
116116
color: accent,
@@ -120,6 +120,19 @@ useEffect(() => {
120120
🌌 Space & Astronomy Dashboard
121121
</h2>
122122

123+
{lastUpdated && (
124+
<p
125+
style={{
126+
textAlign: 'center',
127+
color: subText,
128+
fontSize: '0.95rem',
129+
marginBottom: '1.2rem',
130+
}}
131+
>
132+
Last updated: {lastUpdated.toLocaleString()}
133+
</p>
134+
)}
135+
123136
<div style={{ display: 'flex', justifyContent: 'center', marginBottom: '1.5rem' }}>
124137
<DashboardControls onRefresh={fetchData} />
125138
</div>
@@ -156,11 +169,6 @@ useEffect(() => {
156169
<p style={{ color: textColor, margin: '0.5rem 0' }}>
157170
<strong>Longitude:</strong> {iss.iss_position.longitude}
158171
</p>
159-
{lastUpdated && (
160-
<p style={{ fontSize: '0.9rem', color: subText, margin: '0.5rem 0' }}>
161-
Last updated: {lastUpdated.toLocaleTimeString()}
162-
</p>
163-
)}
164172
</div>
165173

166174
<div style={{ marginTop: '1rem' }}>
@@ -236,7 +244,7 @@ useEffect(() => {
236244
fontSize: '0.9rem',
237245
color: subText,
238246
}}
239-
>
247+
>
240248
Data sourced from{' '}
241249
<a
242250
href="http://api.open-notify.org"
@@ -245,8 +253,8 @@ useEffect(() => {
245253
textDecoration: 'none',
246254
fontWeight: '500',
247255
}}
248-
onMouseEnter={(e) => e.target.style.textDecoration = 'underline'}
249-
onMouseLeave={(e) => e.target.style.textDecoration = 'none'}
256+
onMouseEnter={(e) => (e.target.style.textDecoration = 'underline')}
257+
onMouseLeave={(e) => (e.target.style.textDecoration = 'none')}
250258
>
251259
Open Notify API
252260
</a>

0 commit comments

Comments
 (0)