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

@@ -40,12 +40,12 @@ const ApplicationSettings = () => {
index: 0,
enabled: 1,
};
const appsEndpoint = 'api/apps';
const appsEndpoint = 'api/applications';
const appsOrderEndpoint = 'api/applicationOrder';
const { data: apps, isFetching: isAppsFetching } = useQueryAPI({
const { data: applicationData, isFetching: isAppsFetching } = useQueryAPI({
endpoint: appsEndpoint,
});
const [applicationData, setApplicationData] = useState<Application[]>([]);
const [applications, setApplications] = useState<Application[]>([]);
const [applicationList, setApplicationList] = useState<Application[]>([]);
const { theme, isMobile, reorder } = useCommonHooks();
const [newApplication, setNewApplication] = useState<Application>(defaultApplication);
@@ -64,7 +64,7 @@ const ApplicationSettings = () => {
return;
}
const items = reorder(applicationData, result.source.index, result.destination.index);
const items = reorder(applications, result.source.index, result.destination.index);
setApplicationList(
items.map((item: any, index: number) => {
return {
@@ -83,19 +83,19 @@ const ApplicationSettings = () => {
};
useEffect(() => {
if (apps && !isAppsFetching) {
setApplicationData(
apps
if (applicationData && !isAppsFetching) {
setApplications(
applicationData
.filter((a: Application) =>
a.name.toLowerCase().includes(debouncedSearch.toLowerCase()),
)
.sort((a: Application, b: Application) => (a.index > b.index ? 1 : -1)),
);
}
}, [apps, isAppsFetching, debouncedSearch]);
}, [applicationData, isAppsFetching, debouncedSearch]);
useEffect(() => {
if (applicationList.length > 0 && applicationList !== applicationData) {
if (applicationList.length > 0 && applicationList !== applications) {
mutateAsync({
method: 'PATCH',
endpoint: appsOrderEndpoint,
@@ -229,7 +229,7 @@ const ApplicationSettings = () => {
endpoint: appsEndpoint,
body: {
...newApplication,
index: applicationData.length,
index: applications.length,
},
}).then(handleClose);
}
@@ -253,10 +253,11 @@ const ApplicationSettings = () => {
openModal={openModal}
title={'Applications'}
tooltip={{
title: 'Applications are the apps that will be displayed on the homepage.',
title:
'Applications are the applicationData that will be displayed on the homepage.',
highlightList: [
'Applications',
'apps',
'applicationData',
'application',
'name',
'base url',
@@ -288,7 +289,7 @@ const ApplicationSettings = () => {
ref={provided.innerRef}
{...provided.droppableProps}
>
{applicationData?.map((app: Application) => (
{applications?.map((app: Application) => (
<Draggable
key={app.id}
draggableId={`${app.id}`}
@@ -361,7 +362,7 @@ const ApplicationSettings = () => {
align='center'
>
<Grid columns={18} w={'75%'}>
{applicationData?.map((application: Application) => (
{applications?.map((application: Application) => (
<GridCol span={6} key={application.id}>
<Popover
withArrow