SandDance icon indicating copy to clipboard operation
SandDance copied to clipboard

SandDance Explorer snapshot sharing

Open nlafleur opened this issue 4 years ago • 1 comments

How to make my SandDance Explorer snapshots shareable?

In the SandDance Explorer example https://sanddance.js.org/app it is possible to share your snapshot with the 'share' button; image

I can't find any information about this share/export option in the docs, the only 2 things I could find;

A function called SnapshotExport - https://github.com/microsoft/SandDance/blob/b0725a2eb975b248d6e6a61a2471d0fa97f41669/packages/sanddance-app/src/snapshots.tsx#L269

And a button that changes the url which makes it shareable - https://github.com/microsoft/SandDance/blob/b0725a2eb975b248d6e6a61a2471d0fa97f41669/packages/sanddance-app/src/snapshots.tsx#L301-L316

^These look like the function and button that I'm looking for but I don't know how to implement this in my code

Example of my explorerProps:

return {
  //logoClickUrl: '/',
  mounted: explorer => {
    const service = this.getServices(process.env.webserver);
    const url = myUrl
    const dataFile = {
      displayName: 'Mangrove',
      dataUrl: url,
      type: fileType
    }
    explorer.load(dataFile);
  },
  compactUI: { compactUI },
  dataExportHandler: true
}

I was expecting that there would be an option like; 'snapshotSharing: boolean'.


DataExport: In my code example above you can see that I've set the 'dataExportHandler' on true, but whenever I try to export my rows like this: image It displays the following error in my console; Uncaught TypeError: this.props.dataExportHandler is not a function

Just like the snapshot sharing I cannot find anything regarding this function in the docs.

nlafleur avatar Dec 22 '20 13:12 nlafleur

For snapshot sharing, see snapshotProps, an object with a getActions property, which returns an array of your own SnapShotActions. Here you can provide your own React elements for the snapshot actions.

The dataExportHandler prop should be a function, please see this example

danmarshall avatar Jan 05 '21 01:01 danmarshall

Closing this for now, if you have any feedback, please feel free to re-open.

danmarshall avatar Feb 08 '23 21:02 danmarshall