Skip to content

Instantly share code, notes, and snippets.

@edgerunner
Last active July 7, 2021 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgerunner/f917aa0190011bb6df5d8a9f624f3591 to your computer and use it in GitHub Desktop.
Save edgerunner/f917aa0190011bb6df5d8a9f624f3591 to your computer and use it in GitHub Desktop.
Barn management
Barn management
Initial*
start drag -> Changing
Changing
move to possible -> Possible
move to impossible -> Impossible
move to same -> Same
release -> Initial
Same
Impossible
Possible
release -> Changed
Changed
# this actually completes the move, the cow is at the new barn
confirm move -> Initial
start drag -> Possible
Not assigned*
assign task -> Assigning
Assigning
select user -> Assigned
cancel assign -> Not assigned
Assigned
reassign -> Assigning
// Attach Figma frames (artboards) to states
// IDs can be found under "Share > Public Embed" in Figma
// ** Edit this: Figma File ID
const figmaFile = "PsHPZZcc9VxzEyTpf0I1VKqi";
// ** Edit this: List state names and matching Figma frame/artboard IDs
const figmaNodes =
{
Initial: "855%3A0",
Same: "855%3A5503",
Impossible: "855%3A5845",
Possible: "855%3A6192",
"Not assigned": "855%3A6534",
Assigning: "855%3A7141",
Assigned: "855%3A7505"
};
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