-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/Tormak9970/TabMaster into dev
- Loading branch information
Showing
10 changed files
with
192 additions
and
80 deletions.
There are no files selected for viewing
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
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
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,19 @@ | ||
import { ConfirmModal } from 'decky-frontend-lib'; | ||
import { VFC } from 'react'; | ||
import { getESortByLabel } from '../../hooks/useSortingMenuItems'; | ||
|
||
interface SortOverrideMessageProps { | ||
eSortBy: number; | ||
closeModal?: () => void; | ||
} | ||
|
||
/** | ||
* The message modal to display when sort method is being overriden | ||
*/ | ||
export const SortOverrideMessage: VFC<SortOverrideMessageProps> = ({ eSortBy, closeModal }) => { | ||
return ( | ||
<ConfirmModal strTitle={`Sort By: ${getESortByLabel(eSortBy)}`} bAlertDialog={true} closeModal={closeModal}> | ||
The sorting method is overridden by TabMaster for this tab. Set 'Sort apps by' to 'default' in this tabs settings if you would like it to use library sorting. | ||
</ConfirmModal> | ||
); | ||
}; |
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
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,37 @@ | ||
import { useMemo } from 'react'; | ||
|
||
/** | ||
* Gets the localized version of a sorting method | ||
*/ | ||
export function getESortByLabel(eSortBy: number) { | ||
const map: { [eSortBy: number]: string; } = { | ||
1: "#Library_SortByAlphabetical", | ||
10: "#Library_SortByFriendsPlaying", | ||
2: "#Library_SortByPctAchievementsComplete", | ||
3: "#Library_SortByLastUpdated", | ||
4: "#Library_SortByHoursPlayed", | ||
5: "#Library_SortByLastPlayed", | ||
6: "#Library_SortByReleaseDate", | ||
7: "#Library_SortByAddedToLibrary", | ||
8: "#Library_SortBySizeOnDisk", | ||
9: "#Library_SortByMetacriticScore", | ||
11: "#Library_SortBySteamReview", | ||
}; | ||
return LocalizationManager.LocalizeString(map[eSortBy]); | ||
} | ||
|
||
/** | ||
* Creates the array of sorting SingleDropdownOptions | ||
*/ | ||
function getSortingMenuItems() { | ||
return [1, 10, 2, 4, 5, 6, 7, 8, 9, 11].map((e => ({ | ||
data: e, | ||
label: getESortByLabel(e)! | ||
}))); | ||
} | ||
|
||
/** | ||
* Hook to use memoized sort options | ||
* @param deps Dependency array to determine when to recalculate | ||
*/ | ||
export const useSortingMenuItems = (deps: any[]) => useMemo(() => [{ label: 'Default', data: -1 }].concat(getSortingMenuItems()), deps); |
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
Oops, something went wrong.