Add console.log, remove unused imports

This commit is contained in:
Nicola Benaglia 2025-04-18 17:17:16 +02:00
parent 1ff13589ad
commit 35c488ea75

View File

@ -24,7 +24,6 @@ import CampaignIcon from '@mui/icons-material/Campaign';
import { AddGroup } from './AddGroup'; import { AddGroup } from './AddGroup';
import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline';
import CreateIcon from '@mui/icons-material/Create'; import CreateIcon from '@mui/icons-material/Create';
import { import {
AuthenticatedContainerInnerRight, AuthenticatedContainerInnerRight,
CustomButton, CustomButton,
@ -46,7 +45,6 @@ import { CustomizedSnackbars } from '../Snackbar/Snackbar';
import { LoadingButton } from '@mui/lab'; import { LoadingButton } from '@mui/lab';
import { LoadingSnackbar } from '../Snackbar/LoadingSnackbar'; import { LoadingSnackbar } from '../Snackbar/LoadingSnackbar';
import { GroupAnnouncements } from '../Chat/GroupAnnouncements'; import { GroupAnnouncements } from '../Chat/GroupAnnouncements';
import { GroupForum } from '../Chat/GroupForum'; import { GroupForum } from '../Chat/GroupForum';
import { import {
executeEvent, executeEvent,
@ -56,9 +54,7 @@ import {
import { RequestQueueWithPromise } from '../../utils/queue/queue'; import { RequestQueueWithPromise } from '../../utils/queue/queue';
import { WebSocketActive } from './WebsocketActive'; import { WebSocketActive } from './WebsocketActive';
import { useMessageQueue } from '../../MessageQueueContext'; import { useMessageQueue } from '../../MessageQueueContext';
import { isExtMsg, isUpdateMsg } from '../../background';
import { ContextMenu } from '../ContextMenu'; import { ContextMenu } from '../ContextMenu';
import { ReturnIcon } from '../../assets/Icons/ReturnIcon'; import { ReturnIcon } from '../../assets/Icons/ReturnIcon';
import { ExitIcon } from '../../assets/Icons/ExitIcon'; import { ExitIcon } from '../../assets/Icons/ExitIcon';
import { HomeDesktop } from './HomeDesktop'; import { HomeDesktop } from './HomeDesktop';
@ -113,6 +109,7 @@ export const getPublishesFromAdmins = async (admins: string[], groupId) => {
return sortedData[0]; return sortedData[0];
}; };
interface GroupProps { interface GroupProps {
myAddress: string; myAddress: string;
isFocused: boolean; isFocused: boolean;
@ -134,7 +131,7 @@ export const getGroupAdminsAddress = async (groupNumber: number) => {
`${getBaseApiReact()}/groups/members/${groupNumber}?limit=0&onlyAdmins=true` `${getBaseApiReact()}/groups/members/${groupNumber}?limit=0&onlyAdmins=true`
); );
const groupData = await response.json(); const groupData = await response.json();
let members: any = []; const members: any = [];
if (groupData && Array.isArray(groupData?.members)) { if (groupData && Array.isArray(groupData?.members)) {
for (const member of groupData.members) { for (const member of groupData.members) {
if (member.member) { if (member.member) {
@ -153,7 +150,7 @@ export function validateSecretKey(obj) {
} }
// Iterate over each key in the object // Iterate over each key in the object
for (let key in obj) { for (const key in obj) {
// Ensure the key is a string representation of a positive integer // Ensure the key is a string representation of a positive integer
if (!/^\d+$/.test(key)) { if (!/^\d+$/.test(key)) {
return false; return false;
@ -224,7 +221,9 @@ export const decryptResource = async (data: string, fromQortalRequest) => {
} }
}); });
}); });
} catch (error) {} } catch (error) {
console.log(error);
}
}; };
export const addDataPublishesFunc = async (data: string, groupId, type) => { export const addDataPublishesFunc = async (data: string, groupId, type) => {
@ -247,7 +246,9 @@ export const addDataPublishesFunc = async (data: string, groupId, type) => {
rej(error.message || 'An error occurred'); rej(error.message || 'An error occurred');
}); });
}); });
} catch (error) {} } catch (error) {
console.log(error);
}
}; };
export const getDataPublishesFunc = async (groupId, type) => { export const getDataPublishesFunc = async (groupId, type) => {
@ -269,7 +270,9 @@ export const getDataPublishesFunc = async (groupId, type) => {
rej(error.message || 'An error occurred'); rej(error.message || 'An error occurred');
}); });
}); });
} catch (error) {} } catch (error) {
console.log(error);
}
}; };
export async function getNameInfo(address: string) { export async function getNameInfo(address: string) {
@ -337,6 +340,7 @@ export const getNames = async (listOfMembers) => {
return members; return members;
}; };
export const getNamesForAdmins = async (admins) => { export const getNamesForAdmins = async (admins) => {
let members: any = []; let members: any = [];
@ -538,7 +542,9 @@ export const Group = ({
rej(error.message || 'An error occurred'); rej(error.message || 'An error occurred');
}); });
}); });
} catch (error) {} } catch (error) {
console.log(error);
}
}; };
const refreshHomeDataFunc = () => { const refreshHomeDataFunc = () => {
@ -565,7 +571,9 @@ export const Group = ({
rej(error.message || 'An error occurred'); rej(error.message || 'An error occurred');
}); });
}); });
} catch (error) {} } catch (error) {
console.log(error);
}
}; };
useEffect(() => { useEffect(() => {
@ -586,7 +594,9 @@ export const Group = ({
data.name = name; data.name = name;
} }
setGroupOwner(data); setGroupOwner(data);
} catch (error) {} } catch (error) {
console.log(error);
}
}; };
const directChatHasUnread = useMemo(() => { const directChatHasUnread = useMemo(() => {
@ -755,7 +765,7 @@ export const Group = ({
setAdmins(addresses); setAdmins(addresses);
setAdminsWithNames(both); setAdminsWithNames(both);
} catch (error) { } catch (error) {
//error console.log(error);
} }
}; };
@ -783,7 +793,9 @@ export const Group = ({
); );
const data = await response.json(); const data = await response.json();
if (data && data[0]) return data[0].timestamp; if (data && data[0]) return data[0].timestamp;
} catch (error) {} } catch (error) {
console.log(error);
}
}; };
const getLatestRegularChat = async (groups) => { const getLatestRegularChat = async (groups) => {
@ -811,7 +823,9 @@ export const Group = ({
await Promise.all(getGroupData); await Promise.all(getGroupData);
setGroupChatTimestamps(groupData); setGroupChatTimestamps(groupData);
} catch (error) {} } catch (error) {
console.log(error);
}
}; };
const getGroupsProperties = useCallback(async (address) => { const getGroupsProperties = useCallback(async (address) => {
@ -826,7 +840,7 @@ export const Group = ({
}, {}); }, {});
setGroupsProperties(transformToObject); setGroupsProperties(transformToObject);
} catch (error) { } catch (error) {
// error console.log(error);
} }
}, []); }, []);
@ -958,7 +972,9 @@ export const Group = ({
const res = await getGroupMembers(groupId); const res = await getGroupMembers(groupId);
if (groupId !== selectedGroupRef.current?.groupId) return; if (groupId !== selectedGroupRef.current?.groupId) return;
setMembers(res); setMembers(res);
} catch (error) {} } catch (error) {
console.log(error);
}
}; };
useEffect(() => { useEffect(() => {
if ( if (
@ -1594,8 +1610,8 @@ export const Group = ({
flexDirection: 'column', flexDirection: 'column',
alignItems: 'flex-start', alignItems: 'flex-start',
height: isMobile ? `calc(${rootHeight} - 45px)` : '100%', height: isMobile ? `calc(${rootHeight} - 45px)` : '100%',
background: !isMobile && 'var(--bg-primary)', background: 'var(--bg-primary)',
borderRadius: !isMobile && '0px 15px 15px 0px', borderRadius: '0px 15px 15px 0px',
}} }}
> >
{!isMobile && ( {!isMobile && (