Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions i18n/en/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@
"Demo account": {
"message": "Demo account"
},

"Deriv.com": {
"message": "Deriv.com"
},
Expand All @@ -1192,14 +1193,5 @@
},
"Get real account": {
"message": "Get real account"
},
"Not available in your region": {
"message": "Not available in your region"
},
"You can still use our other products and services.": {
"message": "You can still use our other products and services."
},
"Go to home": {
"message": "Go to home"
}
}
11 changes: 1 addition & 10 deletions i18n/fr/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"message": "Tableau de bord"
},
"API explorer": {
"message": "API explorer"
"message": "Explorateur d'API"
},
"Deriv Tech": {
"message": "Deriv Tech"
Expand Down Expand Up @@ -1192,14 +1192,5 @@
},
"Get real account": {
"message": "Obtenir un compte réel"
},
"Not available in your region": {
"message": "N'est pas disponible dans votre région"
},
"You can still use our other products and services.": {
"message": "Vous pouvez toujours utiliser nos autres produits et services."
},
"Go to home": {
"message": "Rentrez à la page d'accueil"
}
}
1 change: 0 additions & 1 deletion src/contexts/app-manager/app-manager.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export type TAppManagerContext = {
setIsDashboard: Dispatch<SetStateAction<boolean>>;
app_register_modal_open: boolean;
setAppRegisterModalOpen: Dispatch<SetStateAction<boolean>>;
is_dashboard_blocked: boolean;
};

export const AppManagerContext = createContext<TAppManagerContext | null>(null);
11 changes: 1 addition & 10 deletions src/contexts/app-manager/app-manager.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ const AppManagerContextProvider = ({ children }: TAppManagerContextProps) => {
const [is_dashboard, setIsDashboard] = useState(false);
const [app_register_modal_open, setAppRegisterModalOpen] = useState(false);
const [current_updating_item, setCurrentUpdateItem] = useState({});
const { getAllApps, apps: updatedApps, error } = useGetApps();
const { getAllApps, apps: updatedApps } = useGetApps();
const { is_authorized } = useAuthContext();
const [is_dashboard_blocked, setIsDashboardBlocked] = useState(false);

const getApps = useCallback(() => {
if (is_authorized) {
Expand All @@ -33,12 +32,6 @@ const AppManagerContextProvider = ({ children }: TAppManagerContextProps) => {
}
}, []);

useEffect(() => {
if (error?.error?.code === 'AppList') {
setIsDashboardBlocked(true);
}
}, [error]);

const handleCurrentUpdatingItem = useCallback((item: ApplicationObject) => {
setCurrentUpdateItem(item);
}, []);
Expand All @@ -59,7 +52,6 @@ const AppManagerContextProvider = ({ children }: TAppManagerContextProps) => {
app_register_modal_open,
handleCurrentUpdatingItem,
current_updating_item,
is_dashboard_blocked,
};
}, [
apps,
Expand All @@ -72,7 +64,6 @@ const AppManagerContextProvider = ({ children }: TAppManagerContextProps) => {
setAppRegisterModalOpen,
handleCurrentUpdatingItem,
current_updating_item,
is_dashboard_blocked,
]);

return <AppManagerContext.Provider value={context_object}>{children}</AppManagerContext.Provider>;
Expand Down
24 changes: 10 additions & 14 deletions src/contexts/auth/auth.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,16 @@ const AuthProvider = ({ children }: TAuthProviderProps) => {

const updateAuthorize = useCallback(async () => {
if (currentLoginAccount.token) {
try {
const { authorize } = await apiManager.authorize(
currentLoginAccount.token,
setIsConnected,
setIsAuthorized,
);
setIsAuthorized(true);
setisSwitchingAccount(false);
const { account_list, ...user } = authorize;
setUserAccounts(account_list);
setUser(user);
} catch (error) {
console.error('Failed to authorize:', error);
}
const { authorize } = await apiManager.authorize(
currentLoginAccount.token,
setIsConnected,
setIsAuthorized,
);
setIsAuthorized(true);
setisSwitchingAccount(false);
const { account_list, ...user } = authorize;
setUserAccounts(account_list);
setUser(user);
}
}, [currentLoginAccount.token, setUser, setUserAccounts]);

Expand Down

This file was deleted.

This file was deleted.

7 changes: 1 addition & 6 deletions src/features/dashboard/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import ManageDashboard from './manage-dashboard';
import { Login } from '../Login/Login';
import BrowserOnly from '@docusaurus/BrowserOnly';
import { Fallback } from '../Fallback';
import PermissionDeniedError from './components/permission-denied-error/permission-denied-error';

const Dashboard = () => {
const { is_logged_in, siteActive } = useAuthContext();
const { setIsDashboard, is_dashboard_blocked } = useAppManager();
const { setIsDashboard } = useAppManager();

useEffect(() => {
setIsDashboard(true);
Expand All @@ -19,10 +18,6 @@ const Dashboard = () => {
}, [setIsDashboard]);

if (!siteActive) return <Fallback />;

// Show permission denied error if the flag is set
if (is_logged_in && is_dashboard_blocked) return <PermissionDeniedError />;

if (is_logged_in) return <ManageDashboard />;
return <BrowserOnly>{() => <Login />}</BrowserOnly>;
};
Expand Down
4 changes: 2 additions & 2 deletions src/features/dashboard/hooks/useGetApp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import useWS from '@site/src/hooks/useWs';
import { useCallback } from 'react';

const useGetApps = () => {
const { send, data, is_loading, error } = useWS('app_list');
const { send, data, is_loading } = useWS('app_list');

const getAllApps = useCallback(() => {
send();
}, [send]);

return { getAllApps, apps: data, is_loading, error };
return { getAllApps, apps: data, is_loading };
};

export default useGetApps;