Skip to content

Commit

Permalink
Merge pull request #1 from holochain-gym/master
Browse files Browse the repository at this point in the history
Sync fork with holochain-gym
  • Loading branch information
tixel authored Apr 6, 2021
2 parents 732f700 + 4ff9906 commit ba12173
Show file tree
Hide file tree
Showing 32 changed files with 4,377 additions and 5,444 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ docs/_merged_includes/
node_modules/
_site-dev/
_site/
*.code-workspace
1 change: 1 addition & 0 deletions EXERCISE-TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Intermediate >> Remote Call ||203
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# Holochain Gym

Go to the [gym](https://holochain-gym.github.io).

## Contributor Setup

First, you need to be running node v14. An easy way to do this is to enter the nix-shell:

```bash
nix-shell -p nodejs-14_x
```

Install the dependencies for the project:

```bash
npm install
```

## Starting

```bash
npm start
```

This will start a server with hot reload that should open automatically.

## Deploying to github pages

```bash
npm run gh-pages
```

94 changes: 94 additions & 0 deletions creating-a-playground-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Creating a playground exercise

1. Go to the [playground documentation](https://holochain-playground.github.io/elements/?path=/story/call-zome-fns--simple).
- See which components are available and their options.
- This list may grow soon, but the elements that are there should be quite stable.
2. In the gym exercise, add this at the beginning of the markdown file:
````js
```js script
import { html } from "lit-html";
import {
HolochainPlaygroundContainer,
EntryContents,
EntryGraph,
CallZomeFns,
} from "@holochain-playground/elements";
customElements.define(
"holochain-playground-container",
HolochainPlaygroundContainer
);
customElements.define("entry-graph", EntryGraph);
customElements.define("entry-contents", EntryContents);
customElements.define("call-zome-fns", CallZomeFns);
```
````

- Import the elements that you need from the documentation. If you'd need some other element, submit an issue in the playground repository.

3. In the place that you want your interactive playground to appear, write the following:

````js
```js story
const sampleZome = {
name: "helloworld",
entry_defs: [
{
id: "greeting",
visibility: "Public",
},
],
zome_functions: {
// Here you can code whatever functions you want your dna to have
say_greeting: {
call: ({ create_entry }) => ({ content }) => {
return create_entry({ content, entry_def_id: "greeting" });
},
arguments: [{ name: "content", type: "String" }],
},
},
};
const simulatedDnaTemplate = {
zomes: [sampleZome],
};
export const Simple = () => {
return html`
<holochain-playground-container
.numberOfSimulatedConductors=${1}
.simulatedDnaTemplate=${simulatedDnaTemplate}
@ready=${(e) => {
const conductor = e.detail.conductors[0];

const cellId = conductor.getAllCells()[0].cellId;

e.target.activeAgentPubKey = cellId[1];
}}
>
<!-->Here you can put whatever elements you want to show<-->
<div style="display: flex; flex-direction: row; align-items: start; margin-bottom: 20px;">
<call-zome-fns
id="call-zome"
style="height: 250px; margin-right: 20px;"
hide-zome-selector
hide-agent-pub-key
hide-results
>
</call-zome-fns>
<entry-contents style="flex-basis: 500px; height: 250px;"> </entry-contents>
</div>
<entry-graph
show-entry-contents
hide-filter
.excludedEntryTypes=${["Agent"]}
style="flex: 1; height: 500px;"
>
</entry-graph>
</holochain-playground-container>
`;
};
```
````


You can also look at the numerous examples that you have available in this repository.
Binary file added docs/_assets/folder-exercise.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/_assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/_assets/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ html.dark {
--markdown-link-color: #fb7881;
--markdown-blockquote-color: #c9e3ff;
}

@media screen and (min-width: 1024px) {
.content-area {
max-width: 1600px !important;
}
}
6 changes: 5 additions & 1 deletion docs/_data/footer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"children": [
{
"text": "Documentation",
"href": ""
"href": "https://developer.holochain.org/docs/references/"
},
{
"text": "Forum",
Expand All @@ -17,6 +17,10 @@
"children": [
{
"text": "Help and Feedback",
"href": "https://forum.holochain.org/c/learning-library/gym/133"
},
{
"text": "Tasks for Contributors to the Gym",
"href": "https://github.com/holochain-gym/holochain.github.io/issues"
}
]
Expand Down
1 change: 1 addition & 0 deletions docs/_includes/_joiningBlocks/header/30-core-concepts.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="https://developer.holochain.org/docs/concepts/" class="">Core Concepts</a>
1 change: 1 addition & 0 deletions docs/_includes/_joiningBlocks/header/40-glossary.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="https://developer.holochain.org/docs/glossary/" class="">Glossary of Terms</a>
1 change: 1 addition & 0 deletions docs/_includes/_joiningBlocks/header/50-feedback.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="https://forum.holochain.org/c/learning-library/gym/133" class="">Give us Feedback!</a>
3 changes: 0 additions & 3 deletions docs/architects/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: Architects
eleventyNavigation:
key: Architects
order: 20
---

TBD
Loading

0 comments on commit ba12173

Please sign in to comment.