Skip to content

Commit 3615a4f

Browse files
authored
Merge pull request #26 from PinoutLTD/dev
merge upstream v2.0.0
2 parents dd5ea22 + b1b4892 commit 3615a4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+4935
-3226
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup Node
1616
uses: actions/setup-node@v1
1717
with:
18-
node-version: "18.17.x"
18+
node-version: "20.x"
1919

2020
- name: Get yarn cache
2121
id: yarn-cache
@@ -30,6 +30,8 @@ jobs:
3030
${{ runner.os }}-website-
3131
- run: yarn install --frozen-lockfile
3232
- run: yarn build
33+
env:
34+
VITE_CONFIG_ENV: ${{ vars.VITE_CONFIG_ENV }}
3335

3436
- name: Deploy
3537
uses: peaceiris/actions-gh-pages@v3

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dist-ssr
1414
coverage
1515
*.local
1616

17+
/src/config/local/
1718
/cypress/videos/
1819
/cypress/screenshots/
1920

@@ -27,4 +28,4 @@ coverage
2728
*.sln
2829
*.sw?
2930

30-
commit.txt
31+
commit.txt

README.md

Lines changed: 237 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,269 @@
1-
# Create open sensors networks without centralization problems
1+
# sensors.social
22

3-
Decentralized Open Sensors Map. Don't forget to your IFPS ID into `src/agents.json` in case you set up your own [Sensors Connectivity module](https://github.com/airalab/sensors-connectivity/tree/master).
3+
---
44

5-
## Setup your own Map
5+
## 📌 Overview
66

