Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# ==========================================

ENV=development
VITE_MOCK_MODE=false # change to use the Vite development server for frontend changes.

SITE_HTTP_PORT=5173
SITE_HTTPS_PORT=4433
Expand Down
36 changes: 17 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ jobs:
run: npm ci

- name: Run Stylelint
run: npx stylelint "**/*.css"

- name: Build Web UI
run: npm run build
run: npx stylelint **/*.{css,scss}

prettier:
name: Prettier
Expand All @@ -58,10 +55,7 @@ jobs:
run: npm ci

- name: Run Prettier
run: npx prettier --check "."

- name: Build Web UI
run: npm run build
run: npx prettier --check .

eslint:
name: ESLint
Expand All @@ -88,9 +82,6 @@ jobs:
- name: Run ESLint
run: npx eslint .

- name: Build Web UI
run: npm run build

go-lint:
name: Go Lint
runs-on: ubuntu-latest
Expand Down Expand Up @@ -170,6 +161,8 @@ jobs:
name: Cypress Home
runs-on: ubuntu-latest

if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -183,9 +176,10 @@ jobs:
run: |
cat > .env <<'EOF'
ENV=development
VITE_MOCK_MODE=false
SITE_HTTP_PORT=5173
SITE_HTTPS_PORT=4433
CORS_ORIGIN=http://localhost:5173
CORS_ORIGIN=http://localhost:5173
POSTGRES_USERNAME=user
POSTGRES_PASSWORD=pass
POSTGRES_DB_NAME=speed-roulette
Expand Down Expand Up @@ -215,6 +209,8 @@ jobs:
name: Cypress Game
runs-on: ubuntu-latest

if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -228,9 +224,10 @@ jobs:
run: |
cat > .env <<'EOF'
ENV=development
VITE_MOCK_MODE=false
SITE_HTTP_PORT=5173
SITE_HTTPS_PORT=4433
CORS_ORIGIN=http://localhost:5173
CORS_ORIGIN=http://localhost:5173
POSTGRES_USERNAME=user
POSTGRES_PASSWORD=pass
POSTGRES_DB_NAME=speed-roulette
Expand Down Expand Up @@ -270,9 +267,10 @@ jobs:
run: |
cat > .env <<'EOF'
ENV=development
VITE_MOCK_MODE=false
SITE_HTTP_PORT=5173
SITE_HTTPS_PORT=4433
CORS_ORIGIN=http://localhost:5173
CORS_ORIGIN=http://localhost:5173
POSTGRES_USERNAME=user
POSTGRES_PASSWORD=pass
POSTGRES_DB_NAME=speed-roulette
Expand All @@ -291,6 +289,8 @@ jobs:
runs-on: ubuntu-latest
needs: [stylelint, prettier, eslint, go-lint, go-fmt, go-unit, cypress-home, cypress-game, docker-build]

if: github.event_name == 'push' && github.ref == 'refs/heads/main'

permissions:
contents: read
packages: write
Expand Down Expand Up @@ -329,7 +329,8 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
needs: docker-publish
if: github.ref == 'refs/heads/main'

if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- name: Deploy to droplet
Expand All @@ -339,10 +340,7 @@ jobs:
username: root
key: ${{ secrets.DROPLET_SSH_KEY }}
script: |
cd ~/speed-roulette

cd ~/prod
docker compose -f compose.prod.yml pull

docker compose -f compose.prod.yml up -d

docker image prune -af
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ big payouts!
![Vite](https://img.shields.io/badge/Vite-646CFF?style=for-the-badge&logo=vite&logoColor=white)
![React](https://img.shields.io/badge/React-61DAFB?style=for-the-badge&logo=react&logoColor=black)
![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white)
![Tailwind CSS](https://img.shields.io/badge/Tailwind_CSS-38B2AC?style=for-the-badge&logo=tailwind-css&logoColor=white)

### Backend
![Go](https://img.shields.io/badge/Go-00ADD8?style=for-the-badge&logo=go&logoColor=white)
Expand Down
17 changes: 9 additions & 8 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,21 @@
<!-- Prevent white flash before React loads -->
<script>
try {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const stored = localStorage.getItem('darkMode');
const isDark = stored === 'true' || (stored === null && prefersDark);
if (isDark) document.documentElement.classList.add('dark');
} catch (_) {}
const storedTheme = localStorage.getItem('site_theme');

document.documentElement.setAttribute('data-theme', storedTheme === 'light' ? 'light' : 'dark');
} catch (_) {
document.documentElement.setAttribute('data-theme', 'dark');
}
</script>

<!-- Paint background color immediately -->
<style>
html {
html[data-theme='dark'] {
background-color: #111827;
color: white;
}
html:not(.dark) {

html[data-theme='light'] {
background-color: #e9eef3;
color: black;
}
Expand Down
4 changes: 4 additions & 0 deletions site/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ server {
proxy_read_timeout 10s;
proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;
}

location / {
try_files $uri $uri/ /index.html;
}
}
Loading
Loading