Merge pull request #4 from holepunchto/update-pictures-and-add-config
Update pictures and add config
|
Before Width: | Height: | Size: 349 KiB After Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 254 KiB |
BIN
assets/chat-app-4a.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
assets/chat-app-4b.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 294 KiB |
BIN
assets/chat-app-5a.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
assets/chat-app-5b.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 283 KiB |
|
Before Width: | Height: | Size: 281 KiB |
@@ -90,7 +90,7 @@ function onMessageAdded(from, message) {
|
||||
}
|
||||
```
|
||||
|
||||
## Step 3. Run the app
|
||||
## Step 4. Run the app
|
||||
|
||||
Now it's time to write the app.
|
||||
|
||||
@@ -104,13 +104,20 @@ In the first app, click on `Create chat room`. When it has started the topic is
|
||||
|
||||
In the second app, paste in the topic that was shown in the first app, and then click on `Join chat room`.
|
||||
|
||||

|
||||
<p align="center">
|
||||
<img src="./assets/chat-app-4a.png" alt="The first app, with the topic"> <img src="../assets/chat-app-4b.png" alt="Second app, using topic from the first">
|
||||
</p>
|
||||
|
||||
After that the two apps are able to send messages between them
|
||||
|
||||

|
||||
View from the first app
|
||||
|
||||
## Understanding the code
|
||||
<p align="center">
|
||||
<img src="./assets/chat-app-5a.png" alt="View from the first app"> <img src="../assets/chat-app-5b.png" alt="View from the second app">
|
||||
</p>
|
||||
|
||||
|
||||
## Understand the code
|
||||
|
||||
Looking through the code, a great part of it has to do with handling the layout. It's outside of the scope of this tutorial to delve into that, but shouldn't look unfamiliar to most. It's possible to use larger frameworks like React, but that won't be covered here.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
As covered in [Sharing a Pear App](./sharing-a-pear-app.md), Pear use release channels in a similar way that git use branches. When the app has been tested, and it's ready to release it, it's really simple.
|
||||
|
||||
## Step 1. Releasing
|
||||
## Step 1. Release
|
||||
|
||||
Assume that the app was staged into `example`, then releasing it is simply:
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ With Pear there are one single "release" (or "production") version of an app, an
|
||||
To share apps, stage them using `pear stage some-name`. This builds a new version of the app and puts them into the `some-name` channel.
|
||||
|
||||
|
||||
## Step 1. Staging
|
||||
## Step 1. Stage
|
||||
|
||||
Before sharing the app, first stage it into a channel called `example` (the name can be anything)
|
||||
|
||||
@@ -15,7 +15,7 @@ Before sharing the app, first stage it into a channel called `example` (the name
|
||||
$ pear stage example
|
||||
```
|
||||
|
||||
## Step 2. Seeding
|
||||
## Step 2. Seed
|
||||
|
||||
After the app has been staged into the `example` channel, it now needs to be seeded. This is a way to signal that the app is now shared, so others can download and run it.
|
||||
|
||||
@@ -32,7 +32,7 @@ After the app has been staged into the `example` channel, it now needs to be see
|
||||
|
||||
For now, keep this terminal open. As long as this process is running, your computer will help seed the application.
|
||||
|
||||
## Step 3. Launching
|
||||
## Step 3. Launch
|
||||
|
||||
Because the app is now being seeded, it' possible for others with the key (`pear:nykm...`) to launch it.
|
||||
|
||||
@@ -42,6 +42,8 @@ In another terminal (or on another computer), run:
|
||||
$ pear launch pear:nykmkrpwgadcd8m9x5khhh43j9izj123eguzqg3ygta7yn1s379o
|
||||
```
|
||||
|
||||

|
||||
|
||||
This will download and open the app.
|
||||
|
||||
Note: Anyone running the app also help to seed it. So if the app had a lot of users, the original seeder could close down the process.
|
||||
|
||||
@@ -16,8 +16,8 @@ $ pear init --yes
|
||||
|
||||
This will create a base structure for the project.
|
||||
|
||||
- `package.json`. Config for the app. Notice the `pear` property.
|
||||
- `index.html`. The UI for the app.
|
||||
- `package.json`. Configuration for the app. Notice the `pear` property.
|
||||
- `index.html`. The html for the app.
|
||||
- `app.js`. The main code.
|
||||
- `test/index.test.js`. Skeleton for writing tests.
|
||||
|
||||
@@ -41,7 +41,30 @@ While keeping the app open with `pear dev`, open `index.html` in a code editor.
|
||||
|
||||

|
||||
|
||||
## Step 4. Create a basic UI
|
||||
## Step 4. Change Graphical User Interface (GUI) configuration
|
||||
|
||||
It's possible to change various settings with Pear. This is done with the `pear` property in `package.json`
|
||||
|
||||
For now, open `package.json` and update it :
|
||||
```
|
||||
{
|
||||
...
|
||||
"pear": {
|
||||
"gui": {
|
||||
"backgroundColor": "#3592C3",
|
||||
"height": 400,
|
||||
"width": 700
|
||||
}
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
When running the app now, it will be light blue, and have a different size.
|
||||
|
||||
See all the possibly options in the [Configuration Documentation](../reference/configuration.md).
|
||||
|
||||
## Step 5. Create a basic User Interface (UI)
|
||||
|
||||
To add some more interesting UI, let's have an example of a chat app, where users are able to create or join chat rooms and write messages to each other.
|
||||
|
||||
@@ -54,6 +77,7 @@ To add some more interesting UI, let's have an example of a chat app, where user
|
||||
body {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
background-color: #3592C3;
|
||||
color: white;
|
||||
justify-content: center;
|
||||
margin: 0;
|
||||
|
||||