simonw / datasette

An open source multi-tool for exploring and publishing data
https://datasette.io
Apache License 2.0
9.6k stars 690 forks source link

Update screenshots in documentation to match latest designs #1844

Closed simonw closed 2 years ago

simonw commented 2 years ago

https://docs.datasette.io/en/0.62/full_text_search.html has this out-of-date screenshot:

image
simonw commented 2 years ago

I just spotted some other out-dated screenshots in the docs/ directory:

simonw commented 2 years ago

For the advanced export one:

shot-scraper 'https://register-of-members-interests.datasettes.com/regmem/items?_search=hamper' -s '#export' -p 10

Produces:

register-of-members-interests-datasettes-com-regmem-items 2

Current image is:

simonw commented 2 years ago

New screenshot of FTS, from https://register-of-members-interests.datasettes.com/regmem/items?_search=hamper&_sort_desc=date

simonw commented 2 years ago

For this image:

https://latest.datasette.io/fixtures/binary_data has an extra row these days:

image

This deletes every row past the first two (first three including the header row):

Array.from(document.querySelectorAll('tr:nth-child(n+3)'), el => el.parentNode.removeChild(el));
simonw commented 2 years ago

So:

shot-scraper 'https://latest.datasette.io/fixtures/binary_data' \
  -j "Array.from(document.querySelectorAll('tr:nth-child(n+3)'), el => el.parentNode.removeChild(el));" \
  -s table -p 10

latest-datasette-io-fixtures-binary_data 1

simonw commented 2 years ago

Here's the new advanced export image:

simonw commented 2 years ago

I'm going to use this page for the facets screenshot: https://congress-legislators.datasettes.com/legislators/legislator_terms?_facet=type&_facet=party&_facet=state&_facet_size=10

Trying for this bit:

image

Which incorporates .suggested-facets but also the first 3 rows and 10 columns of the table, I wonder if I can specify that in a single selector?

simonw commented 2 years ago

This seems to get every table cell in that table for the first 3 rows and the columns up to party:

document.querySelectorAll('tr:not(:nth-child(n+4)) td:not(:nth-child(n+10))')
simonw commented 2 years ago

This works:

shot-scraper
  'https://congress-legislators.datasettes.com/legislators/legislator_terms?_facet=type&_facet=party&_facet=state&_facet_size=10' \
  -s '.suggested-facets a' \
  --selector-all 'tr:not(tr:nth-child(n+4)) td:not(:nth-child(n+11))' \
  -p 10

congress-legislators-datasettes-com-legislators-legislator_terms 6

simonw commented 2 years ago

I'm going to link the documentation screenshots directly to the images in the https://github.com/simonw/datasette-screenshots repository - but I don't want those images to reflect main when the documentation may reflect a specific version.

So I'm going to start tagging releases of datasette-screenshots so I can get permanent URLs to those images.

simonw commented 2 years ago

That's the last two screenshots:

simonw commented 2 years ago

I'm going to tag datasette-screenshots with the current Datasette version, 0.62.

simonw commented 2 years ago

OK, the URLs to use in the docs are:

simonw commented 2 years ago

New images are now live on these pages:

simonw commented 2 years ago

Here's the YAML I added to https://github.com/simonw/datasette-screenshots/blob/main/shots.yml for this issue:

- url: https://register-of-members-interests.datasettes.com/regmem/items?_search=hamper&_sort_desc=date
  height: 585
  width: 960
  output: regmem-search.png
- url: https://register-of-members-interests.datasettes.com/regmem/items?_search=hamper
  selector: "#export"
  output: advanced-export.png
  padding: 10
- url: https://congress-legislators.datasettes.com/legislators/legislator_terms?_facet=type&_facet=party&_facet=state&_facet_size=10
  selectors_all:
  - .suggested-facets a
  - tr:not(tr:nth-child(n+4)) td:not(:nth-child(n+11))
  padding: 10
  output: faceting-details.png
- url: https://latest.datasette.io/fixtures/binary_data
  selector: table
  javascript: |-
    Array.from(
      document.querySelectorAll('tr:nth-child(n+3)'),
      el => el.parentNode.removeChild(el)
    );
  padding: 10
  output: binary-data.png
simonw commented 2 years ago

Twitter thread about this issue: https://twitter.com/simonw/status/1581012617526595584

simonw commented 2 years ago

Extracted a TIL: https://til.simonwillison.net/shot-scraper/subset-of-table-columns

simonw commented 2 years ago

Blogged about this here: https://simonwillison.net/2022/Oct/14/automating-screenshots/