Skip to content

Commit

Permalink
- Update Documentation (v4.3.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushsharma82 committed Dec 3, 2023
1 parent 04b2ad0 commit ae681b1
Show file tree
Hide file tree
Showing 55 changed files with 530 additions and 66 deletions.
2 changes: 1 addition & 1 deletion docs/cards/air.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sidebar_position: 4


#### Preview:
<img class="card-preview" src="/img/v4/air-card.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/air-card.png" width="280px" alt="Preview" />

<br/>

Expand Down
16 changes: 8 additions & 8 deletions docs/cards/button.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
title: Button Card
sidebar_label: Button
title: Toggle Button
sidebar_label: Toggle Button
sidebar_position: 5
---

#### Preview:

<img class="card-preview" src="/img/v4/button-card-false.png" width="280px" alt="Button Card Preview" />
<img className="card-preview" src="/img/v4/button-card-false.png" width="280px" alt="Button Card Preview" />
&nbsp;
<img class="card-preview" src="/img/v4/button-card-true.png" width="280px" alt="Button Card Preview" />
<img className="card-preview" src="/img/v4/button-card-true.png" width="280px" alt="Button Card Preview" />

<br/>
<br/>

Button card adds a interactive toggle button to your dashboard. This provides you with a simple `true` or `false` input from your dashboard.
Button card adds a interactive toggle button to your dashboard. This provides you with a simple `1` or `0` input from your dashboard.

<br/>

Expand Down Expand Up @@ -41,7 +41,7 @@ Card card1(&dashboard, BUTTON_CARD, "Test Button");
#### Callback:
Button card requires a callback function which will be executed when we receive a input from our dashboard. In this example, we will use the `attachCallback` function and provide a lambda function with a boolean argument.
In the case of button card, the value sent by your dashboard will be opposite of your current value. For Example: If your button is set to `false`, then clicking that button on dashboard will trigger this callback with `true`.
In the case of button card, the value sent by your dashboard will be opposite of your current value. For Example: If your button is set to `0`, then clicking that button on dashboard will trigger this callback with `1`.
**Note:** You need to call the `update` function and `sendUpdates` immediately once you receive the value in callback. Otherwise user input will not be registered on dashboard.
Expand All @@ -62,11 +62,11 @@ card1.attachCallback([&](int value){
#### Updaters:

```cpp
card1.update(true);
card1.update(1);
```

```cpp
card1.update(false);
card1.update(0);
```
<br/>
<br/>
4 changes: 2 additions & 2 deletions docs/cards/dropdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ sidebar_position: 8


#### Preview:
<img class="card-preview" src="/img/v4/dropdown-card.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/dropdown-card.png" width="280px" alt="Preview" />
&nbsp;
<img class="card-preview" src="/img/v4/dropdown-card-2.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/dropdown-card-2.png" width="280px" alt="Preview" />

<br/>

Expand Down
2 changes: 1 addition & 1 deletion docs/cards/energy.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sidebar_position: 4

#### Preview:

<img class="card-preview" src="/img/v4/energy-card.png" width="280px" alt="Energy Card Preview" />
<img className="card-preview" src="/img/v4/energy-card.png" width="280px" alt="Energy Card Preview" />

<br/>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/cards/generic.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 1

#### Preview:

<img class="card-preview" src="/img/v4/generic-card.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/generic-card.png" width="280px" alt="Preview" />

<br/>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/cards/humidity.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 3

#### Preview:

<img class="card-preview" src="/img/v4/humidity-card.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/humidity-card.png" width="280px" alt="Preview" />

<br/>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/cards/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sidebar_position: 9


#### Preview:
<img class="card-preview" src="/img/v4/image-card.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/image-card.png" width="280px" alt="Preview" />

<br/>

Expand Down
2 changes: 1 addition & 1 deletion docs/cards/joystick.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sidebar_position: 7

#### Preview:

<img class="card-preview" src="/img/v4/joystick-card.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/joystick-card.png" width="280px" alt="Preview" />

<br/>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/cards/progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_position: 4
---

#### Preview:
<img class="card-preview" src="/img/v4/progress-card.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/progress-card.png" width="280px" alt="Preview" />

<br/>
<br/>
Expand Down
55 changes: 55 additions & 0 deletions docs/cards/push-button.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: Push Button Card
sidebar_label: Push Button (Pro)
sidebar_position: 5
---

<div className="pro-label">
<i>
<h4 style={{ fontWeight: '500', marginBottom: 5 }}>
This feature is available in <a target="_blank" style={{ color: "red" }} href="https://espdash.pro">DASH Pro</a> only.
</h4>
</i>
</div>

#### Preview:

<img className="card-preview" src="/img/v4/push-button.png" width="280px" alt="Push Button Card Preview" />

<br/>
<br/>

Push button card adds a static button on your dashboard which has no state. Whenever a user clicks this button, it triggers a callback.

<br/>

#### Type:
`PUSH_BUTTON_CARD`

<br/>

#### Initializer:
```cpp
/*
Button Card
Valid Arguments: (ESPDash dashboard, Card Type, const char* name)
*/
Card card1(&dashboard, PUSH_BUTTON_CARD, "Push Button");
```
<br/>
#### Callback:
Push button card will trigger a callback on every click by user, there is no need to update or `sendUpdates` to dashboard because there is no state.
```cpp
/*
We provide our attachCallback with a lambda function to handle trigger
*/
card1.attachCallback([&](){
Serial.println("[Card1] Push Button Triggered");
});
```
<br/>
<br/>
2 changes: 1 addition & 1 deletion docs/cards/slider.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 6

#### Preview:

<img class="card-preview" src="/img/v4/slider-card.png" width="380px" alt="Preview" />
<img className="card-preview" src="/img/v4/slider-card.png" width="380px" alt="Preview" />

<br/>
<br/>
Expand Down
8 changes: 4 additions & 4 deletions docs/cards/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ sidebar_position: 5

#### Preview:

<img class="card-preview" src="/img/v4/status-card-idle.png" width="280px" alt="Preview" />
<img class="card-preview" src="/img/v4/status-card-warning.png" width="280px" alt="Preview" />
<img class="card-preview" src="/img/v4/status-card-success.png" width="280px" alt="Preview" />
<img class="card-preview" src="/img/v4/status-card-danger.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/status-card-idle.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/status-card-warning.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/status-card-success.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/status-card-danger.png" width="280px" alt="Preview" />

<br/>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/cards/temperature.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 2

#### Preview:

<img class="card-preview" src="/img/v4/temperature-card.png" width="280px" alt="Preview" />
<img className="card-preview" src="/img/v4/temperature-card.png" width="280px" alt="Preview" />

<br/>
<br/>
Expand Down
4 changes: 2 additions & 2 deletions docs/cards/text-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sidebar_position: 6

#### Preview:

<img class="card-preview" src="/img/v4/text-input-card.png" width="280px" alt="Energy Card Preview" />
<img className="card-preview" src="/img/v4/text-input-card.png" width="280px" alt="Text Input Card Preview" />

<br/>
<br/>
Expand All @@ -33,6 +33,7 @@ This card is very useful for saving WiFi credentials, passwords and general info

#### Valid Data Types:
- `String`
- `char`

<br/>

Expand All @@ -56,7 +57,6 @@ Text Input Card requires a callback function which will be called when we receiv
```cpp
/*
We provide our attachCallback with a lambda function to handle incomming data
`value` is the boolean sent from your dashboard
*/
card1.attachCallback([&](const char* value){
Serial.println("[Card1] Text Input Callback Triggered: "+String(value));
Expand Down
79 changes: 79 additions & 0 deletions docs/cards/week-selector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: Week Selector Card
sidebar_label: Week Selector (Pro)
sidebar_position: 10
---

<div className="pro-label">
<i>
<h4 style={{ fontWeight: '500', marginBottom: 5 }}>
This feature is available in <a target="_blank" style={{ color: "red" }} href="https://espdash.pro">DASH Pro</a> only.
</h4>
</i>
</div>

#### Preview:

<img className="card-preview" src="/img/v4/week-selector.png" width="280px" alt="Week Selector Card Preview" />

<br/>
<br/>

Week selector card gives you a nice card in which days are selectable by users. This type of card is very useful in many scenarios. The output of the card is comma `,` separated string on days which were selected by the user.

<br/>

#### Type:
`WEEK_SELECTOR_CARD`

<br/>

#### Valid Data Types:
- `String`
- `char`

<br/>

#### Initializer:
```cpp
/*
Energy Card
Valid Arguments: (ESPDash dashboard, Card Type, const char* name)
*/
Card card1(&dashboard, WEEK_SELECTOR_CARD, "Select Days");
```
<br/>
#### Callback:
Week selector card requires a callback function which will be called when we receive a input from our dashboard. In our setup block, we will be calling our `attachCallback` function and provide a lambda (callback) function with a `const char*` (character array) argument. Whenever a user selects a day, this callback will be triggered with a comma `,` separated list of days which indicate what was selected by user.
**Note:** You need to call the `update` function and `sendUpdates` immediately once you receive the value in callback. Otherwise user input will not be registered on dashboard and it will keep the card stuck in 'waiting' phase.
```cpp
/*
We provide our attachCallback with a lambda function to handle incomming data
Example Value: mon,tue,wed,thu,fri,sat,sun
*/
card1.attachCallback([&](const char* days){
Serial.println("[Card1] Week Selector Triggered: "+String(days));
card1.update(value);
dashboard.sendUpdates();
});
```

<br/>

#### Updaters:
You can also select or deselect values depending on your logic. You just need to supply the updater with a comma `,` separated list of days. Order of days in this string doesn't matter. Example: Supplying `tue,mon,thu` will show `Monday, Tuesday & Thursday` as selected on Week Selector Card.

```cpp
card1.update(const char* value);
```

```cpp
card1.update(String value);
```

2 changes: 1 addition & 1 deletion docs/charts/area.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sidebar_position: 3

#### Preview:

<img class="card-preview" src="/img/v4/area-chart.png" width="500px" alt="Preview" />
<img className="card-preview" src="/img/v4/area-chart.png" width="500px" alt="Preview" />

<br/>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/charts/bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_position: 1

#### Preview:

<img class="card-preview" src="/img/v4/bar-chart.png" width="500px" alt="Preview" />
<img className="card-preview" src="/img/v4/bar-chart.png" width="500px" alt="Preview" />

<br/>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/charts/line.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sidebar_position: 2

#### Preview:

<img class="card-preview" src="/img/v4/line-chart.png" width="500px" alt="Preview" />
<img className="card-preview" src="/img/v4/line-chart.png" width="500px" alt="Preview" />

<br/>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/charts/pie.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sidebar_position: 4

#### Preview:

<img class="card-preview" src="/img/v4/pie-chart.png" width="380px" alt="Preview" />
<img className="card-preview" src="/img/v4/pie-chart.png" width="380px" alt="Preview" />

<br/>
<br/>
Expand Down
9 changes: 7 additions & 2 deletions docs/custom-statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ ESP-DASH has a dedicated page called "Statistics" on the dashboard which contain

##### Initializer:
```cpp
Statistic stat1(&dashboard, "Statistic 1", "Value 1");
Statistic stat1(&dashboard, "Key", "Value");
```
##### Update Value:
```cpp
stat1.set("New Value");
```

##### Update both Key & Value:
```cpp
stat1.set("New Key", "New Value");
```
```
Loading

0 comments on commit ae681b1

Please sign in to comment.