mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-23 19:37:52 +00:00
remove unused code group
This commit is contained in:
parent
9045901ff9
commit
46e3d9bcac
@ -1,10 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
Box,
|
Box,
|
||||||
Button,
|
|
||||||
ButtonBase,
|
ButtonBase,
|
||||||
Grid,
|
|
||||||
IconButton,
|
|
||||||
List,
|
List,
|
||||||
ListItem,
|
ListItem,
|
||||||
ListItemAvatar,
|
ListItemAvatar,
|
||||||
@ -12,36 +9,27 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import React, {
|
import React, {
|
||||||
useCallback,
|
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
useMemo,
|
useMemo,
|
||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import SettingsIcon from "@mui/icons-material/Settings";
|
|
||||||
import { ChatGroup } from "../Chat/ChatGroup";
|
import { ChatGroup } from "../Chat/ChatGroup";
|
||||||
import { CreateCommonSecret } from "../Chat/CreateCommonSecret";
|
import { CreateCommonSecret } from "../Chat/CreateCommonSecret";
|
||||||
import { base64ToUint8Array } from "../../qdn/encryption/group-encryption";
|
import { base64ToUint8Array } from "../../qdn/encryption/group-encryption";
|
||||||
import { uint8ArrayToObject } from "../../backgroundFunctions/encryption";
|
import { uint8ArrayToObject } from "../../backgroundFunctions/encryption";
|
||||||
import ChatIcon from "@mui/icons-material/Chat";
|
|
||||||
import CampaignIcon from "@mui/icons-material/Campaign";
|
import CampaignIcon from "@mui/icons-material/Campaign";
|
||||||
import { AddGroup } from "./AddGroup";
|
import { AddGroup } from "./AddGroup";
|
||||||
import MarkUnreadChatAltIcon from "@mui/icons-material/MarkUnreadChatAlt";
|
|
||||||
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 RefreshIcon from "@mui/icons-material/Refresh";
|
|
||||||
import AnnouncementsIcon from "@mui/icons-material/Notifications";
|
|
||||||
import GroupIcon from "@mui/icons-material/Group";
|
|
||||||
import PersonIcon from "@mui/icons-material/Person";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AuthenticatedContainerInnerRight,
|
AuthenticatedContainerInnerRight,
|
||||||
CustomButton,
|
CustomButton,
|
||||||
} from "../../App-styles";
|
} from "../../App-styles";
|
||||||
import ForumIcon from "@mui/icons-material/Forum";
|
|
||||||
import { Spacer } from "../../common/Spacer";
|
import { Spacer } from "../../common/Spacer";
|
||||||
import PeopleIcon from "@mui/icons-material/People";
|
|
||||||
import { ManageMembers } from "./ManageMembers";
|
import { ManageMembers } from "./ManageMembers";
|
||||||
import MarkChatUnreadIcon from "@mui/icons-material/MarkChatUnread";
|
import MarkChatUnreadIcon from "@mui/icons-material/MarkChatUnread";
|
||||||
import {
|
import {
|
||||||
@ -58,38 +46,26 @@ 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 HomeIcon from "@mui/icons-material/Home";
|
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
|
||||||
|
|
||||||
import { ThingsToDoInitial } from "./ThingsToDoInitial";
|
|
||||||
import { GroupJoinRequests } from "./GroupJoinRequests";
|
|
||||||
import { GroupForum } from "../Chat/GroupForum";
|
import { GroupForum } from "../Chat/GroupForum";
|
||||||
import { GroupInvites } from "./GroupInvites";
|
|
||||||
import {
|
import {
|
||||||
executeEvent,
|
executeEvent,
|
||||||
subscribeToEvent,
|
subscribeToEvent,
|
||||||
unsubscribeFromEvent,
|
unsubscribeFromEvent,
|
||||||
} from "../../utils/events";
|
} from "../../utils/events";
|
||||||
import { ListOfThreadPostsWatched } from "./ListOfThreadPostsWatched";
|
|
||||||
import { RequestQueueWithPromise } from "../../utils/queue/queue";
|
import { RequestQueueWithPromise } from "../../utils/queue/queue";
|
||||||
import { WebSocketActive } from "./WebsocketActive";
|
import { WebSocketActive } from "./WebsocketActive";
|
||||||
import { flushSync } from "react-dom";
|
|
||||||
import { useMessageQueue } from "../../MessageQueueContext";
|
import { useMessageQueue } from "../../MessageQueueContext";
|
||||||
import { DrawerComponent } from "../Drawer/Drawer";
|
|
||||||
import { isExtMsg, isUpdateMsg } from "../../background";
|
import { isExtMsg, isUpdateMsg } from "../../background";
|
||||||
import { ContextMenu } from "../ContextMenu";
|
import { ContextMenu } from "../ContextMenu";
|
||||||
import { MobileFooter } from "../Mobile/MobileFooter";
|
|
||||||
import Header from "../Mobile/MobileHeader";
|
|
||||||
import { Home } from "./Home";
|
|
||||||
import { GroupMenu } from "./GroupMenu";
|
|
||||||
import { getRootHeight } from "../../utils/mobile/mobileUtils";
|
|
||||||
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";
|
||||||
import { DesktopFooter, IconWrapper } from "../Desktop/DesktopFooter";
|
import { IconWrapper } from "../Desktop/DesktopFooter";
|
||||||
import { DesktopHeader } from "../Desktop/DesktopHeader";
|
import { DesktopHeader } from "../Desktop/DesktopHeader";
|
||||||
import { Apps } from "../Apps/Apps";
|
|
||||||
import { AppsNavBar } from "../Apps/AppsNavBar";
|
|
||||||
import { AppsDesktop } from "../Apps/AppsDesktop";
|
import { AppsDesktop } from "../Apps/AppsDesktop";
|
||||||
import { AppsDevMode } from "../Apps/AppsDevMode";
|
import { AppsDevMode } from "../Apps/AppsDevMode";
|
||||||
import { DesktopSideBar } from "../DesktopSideBar";
|
import { DesktopSideBar } from "../DesktopSideBar";
|
||||||
@ -101,36 +77,11 @@ import { useSetRecoilState } from "recoil";
|
|||||||
import { selectedGroupIdAtom } from "../../atoms/global";
|
import { selectedGroupIdAtom } from "../../atoms/global";
|
||||||
import { sortArrayByTimestampAndGroupName } from "../../utils/time";
|
import { sortArrayByTimestampAndGroupName } from "../../utils/time";
|
||||||
|
|
||||||
// let touchStartY = 0;
|
|
||||||
// let disablePullToRefresh = false;
|
|
||||||
|
|
||||||
// // Detect when the user touches the screen
|
|
||||||
// window.addEventListener('touchstart', function(event) {
|
|
||||||
// if (event.touches.length !== 1) return; // Ignore multi-touch events
|
|
||||||
|
|
||||||
// touchStartY = event.touches[0].clientY;
|
|
||||||
// disablePullToRefresh = window.scrollY === 0; // Only disable if at the top
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // Detect when the user moves their finger on the screen
|
|
||||||
// window.addEventListener('touchmove', function(event) {
|
|
||||||
// let touchY = event.touches[0].clientY;
|
|
||||||
|
|
||||||
// // If pulling down from the top of the page, prevent the default behavior
|
|
||||||
// if (disablePullToRefresh && touchY > touchStartY) {
|
|
||||||
// event.preventDefault();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
const isWithinLast15Minutes = (timestamp) => {
|
|
||||||
const now = Date.now(); // Current timestamp in milliseconds
|
|
||||||
const fifteenMinutes = 15 * 60 * 1000; // 15 minutes in milliseconds
|
|
||||||
|
|
||||||
return now - timestamp < fifteenMinutes;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getPublishesFromAdmins = async (admins: string[], groupId) => {
|
export const getPublishesFromAdmins = async (admins: string[], groupId) => {
|
||||||
// const validApi = await findUsableApi();
|
|
||||||
const queryString = admins.map((name) => `name=${name}`).join("&");
|
const queryString = admins.map((name) => `name=${name}`).join("&");
|
||||||
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT_PRIVATE&identifier=symmetric-qchat-group-${
|
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT_PRIVATE&identifier=symmetric-qchat-group-${
|
||||||
groupId
|
groupId
|
||||||
@ -163,7 +114,6 @@ export const getPublishesFromAdmins = async (admins: string[], groupId) => {
|
|||||||
interface GroupProps {
|
interface GroupProps {
|
||||||
myAddress: string;
|
myAddress: string;
|
||||||
isFocused: boolean;
|
isFocused: boolean;
|
||||||
isMain: boolean;
|
|
||||||
userInfo: any;
|
userInfo: any;
|
||||||
balance: number;
|
balance: number;
|
||||||
}
|
}
|
||||||
@ -331,16 +281,7 @@ export const getGroupAdmins = async (groupNumber: number) => {
|
|||||||
let members: any = [];
|
let members: any = [];
|
||||||
let membersAddresses = [];
|
let membersAddresses = [];
|
||||||
let both = [];
|
let both = [];
|
||||||
// if (groupData && Array.isArray(groupData?.members)) {
|
|
||||||
// for (const member of groupData.members) {
|
|
||||||
// if (member.member) {
|
|
||||||
// const name = await getNameInfo(member.member);
|
|
||||||
// if (name) {
|
|
||||||
// members.push(name);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
const getMemNames = groupData?.members?.map(async (member) => {
|
const getMemNames = groupData?.members?.map(async (member) => {
|
||||||
if (member?.member) {
|
if (member?.member) {
|
||||||
@ -386,17 +327,9 @@ export const getNames = async (listOfMembers) => {
|
|||||||
return members;
|
return members;
|
||||||
};
|
};
|
||||||
export const getNamesForAdmins = async (admins) => {
|
export const getNamesForAdmins = async (admins) => {
|
||||||
// const validApi = await findUsableApi();
|
|
||||||
|
|
||||||
let members: any = [];
|
let members: any = [];
|
||||||
// if (admins && Array.isArray(admins)) {
|
|
||||||
// for (const admin of admins) {
|
|
||||||
// const name = await getNameInfo(admin);
|
|
||||||
// if (name) {
|
|
||||||
// members.push({ address: admin, name });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
const getMemNames = admins?.map(async (admin) => {
|
const getMemNames = admins?.map(async (admin) => {
|
||||||
if (admin) {
|
if (admin) {
|
||||||
const name = await requestQueueAdminMemberNames.enqueue(() => {
|
const name = await requestQueueAdminMemberNames.enqueue(() => {
|
||||||
@ -417,12 +350,9 @@ export const getNamesForAdmins = async (admins) => {
|
|||||||
export const Group = ({
|
export const Group = ({
|
||||||
myAddress,
|
myAddress,
|
||||||
isFocused,
|
isFocused,
|
||||||
isMain,
|
|
||||||
userInfo,
|
userInfo,
|
||||||
balance,
|
balance,
|
||||||
isOpenDrawerProfile,
|
|
||||||
setIsOpenDrawerProfile,
|
setIsOpenDrawerProfile,
|
||||||
logoutFunc,
|
|
||||||
setDesktopViewMode,
|
setDesktopViewMode,
|
||||||
desktopViewMode
|
desktopViewMode
|
||||||
}: GroupProps) => {
|
}: GroupProps) => {
|
||||||
@ -450,7 +380,7 @@ export const Group = ({
|
|||||||
const [openAddGroup, setOpenAddGroup] = useState(false);
|
const [openAddGroup, setOpenAddGroup] = useState(false);
|
||||||
const [isInitialGroups, setIsInitialGroups] = useState(false);
|
const [isInitialGroups, setIsInitialGroups] = useState(false);
|
||||||
const [openManageMembers, setOpenManageMembers] = useState(false);
|
const [openManageMembers, setOpenManageMembers] = useState(false);
|
||||||
const { setMemberGroups, memberGroups, rootHeight } = useContext(MyContext);
|
const { setMemberGroups, rootHeight } = useContext(MyContext);
|
||||||
const lastGroupNotification = useRef<null | number>(null);
|
const lastGroupNotification = useRef<null | number>(null);
|
||||||
const [timestampEnterData, setTimestampEnterData] = useState({});
|
const [timestampEnterData, setTimestampEnterData] = useState({});
|
||||||
const [chatMode, setChatMode] = useState("groups");
|
const [chatMode, setChatMode] = useState("groups");
|
||||||
@ -570,28 +500,7 @@ export const Group = ({
|
|||||||
});
|
});
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
const getGroupDataSingle = async (groupId) => {
|
|
||||||
try {
|
|
||||||
return new Promise((res, rej) => {
|
|
||||||
window.sendMessage("getGroupDataSingle", {
|
|
||||||
groupId,
|
|
||||||
})
|
|
||||||
.then((response) => {
|
|
||||||
if (!response?.error) {
|
|
||||||
res(response);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
rej(response.error);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
rej(error.message || "An error occurred");
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const refreshHomeDataFunc = () => {
|
const refreshHomeDataFunc = () => {
|
||||||
setGroupSection("default");
|
setGroupSection("default");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -633,43 +542,8 @@ export const Group = ({
|
|||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkGroupList = React.useCallback(async (address) => {
|
|
||||||
try {
|
|
||||||
const url = `${getBaseApiReact()}/chat/active/${address}`;
|
|
||||||
const response = await fetch(url, {
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const responseData = await response.json();
|
|
||||||
if (!Array.isArray(responseData?.groups)) return;
|
|
||||||
const filterOutGeneral = responseData.groups?.filter(
|
|
||||||
(item) => item?.groupId !== 0
|
|
||||||
);
|
|
||||||
const sortedGroups = filterOutGeneral.sort((a, b) => {
|
|
||||||
// If a has no timestamp, move it down
|
|
||||||
if (!a.timestamp) return 1;
|
|
||||||
// If b has no timestamp, move it up
|
|
||||||
if (!b.timestamp) return -1;
|
|
||||||
// Otherwise, sort by timestamp in descending order (most recent first)
|
|
||||||
return b.timestamp - a.timestamp;
|
|
||||||
});
|
|
||||||
setGroups(sortedGroups);
|
|
||||||
setMemberGroups(sortedGroups);
|
|
||||||
} catch (error) {
|
|
||||||
} finally {
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
// const checkGroupListFunc = useCallback((myAddress) => {
|
|
||||||
// let isCalling = false;
|
|
||||||
// checkGroupInterval.current = setInterval(async () => {
|
|
||||||
// if (isCalling) return;
|
|
||||||
// isCalling = true;
|
|
||||||
// const res = await checkGroupList(myAddress);
|
|
||||||
// isCalling = false;
|
|
||||||
// }, 120000);
|
|
||||||
// }, []);
|
|
||||||
|
|
||||||
const directChatHasUnread = useMemo(() => {
|
const directChatHasUnread = useMemo(() => {
|
||||||
let hasUnread = false;
|
let hasUnread = false;
|
||||||
@ -721,15 +595,7 @@ export const Group = ({
|
|||||||
return hasUnread;
|
return hasUnread;
|
||||||
}, [groupAnnouncements, groups]);
|
}, [groupAnnouncements, groups]);
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// if (!myAddress) return;
|
|
||||||
// checkGroupListFunc(myAddress);
|
|
||||||
// return () => {
|
|
||||||
// if (checkGroupInterval?.current) {
|
|
||||||
// clearInterval(checkGroupInterval.current);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// }, [checkGroupListFunc, myAddress]);
|
|
||||||
|
|
||||||
|
|
||||||
const getSecretKey = async (
|
const getSecretKey = async (
|
||||||
@ -738,22 +604,10 @@ export const Group = ({
|
|||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
setIsLoadingGroupMessage("Locating encryption keys");
|
setIsLoadingGroupMessage("Locating encryption keys");
|
||||||
// setGroupDataLastSet(null)
|
|
||||||
pauseAllQueues();
|
pauseAllQueues();
|
||||||
let dataFromStorage;
|
let dataFromStorage;
|
||||||
let publishFromStorage;
|
let publishFromStorage;
|
||||||
let adminsFromStorage;
|
let adminsFromStorage;
|
||||||
// const groupData = await getGroupDataSingle(selectedGroup?.groupId);
|
|
||||||
// if (
|
|
||||||
// groupData?.secretKeyData &&
|
|
||||||
// Date.now() - groupData?.timestampLastSet < 3600000
|
|
||||||
// ) {
|
|
||||||
// dataFromStorage = groupData.secretKeyData;
|
|
||||||
// publishFromStorage = groupData.secretKeyResource;
|
|
||||||
// adminsFromStorage = groupData.admins;
|
|
||||||
// // setGroupDataLastSet(groupData.timestampLastSet)
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
secretKeyToPublish &&
|
secretKeyToPublish &&
|
||||||
secretKey &&
|
secretKey &&
|
||||||
@ -844,9 +698,6 @@ export const Group = ({
|
|||||||
} finally {
|
} finally {
|
||||||
setIsLoadingGroup(false);
|
setIsLoadingGroup(false);
|
||||||
setIsLoadingGroupMessage("");
|
setIsLoadingGroupMessage("");
|
||||||
if (!secretKeyToPublish) {
|
|
||||||
// await getAdmins(selectedGroup?.groupId);
|
|
||||||
}
|
|
||||||
resumeAllQueues();
|
resumeAllQueues();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -864,14 +715,7 @@ export const Group = ({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const getAdmins = async (groupId) => {
|
|
||||||
try {
|
|
||||||
const res = await getGroupAdminsAddress(groupId);
|
|
||||||
setAdmins(res);
|
|
||||||
const adminsWithNames = await getNamesForAdmins(res);
|
|
||||||
setAdminsWithNames(adminsWithNames);
|
|
||||||
} catch (error) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getCountNewMesg = async (groupId, after)=> {
|
const getCountNewMesg = async (groupId, after)=> {
|
||||||
try {
|
try {
|
||||||
@ -1133,9 +977,7 @@ export const Group = ({
|
|||||||
} else {
|
} else {
|
||||||
setMobileViewModeKeepOpen("messaging");
|
setMobileViewModeKeepOpen("messaging");
|
||||||
}
|
}
|
||||||
// setChatMode("directs");
|
|
||||||
setSelectedDirect(null);
|
setSelectedDirect(null);
|
||||||
// setSelectedGroup(null);
|
|
||||||
|
|
||||||
setNewChat(false);
|
setNewChat(false);
|
||||||
|
|
||||||
@ -1171,7 +1013,6 @@ export const Group = ({
|
|||||||
setMobileViewModeKeepOpen("messaging");
|
setMobileViewModeKeepOpen("messaging");
|
||||||
}
|
}
|
||||||
setSelectedDirect(null);
|
setSelectedDirect(null);
|
||||||
// setSelectedGroup(null);
|
|
||||||
|
|
||||||
setNewChat(false);
|
setNewChat(false);
|
||||||
|
|
||||||
@ -1485,11 +1326,7 @@ export const Group = ({
|
|||||||
if (findGroup?.groupId === selectedGroup?.groupId) {
|
if (findGroup?.groupId === selectedGroup?.groupId) {
|
||||||
setGroupSection("forum");
|
setGroupSection("forum");
|
||||||
setDefaultThread(data);
|
setDefaultThread(data);
|
||||||
// setTimeout(() => {
|
|
||||||
// executeEvent("setThreadByEvent", {
|
|
||||||
// data: data
|
|
||||||
// });
|
|
||||||
// }, 400);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (findGroup) {
|
if (findGroup) {
|
||||||
@ -1541,31 +1378,13 @@ export const Group = ({
|
|||||||
}
|
}
|
||||||
setDesktopViewMode('home')
|
setDesktopViewMode('home')
|
||||||
|
|
||||||
// setGroupSection("default");
|
|
||||||
// clearAllQueues();
|
|
||||||
await new Promise((res) => {
|
await new Promise((res) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
res(null);
|
res(null);
|
||||||
}, 200);
|
}, 200);
|
||||||
});
|
});
|
||||||
// setGroupSection("home");
|
|
||||||
// setSelectedGroup(null);
|
|
||||||
// setNewChat(false);
|
|
||||||
// setSelectedDirect(null);
|
|
||||||
// setSecretKey(null);
|
|
||||||
// setGroupOwner(null)
|
|
||||||
// lastFetchedSecretKey.current = null;
|
|
||||||
// initiatedGetMembers.current = false;
|
|
||||||
// setSecretKeyPublishDate(null);
|
|
||||||
// setAdmins([]);
|
|
||||||
// setSecretKeyDetails(null);
|
|
||||||
// setAdminsWithNames([]);
|
|
||||||
// setMembers([]);
|
|
||||||
// setMemberCountFromSecretKeyData(null);
|
|
||||||
// setTriedToFetchSecretKey(false);
|
|
||||||
// setFirstSecretKeyInCreation(false);
|
|
||||||
// setIsOpenSideViewDirects(false)
|
|
||||||
// setIsOpenSideViewGroups(false)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const goToAnnouncements = async () => {
|
const goToAnnouncements = async () => {
|
||||||
@ -1701,54 +1520,6 @@ export const Group = ({
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isMobile && (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
width: "100%",
|
|
||||||
marginTop: "14px",
|
|
||||||
justifyContent: "center",
|
|
||||||
height: "15px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "space-between",
|
|
||||||
width: "320px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
width: "50px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
width: "50px",
|
|
||||||
justifyContent: "flex-end",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ButtonBase
|
|
||||||
onClick={() => {
|
|
||||||
setMobileViewModeKeepOpen('')
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ExitIcon />
|
|
||||||
</ButtonBase>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@ -1757,9 +1528,6 @@ export const Group = ({
|
|||||||
alignItems: "flex-start",
|
alignItems: "flex-start",
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
overflowY: "auto",
|
overflowY: "auto",
|
||||||
// visibility: chatMode === "groups" && "hidden",
|
|
||||||
// position: chatMode === "groups" && "fixed",
|
|
||||||
// left: chatMode === "groups" && "-1000px",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{directs.map((direct: any) => (
|
{directs.map((direct: any) => (
|
||||||
@ -1771,15 +1539,9 @@ export const Group = ({
|
|||||||
dense={true}
|
dense={true}
|
||||||
>
|
>
|
||||||
<ListItem
|
<ListItem
|
||||||
// secondaryAction={
|
|
||||||
// <IconButton edge="end" aria-label="delete">
|
|
||||||
// <SettingsIcon />
|
|
||||||
// </IconButton>
|
|
||||||
// }
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSelectedDirect(null);
|
setSelectedDirect(null);
|
||||||
setNewChat(false);
|
setNewChat(false);
|
||||||
// setSelectedGroup(null);
|
|
||||||
setIsOpenDrawer(false);
|
setIsOpenDrawer(false);
|
||||||
window.sendMessage("addTimestampEnterChat", {
|
window.sendMessage("addTimestampEnterChat", {
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
@ -1820,7 +1582,6 @@ export const Group = ({
|
|||||||
color: "white",
|
color: "white",
|
||||||
}}
|
}}
|
||||||
alt={direct?.name || direct?.address}
|
alt={direct?.name || direct?.address}
|
||||||
// src={`${getBaseApiReact()}/arbitrary/THUMBNAIL/${groupOwner?.name}/qortal_group_avatar_${group.groupId}?async=true`}
|
|
||||||
>
|
>
|
||||||
{(direct?.name || direct?.address)?.charAt(0)}
|
{(direct?.name || direct?.address)?.charAt(0)}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
@ -1881,7 +1642,6 @@ export const Group = ({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setNewChat(true);
|
setNewChat(true);
|
||||||
setSelectedDirect(null);
|
setSelectedDirect(null);
|
||||||
// setSelectedGroup(null);
|
|
||||||
setIsOpenDrawer(false);
|
setIsOpenDrawer(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -1993,11 +1753,6 @@ export const Group = ({
|
|||||||
dense={true}
|
dense={true}
|
||||||
>
|
>
|
||||||
<ListItem
|
<ListItem
|
||||||
// secondaryAction={
|
|
||||||
// <IconButton edge="end" aria-label="delete">
|
|
||||||
// <SettingsIcon />
|
|
||||||
// </IconButton>
|
|
||||||
// }
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setMobileViewMode("group");
|
setMobileViewMode("group");
|
||||||
setDesktopSideView('groups')
|
setDesktopSideView('groups')
|
||||||
@ -2018,28 +1773,12 @@ export const Group = ({
|
|||||||
setMemberCountFromSecretKeyData(null);
|
setMemberCountFromSecretKeyData(null);
|
||||||
setHideCommonKeyPopup(false);
|
setHideCommonKeyPopup(false);
|
||||||
setFirstSecretKeyInCreation(false);
|
setFirstSecretKeyInCreation(false);
|
||||||
// setGroupSection("announcement");
|
|
||||||
setGroupSection("chat");
|
setGroupSection("chat");
|
||||||
setIsOpenDrawer(false);
|
setIsOpenDrawer(false);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setSelectedGroup(group);
|
setSelectedGroup(group);
|
||||||
|
|
||||||
// getTimestampEnterChat();
|
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
// window.sendMessage("addTimestampEnterChat", {
|
|
||||||
// timestamp: Date.now(),
|
|
||||||
// groupId: group.groupId,
|
|
||||||
// }).catch((error) => {
|
|
||||||
// console.error("Failed to add timestamp:", error.message || "An error occurred");
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
// setTimeout(() => {
|
|
||||||
// getTimestampEnterChat();
|
|
||||||
// }, 200);
|
|
||||||
|
|
||||||
|
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@ -2072,7 +1811,6 @@ export const Group = ({
|
|||||||
color: "white",
|
color: "white",
|
||||||
}}
|
}}
|
||||||
alt={group?.groupName}
|
alt={group?.groupName}
|
||||||
// src={`${getBaseApiReact()}/arbitrary/THUMBNAIL/${groupOwner?.name}/qortal_group_avatar_${group.groupId}?async=true`}
|
|
||||||
>
|
>
|
||||||
{group.groupName?.charAt(0)}
|
{group.groupName?.charAt(0)}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
@ -2158,7 +1896,6 @@ export const Group = ({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setNewChat(true);
|
setNewChat(true);
|
||||||
setSelectedDirect(null);
|
setSelectedDirect(null);
|
||||||
// setSelectedGroup(null);
|
|
||||||
setIsOpenDrawer(false);
|
setIsOpenDrawer(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -2188,26 +1925,7 @@ export const Group = ({
|
|||||||
setInfo={setInfoSnack}
|
setInfo={setInfoSnack}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{isMobile && (
|
|
||||||
<Header
|
|
||||||
setMobileViewModeKeepOpen={setMobileViewModeKeepOpen}
|
|
||||||
isThin={
|
|
||||||
mobileViewMode === "groups" ||
|
|
||||||
mobileViewMode === "group" ||
|
|
||||||
mobileViewModeKeepOpen === "messaging" || (mobileViewMode === "apps" && appsMode !== 'home')
|
|
||||||
}
|
|
||||||
logoutFunc={logoutFunc}
|
|
||||||
goToHome={goToHome}
|
|
||||||
setIsOpenDrawerProfile={setIsOpenDrawerProfile}
|
|
||||||
hasUnreadGroups={groupChatHasUnread ||
|
|
||||||
groupsAnnHasUnread}
|
|
||||||
hasUnreadDirects={directChatHasUnread}
|
|
||||||
setMobileViewMode={setMobileViewMode}
|
|
||||||
myName={userInfo?.name}
|
|
||||||
setSelectedDirect={setSelectedDirect}
|
|
||||||
setNewChat={setNewChat}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@ -2241,9 +1959,7 @@ export const Group = ({
|
|||||||
setOpen={setOpenAddGroup}
|
setOpen={setOpenAddGroup}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{mobileViewMode === "groups" && !mobileViewModeKeepOpen && renderGroups()}
|
|
||||||
|
|
||||||
{mobileViewModeKeepOpen === "messaging" && renderDirects()}
|
|
||||||
{newChat && (
|
{newChat && (
|
||||||
<>
|
<>
|
||||||
{isMobile && (
|
{isMobile && (
|
||||||
@ -2358,7 +2074,7 @@ export const Group = ({
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
{mobileViewMode !== 'groups' && (
|
|
||||||
<div style={{
|
<div style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
display: selectedGroup? 'block' : 'none',
|
display: selectedGroup? 'block' : 'none',
|
||||||
@ -2404,75 +2120,9 @@ export const Group = ({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
{isMobile && (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
width: "100%",
|
|
||||||
marginTop: "14px",
|
|
||||||
justifyContent: "center",
|
|
||||||
height: "15px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "space-between",
|
|
||||||
width: "320px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
width: "50px",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ButtonBase
|
|
||||||
onClick={() => {
|
|
||||||
setMobileViewMode("groups");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ReturnIcon />
|
|
||||||
</ButtonBase>
|
|
||||||
</Box>
|
|
||||||
<Typography
|
|
||||||
sx={{
|
|
||||||
fontSize: "14px",
|
|
||||||
fontWeight: 600,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{selectedGroup?.groupName}
|
|
||||||
</Typography>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
width: "50px",
|
|
||||||
justifyContent: "flex-end",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* <ExitIcon /> */}
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{isMobile && mobileViewMode === "group" && (
|
|
||||||
<>
|
|
||||||
<GroupMenu
|
|
||||||
setGroupSection={setGroupSection}
|
|
||||||
groupSection={groupSection}
|
|
||||||
setOpenManageMembers={setOpenManageMembers}
|
|
||||||
goToAnnouncements={goToAnnouncements}
|
|
||||||
goToChat={goToChat}
|
|
||||||
hasUnreadAnnouncements={isUnread}
|
|
||||||
hasUnreadChat={isUnreadChat}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
position: "relative",
|
position: "relative",
|
||||||
@ -2656,7 +2306,7 @@ export const Group = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
|
|
||||||
{selectedDirect && !newChat && (
|
{selectedDirect && !newChat && (
|
||||||
<>
|
<>
|
||||||
@ -2701,62 +2351,7 @@ export const Group = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{/* {!isMobile && groupSection === "home" && (
|
|
||||||
<DesktopFooter
|
|
||||||
selectedGroup={selectedGroup}
|
|
||||||
groupSection={groupSection}
|
|
||||||
isUnread={isUnread}
|
|
||||||
goToAnnouncements={goToAnnouncements}
|
|
||||||
isUnreadChat={isUnreadChat}
|
|
||||||
goToChat={goToChat}
|
|
||||||
goToThreads={goToThreads}
|
|
||||||
setOpenManageMembers={setOpenManageMembers}
|
|
||||||
groupChatHasUnread={groupChatHasUnread}
|
|
||||||
groupsAnnHasUnread={groupsAnnHasUnread}
|
|
||||||
directChatHasUnread={directChatHasUnread}
|
|
||||||
chatMode={chatMode}
|
|
||||||
openDrawerGroups={openDrawerGroups}
|
|
||||||
goToHome={goToHome}
|
|
||||||
setIsOpenDrawerProfile={setIsOpenDrawerProfile}
|
|
||||||
mobileViewMode={mobileViewMode}
|
|
||||||
setMobileViewMode={setMobileViewMode}
|
|
||||||
setMobileViewModeKeepOpen={setMobileViewModeKeepOpen}
|
|
||||||
hasUnreadGroups={groupChatHasUnread ||
|
|
||||||
groupsAnnHasUnread}
|
|
||||||
hasUnreadDirects={directChatHasUnread}
|
|
||||||
myName={userInfo?.name || null}
|
|
||||||
isHome={groupSection === "home" && desktopViewMode === 'home'}
|
|
||||||
isGroups={desktopSideView === 'groups' && desktopViewMode !== 'apps' && desktopViewMode !== 'apps'}
|
|
||||||
isDirects={desktopSideView === 'directs' && desktopViewMode !== 'apps' && desktopViewMode !== 'apps'}
|
|
||||||
setDesktopViewMode={setDesktopViewMode}
|
|
||||||
isApps={desktopViewMode === 'apps'}
|
|
||||||
setDesktopSideView={setDesktopSideView}
|
|
||||||
desktopViewMode={desktopViewMode}
|
|
||||||
hide={desktopViewMode === 'apps' || desktopViewMode === 'dev'}
|
|
||||||
setIsOpenSideViewDirects={setIsOpenSideViewDirects}
|
|
||||||
setIsOpenSideViewGroups={setIsOpenSideViewGroups}
|
|
||||||
/>
|
|
||||||
)} */}
|
|
||||||
{isMobile && mobileViewMode === "home" && (
|
|
||||||
<Home
|
|
||||||
refreshHomeDataFunc={refreshHomeDataFunc}
|
|
||||||
myAddress={myAddress}
|
|
||||||
isLoadingGroups={isLoadingGroups}
|
|
||||||
balance={balance}
|
|
||||||
userInfo={userInfo}
|
|
||||||
groups={groups}
|
|
||||||
setGroupSection={setGroupSection}
|
|
||||||
setSelectedGroup={setSelectedGroup}
|
|
||||||
getTimestampEnterChat={getTimestampEnterChat}
|
|
||||||
setOpenManageMembers={setOpenManageMembers}
|
|
||||||
setOpenAddGroup={setOpenAddGroup}
|
|
||||||
setMobileViewMode={setMobileViewMode}
|
|
||||||
setDesktopViewMode={setDesktopViewMode}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{isMobile && (
|
|
||||||
<Apps mode={appsMode} setMode={setAppsMode} show={mobileViewMode === "apps"} myName={userInfo?.name} />
|
|
||||||
)}
|
|
||||||
{!isMobile && (
|
{!isMobile && (
|
||||||
<AppsDesktop toggleSideViewGroups={toggleSideViewGroups} toggleSideViewDirects={toggleSideViewDirects} goToHome={goToHome} mode={appsMode} setMode={setAppsMode} setDesktopSideView={setDesktopSideView} hasUnreadDirects={directChatHasUnread} show={desktopViewMode === "apps"} myName={userInfo?.name} isGroups={isOpenSideViewGroups}
|
<AppsDesktop toggleSideViewGroups={toggleSideViewGroups} toggleSideViewDirects={toggleSideViewDirects} goToHome={goToHome} mode={appsMode} setMode={setAppsMode} setDesktopSideView={setDesktopSideView} hasUnreadDirects={directChatHasUnread} show={desktopViewMode === "apps"} myName={userInfo?.name} isGroups={isOpenSideViewGroups}
|
||||||
isDirects={isOpenSideViewDirects} hasUnreadGroups={groupChatHasUnread ||
|
isDirects={isOpenSideViewDirects} hasUnreadGroups={groupChatHasUnread ||
|
||||||
@ -2794,7 +2389,6 @@ export const Group = ({
|
|||||||
sx={{
|
sx={{
|
||||||
marginLeft: "auto",
|
marginLeft: "auto",
|
||||||
width: "31px",
|
width: "31px",
|
||||||
// minWidth: "135px",
|
|
||||||
padding: "5px",
|
padding: "5px",
|
||||||
display: (isMobile || desktopViewMode === 'apps' || desktopViewMode === 'dev' || desktopViewMode === 'chat') ? "none" : "flex",
|
display: (isMobile || desktopViewMode === 'apps' || desktopViewMode === 'dev' || desktopViewMode === 'chat') ? "none" : "flex",
|
||||||
}}
|
}}
|
||||||
@ -2816,54 +2410,6 @@ export const Group = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{(isMobile && mobileViewMode === "home" || (isMobile && mobileViewMode === "apps" && appsMode === 'home')) && !mobileViewModeKeepOpen && (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
height: "66px",
|
|
||||||
width: "100%",
|
|
||||||
backgroundColor: "var(--bg-primary)",
|
|
||||||
borderTopRightRadius: "25px",
|
|
||||||
borderTopLeftRadius: "25px",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{/* <DrawerComponent open={isOpenDrawer} setOpen={setIsOpenDrawer}>
|
|
||||||
{renderGroups()}
|
|
||||||
</DrawerComponent> */}
|
|
||||||
{isMobile && (
|
|
||||||
<MobileFooter
|
|
||||||
selectedGroup={selectedGroup}
|
|
||||||
groupSection={groupSection}
|
|
||||||
isUnread={isUnread}
|
|
||||||
goToAnnouncements={goToAnnouncements}
|
|
||||||
isUnreadChat={isUnreadChat}
|
|
||||||
goToChat={goToChat}
|
|
||||||
goToThreads={goToThreads}
|
|
||||||
setOpenManageMembers={setOpenManageMembers}
|
|
||||||
groupChatHasUnread={groupChatHasUnread}
|
|
||||||
groupsAnnHasUnread={groupsAnnHasUnread}
|
|
||||||
directChatHasUnread={directChatHasUnread}
|
|
||||||
chatMode={chatMode}
|
|
||||||
openDrawerGroups={openDrawerGroups}
|
|
||||||
goToHome={goToHome}
|
|
||||||
setIsOpenDrawerProfile={setIsOpenDrawerProfile}
|
|
||||||
mobileViewMode={mobileViewMode}
|
|
||||||
setMobileViewMode={setMobileViewMode}
|
|
||||||
setMobileViewModeKeepOpen={setMobileViewModeKeepOpen}
|
|
||||||
hasUnreadGroups={groupChatHasUnread ||
|
|
||||||
groupsAnnHasUnread}
|
|
||||||
hasUnreadDirects={directChatHasUnread}
|
|
||||||
myName={userInfo?.name || null}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{(isMobile && mobileViewMode === "apps" && appsMode !== 'home') && !mobileViewModeKeepOpen && (
|
|
||||||
<>
|
|
||||||
<AppsNavBar />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user