()
| 5 | import { getImageUrlForShip, getShip, imgSrc } from './utils.tsx' |
| 6 | |
| 7 | function App() { |
| 8 | const [shipName, setShipName] = useState('Dreadnought') |
| 9 | const [isTransitionPending, startTransition] = useTransition() |
| 10 | const isPending = useSpinDelay(isTransitionPending, { |
| 11 | delay: 300, |
| 12 | minDuration: 350, |
| 13 | }) |
| 14 | |
| 15 | function handleShipSelection(newShipName: string) { |
| 16 | startTransition(() => { |
| 17 | setShipName(newShipName) |
| 18 | }) |
| 19 | } |
| 20 | |
| 21 | return ( |
| 22 | <div className="app-wrapper"> |
| 23 | <ShipButtons shipName={shipName} onShipSelect={handleShipSelection} /> |
| 24 | <div className="app"> |
| 25 | <div className="details" style={{ opacity: isPending ? 0.6 : 1 }}> |
| 26 | <ErrorBoundary fallback={<ShipError shipName={shipName} />}> |
| 27 | <Suspense fallback={<ShipFallback shipName={shipName} />}> |
| 28 | <ShipDetails shipName={shipName} /> |
| 29 | </Suspense> |
| 30 | </ErrorBoundary> |
| 31 | </div> |
| 32 | </div> |
| 33 | </div> |
| 34 | ) |
| 35 | } |
| 36 | |
| 37 | function ShipButtons({ |
| 38 | shipName, |
nothing calls this directly
no outgoing calls
no test coverage detected