Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deps update 3 #22

Open
wants to merge 100 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
5f98755
feat: pointing to a new API
daithihearn Aug 25, 2023
52f7093
feat: making port configurable
daithihearn Aug 25, 2023
4611353
feat: supporting more architectures
daithihearn Aug 25, 2023
3665c05
Updating version
daithihearn Aug 25, 2023
87b18bb
bug: removing unsupported architecture
daithihearn Aug 25, 2023
e65cf27
bug: removing unsupported architecture
daithihearn Aug 25, 2023
cbd467c
bug: removing unsupported architecture
daithihearn Aug 25, 2023
c112059
updating dependencies
daithihearn Aug 25, 2023
a2c8dcd
feat: using backend to calculate price info
daithihearn Aug 31, 2023
0a1f71e
removing import
daithihearn Aug 31, 2023
4ca9bd6
switching to a different API
daithihearn Sep 2, 2023
091bf6f
fix: using madrid timezone
daithihearn Sep 2, 2023
e1524a7
Updating version number in package.json
daithihearn Sep 2, 2023
842913f
Merge pull request #1 from daithihearn/locale-issue
daithihearn Sep 2, 2023
9b5ee28
feat: adding i18n support
daithihearn Sep 5, 2023
a08e700
feat: updating version to 2.3.0
daithihearn Sep 5, 2023
112772a
Merge pull request #2 from daithihearn/i18n
daithihearn Sep 5, 2023
19cbf6c
feat: auto detect locale
daithihearn Sep 6, 2023
8475f21
Merge pull request #3 from daithihearn/detect-locale
daithihearn Sep 6, 2023
768dd4d
fix: max was coming before min on mobile
daithihearn Sep 6, 2023
dd81e07
Merge pull request #4 from daithihearn/component-order
daithihearn Sep 6, 2023
aaea0b0
fix: translating day rating
daithihearn Sep 8, 2023
c4f9d9b
fix: api change
daithihearn Sep 10, 2023
988a56a
feat: adding mixpanel
daithihearn Sep 23, 2023
b6ab5f1
Merge pull request #5 from daithihearn/mixpanel
daithihearn Sep 23, 2023
8a2fbb3
fix: tag name
daithihearn Sep 23, 2023
4b69dfc
Merge branch 'main' into mixpanel
daithihearn Sep 23, 2023
abc22ec
Merge pull request #6 from daithihearn/mixpanel
daithihearn Sep 23, 2023
76f5a75
chore: updating to node 18.18
daithihearn Oct 10, 2023
4ccefb4
chore: upgrading dependencies
daithihearn Oct 10, 2023
8ca4a70
chore: updating git ignore
daithihearn Oct 10, 2023
eb180e1
refactor: removing unused code
daithihearn Oct 10, 2023
bc4616d
refactor: created a hook for regional date times
daithihearn Oct 10, 2023
e692d8b
chore: updating version
daithihearn Oct 10, 2023
c229172
chore: updating version
daithihearn Oct 10, 2023
8c27d41
chore: updating version
daithihearn Oct 10, 2023
11fb8ad
Merge pull request #7 from daithihearn/toggle-hide-past-periods
daithihearn Oct 10, 2023
32dbd4e
feat: variable periods
daithihearn Oct 17, 2023
82a40a4
Merge pull request #8 from daithihearn/variable-period-lengths
daithihearn Oct 17, 2023
7103908
fix: api uri
daithihearn Oct 17, 2023
803fc40
Merge pull request #9 from daithihearn/incorrect-uri
daithihearn Oct 17, 2023
c573820
fix: api uri
daithihearn Oct 17, 2023
d678219
Merge pull request #10 from daithihearn/incorrect-uri-2
daithihearn Oct 17, 2023
0fc7fe7
feat: adding env variable for api url
daithihearn Oct 18, 2023
7f62db5
Merge pull request #11 from daithihearn/env-var-for-api-url
daithihearn Oct 18, 2023
94ff470
chore: updating logos
daithihearn Oct 18, 2023
3ff5c70
feat: allow viewing of historic data
daithihearn Oct 18, 2023
88de45f
test: removing redundant test
daithihearn Oct 18, 2023
545bc0a
Merge pull request #12 from daithihearn/historic-data
daithihearn Oct 18, 2023
1e59380
fix: tomorrow date
daithihearn Oct 18, 2023
670837a
Using new daily median endpoint
daithihearn Oct 19, 2023
1417fb0
fix: build
daithihearn Oct 19, 2023
b307489
fix: build
daithihearn Oct 19, 2023
bb8cd89
refactor: changing median to average
daithihearn Oct 30, 2023
03c0d02
Merge pull request #13 from daithihearn/median-average
daithihearn Oct 30, 2023
3cc02b1
fix: minor bug fix on chart
daithihearn Nov 2, 2023
05e9d0d
Merge pull request #14 from daithihearn/chart-bugfix
daithihearn Nov 2, 2023
84fe847
chore: codecev support
daithihearn Nov 5, 2023
38168f9
fix: naming issue
daithihearn Nov 5, 2023
13221b7
Merge pull request #15 from daithihearn/codecev
daithihearn Nov 5, 2023
bd9711f
fix: incorrect api
daithihearn Nov 5, 2023
5d39b0d
Merge branch 'main' into codecev
daithihearn Nov 5, 2023
f341a72
Merge pull request #16 from daithihearn/codecev
daithihearn Nov 5, 2023
13af573
chore: adding heroku build
daithihearn Dec 7, 2023
b73da83
chore: adding heroku build
daithihearn Dec 7, 2023
9b60e36
chore: adding support for a build arg for the api url
daithihearn Dec 7, 2023
f649a1b
chore: adding support for a build arg for the api url
daithihearn Dec 7, 2023
3f6b07a
refactor: renaming const
daithihearn Dec 7, 2023
f961ec4
chore: adding heroku build
daithihearn Dec 7, 2023
099a704
adding logging
daithihearn Dec 7, 2023
768b6d2
fixing build
daithihearn Dec 7, 2023
025437a
fixing build
daithihearn Dec 7, 2023
6f94cfe
hardcoding the api value
daithihearn Dec 7, 2023
89387e2
Create docker-image.yml
daithihearn Dec 7, 2023
f8c54dc
build: github pages build
daithihearn Dec 7, 2023
726becf
build: github pages build
daithihearn Dec 7, 2023
f8415fc
build: github pages build
daithihearn Dec 7, 2023
ee06b42
deploy on release
daithihearn Dec 7, 2023
15abf6f
run on github hosted hardware
daithihearn Dec 7, 2023
ea3c435
updating version
daithihearn Dec 7, 2023
d253b14
run on github hosted hardware
daithihearn Dec 7, 2023
0d8a18c
updating dependencies
daithihearn Dec 7, 2023
c36860f
updating version
daithihearn Dec 7, 2023
2f86087
Merge pull request #17 from daithihearn/deps-update-2
daithihearn Dec 7, 2023
8a75b4c
adding cname record
daithihearn Dec 7, 2023
255a615
chore: update dependencies
daithihearn Jan 3, 2024
e8b6647
refactor: removing default api url
daithihearn Jan 3, 2024
d9b7013
added loading animation
daithihearn Jan 3, 2024
fbd0b2a
chore: update version
daithihearn Jan 3, 2024
4bce8de
Merge pull request #18 from daithihearn/loading-animation
daithihearn Jan 3, 2024
13cc56b
chore: readme update
daithihearn Jan 4, 2024
9fe5b2d
chore: readme update
daithihearn Jan 4, 2024
9f600ba
Merge pull request #19 from daithihearn/readme2
daithihearn Jan 4, 2024
6f08c83
chore: renaming publish step
daithihearn Jan 4, 2024
014646e
chore: updating dependencies
daithihearn Jan 4, 2024
19e69af
chore: increasing timeout when running yarn
daithihearn Jan 4, 2024
d1db6fa
chore: updating version
daithihearn Jan 4, 2024
1ad8365
Merge pull request #20 from daithihearn/docker-image
daithihearn Jan 4, 2024
60b0f80
chore: updating dependencies
daithihearn Jan 10, 2024
e092c2e
chore: updating version
daithihearn Jan 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ gradle
*.bat
*.sh
yarn.lock
.env
20 changes: 10 additions & 10 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Build Docker image

