generated from SteamDeckHomebrew/Plugin-Template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish profile page view (excluding uploading)
- Loading branch information
Showing
6 changed files
with
93 additions
and
168 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Focusable } from "@decky/ui"; | ||
import { ProfileInstalledEntry } from "./ProfileInstalledEntry"; | ||
import { useProfileContext } from "../state"; | ||
import { SectionTitle } from "./SectionTitle"; | ||
import { SectionSubtitle } from "./SectionSubtitle"; | ||
import { ProfileUploadedEntry } from "./ProfileUploadedEntry"; | ||
|
||
export function OnlineView() { | ||
const { downloadedProfiles, localProfiles, uploadedProfiles } = useProfileContext(); | ||
return ( | ||
<Focusable className="flex flex-col gap-4"> | ||
{downloadedProfiles.length > 0 && ( | ||
<> | ||
<Focusable className="flex flex-col gap-2"> | ||
<SectionTitle>Downloaded Profiles</SectionTitle> | ||
<Focusable className="flex flex-col gap-1"> | ||
{downloadedProfiles.map((profile) => ( | ||
<ProfileInstalledEntry key={profile.id} data={profile} /> | ||
))} | ||
</Focusable> | ||
</Focusable> | ||
<div className="cl_divider" /> | ||
</> | ||
)} | ||
{(localProfiles.length > 0 || uploadedProfiles.length > 0) && ( | ||
<Focusable className="flex flex-col gap-2"> | ||
<SectionTitle>Your Profiles</SectionTitle> | ||
{localProfiles.length > 0 && ( | ||
<Focusable className="flex flex-col"> | ||
<SectionSubtitle>Local</SectionSubtitle> | ||
<Focusable className="flex flex-col gap-1"> | ||
{localProfiles.map((profile) => ( | ||
<ProfileInstalledEntry key={profile.id} data={profile} /> | ||
))} | ||
</Focusable> | ||
</Focusable> | ||
)} | ||
{uploadedProfiles.length > 0 && ( | ||
<Focusable className="flex flex-col"> | ||
<SectionSubtitle>On DeckThemes</SectionSubtitle> | ||
<Focusable className="flex flex-col gap-1"> | ||
{uploadedProfiles.map((profile) => ( | ||
<ProfileUploadedEntry key={profile.id} data={profile} /> | ||
))} | ||
</Focusable> | ||
</Focusable> | ||
)} | ||
</Focusable> | ||
)} | ||
</Focusable> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
export * from "./ProfileInstalledEntry"; | ||
export * from "./ProfileUploadedEntry"; | ||
export * from "./SectionSubtitle"; | ||
export * from "./SectionTitle"; | ||
export * from "./OfflineView"; | ||
export * from "./OnlineView"; |
54 changes: 23 additions & 31 deletions
54
src/modules/settings/profile/pages/ProfileSettingsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,37 @@ | ||
import { useCSSLoaderActions, useCSSLoaderValues } from "@/backend"; | ||
import { PresetSelectionDropdown } from "@/lib"; | ||
import { Flags, PartialCSSThemeInfo, Theme } from "@/types"; | ||
import { DialogButton, Focusable } from "@decky/ui"; | ||
import { useEffect, useMemo, useState } from "react"; | ||
import { Focusable } from "@decky/ui"; | ||
import { ProfileContextProvider, useProfileContext } from "../state"; | ||
import { OfflineView } from "../components/OfflineView"; | ||
import { LoggedInView } from "../components/LoggedInView"; | ||
import { LoggedOutView } from "../components/LoggedOutView"; | ||
import { OfflineView, OnlineView } from "../components"; | ||
import { ImSpinner5 } from "react-icons/im"; | ||
|
||
export function ProfileSettingsPage() { | ||
return ( | ||
<ProfileContextProvider> | ||
<Focusable className="cl_settingspage_container flex flex-col gap-4"> | ||
<PresetSelectionDropdown noBottomSeparator /> | ||
<div className="cl_divider" /> | ||
<ProfileSettingsContent /> | ||
</Focusable> | ||
<ProfileSettingsPageContent /> | ||
</ProfileContextProvider> | ||
); | ||
} | ||
|
||
function ProfileSettingsContent() { | ||
function ProfileSettingsPageContent() { | ||
const { loading } = useProfileContext(); | ||
return ( | ||
<Focusable className="cl_settingspage_container flex flex-col gap-4"> | ||
<PresetSelectionDropdown noBottomSeparator /> | ||
<div className="cl_divider" /> | ||
<ProfileSettingsModeSwitcher /> | ||
{loading && ( | ||
<div className="h-full w-full flex items-center justify-center gap-4"> | ||
<ImSpinner5 className="cl_spinny" size={48} /> | ||
</div> | ||
)} | ||
</Focusable> | ||
); | ||
} | ||
|
||
function ProfileSettingsModeSwitcher() { | ||
const { displayMode } = useProfileContext(); | ||
if (displayMode === "loggedin") { | ||
return <LoggedInView />; | ||
} | ||
if (displayMode === "loggedout") { | ||
return <LoggedOutView />; | ||
if (displayMode === "online") { | ||
return <OnlineView />; | ||
} | ||
return <OfflineView />; | ||
} | ||
|
||
// function UploadProfileButton() { | ||
// const { publishProfile } = useCSSLoaderActions(); | ||
// return ( | ||
// <DialogButton | ||
// onClick={() => { | ||
// publishProfile("LCD Hero.profile", false); | ||
// }} | ||
// > | ||
// Upload Profile | ||
// </DialogButton> | ||
// ); | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters