Updated names for uniformity

This commit is contained in:
Sean Edmunds
2025-04-28 14:21:45 -05:00
parent f44f6e004b
commit 19b793fbf9
26 changed files with 247 additions and 404 deletions

View File

@@ -6,46 +6,42 @@ import type { Application } from 'types';
import AppItem from './AppItem';
function Applications({ contentType }: { contentType: string[] }) {
const { data: apps, isFetching: isAppsFetching } = useQueryAPI({
endpoint: 'api/apps',
const { data: applicationData, isFetching: isApplicationDataFetching } = useQueryAPI({
endpoint: 'api/enabledApplications',
});
const { isMobile, appSort, appDensity } = useCommonHooks();
const [applicationData, setApplicationData] = useState<Application[]>([]);
const [applications, setApplications] = useState<Application[]>([]);
useEffect(() => {
if (apps && !isAppsFetching) {
setApplicationData(
apps
.filter((a: Application) => a.enabled === 1)
.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':
if (a.id && b.id) {
return a.id < b.id ? 1 : -1;
}
return -1;
case 'Oldest':
if (a.id && b.id) {
return a.id > b.id ? 1 : -1;
}
return -1;
case 'Custom':
return a.index > b.index ? 1 : -1;
}
}),
if (applicationData && !isApplicationDataFetching) {
setApplications(
applicationData.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':
if (a.id && b.id) {
return a.id < b.id ? 1 : -1;
}
return -1;
case 'Oldest':
if (a.id && b.id) {
return a.id > b.id ? 1 : -1;
}
return -1;
case 'Custom':
return a.index > b.index ? 1 : -1;
}
}),
);
}
}, [apps, isAppsFetching, appSort]);
}, [applicationData, isApplicationDataFetching, appSort]);
return (
<>
{applicationData.length > 0 && contentType.length > 0 && (
<Stack id='apps' style={{ gap: 0 }}>
{applications.length > 0 && contentType.length > 0 && (
<Stack style={{ gap: 0 }}>
<Text className={textClasses.sectionTitle} classNames={textClasses}>
Applications
</Text>
@@ -63,7 +59,7 @@ function Applications({ contentType }: { contentType: string[] }) {
gridTemplateRows: '64px',
}}
>
{applicationData
{applications
?.filter(
(application: Application) =>
contentType.includes(application.filterName) ||