on:
workflow_dispatch:
pull_request:
branches: ["main"]
workflow_dispatch:
pull_request:
branches: ["main"]

jobs:
build:
name: Build docker image
runs-on: self-hosted
build:
name: Build docker image
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile
43 changes: 43 additions & 0 deletions .github/workflows/deploy-github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Deploy to GitHub Pages

on:
release:
types: [published]

jobs:
build-and-deploy:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Build and Extract Static Files
run: |
docker build --build-arg REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }} --target builder -t react-app .
id=$(docker create react-app)
docker cp $id:/app/build ./build
docker rm -v $id

- name: Create CNAME File
run: echo '${{ secrets.CNAME }}' > ./build/CNAME

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
46 changes: 23 additions & 23 deletions .github/workflows/publish-to-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: Publish to Dockerhub

on:
release:
types: [published]
release:
types: [published]

jobs:
publish:
name: Build and Publish docker image to dockerhub
permissions:
contents: write
pull-requests: write
packages: read
runs-on: self-hosted
publish:
name: Publish to dockerhub
permissions:
contents: write
pull-requests: write
packages: read
runs-on: ubuntu-latest

steps:
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and publish Docker image
run: |
docker buildx build --platform linux/amd64,linux/arm64/v8 -t daithihearn/electricity-prices-dashboard:latest -t daithihearn/electricity-prices-dashboard:${{ github.ref_name }} --push .
steps:
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and publish Docker image
run: |
docker buildx build --platform linux/amd64,linux/arm64/v8,linux/arm/v7 -t daithihearn/electricity-prices-dashboard:latest -t daithihearn/electricity-prices-dashboard:${{ github.event.release.tag_name }} --push .
8 changes: 7 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
branches: ["main"]

