More typing and fixes
This commit is contained in:
@@ -5,7 +5,7 @@ import { textClasses } from 'styles';
|
||||
import type { Application } from 'types';
|
||||
import AppItem from './AppItem';
|
||||
|
||||
function Applications({ contentType }: { contentType: [string] }) {
|
||||
function Applications({ contentType }: { contentType: string[] }) {
|
||||
const { data: apps, isFetching: isAppsFetching } = useQueryAPI({
|
||||
endpoint: 'api/apps',
|
||||
});
|
||||
@@ -17,16 +17,24 @@ function Applications({ contentType }: { contentType: [string] }) {
|
||||
setApplicationData(
|
||||
apps
|
||||
.filter((a: Application) => a.enabled === 1)
|
||||
.sort((a: any, b: any) => {
|
||||
.sort((a: Application, b: Application) => {
|
||||
switch (appSort) {
|
||||
case 'A>Z':
|
||||
return a.name > b.name ? 1 : -1;
|
||||
case 'Z>A':
|
||||
return a.name < b.name ? 1 : -1;
|
||||
case 'Newest':
|
||||
return a.id < b.id ? 1 : -1;
|
||||
if (a.id && b.id) {
|
||||
return a.id < b.id ? 1 : -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
case 'Oldest':
|
||||
return a.id > b.id ? 1 : -1;
|
||||
if (a.id && b.id) {
|
||||
return a.id > b.id ? 1 : -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
case 'Custom':
|
||||
return a.index > b.index ? 1 : -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user