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
22 changes: 3 additions & 19 deletions opennow-stable/src/renderer/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ function saveCatalogPreferences(prefs: CatalogPreferences): void {
}
}

type GameSource = "main" | "library";
type AppPage = "home" | "library" | "settings";
type StreamStatus = "idle" | "queue" | "setup" | "starting" | "connecting" | "streaming";
type StreamLoadingStatus = "queue" | "setup" | "starting" | "connecting";
Expand Down Expand Up @@ -793,7 +792,6 @@ export function App(): JSX.Element {
// Games State
const [games, setGames] = useState<GameInfo[]>([]);
const [libraryGames, setLibraryGames] = useState<GameInfo[]>([]);
const [source, setSource] = useState<GameSource>("main");
const [searchQuery, setSearchQuery] = useState("");
const [selectedGameId, setSelectedGameId] = useState("");
const [variantByGameId, setVariantByGameId] = useState<Record<string, string>>({});
Expand Down Expand Up @@ -2349,7 +2347,6 @@ export function App(): JSX.Element {
setCatalogSelectedFilterIds((previous) => areStringArraysEqual(previous, catalogResult.selectedFilterIds) ? previous : catalogResult.selectedFilterIds);
setCatalogTotalCount(catalogResult.totalCount);
setCatalogSupportedCount(catalogResult.numberSupported);
setSource("main");
setSelectedGameId((previous) => catalogResult.games.some((game) => game.id === previous) ? previous : (catalogResult.games[0]?.id ?? ""));
applyVariantSelections(catalogResult.games);
}, [applyVariantSelections]);
Expand Down Expand Up @@ -2416,7 +2413,6 @@ export function App(): JSX.Element {
setCatalogSelectedFilterIds([]);
setCatalogTotalCount(0);
setCatalogSupportedCount(0);
setSource("main");
setSelectedGameId("");
}, [resetLaunchRuntime]);

Expand All @@ -2426,7 +2422,7 @@ export function App(): JSX.Element {
}, []);

// Load games handler
const loadGames = useCallback(async (targetSource: GameSource) => {
const loadGames = useCallback(async (targetSource: "main" | "library") => {
setIsLoadingGames(true);
try {
const token = authSession?.tokens.idToken ?? authSession?.tokens.accessToken;
Expand All @@ -2449,7 +2445,6 @@ export function App(): JSX.Element {

const result = await window.openNow.fetchLibraryGames({ token, providerStreamingBaseUrl: baseUrl });
setLibraryGames(result);
setSource("library");
setSelectedGameId((previous) => result.some((game) => game.id === previous) ? previous : (result[0]?.id ?? ""));
applyVariantSelections(result);
} catch (error) {
Expand All @@ -2460,14 +2455,14 @@ export function App(): JSX.Element {
}, [applyCatalogBrowseResult, applyVariantSelections, authSession, effectiveStreamingBaseUrl, searchQuery, catalogFilterKey, catalogSelectedSortId]);

useEffect(() => {
if (!authSession || source !== "main") {
if (!authSession || currentPage !== "home") {
return;
}
const handle = window.setTimeout(() => {
void loadGames("main");
}, searchQuery.trim() ? 220 : 0);
return () => window.clearTimeout(handle);
}, [authSession, loadGames, searchQuery, source, catalogFilterKey, catalogSelectedSortId]);
}, [authSession, currentPage, loadGames, searchQuery, catalogFilterKey, catalogSelectedSortId]);

const handleSelectGameVariant = useCallback((gameId: string, variantId: string): void => {
setVariantByGameId((prev) => {
Expand Down Expand Up @@ -3729,17 +3724,6 @@ export function App(): JSX.Element {
{currentPage === "home" && (
<HomePage
games={filteredGames}
source="main"
onSourceChange={(nextSource) => {
if (nextSource === "library") {
setCurrentPage("library");
if (libraryGames.length === 0 && authSession) {
void loadGames("library");
}
return;
}
void loadGames("main");
}}
searchQuery={searchQuery}
onSearchChange={setSearchQuery}
onPlayGame={handleInitiatePlay}
Expand Down
15 changes: 0 additions & 15 deletions opennow-stable/src/renderer/src/components/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { GameCard } from "./GameCard";

export interface HomePageProps {
games: GameInfo[];
source: "main" | "library";
onSourceChange: (source: "main" | "library") => void;
searchQuery: string;
onSearchChange: (query: string) => void;
onPlayGame: (game: GameInfo) => void;
Expand All @@ -27,8 +25,6 @@ export interface HomePageProps {

export function HomePage({
games,
source,
onSourceChange,
searchQuery,
onSearchChange,
onPlayGame,
Expand All @@ -53,17 +49,6 @@ export function HomePage({
return (
<div className="home-page">
<header className="home-toolbar">
<div className="home-tabs">
<button
className={`home-tab ${source === "main" ? "active" : ""}`}
onClick={() => onSourceChange("main")}
disabled={isLoading}
>
<LayoutGrid size={15} />
Catalog
</button>
</div>

<div className="home-search">
<Search className="home-search-icon" size={16} />
<input
Expand Down
42 changes: 0 additions & 42 deletions opennow-stable/src/renderer/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1602,48 +1602,6 @@ body.controller-mode.controller-hide-cursor * {
flex-wrap: wrap;
}

.home-tabs {
display: flex;
gap: 2px;
background: var(--card);
border: 1px solid var(--panel-border);
border-radius: var(--r-sm);
padding: 3px;
}

.home-tab {
display: flex;
align-items: center;
gap: 5px;
padding: 6px 12px;
border-radius: 6px;
border: none;
background: transparent;
color: var(--ink-muted);
font-size: 0.8rem;
font-weight: 600;
font-family: inherit;
cursor: pointer;
transition: color var(--t-fast), background var(--t-fast);
outline: none;
white-space: nowrap;
}

.home-tab:hover:not(:disabled) {
color: var(--ink-soft);
background: rgba(255, 255, 255, 0.04);
}

.home-tab.active {
color: var(--accent-on);
background: var(--accent);
}

.home-tab:disabled {
opacity: 0.5;
cursor: not-allowed;
}

.home-search {
flex: 1;
position: relative;
Expand Down
Loading