jobs:
test:
unit-tests:
name: Run unit tests
runs-on: ubuntu-latest

steps:
Expand All @@ -23,3 +24,8 @@ jobs:

- name: Run tests
run: yarn test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.vscode

.env
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.18.0
5 changes: 5 additions & 0 deletions .typesafe-i18n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"adapter": "react",
"baseLocale": "es",
"$schema": "https://unpkg.com/[email protected]/schema/typesafe-i18n.json"
}
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
# build
FROM node:16 AS builder
FROM node:18.18 AS builder

WORKDIR /app

COPY package.json ./

RUN yarn --network-timeout 100000
RUN yarn --network-timeout 1000000

COPY ./src ./src
COPY ./public ./public
COPY ./tsconfig.json tsconfig.json

# Set the build argument
ARG REACT_APP_API_URL

# Set the environment variable to the value of the build argument
ENV REACT_APP_API_URL=${REACT_APP_API_URL}

RUN yarn build

# deployment
FROM nginx:1.19-alpine AS deployment

COPY --from=builder /app/build /usr/share/nginx/html
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf.template
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./nginx/entrypoint.sh /entrypoint.sh

# Make our entrypoint script executable
RUN chmod +x /entrypoint.sh

CMD nginx -g 'daemon off;'
CMD ["/entrypoint.sh"]
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
help:
@egrep -h '\s#@\s' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?#@ "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}'

start: #@ Start local
yarn start
build: #@ Build local
yarn build
.PHONY:build

docker-up: #@ Start docker
docker compose up --build -d
docker-down: #@ Stop docker
docker compose down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Electricity Prices Dashboard

