removed unused variable

This commit is contained in:
discollizard 2024-06-29 00:27:27 -03:00
parent d52c7d6839
commit 3e0ca90edb
2 changed files with 19 additions and 21 deletions

View File

@ -27,7 +27,6 @@
"last_launched": "Last launched",
"number_of_hours": "Number of hours",
"installed_or_not": "Installed or not"
},
"header": {
"search": "Search games",

View File

@ -15,7 +15,6 @@ import { buildGameDetailsPath } from "@renderer/helpers";
import SteamLogo from "@renderer/assets/steam-logo.svg?react";
import { SidebarProfile } from "./sidebar-profile";
import { sortBy } from "lodash-es";
import { setLibrary } from "@renderer/features";
const SIDEBAR_MIN_WIDTH = 200;
const SIDEBAR_INITIAL_WIDTH = 250;
@ -35,41 +34,41 @@ export function Sidebar() {
initialSidebarWidth ? Number(initialSidebarWidth) : SIDEBAR_INITIAL_WIDTH
);
const [ sortParam, setSortParam ] = useState<string>('latest_added');
const [sortParam, setSortParam] = useState<string>("latest_added");
const sortParamOptions = [
"latest_added",
"alphabetically",
"last_launched",
"number_of_hours",
"installed_or_not",
]
"latest_added",
"alphabetically",
"last_launched",
"number_of_hours",
"installed_or_not",
];
const handleSortParamChange = (e) => {
const selectedOption: string = e.target.value
setSortParam(selectedOption)
}
const selectedOption: string = e.target.value;
setSortParam(selectedOption);
};
const location = useLocation();
const sortedLibrary = useMemo(() => {
console.log(library)
switch(sortParam){
case 'latest_added':
console.log(library);
switch (sortParam) {
case "latest_added":
return sortBy(library, (game) => game.createdAt);
break;
case 'alphabetically':
case "alphabetically":
return sortBy(library, (game) => game.title);
break;
case 'last_launched':
case "last_launched":
return sortBy(library, (game) => game.lastTimePlayed);
break;
case 'number_of_hours':
case "number_of_hours":
return sortBy(library, (game) => game.playTimeInMilliseconds);
break;
case 'installed_or_not':
case "installed_or_not":
return sortBy(library, (game) => game.executablePath !== null);
break;
default:
default:
return sortBy(library, (game) => game.title);
}
}, [library, sortParam]);