Skip to content

Commit bf854f5

Browse files
authored
move from templ to react app (#235)
* add react app * serve react app * add build files * clean code * update title * fix bug * remove unnecesary files * fix .gitignore to add log file * fix logs with map layout
1 parent eeb29de commit bf854f5

File tree

35 files changed

+4199
-317
lines changed

35 files changed

+4199
-317
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ DOCKER ?= docker
1212
SHELL = /bin/bash
1313
.PHONY: build
1414

15-
build:
15+
build: build-frontend-app
1616
mkdir -p dist/$(GOOS)/$(GOARCH)/bin
1717
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o dist/$(GOOS)/$(GOARCH)/bin/hotrod ./cmd/hotrod
1818

19+
build-frontend-app:
20+
cd services/frontend/react_app && ./scripts/build.sh
21+
1922
dev-build-docker: build
2023
$(DOCKER) build -t signadot/hotrod:latest \
2124
--platform $(GOOS)/$(GOARCH) \
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:@typescript-eslint/recommended',
7+
'plugin:react-hooks/recommended',
8+
],
9+
ignorePatterns: ['dist', '.eslintrc.cjs'],
10+
parser: '@typescript-eslint/parser',
11+
plugins: ['react-refresh'],
12+
rules: {
13+
'react-refresh/only-export-components': [
14+
'warn',
15+
{ allowConstantExport: true },
16+
],
17+
},
18+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Logs
2+
npm-debug.log*
3+
yarn-debug.log*
4+
yarn-error.log*
5+
pnpm-debug.log*
6+
lerna-debug.log*
7+
8+
node_modules
9+
dist
10+
dist-ssr
11+
*.local
12+
13+
# Editor directories and files
14+
.vscode/*
15+
!.vscode/extensions.json
16+
.idea
17+
.DS_Store
18+
*.suo
19+
*.ntvs*
20+
*.njsproj
21+
*.sln
22+
*.sw?
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# HotROD frontend
2+
3+
### Development
4+
```bash
5+
yarn dev
6+
```
7+
8+
### Production
9+
```bash
10+
yarn build
11+
# update paths to /web_assets/assets...
12+
# update logo to /web_assets/...
13+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>HotROD - Rides On Demand</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "hotrod-ux-improvements",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10+
"preview": "vite preview"
11+
},
12+
"dependencies": {
13+
"@chakra-ui/react": "^2.8.2",
14+
"@emotion/react": "^11.11.4",
15+
"@emotion/styled": "^11.11.0",
16+
"framer-motion": "^11.0.8",
17+
"geojson-path-finder": "^2.0.2",
18+
"leaflet": "^1.9.4",
19+
"pigeon-maps": "^0.21.4",
20+
"react": "^18.2.0",
21+
"react-dom": "^18.2.0",
22+
"react-leaflet": "^4.2.1"
23+
},
24+
"devDependencies": {
25+
"@types/leaflet": "^1.9.8",
26+
"@types/react": "^18.2.56",
27+
"@types/react-dom": "^18.2.19",
28+
"@typescript-eslint/eslint-plugin": "^7.0.2",
29+
"@typescript-eslint/parser": "^7.0.2",
30+
"@vitejs/plugin-react": "^4.2.1",
31+
"eslint": "^8.56.0",
32+
"eslint-plugin-react-hooks": "^4.6.0",
33+
"eslint-plugin-react-refresh": "^0.4.5",
34+
"typescript": "^5.2.2",
35+
"vite": "^5.1.4"
36+
}
37+
}
153 KB
Loading
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env sh
2+
3+
rm -rf "../web_assets/assets"
4+
5+
yarn && yarn build
6+
7+
8+
original_file="../web_assets/index.html"
9+
output_file="tmp"
10+
11+
sed 's|src="/assets|src="/web_assets/assets|g; s|href="/assets|href="/web_assets/assets|g' "$original_file" > "$output_file"
12+
13+
mv $output_file $original_file
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#root {
2+
margin: 0 auto;
3+
text-align: center;
4+
}
5+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import './App.css'
2+
import {HomePage} from "./pages/home.tsx";
3+
import {SessionProvider} from "./context/sessionContext/context.tsx";
4+
5+
function App() {
6+
return (
7+
<SessionProvider>
8+
<HomePage />
9+
</SessionProvider>
10+
)
11+
}
12+
13+
export default App

0 commit comments

Comments
 (0)