new menu, trying to keep envs, faster api calls etc
Some checks failed
Build Images and Deploy / Update-PROD-Stack (push) Failing after 18s
Some checks failed
Build Images and Deploy / Update-PROD-Stack (push) Failing after 18s
This commit is contained in:
@@ -54,9 +54,12 @@ jobs:
|
|||||||
# Read stack file content
|
# Read stack file content
|
||||||
STACK_FILE_CONTENT=$(echo "$(<prod-compose.yml )")
|
STACK_FILE_CONTENT=$(echo "$(<prod-compose.yml )")
|
||||||
|
|
||||||
# Prepare JSON payload
|
# Parse .env file into JSON array format for Portainer
|
||||||
JSON_PAYLOAD=$(jq -n --arg stackFileContent "$STACK_FILE_CONTENT" --argjson pullImage true \
|
ENV_VARS=$(cat .env | grep -v '^#' | grep -v '^$' | jq -R -s -c 'split("\n") | map(select(length > 0)) | map(split("=") | {name: .[0], value: (.[1:] | join("="))}) | map(select(.name != ""))')
|
||||||
'{stackFileContent: $stackFileContent, pullImage: $pullImage}')
|
|
||||||
|
# Prepare JSON payload with environment variables
|
||||||
|
JSON_PAYLOAD=$(jq -n --arg stackFileContent "$STACK_FILE_CONTENT" --argjson pullImage true --argjson env "$ENV_VARS" \
|
||||||
|
'{stackFileContent: $stackFileContent, pullImage: $pullImage, env: $env}')
|
||||||
|
|
||||||
echo "About to push the following JSON payload:"
|
echo "About to push the following JSON payload:"
|
||||||
echo $JSON_PAYLOAD
|
echo $JSON_PAYLOAD
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ services:
|
|||||||
dockerfile: Dockerfile.dev
|
dockerfile: Dockerfile.dev
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
VITE_API_URL: http://192.168.1.175:4000/api
|
VITE_API_URL: http://backend:4000/api
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -134,14 +134,52 @@ body {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
flex-wrap: wrap;
|
}
|
||||||
|
|
||||||
|
.nav-brand {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-brand h2 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger {
|
||||||
|
display: none;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0.5rem;
|
||||||
|
z-index: 1001;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger span {
|
||||||
|
width: 25px;
|
||||||
|
height: 3px;
|
||||||
|
background: var(--text);
|
||||||
|
border-radius: 3px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-menu {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2rem;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-links {
|
.nav-links {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
flex-wrap: wrap;
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-links a {
|
.nav-links a {
|
||||||
@@ -150,12 +188,17 @@ body {
|
|||||||
padding: 0.5rem 1rem;
|
padding: 0.5rem 1rem;
|
||||||
border-radius: 0.375rem;
|
border-radius: 0.375rem;
|
||||||
transition: background 0.2s;
|
transition: background 0.2s;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-links a:hover, .nav-links a.active {
|
.nav-links a:hover, .nav-links a.active {
|
||||||
background: var(--bg-lighter);
|
background: var(--bg-lighter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logout-btn {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.grid {
|
.grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
@@ -207,19 +250,72 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.nav {
|
.nav-brand {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger.active span:nth-child(1) {
|
||||||
|
transform: rotate(45deg) translate(5px, 5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger.active span:nth-child(2) {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger.active span:nth-child(3) {
|
||||||
|
transform: rotate(-45deg) translate(7px, -7px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-menu {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: -100%;
|
||||||
|
width: 70%;
|
||||||
|
height: 100vh;
|
||||||
|
background: var(--bg-light);
|
||||||
|
border-left: 1px solid var(--border);
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: stretch;
|
justify-content: flex-start;
|
||||||
|
padding: 5rem 2rem 2rem;
|
||||||
|
gap: 2rem;
|
||||||
|
transition: right 0.3s ease;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-menu.active {
|
||||||
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-links {
|
.nav-links {
|
||||||
gap: 0.25rem;
|
flex-direction: column;
|
||||||
justify-content: center;
|
width: 100%;
|
||||||
|
gap: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links li {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-links a {
|
.nav-links a {
|
||||||
padding: 0.5rem;
|
display: block;
|
||||||
font-size: 0.875rem;
|
padding: 1rem;
|
||||||
|
font-size: 1.125rem;
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links a:hover {
|
||||||
|
background: var(--bg-lighter);
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-btn {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import { BrowserRouter, Routes, Route, Navigate, Link } from 'react-router-dom';
|
import { BrowserRouter, Routes, Route, Navigate, Link } from 'react-router-dom';
|
||||||
import { Toaster } from 'react-hot-toast';
|
import { Toaster } from 'react-hot-toast';
|
||||||
@@ -26,25 +26,44 @@ function ProtectedRoute({ children }) {
|
|||||||
|
|
||||||
function Header() {
|
function Header() {
|
||||||
const { user, logout } = useAuth();
|
const { user, logout } = useAuth();
|
||||||
|
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
||||||
|
|
||||||
if (!user) return null;
|
if (!user) return null;
|
||||||
|
|
||||||
|
const handleLogout = () => {
|
||||||
|
setMobileMenuOpen(false);
|
||||||
|
logout();
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeMobileMenu = () => setMobileMenuOpen(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="header">
|
<header className="header">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<nav className="nav">
|
<nav className="nav">
|
||||||
<div style={{ display: 'flex', alignItems: 'center', gap: '2rem' }}>
|
<div className="nav-brand">
|
||||||
<h2 style={{ margin: 0 }}>WTP</h2>
|
<h2>WTP</h2>
|
||||||
<ul className="nav-links">
|
<button
|
||||||
<li><Link to="/challenges">Challenges</Link></li>
|
className="hamburger"
|
||||||
<li><Link to="/leaderboard">Leaderboard</Link></li>
|
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
|
||||||
<li><Link to="/friends">Friends</Link></li>
|
aria-label="Toggle menu"
|
||||||
<li><Link to="/profile">Profile</Link></li>
|
>
|
||||||
</ul>
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className={`nav-menu ${mobileMenuOpen ? 'active' : ''}`}>
|
||||||
|
<ul className="nav-links">
|
||||||
|
<li><Link to="/challenges" onClick={closeMobileMenu}>Challenges</Link></li>
|
||||||
|
<li><Link to="/leaderboard" onClick={closeMobileMenu}>Leaderboard</Link></li>
|
||||||
|
<li><Link to="/friends" onClick={closeMobileMenu}>Friends</Link></li>
|
||||||
|
<li><Link to="/profile" onClick={closeMobileMenu}>Profile</Link></li>
|
||||||
|
</ul>
|
||||||
|
<button onClick={handleLogout} className="btn btn-secondary btn-sm logout-btn">
|
||||||
|
Logout
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<button onClick={logout} className="btn btn-secondary btn-sm">
|
|
||||||
Logout
|
|
||||||
</button>
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ export default function ChallengeList() {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div style={{ flex: 1 }}>
|
<div style={{ flex: 1 }}>
|
||||||
<h3 style={{ marginBottom: '0.5rem' }}>{challenge.title}</h3>
|
<h3 style={{ marginBottom: '0.5rem', color: 'var(--primary)' }}>{challenge.title}</h3>
|
||||||
<p style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>
|
<p style={{ fontSize: '0.875rem', color: 'var(--text-muted)' }}>
|
||||||
Created by {challenge.creator_username}
|
Created by {challenge.creator_username}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user