7-
To deploy your own instance of the map using GitHub Pages, start by forking the [repository](https://github.com/airalab/sensors.robonomics.network) and clone it. To enable GitHub Actions, go to the repository page, click on the `Actions` tab, and set up a workflow if you haven't done so already.
8-
To successfully deploy the map, you will need to modify certain files:
7+
**sensors.social** is a decentralized application that visualizes data from sensors sending their measurements to the blockchain (Polkadot network, Robonomics parachain). The platform supports two modes of operation:
98

10-
### Option 1: you don't have Domain
9+
- **Peer-to-peer connectivity** for direct access to sensor data.
10+
- **Federative concept** for accumulating sensor data and displaying measurement history.
1111

12-
1. In `.github/workflows/main.yaml` remove `cname: sensors.robonomics.network`.
13-
2. Add the following code right below `runs-on: ubuntu-latest` in `.github/workflows/main.yaml`:
12+
For more details on connectivity and how to deploy your own map interface (or even a connectivity server), visit [Robonomics Academy](https://robonomics.academy/en/learn/sensors-connectivity-course/overview/).
13+
14+
---
15+
16+
## 🚀 Deployment
17+
18+
This section is intended for contributors working on the existing map and developers setting up their own map interface. For comprehensive instructions on configuring your own user interface, refer to the next sections.
19+
20+
### 1️⃣ Fork & Clone the Repository
21+
22+
If you plan to contribute or customize the project extensively, consider forking it first. Then clone the repository:
23+
24+
```sh
25+
git clone <map repository>
1426
```
15-
permissions:
16-
contents: write
27+
28+
If you plan to contribute or customize the project extensively, consider forking it first.
29+
30+
### 2️⃣ Install Dependencies
31+
32+
Ensure **Node.js** and **Yarn** are installed:
33+
34+
```sh
35+
node -v # Should be >= 16
36+
yarn -v # Should be installed
1737
```
18-
3. In `vite.config.js` add `base: "/<repository name>/",` to the `defineConfig` object just above the `plugins` section , replacing `<repository_name>` with the name of your fork (default will be `sensors.robonomics.network`)
1938

20-
### Option 2: you have Domanin
39+
Then install the required dependencies:
2140

22-
1. In `.github/workflows/main.yaml` change `cname: sensors.robonomics.network` to your `CNAME`.
23-
2. Add the following code right below `runs-on: ubuntu-latest` in `.github/workflows/main.yaml`:
41+
```sh
42+
yarn install
2443
```
25-
permissions:
26-
contents: write
44+
45+
### 3️⃣ Start the Server Locally for Development
46+
47+
```sh
48+
yarn dev
2749
```
2850

29-
### Manage Github Pages
51+
---
3052

31-
After making modifications to the files, you can deploy your instance of the map by following these steps:
3253

33-
1. Commit and push the changes to your forked repository.
34-
2. Wait until the actions have successfully completed.
35-
3. Go to the `Pages` section of your repository `Settings`.
36-
4. Enable GitHub Pages by selecting `Deploy from a branch` as the source
37-
5. Choose the `gh-pages` branch and the `root` folder.
38-
6. Save the settings, and GitHub Pages will deploy your instance of the map.
39-
7. Access it using the provided GitHub Pages URL.
54+
## 🔧 Setup Your Own Map (For Experienced Users)
4055

41-
> If you dont see the GitHub Pages URL try to reload the page.
56+
### 1️⃣ Deploy Your Own Instance of the Map
4257

43-
## Project setup
58+
Refer to the "🚀 Deployment" section.
4459

45-
```
46-
yarn install
47-
```
60+
### 2️⃣ Enable GitHub Actions
4861

49-
### Compiles and hot-reloads for development
62+
To activate GitHub Actions in your repository:
5063

51-
```
52-
yarn dev
64+
- Navigate to the **Actions** tab in your GitHub repository.
65+
- If prompted, enable workflows by clicking **Enable GitHub Actions**.
66+
- Ensure that workflows are correctly set up in `.github/workflows/`.
67+
68+
### 3️⃣ Configure Deployment
69+
70+
#### Option 1: Deploy Without a Custom Domain
71+
72+
- Open `.github/workflows/main.yaml` and remove the line:
73+
```yaml
74+
cname: sensors.social
75+
```
76+
- Add the following permissions block right below `runs-on: ubuntu-latest`:
77+
```yaml
78+
permissions:
79+
contents: write
80+
```
81+
- In `vite.config.js`, add the following line to the `defineConfig` object, just above the `plugins` section:
82+
```javascript
83+
base: "/<repository_name>/",
84+
```
85+
Replace `<repository_name>` with the name of your fork.
86+
87+
#### Option 2: Deploy With a Custom Domain
88+
89+
- Open `.github/workflows/main.yaml` and replace:
90+
```yaml
91+
cname: sensors.social
92+
```
93+
with your custom domain:
94+
```yaml
95+
cname: your-custom-domain.com
96+
```
97+
- Add the following permissions block right below `runs-on: ubuntu-latest`:
98+
```yaml
99+
permissions:
100+
contents: write
101+
```
102+
103+
### 4️⃣ Finalizing Deployment
104+
105+
After modifying the necessary files, deploy your instance of the map by following these steps:
106+
107+
1. Commit and push the changes to your forked repository:
108+
```sh
109+
git add .
110+
git commit -m "Configured deployment settings"
111+
git push origin main
112+
```
113+
2. Wait until the GitHub Actions workflow successfully completes.
114+
3. Navigate to the **Pages** section in your repository **Settings**.
115+
4. Enable GitHub Pages by selecting **Deploy from a branch** as the source.
116+
5. Choose the `gh-pages` branch and the root folder.
117+
6. Save the settings—GitHub Pages will deploy your instance of the map.
118+
119+
You can now access your deployed map using the provided GitHub Pages URL.
120+
121+
122+
---
123+
124+
125+
## 💬 Localization & Translations
126+
127+
You can add a new language to the map by modifying the translation files located in `src/translate/`.
128+
129+
### 📝 Adding a New Language
130+
131+
1️⃣ **Create a new translation file** in `src/translate/`, e.g., `es.js`.
132+
133+
2️⃣ **Update `index.js`** in the same folder:
134+
- Import your newly created translation file:
135+
136+
```js
137+
import es from "./es";
138+
139+
export default { en, ru, es };
140+
```
141+
142+
- Add the new language to the language list:
143+
144+
```js
145+
export const languages = [
146+
{ code: "en", title: "English" },
147+
{ code: "ru", title: "Русский" },
148+
{ code: "es", title: "Español" },
149+
];
150+
```
151+
152+
### 📏 Translating Measurements
153+
154+
Measurement values are located in `src/measurements/`.
155+
To support multiple languages, update the relevant files in this folder.
156+
157+
#### Files to Update
158+
159+
| Measurement Type | File Name |
160+
|-------------------------|-----------|
161+
| Carbon Monoxide | `co.js` |
162+
| Background Radiation | `gs.js` |
163+
| Humidity | `humidity.js` |
164+
| Ammonia (NH₃) | `nh3.js` |
165+
| Nitrogen Dioxide (NO₂) | `no2.js` |
166+
| Noise Levels | `noise.js`, `noiseavg.js`, `noisemax.js` |
167+
| PM10 Particulate Matter | `pm10.js` |
168+
| PM2.5 Particulate Matter | `pm25.js` |
169+
| Pressure | `pressure.js` |
170+
| Temperature | `temperature.js` |
171+
172+
#### Example Translation Update (`humidity.js`)
173+
174+
To add support for **Spanish (es)**, update the `name`, `nameshort`, and `zones` properties:
175+
176+
```js
177+
178+
name: {
179+
en: "Humidity",
180+
ru: "Влажность",
181+
es: "Humedad"
182+
},
183+
nameshort: {
184+
en: "Humidity",
185+
ru: "Влажность",
186+
es: "Humedad"
187+
},
188+
189+
zones: [
190+
{
191+
value: 30,
192+
color: "#ff4d00",
193+
label: {
194+
en: "Very dry",
195+
ru: "Очень сухо",
196+
es: "Muy seco"
197+
}
198+
}
199+
]
200+
```
201+
202+
---
203+
204+
205+
## How to Fork the Repository with Custom Configuration Files
206+
207+
1️⃣ Copy the `src/config/template` directory to your own:
208+
209+
```sh
210+
cp -r src/config/template src/config/my-project
53211
```
54212

55-
### Compiles and minifies for production
213+
2️⃣ In the `src/config/my-project/config.json` file, all parameters are optional. You can configure the following settings:
56214

215+
```json
216+
{
217+
"LIBP2P": "Configuration for initializing the LIBP2P library",
218+
"REMOTE_PROVIDER": "Server with Rozman",
219+
"WIND_PROVIDER": "Server with wind data",
220+
"MAP": {
221+
"zoom": "Zoom level",
222+
"position": {
223+
"lat": "Latitude",
224+
"lng": "Longitude"
225+
}
226+
},
227+
"SHOW_MESSAGES": "Boolean value (true/false) indicating whether to display user messages on the map",
228+
"DEFAUL_TYPE_PROVIDER": "Default data provider type (remote or realtime)",
229+
"TITLE": "Project title",
230+
"SERIES_MAX_VISIBLE": "Maximum number of data points on the chart before grouping is applied"
231+
}
57232
```
58-
yarn build
233+
**Example**: [config.json](https://github.com/airalab/sensors.social/blob/master/src/config/main/config.json)
234+
235+
3️⃣ In the `src/config/my-project/agents.json` file, specify a list of libp2p identifiers from which data can be received via pubsub in realtime mode.
236+
237+
**Example**: [agents.json](https://github.com/airalab/sensors.social/blob/master/src/config/main/agents.json)
238+
239+
4️⃣ In the `src/config/main/sensors.js` file, you can set an icon and a website link for a specific sensor:
240+
241+
```json
242+
{
243+
"HASH ID_SENSOR": {
244+
"icon": "Path to the icon file",
245+
"link": "URL of the website"
246+
}
247+
}
59248
```
60249

61-
### Lints and fixes files
250+
**Example**: [sensors.json](https://github.com/airalab/sensors.social/blob/master/src/config/main/sensors.js)
251+
252+
5️⃣ To ensure that your configuration is loaded in the final build, set the following environment variable:
62253

63254
```
64-
yarn lint
255+
VITE_CONFIG_ENV=my-project
65256
```
66257

67-
### Customize configuration
258+
You can configure this in your GitHub project settings under the Environments section.
259+
260+
<img src="https://github.com/user-attachments/assets/97368424-ac08-4b62-9beb-3c36a61a1b47" width="500">
261+
262+
---
263+
68264

69-
See [Vite Configuration Reference](https://vitejs.dev/config/).
265+
## ❓ Support
70266

71-
## Recommended IDE Setup
267+
For questions or suggestions, create an **issue** in the repository.
72268

73-
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
269+
---

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sensors.robonomics.network",
3-
"version": "0.5.0",
3+
"version": "2.0.0",
44
"private": true,
55
"scripts": {
66
"dev": "vite --host",
@@ -10,8 +10,8 @@
1010
},
1111
"dependencies": {
1212
"@chainsafe/libp2p-noise": "^13.0.1",
13-
"@fortawesome/fontawesome-svg-core": "^6.2.0",
14-
"@fortawesome/free-solid-svg-icons": "^6.2.0",
13+
"@fortawesome/fontawesome-svg-core": "^6.7.2",
14+
"@fortawesome/free-solid-svg-icons": "^6.7.2",
1515
"@fortawesome/vue-fontawesome": "^3.0.1",
1616
"@kyvg/vue3-notification": "^2.9.1",
1717
"@libp2p/bootstrap": "^9.0.6",
@@ -48,12 +48,14 @@
4848
"vue3-clipboard": "^1.0.0"
4949
},
5050
"devDependencies": {
51+
"@release-it/conventional-changelog": "^10.0.1",
5152
"@rushstack/eslint-patch": "^1.1.4",
5253
"@vitejs/plugin-vue": "^3.0.3",
5354
"@vue/eslint-config-prettier": "^7.0.0",
5455
"eslint": "^8.22.0",
5556
"eslint-plugin-vue": "^9.3.0",
5657
"prettier": "^2.7.1",
58+
"release-it": "^19.0.1",
5759
"vite": "^3.2.7"
5860
}
5961
}

src/agents.template.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)