sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.17k stars 216 forks source link

provide a nice tile/preview view of use documents in file browser #3961

Open williamstein opened 5 years ago

williamstein commented 5 years ago

Motivation -- Google drive (and all OS's) provide something like this, and it just feels very nice.

There are many approaches to this problem, which makes it harder. One idea would be to ONLY show previews for documents that have already been opened by some user, and make those previews using

https://github.com/niklasvh/html2canvas

What we would do is periodically take a screenshot using the above html2canvas library. We would then store the resulting updated png in our global blob store (deleting the old one), and place a reference to it (the sha1 hash) somewhere in the database -- probably in a new table that provides cached directory listing information for projects (finally!).

Alternatively, and probably better, these previews could be sent to the project itself and stored there in its little local sqlite store (which is used for jupyter images right now).

The important thing is to not make anything feel slow. In any case, with possibly relatively little work, this could make cocalc "delightful" in a pretty cool way. 🤷‍♂

williamstein commented 5 years ago

Also, showing the preview right when loading the file would be nice. E.g., within milliseconds of clicking to open a file, you would see a static png of it opened while the file is actually being loaded (of course there would still be a loading indicator or it would be shown in some special preview mode).