From 16b2cbf32a5c2b66bf7bae90574696daf76c15b8 Mon Sep 17 00:00:00 2001 From: Tickbase Date: Sat, 11 Jul 2026 12:21:12 +0200 Subject: [PATCH] App --- src/App.tsx | 95 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 30 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index e643923..929d9db 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,8 @@ -import { useState } from 'react' +import { useState, useEffect } from 'react' import { invoke } from '@tauri-apps/api/core' import { useAppContext } from '@/contexts/useAppContext' import { useAppLogic, useConflictDetection, useDisclaimer } from '@/hooks' +import { GameVotes } from '@/components/common/VotesDisplay' import './styles/main.scss' // Layout components @@ -11,19 +12,20 @@ import { InitialLoadingScreen, ErrorBoundary, UpdateScreen, - AnimatedBackground, } from '@/components/layout' // Dialog components import { ProgressDialog, DlcSelectionDialog, - SettingsDialog, ConflictDialog, DisclaimerDialog, - UnlockerSelectionDialog, + UnlockerChoiceDialog, } from '@/components/dialogs' +// Page components (Overview and Settings) +import { OverviewPage, SettingsPage } from '@/components/pages' + // Game components import { GameList, EpicGameList } from '@/components/games' @@ -32,6 +34,8 @@ import { GameList, EpicGameList } from '@/components/games' */ function App() { const [updateComplete, setUpdateComplete] = useState(false) + const [creamVotes, setCreamVotes] = useState(null) + const [smokeVotes, setSmokeVotes] = useState(null) const { showDisclaimer, handleDisclaimerClose } = useDisclaimer() @@ -47,7 +51,7 @@ function App() { handleRefresh, isLoading, error, - } = useAppLogic({ autoLoad: updateComplete }) + } = useAppLogic() // Get action handlers from context const { @@ -60,9 +64,6 @@ function App() { handleDlcConfirm, handleGameEdit, handleUpdateDlcs, - settingsDialog, - handleSettingsOpen, - handleSettingsClose, handleSmokeAPISettingsOpen, handleOpenRating, reportingEnabled, @@ -84,6 +85,28 @@ function App() { // Conflict detection const { conflicts, showDialog, resolveConflict, closeDialog } = useConflictDetection(games) + // Community vote data for the Steam unlocker choice dialog (Epic's + // equivalent choice has no vote data, so it skips this entirely) + useEffect(() => { + const gameId = unlockerSelectionDialog.gameId + if (!unlockerSelectionDialog.visible || !gameId) { + setCreamVotes(null) + setSmokeVotes(null) + return + } + + invoke('get_game_votes', { gameId }) + .then((results) => { + setCreamVotes(results.find((v) => v.unlocker === 'creamlinux') ?? null) + setSmokeVotes(results.find((v) => v.unlocker === 'smokeapi') ?? null) + }) + .catch(() => { + // Votes are non-critical, silently fall back to "No votes yet" + setCreamVotes(null) + setSmokeVotes(null) + }) + }, [unlockerSelectionDialog.visible, unlockerSelectionDialog.gameId]) + const handleSetFilter = async (f: string) => { setFilter(f) if (f === 'epic' && epicGames.length === 0 && !epicLoading) { @@ -126,26 +149,18 @@ function App() { return (
- {/* Animated background */} - - {/* Header with search */} -
+
{/* Sidebar for filtering */} - + - {filter === 'epic' ? ( + {filter === 'overview' ? ( + + ) : filter === 'settings' ? ( + + ) : filter === 'epic' ? ( ) : error ? (
@@ -169,6 +185,7 @@ function App() { onEdit={handleGameEdit} onSmokeAPISettings={handleSmokeAPISettingsOpen} onRate={handleOpenRating} + onRefresh={handleRefresh} reportingEnabled={reportingEnabled} /> )} @@ -203,9 +220,6 @@ function App() { onUpdate={handleUpdateDlcs} /> - {/* Settings Dialog */} - - {/* Conflict Detection Dialog */} {/* Unlocker Selection Dialog */} - {/* Disclaimer Dialog - Shows AFTER everything is loaded */}