generated from nhcarrigan/template
feat: add cloud save timestamp and force sync button
Shows a relative time label (e.g. "☁️ 2m ago") in the resource bar seeded from the server on load and updated after every auto-save or manual save. A 💾 button lets players trigger an immediate cloud save outside the 30-second auto-save cycle, with a ⏳ spinner and disabled state while the request is in-flight.
This commit is contained in:
@@ -27,7 +27,7 @@ const TABS: { id: Tab; label: string }[] = [
|
||||
];
|
||||
|
||||
export const GameLayout = (): React.JSX.Element => {
|
||||
const { state, isLoading, error, battleResult, dismissBattle } = useGame();
|
||||
const { state, isLoading, error, battleResult, dismissBattle, lastSavedAt, isSyncing, forceSync } = useGame();
|
||||
const [activeTab, setActiveTab] = useState<Tab>("adventurers");
|
||||
const [editingProfile, setEditingProfile] = useState(false);
|
||||
|
||||
@@ -58,6 +58,9 @@ export const GameLayout = (): React.JSX.Element => {
|
||||
prestigeCount={state.prestige.count}
|
||||
profileUrl={profileUrl}
|
||||
onEditProfile={() => { setEditingProfile(true); }}
|
||||
lastSavedAt={lastSavedAt}
|
||||
isSyncing={isSyncing}
|
||||
onForceSync={forceSync}
|
||||
/>
|
||||
<OfflineModal />
|
||||
<AchievementToast />
|
||||
|
||||
Reference in New Issue
Block a user