@@ -138,93 +138,92 @@ export default function App() {
138
138
</ div >
139
139
140
140
{ /* Table */ }
141
- { error ? (
141
+ { error && (
142
142
< div className = "text-center text-red-500 p-4 whitespace-pre-line" >
143
143
{ error }
144
144
</ div >
145
- ) : (
146
- < div className = "relative" >
147
- { loading && (
148
- < div className = "absolute inset-0 bg-white/70 flex items-center justify-center z-10" >
149
- < div className = "text-gray-600" > Loading...</ div >
150
- </ div >
151
- ) }
152
- < div className = "overflow-x-auto" >
153
- < table className = "min-w-full bg-white shadow-md rounded-lg" >
154
- < thead className = "bg-gray-50" >
155
- < tr >
156
- < th
157
- onClick = { ( ) => handleSort ( "date" ) }
158
- className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" >
159
- Date{ " " }
160
- < SortIcon
161
- column = "date"
162
- currentSort = { sortBy }
163
- order = { sortOrder }
164
- />
165
- </ th >
166
- < th
167
- onClick = { ( ) => handleSort ( "revenue" ) }
168
- className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" >
169
- Revenue{ " " }
170
- < SortIcon
171
- column = "revenue"
172
- currentSort = { sortBy }
173
- order = { sortOrder }
174
- />
175
- </ th >
176
- < th
177
- onClick = { ( ) => handleSort ( "net_income" ) }
178
- className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" >
179
- Net Income{ " " }
180
- < SortIcon
181
- column = "net_income"
182
- currentSort = { sortBy }
183
- order = { sortOrder }
184
- />
185
- </ th >
186
- < th className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider" >
187
- Gross Profit
188
- </ th >
189
- < th
190
- className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
191
- title = "Earnings Per Share" >
192
- EPS
193
- </ th >
194
- < th className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider" >
195
- Operating Income
196
- </ th >
197
- </ tr >
198
- </ thead >
199
-
200
- < tbody className = "divide-y divide-gray-200" >
201
- { statements . map ( ( statement ) => (
202
- < tr key = { statement . date } className = "hover:bg-gray-50" >
203
- < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
204
- { statement . date }
205
- </ td >
206
- < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
207
- ${ formatMoney ( statement . revenue ) }
208
- </ td >
209
- < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
210
- ${ formatMoney ( statement . net_income ) }
211
- </ td >
212
- < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
213
- ${ formatMoney ( statement . gross_profit ) }
214
- </ td >
215
- < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
216
- ${ statement . eps . toFixed ( 2 ) }
217
- </ td >
218
- < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
219
- ${ formatMoney ( statement . operating_income ) }
220
- </ td >
221
- </ tr >
222
- ) ) }
223
- </ tbody >
224
- </ table >
145
+ ) }
146
+ < div className = "relative" >
147
+ { loading && (
148
+ < div className = "absolute inset-0 bg-white/70 flex items-center justify-center z-10" >
149
+ < div className = "text-gray-600" > Loading...</ div >
225
150
</ div >
151
+ ) }
152
+ < div className = "overflow-x-auto" >
153
+ < table className = "min-w-full bg-white shadow-md rounded-lg" >
154
+ < thead className = "bg-gray-50" >
155
+ < tr >
156
+ < th
157
+ onClick = { ( ) => handleSort ( "date" ) }
158
+ className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" >
159
+ Date{ " " }
160
+ < SortIcon
161
+ column = "date"
162
+ currentSort = { sortBy }
163
+ order = { sortOrder }
164
+ />
165
+ </ th >
166
+ < th
167
+ onClick = { ( ) => handleSort ( "revenue" ) }
168
+ className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" >
169
+ Revenue{ " " }
170
+ < SortIcon
171
+ column = "revenue"
172
+ currentSort = { sortBy }
173
+ order = { sortOrder }
174
+ />
175
+ </ th >
176
+ < th
177
+ onClick = { ( ) => handleSort ( "net_income" ) }
178
+ className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" >
179
+ Net Income{ " " }
180
+ < SortIcon
181
+ column = "net_income"
182
+ currentSort = { sortBy }
183
+ order = { sortOrder }
184
+ />
185
+ </ th >
186
+ < th className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider" >
187
+ Gross Profit
188
+ </ th >
189
+ < th
190
+ className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
191
+ title = "Earnings Per Share" >
192
+ EPS
193
+ </ th >
194
+ < th className = "px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider" >
195
+ Operating Income
196
+ </ th >
197
+ </ tr >
198
+ </ thead >
199
+
200
+ < tbody className = "divide-y divide-gray-200" >
201
+ { statements . map ( ( statement ) => (
202
+ < tr key = { statement . date } className = "hover:bg-gray-50" >
203
+ < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
204
+ { statement . date }
205
+ </ td >
206
+ < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
207
+ ${ formatMoney ( statement . revenue ) }
208
+ </ td >
209
+ < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
210
+ ${ formatMoney ( statement . net_income ) }
211
+ </ td >
212
+ < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
213
+ ${ formatMoney ( statement . gross_profit ) }
214
+ </ td >
215
+ < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
216
+ ${ statement . eps . toFixed ( 2 ) }
217
+ </ td >
218
+ < td className = "px-6 py-4 whitespace-nowrap text-sm text-gray-900" >
219
+ ${ formatMoney ( statement . operating_income ) }
220
+ </ td >
221
+ </ tr >
222
+ ) ) }
223
+ </ tbody >
224
+ </ table >
226
225
</ div >
227
- ) }
226
+ </ div >
228
227
</ div >
229
228
) ;
230
229
}
0 commit comments