|
1 | | -# InfoHub |
| 1 | + |
| 2 | + |
| 3 | +# InfoHub · [](https://github.com/prettier/prettier) [](https://github.com/Levis92/InfoHub/blob/master/LICENCE) |
| 4 | + |
2 | 5 | This project is made for my personal use, but you're welcome to use any part of the code. Some widgets may need [API keys](https://en.wikipedia.org/wiki/Application_programming_interface_key) and it's up to you to acquire those yourself. |
3 | 6 |
|
4 | 7 | ## Application |
| 8 | + |
5 | 9 | InfoHub is an application to display widgets on a screen. That's it. No accounts or special features for touchscreen monitors. Just for displaying information. |
6 | 10 |
|
| 11 | +It fetches background wallpapers from [Unsplash API](https://unsplash.com/developers). |
| 12 | + |
7 | 13 | ### Current widgets |
8 | | -* **Clock with time and date.** Displays the current time and date. |
9 | 14 |
|
10 | | -* **Västtrafik.** Displays the current departures from chosen bus-, tram- or trainstops. Needs API keys. You can get them from [developer.vasttrafik.se](https://developer.vasttrafik.se/portal/#/). |
| 15 | +- **Clock with time and date.** Displays the current time and date. |
11 | 16 |
|
12 | | -* **Twitter images.** Displays the latest images from specified Twitter user. |
| 17 | +- **Västtrafik.** Displays the current departures from chosen bus-, tram- or trainstops. Needs API keys. You can get them from [developer.vasttrafik.se](https://developer.vasttrafik.se/portal/#/). |
13 | 18 |
|
14 | | -* **Weather (Dark Sky API).** Displays current and hourly weather data for chosen location. Needs API key. You can get it from [darksky.net/dev](https://darksky.net/dev/). |
| 19 | +- **Twitter images.** Displays the latest images from specified Twitter user. |
15 | 20 |
|
16 | | -## React |
17 | | -The frontend is built with the Javascript library [React](https://facebook.github.io/react/) and is styled with the CSS extension language [Sass](http://sass-lang.com). |
| 21 | +- **Weather (Tomorrow API).** Displays current and hourly weather data for chosen location. Needs API key. You can get it from [tomorrow.io/weather-api](https://www.tomorrow.io/weather-api/). |
18 | 22 |
|
19 | | -### Development |
20 | | -First you need to add a copy of `widget-settings.example.js` and rename it to `widget-settings.js`. The file can be found in `infohub/src/components/`. Add your own settings in the file. |
| 23 | +## Docker |
21 | 24 |
|
22 | | -The first time you run the application (and every time you add new dependencies) you need do run: |
23 | | -``` |
24 | | -npm install |
25 | | -``` |
26 | | -After that you only need to run: |
27 | | -``` |
28 | | -npm start |
29 | | -``` |
| 25 | +The application can, after fixing the configuration files, be composed with [Docker](https://www.docker.com). |
30 | 26 |
|
31 | | -#### Sass |
32 | | -To compile the Sass files you need to have Sass installed. Instructions on how to do that can be found [here](http://sass-lang.com/install). |
| 27 | +To build it run: |
33 | 28 |
|
34 | | -There's a [npm](https://www.npmjs.com) script included, so to compile you only need to run: |
35 | | -``` |
36 | | -npm run sass |
| 29 | +```shell |
| 30 | +$ docker-compose up --build |
37 | 31 | ``` |
38 | 32 |
|
39 | | -### Production |
40 | | -To build the React application you run: |
41 | | -``` |
42 | | -npm run build |
| 33 | +To just compose it, after being built, run: |
| 34 | + |
| 35 | +```shell |
| 36 | +$ docker-compose up |
43 | 37 | ``` |
44 | 38 |
|
45 | | -## Flask |
46 | | -The backend runs on the Python framework [Flask](http://flask.pocoo.org) and is used as an [API](https://en.wikipedia.org/wiki/Application_programming_interface) to request data and structure it in a format more convenient for the frontend application. |
| 39 | +## Next.js |
| 40 | + |
| 41 | +The frontend is built with the Javascript framework [Next.js](https://nextjs.org/) based on [React](https://facebook.github.io/react/) and is styled with [CSS Modules](https://github.com/css-modules/css-modules) and the CSS extension language [Sass](http://sass-lang.com). |
47 | 42 |
|
48 | 43 | ### Development |
49 | | -First you need to add a copy of `api_keys.example.py` and rename it to `api_keys.py`. The file can be found in `flask-app/InfoHubAPI/`. Add your API keys in this file. |
| 44 | + |
| 45 | +First you need to add a copy of `widget-settings.example.ts` and rename it to `widget-settings.ts`. The file can be found in `infohub/`. Add your own settings in the file. |
| 46 | + |
| 47 | +Then you also need to make a copy of the `.env` file in `infohub/` and rename it `.env.local`. Add your API keys in it. |
50 | 48 |
|
51 | 49 | The first time you run the application (and every time you add new dependencies) you need do run: |
| 50 | + |
| 51 | +```shell |
| 52 | +$ yarn install |
52 | 53 | ``` |
53 | | -sh ./init.sh |
54 | | -``` |
| 54 | + |
55 | 55 | After that you only need to run: |
56 | | -``` |
57 | | -sh ./debug.sh |
| 56 | + |
| 57 | +```shell |
| 58 | +$ yarn dev |
58 | 59 | ``` |
59 | 60 |
|
| 61 | +#### Sass |
| 62 | + |
| 63 | +Sass files are automatically compiled during runtime or when building the application. |
| 64 | + |
60 | 65 | ### Production |
61 | | -There are currently no specified script for production mode. |
| 66 | + |
| 67 | +To build and run the Next.js application you run: |
| 68 | + |
| 69 | +```shell |
| 70 | +$ yarn build && yarn start |
| 71 | +``` |
62 | 72 |
|
63 | 73 | ## Dependencies |
64 | | -* [React](https://facebook.github.io/react/) |
65 | | -* [Flask](http://flask.pocoo.org) |
66 | | -* [npm](https://www.npmjs.com) |
67 | | -* [Sass](http://sass-lang.com) |
68 | | -* [SuperAgent](https://visionmedia.github.io/superagent/) |
69 | | -* [Requests: HTTP for Humans](http://docs.python-requests.org/en/master/) |
70 | | -* [Moment.js](http://momentjs.com) |
71 | | -* [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/) |
| 74 | + |
| 75 | +- [Next.js](https://nextjs.org/) |
| 76 | +- [React](https://facebook.github.io/react/) |
| 77 | +- [Yarn](https://yarnpkg.com/) |
| 78 | +- [Sass](http://sass-lang.com) |
| 79 | +- [React Query](https://react-query.tanstack.com/) |
| 80 | +- [Day.js](https://day.js.org/en/) |
| 81 | +- [Puppeteer](https://pptr.dev/) |
72 | 82 |
|
73 | 83 | ## Resources |
74 | | -* [Västtrafik Developer Portal](https://developer.vasttrafik.se/portal/#/) |
75 | | -* [Dark Sky API](https://darksky.net/dev/) |
| 84 | + |
| 85 | +- [Västtrafik Developer Portal](https://developer.vasttrafik.se/portal/#/) |
| 86 | +- [Tomorrow API](https://www.tomorrow.io/weather-api/) |
| 87 | +- [Unsplash](https://unsplash.com/developers) |
| 88 | +- [News API](https://newsapi.org/docs) |
0 commit comments