addff8f0cc
Previous pipeline built images locally via Portainer Docker API, but Docker layer caching produced identical images. Now: - Build with nocache=1 - Push to Gitea registry (git.home.rm-warpstation.de) - Compose uses image: from registry instead of build: - Redeploy with pullImage: true forces fresh container Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
import { useState, useEffect } from 'react';
|
|
import { api } from '../api/client';
|
|
const RANK_KEY = 'tippspiel_last_rank';
|
|
const SHOWN_KEY = 'tippspiel_rank_toast_shown';
|
|
export function useRankChange() {
|
|
const [message, setMessage] = useState(null);
|
|
useEffect(() => {
|
|
// Only show once per session
|
|
if (sessionStorage.getItem(SHOWN_KEY))
|
|
return;
|
|
api.getMyStats().then(stats => {
|
|
if (!stats.rank)
|
|
return;
|
|
const lastRank = parseInt(localStorage.getItem(RANK_KEY) || '0');
|
|
if (lastRank > 0 && lastRank !== stats.rank) {
|
|
if (stats.rank < lastRank) {
|
|
setMessage(`⬆️ Du bist auf Platz ${stats.rank} aufgestiegen!`);
|
|
}
|
|
else {
|
|
setMessage(`⬇️ Du bist auf Platz ${stats.rank} gerutscht — hol dir die Punkte zurück!`);
|
|
}
|
|
sessionStorage.setItem(SHOWN_KEY, '1');
|
|
}
|
|
localStorage.setItem(RANK_KEY, String(stats.rank));
|
|
}).catch(() => { });
|
|
}, []);
|
|
function dismiss() { setMessage(null); }
|
|
return { message, dismiss };
|
|
}
|