Skip to content

Instantly share code, notes, and snippets.

@kav
Last active September 27, 2022 01:06
Show Gist options
  • Save kav/91de9eb01c2913c4129ab07473382464 to your computer and use it in GitHub Desktop.
Save kav/91de9eb01c2913c4129ab07473382464 to your computer and use it in GitHub Desktop.
Tool
Tool
Active
mark lost ->Inactive
mark stolen -> Inactive
mark out for repair -> Inactive
mark hidden -> Inactive
mark consumed -> Inactive
With A
B request -> Requested
A transfer -> Transferring
A transfer without confirmation -> With B
audit -> Auditing
Requested
A transfer -> Transferring
cancel -> With A
Transferring
B accept -> With B
cancel -> With A
With B
b becomes a -> With A
Auditing
A audit -> With A
mark lost -> Inactive
mark stolen -> Inactive
Inactive
mark active -> Active
// Attach Figma frames (artboards) to states
// IDs can be found under "Share > Public Embed" in Figma
// ** Edit this: Figma File ID
const figmaFile = "MSPqZQybfRPKBuDQe7nfH1";
// ** Edit this: List state names and matching Figma frame/artboard IDs
const figmaNodes =
{"With A": "2%3A270",
"Requested": "2%3A274",
"Transferring": "5%3A513",
"With B": "5%3A603",
"Auditing": "168%3A244"};
const figmaURL = "https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/" + figmaFile + "/Sample-File?node-id=";
function render(model){
const currentStateName = model.active_states[0].name;
for (f in figmaNodes)
if (currentStateName === f)
return $("iframe",{src: figmaURL + figmaNodes[f], width: '100%', height: '100%'});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment