{
const [comment, setComment] = useState('');
const queryClient = useQueryClient();
- const { mutate: commentToProject, isLoading } = useMutation<
+ const { mutate: commentToProject, isPending } = useMutation<
any,
any,
any,
@@ -57,8 +57,8 @@ const ApprovalSection = () => {
variant="outline"
onClick={() => handleApprovalStatus('REJECTED')}
className="naxatw-border-red naxatw-font-primary naxatw-text-red"
- isLoading={isLoading}
- disabled={isLoading}
+ isLoading={isPending}
+ disabled={isPending}
>
Reject
@@ -66,8 +66,8 @@ const ApprovalSection = () => {
variant="ghost"
onClick={() => handleApprovalStatus('APPROVED')}
className="naxatw-bg-red naxatw-font-primary naxatw-text-white"
- isLoading={isLoading}
- disabled={isLoading}
+ isLoading={isPending}
+ disabled={isPending}
>
Accept
diff --git a/src/frontend/src/components/UpdateUserDetails/BasicDetails.tsx/index.tsx b/src/frontend/src/components/UpdateUserDetails/BasicDetails.tsx/index.tsx
index 0f3eff6e..549838c0 100644
--- a/src/frontend/src/components/UpdateUserDetails/BasicDetails.tsx/index.tsx
+++ b/src/frontend/src/components/UpdateUserDetails/BasicDetails.tsx/index.tsx
@@ -23,7 +23,7 @@ const BasicDetails = () => {
defaultValues: initialState,
});
- const { mutate: updateBasicInfo, isLoading } = useMutation<
+ const { mutate: updateBasicInfo, isPending } = useMutation<
any,
any,
any,
@@ -31,7 +31,7 @@ const BasicDetails = () => {
>({
mutationFn: payloadDataObject => patchUserProfile(payloadDataObject),
onSuccess: () => {
- queryClient.invalidateQueries(['user-profile']);
+ queryClient.invalidateQueries({queryKey: ['user-profile']});
toast.success('Details Updated Successfully');
},
onError: err => {
@@ -145,7 +145,7 @@ const BasicDetails = () => {
handleSubmit(onSubmit)();
}}
withLoader
- isLoading={isLoading}
+ isLoading={isPending}
>
Save
diff --git a/src/frontend/src/components/UpdateUserDetails/OrganizationDetails/index.tsx b/src/frontend/src/components/UpdateUserDetails/OrganizationDetails/index.tsx
index 0d6377f3..6e60ed19 100644
--- a/src/frontend/src/components/UpdateUserDetails/OrganizationDetails/index.tsx
+++ b/src/frontend/src/components/UpdateUserDetails/OrganizationDetails/index.tsx
@@ -22,7 +22,7 @@ const OrganizationDetails = () => {
defaultValues: initialState,
});
- const { mutate: updateOrganizationDetails, isLoading } = useMutation<
+ const { mutate: updateOrganizationDetails, isPending } = useMutation<
any,
any,
any,
@@ -30,7 +30,7 @@ const OrganizationDetails = () => {
>({
mutationFn: payloadDataObject => patchUserProfile(payloadDataObject),
onSuccess: () => {
- queryClient.invalidateQueries(['user-profile']);
+ queryClient.invalidateQueries({queryKey: ['user-profile']});
toast.success('Details Updated successfully');
},
@@ -101,7 +101,7 @@ const OrganizationDetails = () => {
handleSubmit(onSubmit)();
}}
withLoader
- isLoading={isLoading}
+ isLoading={isPending}
>
Save
diff --git a/src/frontend/src/components/UpdateUserDetails/OtherDetails/index.tsx b/src/frontend/src/components/UpdateUserDetails/OtherDetails/index.tsx
index 9b5e84eb..e9838198 100644
--- a/src/frontend/src/components/UpdateUserDetails/OtherDetails/index.tsx
+++ b/src/frontend/src/components/UpdateUserDetails/OtherDetails/index.tsx
@@ -43,7 +43,7 @@ const OtherDetails = () => {
defaultValues: initialState,
});
- const { mutate: updateOtherDetails, isLoading } = useMutation<
+ const { mutate: updateOtherDetails, isPending } = useMutation<
any,
any,
any,
@@ -67,7 +67,7 @@ const OtherDetails = () => {
await callApiSimultaneously(urlsToUpload, assetsToUpload, 'put');
}
- queryClient.invalidateQueries(['user-profile']);
+ queryClient.invalidateQueries({queryKey: ['user-profile']});
toast.success('Details Updated Successfully');
},
@@ -230,7 +230,7 @@ const OtherDetails = () => {
handleSubmit(onSubmit)();
}}
withLoader
- isLoading={isLoading}
+ isLoading={isPending}
>
Save
diff --git a/src/frontend/src/components/UpdateUserDetails/Password/index.tsx b/src/frontend/src/components/UpdateUserDetails/Password/index.tsx
index 9baa396d..39d1d684 100644
--- a/src/frontend/src/components/UpdateUserDetails/Password/index.tsx
+++ b/src/frontend/src/components/UpdateUserDetails/Password/index.tsx
@@ -23,7 +23,7 @@ const Password = () => {
});
const password = watch('password');
- const { mutate: updatePassword, isLoading } = useMutation<
+ const { mutate: updatePassword, isPending } = useMutation<
any,
any,
any,
@@ -107,7 +107,7 @@ const Password = () => {
handleSubmit(onSubmit)();
}}
withLoader
- isLoading={isLoading}
+ isLoading={isPending}
>
Save
diff --git a/src/frontend/src/components/common/HotTracking/index.tsx b/src/frontend/src/components/common/HotTracking/index.tsx
deleted file mode 100644
index 2ce0baf2..00000000
--- a/src/frontend/src/components/common/HotTracking/index.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { createElement } from 'react';
-
-// import('@hotosm/ui/components/tracking/tracking');
-
-const HotTracker = () => {
- return createElement('hot-tracking', {
- style: { position: 'fixed', bottom: '0%' },
- 'site-id': '35',
- domain: 'dronetm.org',
- force: true,
- });
-};
-
-export default HotTracker;
diff --git a/src/frontend/src/components/common/Icon/index.tsx b/src/frontend/src/components/common/Icon/index.tsx
index f4faff43..82ecbd26 100644
--- a/src/frontend/src/components/common/Icon/index.tsx
+++ b/src/frontend/src/components/common/Icon/index.tsx
@@ -1,3 +1,5 @@
+import React from 'react';
+
interface IIconProps extends React.HTMLAttributes
{
name: string;
className?: string;
@@ -10,7 +12,7 @@ export default function Icon({
className,
iconSymbolType = 'material-symbols-outlined',
onClick,
-}: IIconProps): JSX.Element {
+}: IIconProps): React.JSX.Element {
return (
(value);
- const timerRef = useRef>();
+ const timerRef = useRef>(null);
useEffect(() => {
timerRef.current = setTimeout(() => setDebouncedValue(value), delay);
diff --git a/src/frontend/src/main.tsx b/src/frontend/src/main.tsx
index a9222b43..394b2597 100644
--- a/src/frontend/src/main.tsx
+++ b/src/frontend/src/main.tsx
@@ -1,3 +1,5 @@
+import '@hotosm/ui/dist/style.css';
+
import ReactDOM from 'react-dom/client';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
@@ -9,12 +11,16 @@ import '@Assets/css/tailwind.css';
import { store, persistor } from './store';
import App from './App';
+// Workaround required, as @hotosm/gcp-editor already imports all components
+if (!customElements.get('hot-tracking')) {
+ import('@hotosm/ui/dist/hotosm-ui');
+}
+
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: false,
- suspense: false,
},
},
});
@@ -26,6 +32,11 @@ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
+
diff --git a/src/frontend/src/modules/user-auth-module/src/components/Authentication/Login/index.tsx b/src/frontend/src/modules/user-auth-module/src/components/Authentication/Login/index.tsx
index ff3ed8f4..12625629 100644
--- a/src/frontend/src/modules/user-auth-module/src/components/Authentication/Login/index.tsx
+++ b/src/frontend/src/modules/user-auth-module/src/components/Authentication/Login/index.tsx
@@ -1,6 +1,6 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
-import { useState } from 'react';
+import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useForm } from 'react-hook-form';
import { useQuery, useMutation } from '@tanstack/react-query';
@@ -37,7 +37,7 @@ export default function Login() {
const signedInAs = localStorage.getItem('signedInAs') || 'PROJECT_CREATOR';
- const { mutate, isLoading } = useMutation({
+ const { mutate, isPending } = useMutation({
mutationFn: signInUser,
onSuccess: async (res: any) => {
dispatch(setUserState({ user: res.data }));
@@ -68,16 +68,19 @@ export default function Login() {
},
});
- useQuery({
+ const googleLoginQuery = useQuery({
queryKey: ['google-login'],
queryFn: signInGoogle,
select: (res: any) => res.data,
- onSuccess: (res: any) => {
- window.location.href = res.login_url;
- },
enabled: !!onSignUpBtnClick,
});
+ useEffect(() => {
+ if (googleLoginQuery.data) {
+ window.location.href = googleLoginQuery.data.login_url;
+ }
+ }, [googleLoginQuery.data]);
+
const { register, handleSubmit } = useForm({
defaultValues: initialState,
});
@@ -171,7 +174,7 @@ export default function Login() {