|
1 |
| -import PropTypes from 'prop-types'; |
2 |
| -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; |
3 |
| - |
4 | 1 | import { isLoaded, load, project } from '@arcgis/core/geometry/projection';
|
5 |
| - |
6 |
| -import { toQueryString } from '@ugrc/utilities/src'; |
7 |
| - |
| 2 | +import { Label } from '@ugrc/utah-design-system'; |
| 3 | +import { toQueryString } from '@ugrc/utilities'; |
8 | 4 | import ky from 'ky';
|
9 |
| -import './Identify.css'; |
| 5 | +import startCase from 'lodash.startcase'; |
| 6 | +import PropTypes from 'prop-types'; |
| 7 | +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; |
| 8 | +import { Text } from 'react-aria-components'; |
| 9 | +import { ExternalLink } from './ExternalLink'; |
10 | 10 |
|
11 | 11 | const featureClassNames = {
|
12 | 12 | counties: 'boundaries.county_boundaries',
|
@@ -50,7 +50,7 @@ const projectPoint = async (mapPoint, srid) => {
|
50 | 50 | return project(mapPoint, { wkid: srid });
|
51 | 51 | };
|
52 | 52 |
|
53 |
| -const IdentifyInformation = ({ apiKey, wkid = 3857, location }) => { |
| 53 | +export const IdentifyInformation = ({ apiKey, wkid = 3857, location }) => { |
54 | 54 | const [spatial, setSpatial] = useState({
|
55 | 55 | x: 0,
|
56 | 56 | y: 0,
|
@@ -296,92 +296,136 @@ const IdentifyInformation = ({ apiKey, wkid = 3857, location }) => {
|
296 | 296 | return () => controller.current?.abort();
|
297 | 297 | }, [location, get, requests]);
|
298 | 298 |
|
| 299 | + if (!location) { |
| 300 | + return ( |
| 301 | + <p> |
| 302 | + First, explore the map to find your desired location. Then, click on it to reveal additional details about the |
| 303 | + area. |
| 304 | + </p> |
| 305 | + ); |
| 306 | + } |
| 307 | + |
299 | 308 | return (
|
300 |
| - <dev className="identify"> |
301 |
| - <div> |
302 |
| - <h4>What's here?</h4> |
303 |
| - <hr /> |
304 |
| - </div> |
305 |
| - <div> |
306 |
| - <strong>Approximate Street Address</strong> |
307 |
| - <p className="identify--muted"> |
308 |
| - <span className="d-block">{address}</span> |
309 |
| - <a href={spatial.googleMapsLink} className="text-info" target="_blank" rel="noopener noreferrer"> |
| 309 | + <div className="grid grid-cols-2 lg:grid-cols-5 lg:gap-4 gap-10 mx-auto"> |
| 310 | + <div |
| 311 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 312 | + role="presentation" |
| 313 | + > |
| 314 | + <Label>Approximate Street Address</Label> |
| 315 | + <Text className="block text-sm pl-1"> |
| 316 | + <Text className="block text-sm pl-1">{address}</Text> |
| 317 | + <ExternalLink href={spatial.googleMapsLink} className="pl-1"> |
310 | 318 | Google Street View
|
311 |
| - </a> |
312 |
| - </p> |
| 319 | + </ExternalLink> |
| 320 | + </Text> |
| 321 | + <Text className="text-xs block grow content-end"> |
| 322 | + Provided by{' '} |
| 323 | + <ExternalLink href="https://gis.utah.gov/products/sgid/transportation/road-centerlines/">roads</ExternalLink> |
| 324 | + </Text> |
313 | 325 | </div>
|
314 |
| - <div> |
315 |
| - <strong>City</strong> |
316 |
| - <p className="identify--muted">{city}</p> |
| 326 | + <div |
| 327 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 328 | + role="presentation" |
| 329 | + > |
| 330 | + <Label>City</Label> |
| 331 | + <Text className="block text-sm pl-1">{city}</Text> |
| 332 | + <Text className="text-xs block grow content-end"> |
| 333 | + Provided by{' '} |
| 334 | + <ExternalLink href="https://gis.utah.gov/products/sgid/boundaries/municipal/"> |
| 335 | + municipal boundaries |
| 336 | + </ExternalLink> |
| 337 | + </Text> |
317 | 338 | </div>
|
318 |
| - <div> |
319 |
| - <strong>Zip Code</strong> |
320 |
| - <p className="identify--muted">{zip}</p> |
| 339 | + <div |
| 340 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 341 | + role="presentation" |
| 342 | + > |
| 343 | + <Label>Zip code</Label> |
| 344 | + <Text className="block text-sm pl-1">{zip}</Text> |
| 345 | + <Text className="text-xs block grow content-end"> |
| 346 | + Provided by{' '} |
| 347 | + <ExternalLink href="https://gis.utah.gov/products/sgid/boundaries/zip-codes/">zip code areas</ExternalLink> |
| 348 | + </Text> |
321 | 349 | </div>
|
322 |
| - <div> |
323 |
| - <strong>County</strong> |
324 |
| - <p className="identify--muted">{county}</p> |
| 350 | + <div |
| 351 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 352 | + role="presentation" |
| 353 | + > |
| 354 | + <Label>County</Label> |
| 355 | + <Text className="block text-sm pl-1">{startCase(county.toLowerCase())}</Text> |
| 356 | + <Text className="text-xs block grow content-end"> |
| 357 | + Provided by{' '} |
| 358 | + <ExternalLink href="https://gis.utah.gov/products/sgid/boundaries/county/">county boundaries</ExternalLink> |
| 359 | + </Text> |
325 | 360 | </div>
|
326 |
| - <div> |
327 |
| - <strong>UTM 12 NAD83 Coordinates</strong> |
328 |
| - <p className="identify--muted"> |
329 |
| - {spatial.x}, {spatial.y} meters |
330 |
| - </p> |
| 361 | + <div |
| 362 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 363 | + role="presentation" |
| 364 | + > |
| 365 | + <Label>UTM 12 NAD83 coordinates</Label> |
| 366 | + <Text className="block text-sm pl-1"> |
| 367 | + {spatial.x}, {spatial.y} m |
| 368 | + </Text> |
331 | 369 | </div>
|
332 |
| - <div> |
333 |
| - <strong>WGS84 Coordinates</strong> |
334 |
| - <p className="identify--muted"> |
| 370 | + <div |
| 371 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 372 | + role="presentation" |
| 373 | + > |
| 374 | + <Label>WGS84 coordinates</Label> |
| 375 | + <Text className="block text-sm pl-1"> |
335 | 376 | {spatial.lat}, {spatial.lon}
|
336 |
| - </p> |
337 |
| - </div> |
338 |
| - <div> |
339 |
| - <strong>Elevation Meters</strong> |
340 |
| - <p className="identify--muted">{elevation.meters}</p> |
| 377 | + </Text> |
341 | 378 | </div>
|
342 |
| - <div> |
343 |
| - <strong>Elevation Feet</strong> |
344 |
| - <p className="identify--muted">{elevation.feet}</p> |
| 379 | + <div |
| 380 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 381 | + role="presentation" |
| 382 | + > |
| 383 | + <Label>Elevation</Label> |
| 384 | + <Text className="block text-sm pl-1">{elevation.meters} m</Text> |
| 385 | + <Text className="block text-sm pl-1">{elevation.feet} ft</Text> |
| 386 | + <Text className="text-xs block grow content-end"> |
| 387 | + Provided by <ExternalLink href="https://elevation.nationalmap.gov/">The National Map</ExternalLink> |
| 388 | + </Text> |
345 | 389 | </div>
|
346 |
| - <div> |
347 |
| - <strong>Land Administration Category</strong> |
348 |
| - <p className="identify--muted">{ownership}</p> |
| 390 | + <div |
| 391 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 392 | + role="presentation" |
| 393 | + > |
| 394 | + <Label>Land administration category</Label> |
| 395 | + <Text className="block text-sm pl-1">{ownership}</Text> |
| 396 | + <Text className="text-xs block grow content-end"> |
| 397 | + Provided by{' '} |
| 398 | + <ExternalLink href="https://gis.utah.gov/products/sgid/cadastre/land-ownership/">land ownership</ExternalLink> |
| 399 | + </Text> |
349 | 400 | </div>
|
350 |
| - <div> |
351 |
| - <strong>US National Grid</strong> |
352 |
| - <p className="identify--muted">{grid}</p> |
| 401 | + <div |
| 402 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 403 | + role="presentation" |
| 404 | + > |
| 405 | + <Label>US National Grid</Label> |
| 406 | + <Text className="block text-sm pl-1">{grid}</Text> |
| 407 | + <Text className="text-xs block grow content-end"> |
| 408 | + Provided by the{' '} |
| 409 | + <ExternalLink href="https://gis.utah.gov/products/sgid/indices/national-grid-index/"> |
| 410 | + national grid |
| 411 | + </ExternalLink> |
| 412 | + </Text> |
353 | 413 | </div>
|
354 |
| - <div> |
355 |
| - <strong>Imagery Flight Data</strong> |
356 |
| - <p className="identify--muted">{flightDate.date && `${flightDate.resolution} on ${flightDate.date}`}</p> |
| 414 | + <div |
| 415 | + className="flex flex-col gap-1 px-3 py-2 border border-zinc-200 dark:border-zinc-800 rounded" |
| 416 | + role="presentation" |
| 417 | + > |
| 418 | + <Label>Imagery flight metadata</Label> |
| 419 | + <Text className="block text-sm pl-1"> |
| 420 | + {flightDate.date && `${flightDate.resolution} on ${flightDate.date}`} |
| 421 | + </Text> |
357 | 422 | </div>
|
358 |
| - </dev> |
359 |
| - ); |
360 |
| -}; |
361 |
| - |
362 |
| -IdentifyInformation.propTypes = { |
363 |
| - location: PropTypes.object, |
364 |
| -}; |
365 |
| - |
366 |
| -const IdentifyContainer = function ({ show, children }) { |
367 |
| - return ( |
368 |
| - <div className="identify__container side-bar side-bar--with-border side-bar--open"> |
369 |
| - <button type="button" className="identify__close" aria-label="Close" onClick={() => show(false)}> |
370 |
| - <span aria-hidden="true">×</span> |
371 |
| - </button> |
372 |
| - {children} |
373 | 423 | </div>
|
374 | 424 | );
|
375 | 425 | };
|
376 | 426 |
|
377 |
| -IdentifyContainer.propTypes = { |
378 |
| - show: PropTypes.func.isRequired, |
379 |
| - children: PropTypes.node.isRequired, |
380 |
| -}; |
381 |
| - |
382 |
| -export { IdentifyContainer, IdentifyInformation }; |
383 |
| - |
384 | 427 | IdentifyInformation.propTypes = {
|
| 428 | + location: PropTypes.object, |
385 | 429 | apiKey: PropTypes.string.isRequired,
|
386 | 430 | wkid: PropTypes.number,
|
387 | 431 | };
|
0 commit comments