[![Publish to Dockerhub](https://github.com/daithihearn/electricity-prices-dashboard/actions/workflows/publish-to-dockerhub.yml/badge.svg)](https://github.com/daithihearn/electricity-prices-dashboard/actions/workflows/publish-to-dockerhub.yml)
[![Build and Deploy to GitHub Pages](https://github.com/daithihearn/electricity-prices-dashboard/actions/workflows/deploy-github-pages.yml/badge.svg)](https://github.com/daithihearn/electricity-prices-dashboard/actions/workflows/deploy-github-pages.yml)

## Description

A dashboard to display the PVPC electricity prices in Spain.
[A dashboard to display the PVPC electricity prices for Spain](https://preciosdelaelectricidad.es/). A docker image for this can also be found on [docker hub](https://hub.docker.com/repository/docker/daithihearn/electricity-prices-dashboard/general).

## Stack

Expand Down
8 changes: 7 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ version: "3.5"

services:
electricity-prices-dashboard:
image: electricity-prices-dashboard
build:
context: .
dockerfile: Dockerfile
args:
- REACT_APP_API_URL=https://elec-api.daithiapp.com/api/v1/price
container_name: electricity-prices-dashboard
restart: always
environment:
- PORT=80
ports:
- 3000:80
networks:
Expand Down
8 changes: 8 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
build:
docker:
web: Dockerfile
config:
REACT_APP_API_URL: https://elec-prices-9603b16ade4e.herokuapp.com/api/v1/price

run:
web: ./entrypoint.sh
2 changes: 1 addition & 1 deletion nginx/default.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
listen 80;
listen ${PORT};

#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
Expand Down
7 changes: 7 additions & 0 deletions nginx/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Substitute environment variables in the Nginx configuration file
envsubst '$PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf

# Start Nginx
exec nginx -g 'daemon off;'
48 changes: 27 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
{
"name": "daithi-dashboard",
"version": "2.1.2",
"version": "2.9.2",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.1",
"@mui/material": "^5.14.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.5.3",
"@types/node": "^20.4.4",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"axios": "^1.4.0",
"chart.js": "^4.3.0",
"@mui/icons-material": "^5.15.4",
"@mui/material": "^5.15.4",
"@mui/x-date-pickers": "^6.18.7",
"@testing-library/jest-dom": "^6.2.0",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.11",
"@types/luxon": "^3.4.0",
"@types/node": "^20.10.8",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"axios": "^1.6.5",
"chart.js": "^4.4.1",
"chartjs-adapter-moment": "^1.0.1",
"chartjs-plugin-annotation": "^3.0.1",
"date-fns": "^2.30.0",
"prettier": "^3.0.0",
"luxon": "^3.4.4",
"mixpanel-browser": "^2.48.1",
"prettier": "^3.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^5.1.6",
"web-vitals": "^3.4.0"
"typesafe-i18n": "^5.26.2",
"typescript": "^5.3.3",
"web-vitals": "^3.5.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"format": "yarn prettier --write src",
"i18n": "typesafe-i18n",
"format:check": "yarn prettier --check src"
},
"eslintConfig": {
Expand Down Expand Up @@ -59,9 +64,10 @@
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"babel-jest": "^29.6.1"
"@babel/preset-env": "^7.23.8",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@types/mixpanel-browser": "^2.48.1",
"babel-jest": "^29.7.0"
}
}
Binary file modified public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"sizes": "512x512"
}
],
"version": "2.1.2",
"version": "2.9.2",
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
Expand Down
18 changes: 16 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import React from "react"
import React, { useEffect } from "react"
import { ThemeProvider } from "@mui/material/styles"
import { lightTheme, darkTheme } from "Themes"
import Dashboard from "pages/Dashboard"
import { Box, CssBaseline, createTheme, useMediaQuery } from "@mui/material"
import TypesafeI18n from "i18n/i18n-react"
import { loadLocale } from "i18n/i18n-util.sync"
import { Locales } from "i18n/i18n-types"
import mixpanel from "mixpanel-browser"

mixpanel.init("c22c74cac287fb74387b7ce250f1548f")

function App() {
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)")
const locale: Locales = navigator?.language.startsWith("en") ? "en" : "es"

useEffect(() => {
mixpanel.track("Website Accessed")
}, [])

const theme = React.useMemo(
() =>
Expand All @@ -14,12 +25,15 @@ function App() {
}),
[prefersDarkMode],
)
loadLocale(locale)
return (
<>
<ThemeProvider theme={theme}>
<Box sx={{ display: "flex" }}>
<CssBaseline />
<Dashboard />
<TypesafeI18n locale={locale}>
<Dashboard />
</TypesafeI18n>
</Box>
</ThemeProvider>
</>
Expand Down
Loading
Loading