Bug fixes

This commit is contained in:
Sean Edmunds
2025-04-03 13:57:08 -05:00
parent 6493a458ff
commit d232a7bdb0
13 changed files with 77 additions and 35 deletions

View File

@@ -46,6 +46,7 @@ const ApplicationSettings = () => {
const [searchValue, setSearchValue] = useState('');
const [debouncedSearch] = useDebouncedValue(searchValue, 500);
const [dragging, setDragging] = useState(false);
const [isOpen, setIsOpen] = useState(false);
const reorder = (list: any, startIndex: any, endIndex: any) => {
const result = Array.from(list);
@@ -319,7 +320,12 @@ const ApplicationSettings = () => {
<Grid columns={18} w={'75%'}>
{applicationData?.map((application: Application) => (
<GridCol span={6} key={application.id}>
<Popover withArrow withOverlay withinPortal={false}>
<Popover
withArrow
withOverlay
withinPortal={false}
closeOnClickOutside={!isOpen}
>
<Popover.Target>
<Box
onClick={(e) => {
@@ -335,7 +341,10 @@ const ApplicationSettings = () => {
</Box>
</Popover.Target>
<Popover.Dropdown>
<DebouncedApplication application={application} />
<DebouncedApplication
application={application}
setIsOpen={setIsOpen}
/>
</Popover.Dropdown>
</Popover>
</GridCol>

View File

@@ -17,7 +17,10 @@ import { cardClasses, textInputClasses } from 'styles';
import type { Application } from 'types';
import DeleteItemModal from '../Shared/DeleteItemModal';
function DebouncedApplication({ application }: { application: Application }) {
function DebouncedApplication({
application,
setIsOpen,
}: { application: Application; setIsOpen: any }) {
const { theme, handleDelete } = useCommonHooks();
const [modalOpened, { open: openModal, close: closeModal }] = useDisclosure(false);
const { mutateAsync } = useMutationAPI();
@@ -25,7 +28,10 @@ function DebouncedApplication({ application }: { application: Application }) {
const [app, setApp] = useState<Application>(application);
const [update, setUpdate] = useState<any>();
const [debounced] = useDebouncedValue(update, 1000);
const handleClose = () => {
setIsOpen(false);
closeModal();
};
useEffect(() => {
if (debounced && Object.keys(debounced).length > 0) {
mutateAsync({ method: 'PATCH', endpoint: 'api/apps', body: debounced });
@@ -41,7 +47,7 @@ function DebouncedApplication({ application }: { application: Application }) {
<Card className={cardClasses.settingsItem} classNames={cardClasses}>
<DeleteItemModal
modalOpened={modalOpened}
handleClose={closeModal}
handleClose={handleClose}
title='Delete Application'
body={
<Stack gap={0} w={'100%'} h={'150px'} align='center'>
@@ -64,7 +70,7 @@ function DebouncedApplication({ application }: { application: Application }) {
styles={{ label: { color: 'black' } }}
onClick={() => {
handleDelete(app, 'api/apps');
closeModal();
handleClose();
}}
>
Delete
@@ -72,9 +78,7 @@ function DebouncedApplication({ application }: { application: Application }) {
<Button
color={'grey'}
styles={{ label: { color: 'black' } }}
onClick={() => {
closeModal();
}}
onClick={handleClose}
>
Cancel
</Button>
@@ -92,6 +96,7 @@ function DebouncedApplication({ application }: { application: Application }) {
right={16}
color='red'
onClick={() => {
setIsOpen(true);
openModal();
}}
>