diff --git a/src/components/Apps/Apps.tsx b/src/components/Apps/Apps.tsx deleted file mode 100644 index b4e6f67..0000000 --- a/src/components/Apps/Apps.tsx +++ /dev/null @@ -1,357 +0,0 @@ -import React, { useEffect, useMemo, useRef, useState } from 'react'; -import { AppsHome } from './AppsHome'; -import { Spacer } from '../../common/Spacer'; -import { getBaseApiReact } from '../../App'; -import { AppInfo } from './AppInfo'; -import { - executeEvent, - subscribeToEvent, - unsubscribeFromEvent, -} from '../../utils/events'; -import { AppsParent } from './Apps-styles'; -import AppViewerContainer from './AppViewerContainer'; -import ShortUniqueId from 'short-unique-id'; -import { AppPublish } from './AppPublish'; -import { AppsCategory } from './AppsCategory'; -import { AppsLibrary } from './AppsLibrary'; - -const uid = new ShortUniqueId({ length: 8 }); - -export const Apps = ({ mode, setMode, show, myName }) => { - const [availableQapps, setAvailableQapps] = useState([]); - const [selectedAppInfo, setSelectedAppInfo] = useState(null); - const [selectedCategory, setSelectedCategory] = useState(null); - const [tabs, setTabs] = useState([]); - const [selectedTab, setSelectedTab] = useState(null); - const [isNewTabWindow, setIsNewTabWindow] = useState(false); - const [categories, setCategories] = useState([]); - const iframeRefs = useRef({}); - - const myApp = useMemo(() => { - return availableQapps.find( - (app) => app.name === myName && app.service === 'APP' - ); - }, [myName, availableQapps]); - - const myWebsite = useMemo(() => { - return availableQapps.find( - (app) => app.name === myName && app.service === 'WEBSITE' - ); - }, [myName, availableQapps]); - - useEffect(() => { - setTimeout(() => { - executeEvent('setTabsToNav', { - data: { - tabs: tabs, - selectedTab: selectedTab, - isNewTabWindow: isNewTabWindow, - }, - }); - }, 100); - }, [show, tabs, selectedTab, isNewTabWindow]); - - const getCategories = React.useCallback(async () => { - try { - const url = `${getBaseApiReact()}/arbitrary/categories`; - - const response = await fetch(url, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, - }); - if (!response?.ok) return; - const responseData = await response.json(); - - setCategories(responseData); - } catch (error) { - console.log(error); - } finally { - // dispatch(setIsLoadingGlobal(false)) - } - }, []); - - const getQapps = React.useCallback(async () => { - try { - let apps = []; - let websites = []; - // dispatch(setIsLoadingGlobal(true)) - const url = `${getBaseApiReact()}/arbitrary/resources/search?service=APP&mode=ALL&limit=0&includestatus=true&includemetadata=true`; - - const response = await fetch(url, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, - }); - if (!response?.ok) return; - const responseData = await response.json(); - const urlWebsites = `${getBaseApiReact()}/arbitrary/resources/search?service=WEBSITE&mode=ALL&limit=0&includestatus=true&includemetadata=true`; - - const responseWebsites = await fetch(urlWebsites, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, - }); - if (!responseWebsites?.ok) return; - const responseDataWebsites = await responseWebsites.json(); - - apps = responseData; - websites = responseDataWebsites; - const combine = [...apps, ...websites]; - setAvailableQapps(combine); - } catch (error) { - console.log(error); - } finally { - // dispatch(setIsLoadingGlobal(false)) - } - }, []); - useEffect(() => { - getQapps(); - getCategories(); - }, [getQapps, getCategories]); - - const selectedAppInfoFunc = (e) => { - const data = e.detail?.data; - setSelectedAppInfo(data); - setMode('appInfo'); - }; - - useEffect(() => { - subscribeToEvent('selectedAppInfo', selectedAppInfoFunc); - - return () => { - unsubscribeFromEvent('selectedAppInfo', selectedAppInfoFunc); - }; - }, []); - - const selectedAppInfoCategoryFunc = (e) => { - const data = e.detail?.data; - setSelectedAppInfo(data); - setMode('appInfo-from-category'); - }; - - useEffect(() => { - subscribeToEvent('selectedAppInfoCategory', selectedAppInfoCategoryFunc); - - return () => { - unsubscribeFromEvent( - 'selectedAppInfoCategory', - selectedAppInfoCategoryFunc - ); - }; - }, []); - - const selectedCategoryFunc = (e) => { - const data = e.detail?.data; - setSelectedCategory(data); - setMode('category'); - }; - - useEffect(() => { - subscribeToEvent('selectedCategory', selectedCategoryFunc); - - return () => { - unsubscribeFromEvent('selectedCategory', selectedCategoryFunc); - }; - }, []); - - const navigateBackFunc = (e) => { - if ( - [ - 'category', - 'appInfo-from-category', - 'appInfo', - 'library', - 'publish', - ].includes(mode) - ) { - // Handle the various modes as needed - if (mode === 'category') { - setMode('library'); - setSelectedCategory(null); - } else if (mode === 'appInfo-from-category') { - setMode('category'); - } else if (mode === 'appInfo') { - setMode('library'); - } else if (mode === 'library') { - if (isNewTabWindow) { - setMode('viewer'); - } else { - setMode('home'); - } - } else if (mode === 'publish') { - setMode('library'); - } - } else if (selectedTab?.tabId) { - executeEvent(`navigateBackApp-${selectedTab?.tabId}`, {}); - } - }; - - useEffect(() => { - subscribeToEvent('navigateBack', navigateBackFunc); - - return () => { - unsubscribeFromEvent('navigateBack', navigateBackFunc); - }; - }, [mode, selectedTab]); - - const addTabFunc = (e) => { - const data = e.detail?.data; - const newTab = { - ...data, - tabId: uid.rnd(), - }; - setTabs((prev) => [...prev, newTab]); - setSelectedTab(newTab); - setMode('viewer'); - - setIsNewTabWindow(false); - }; - - useEffect(() => { - subscribeToEvent('addTab', addTabFunc); - - return () => { - unsubscribeFromEvent('addTab', addTabFunc); - }; - }, [tabs]); - - const setSelectedTabFunc = (e) => { - const data = e.detail?.data; - - setSelectedTab(data); - setTimeout(() => { - executeEvent('setTabsToNav', { - data: { - tabs: tabs, - selectedTab: data, - isNewTabWindow: isNewTabWindow, - }, - }); - }, 100); - setIsNewTabWindow(false); - }; - - useEffect(() => { - subscribeToEvent('setSelectedTab', setSelectedTabFunc); - - return () => { - unsubscribeFromEvent('setSelectedTab', setSelectedTabFunc); - }; - }, [tabs, isNewTabWindow]); - - const removeTabFunc = (e) => { - const data = e.detail?.data; - const copyTabs = [...tabs].filter((tab) => tab?.tabId !== data?.tabId); - if (copyTabs?.length === 0) { - setMode('home'); - } else { - setSelectedTab(copyTabs[0]); - } - setTabs(copyTabs); - setSelectedTab(copyTabs[0]); - setTimeout(() => { - executeEvent('setTabsToNav', { - data: { - tabs: copyTabs, - selectedTab: copyTabs[0], - }, - }); - }, 400); - }; - - useEffect(() => { - subscribeToEvent('removeTab', removeTabFunc); - - return () => { - unsubscribeFromEvent('removeTab', removeTabFunc); - }; - }, [tabs]); - - const setNewTabWindowFunc = (e) => { - setIsNewTabWindow(true); - setSelectedTab(null); - }; - - useEffect(() => { - subscribeToEvent('newTabWindow', setNewTabWindowFunc); - - return () => { - unsubscribeFromEvent('newTabWindow', setNewTabWindowFunc); - }; - }, [tabs]); - - return ( - - {mode !== 'viewer' && !selectedTab && } - {mode === 'home' && ( - - )} - - - - {mode === 'appInfo' && !selectedTab && ( - - )} - {mode === 'appInfo-from-category' && !selectedTab && ( - - )} - - {mode === 'publish' && !selectedTab && ( - - )} - - {tabs.map((tab) => { - if (!iframeRefs.current[tab.tabId]) { - iframeRefs.current[tab.tabId] = React.createRef(); - } - return ( - - ); - })} - - {isNewTabWindow && mode === 'viewer' && ( - <> - - - - )} - {mode !== 'viewer' && !selectedTab && } - - ); -}; diff --git a/src/components/Apps/AppsCategory.tsx b/src/components/Apps/AppsCategory.tsx deleted file mode 100644 index be10853..0000000 --- a/src/components/Apps/AppsCategory.tsx +++ /dev/null @@ -1,204 +0,0 @@ -import React, { - useCallback, - useContext, - useEffect, - useMemo, - useRef, - useState, -} from 'react'; -import { - AppCircle, - AppCircleContainer, - AppCircleLabel, - AppLibrarySubTitle, - AppsContainer, - AppsLibraryContainer, - AppsParent, - AppsSearchContainer, - AppsSearchLeft, - AppsSearchRight, - AppsWidthLimiter, - PublishQAppCTAButton, - PublishQAppCTALeft, - PublishQAppCTAParent, - PublishQAppCTARight, - PublishQAppDotsBG, -} from './Apps-styles'; -import { Avatar, Box, ButtonBase, InputBase, styled } from '@mui/material'; -import { Add } from '@mui/icons-material'; -import { MyContext, getBaseApiReact } from '../../App'; -import LogoSelected from '../../assets/svgs/LogoSelected.svg'; -import IconSearch from '../../assets/svgs/Search.svg'; -import IconClearInput from '../../assets/svgs/ClearInput.svg'; -import qappDevelopText from '../../assets/svgs/qappDevelopText.svg'; -import qappDots from '../../assets/svgs/qappDots.svg'; - -import { Spacer } from '../../common/Spacer'; -import { AppInfoSnippet } from './AppInfoSnippet'; -import { Virtuoso } from 'react-virtuoso'; -import { executeEvent } from '../../utils/events'; -const officialAppList = [ - 'q-tube', - 'q-blog', - 'q-share', - 'q-support', - 'q-mail', - 'q-fund', - 'q-shop', - 'q-trade', - 'q-support', - 'q-manager', - 'q-wallets', - 'q-search', - 'q-nodecontrol', -]; - -const ScrollerStyled = styled('div')({ - // Hide scrollbar for WebKit browsers (Chrome, Safari) - '::-webkit-scrollbar': { - width: '0px', - height: '0px', - }, - - // Hide scrollbar for Firefox - scrollbarWidth: 'none', - - // Hide scrollbar for IE and older Edge - '-msOverflowStyle': 'none', -}); - -const StyledVirtuosoContainer = styled('div')({ - position: 'relative', - width: '100%', - display: 'flex', - flexDirection: 'column', - - // Hide scrollbar for WebKit browsers (Chrome, Safari) - '::-webkit-scrollbar': { - width: '0px', - height: '0px', - }, - - // Hide scrollbar for Firefox - scrollbarWidth: 'none', - - // Hide scrollbar for IE and older Edge - '-msOverflowStyle': 'none', -}); - -export const AppsCategory = ({ availableQapps, myName, category, isShow }) => { - const [searchValue, setSearchValue] = useState(''); - const virtuosoRef = useRef(); - const { rootHeight } = useContext(MyContext); - - const categoryList = useMemo(() => { - return availableQapps.filter( - (app) => app?.metadata?.category === category?.id - ); - }, [availableQapps, category]); - - const [debouncedValue, setDebouncedValue] = useState(''); // Debounced value - - // Debounce logic - useEffect(() => { - const handler = setTimeout(() => { - setDebouncedValue(searchValue); - }, 350); - - // Cleanup timeout if searchValue changes before the timeout completes - return () => { - clearTimeout(handler); - }; - }, [searchValue]); // Runs effect when searchValue changes - - // Example: Perform search or other actions based on debouncedValue - - const searchedList = useMemo(() => { - if (!debouncedValue) return categoryList; - return categoryList.filter((app) => - app.name.toLowerCase().includes(debouncedValue.toLowerCase()) - ); - }, [debouncedValue, categoryList]); - - const rowRenderer = (index) => { - let app = searchedList[index]; - return ( - - ); - }; - - return ( - - - - - - - setSearchValue(e.target.value)} - sx={{ ml: 1, flex: 1 }} - placeholder="Search for apps" - inputProps={{ - 'aria-label': 'Search for apps', - fontSize: '16px', - fontWeight: 400, - }} - /> - - - {searchValue && ( - { - setSearchValue(''); - }} - > - - - )} - - - - - - - {`Category: ${category?.name}`} - - - - - - - - - - ); -}; diff --git a/src/components/Apps/AppsHome.tsx b/src/components/Apps/AppsHome.tsx deleted file mode 100644 index fda90ea..0000000 --- a/src/components/Apps/AppsHome.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { - AppCircle, - AppCircleContainer, - AppCircleLabel, - AppLibrarySubTitle, - AppsContainer, -} from './Apps-styles'; -import { ButtonBase } from '@mui/material'; -import { Add } from '@mui/icons-material'; -import { SortablePinnedApps } from './SortablePinnedApps'; -import { Spacer } from '../../common/Spacer'; - -export const AppsHome = ({ setMode, myApp, myWebsite, availableQapps }) => { - return ( - <> - - Apps Dashboard - - - - - { - setMode('library'); - }} - > - - - + - - Library - - - - - - - ); -}; diff --git a/src/components/Apps/AppsLibrary.tsx b/src/components/Apps/AppsLibrary.tsx deleted file mode 100644 index e5cac4a..0000000 --- a/src/components/Apps/AppsLibrary.tsx +++ /dev/null @@ -1,384 +0,0 @@ -import { useContext, useEffect, useMemo, useRef, useState } from 'react'; -import { - AppCircle, - AppCircleContainer, - AppCircleLabel, - AppLibrarySubTitle, - AppsContainer, - AppsLibraryContainer, - AppsSearchContainer, - AppsSearchLeft, - AppsSearchRight, - AppsWidthLimiter, - PublishQAppCTAButton, - PublishQAppCTALeft, - PublishQAppCTAParent, - PublishQAppCTARight, - PublishQAppDotsBG, -} from './Apps-styles'; -import { - Avatar, - Box, - ButtonBase, - InputBase, - styled, - useTheme, -} from '@mui/material'; -import { MyContext, getBaseApiReact } from '../../App'; -import LogoSelected from '../../assets/svgs/LogoSelected.svg'; -import IconSearch from '../../assets/svgs/Search.svg'; -import IconClearInput from '../../assets/svgs/ClearInput.svg'; -import qappDevelopText from '../../assets/svgs/qappDevelopText.svg'; -import qappDots from '../../assets/svgs/qappDots.svg'; -// import { Return } from './assets/svgs/Return.tsx'; -import ReturnSVG from '../../assets/svgs/Return.svg'; -import { Spacer } from '../../common/Spacer'; -import { AppInfoSnippet } from './AppInfoSnippet'; -import { Virtuoso } from 'react-virtuoso'; -import { executeEvent } from '../../utils/events'; -import { - ComposeP, - MailIconImg, - ShowMessageReturnButton, -} from '../Group/Forum/Mail-styles'; - -const officialAppList = [ - 'q-tube', - 'q-blog', - 'q-share', - 'q-support', - 'q-mail', - 'q-fund', - 'q-shop', - 'q-trade', - 'q-support', - 'q-manager', - 'q-wallets', - 'q-search', - 'q-nodecontrol', -]; - -const ScrollerStyled = styled('div')({ - // Hide scrollbar for WebKit browsers (Chrome, Safari) - '::-webkit-scrollbar': { - width: '0px', - height: '0px', - }, - - // Hide scrollbar for Firefox - scrollbarWidth: 'none', - - // Hide scrollbar for IE and older Edge - '-msOverflowStyle': 'none', -}); - -const StyledVirtuosoContainer = styled('div')({ - display: 'flex', - flexDirection: 'column', - position: 'relative', - width: '100%', - - // Hide scrollbar for WebKit browsers (Chrome, Safari) - '::-webkit-scrollbar': { - width: '0px', - height: '0px', - }, - - // Hide scrollbar for Firefox - scrollbarWidth: 'none', - - // Hide scrollbar for IE and older Edge - '-msOverflowStyle': 'none', -}); - -export const AppsLibrary = ({ - availableQapps, - setMode, - myName, - hasPublishApp, - isShow, - categories = { categories }, -}) => { - const [searchValue, setSearchValue] = useState(''); - const virtuosoRef = useRef(); - const { rootHeight } = useContext(MyContext); - - const officialApps = useMemo(() => { - return availableQapps.filter( - (app) => - app.service === 'APP' && - officialAppList.includes(app?.name?.toLowerCase()) - ); - }, [availableQapps]); - - const [debouncedValue, setDebouncedValue] = useState(''); // Debounced value - - // Debounce logic - useEffect(() => { - const handler = setTimeout(() => { - setDebouncedValue(searchValue); - }, 350); - - // Cleanup timeout if searchValue changes before the timeout completes - return () => { - clearTimeout(handler); - }; - }, [searchValue]); // Runs effect when searchValue changes - - // Example: Perform search or other actions based on debouncedValue - - const searchedList = useMemo(() => { - if (!debouncedValue) return []; - return availableQapps.filter((app) => - app.name.toLowerCase().includes(debouncedValue.toLowerCase()) - ); - }, [debouncedValue]); - - const rowRenderer = (index) => { - let app = searchedList[index]; - return ( - - ); - }; - - const theme = useTheme(); - - return ( - - - - - - - - setSearchValue(e.target.value)} - sx={{ ml: 1, flex: 1 }} - placeholder="Search for apps" - inputProps={{ - 'aria-label': 'Search for apps', - fontSize: '16px', - fontWeight: 400, - }} - /> - - - {searchValue && ( - { - setSearchValue(''); - }} - > - - - )} - - - - - - - - { - executeEvent('navigateBack', {}); - }} - > - // TODO return icon - Return to Apps Dashboard - - - - - {searchedList?.length > 0 ? ( - - - - - - ) : ( - <> - - Official Apps - - - - - {officialApps?.map((qapp) => { - return ( - { - // executeEvent("addTab", { - // data: qapp - // }) - executeEvent('selectedAppInfo', { - data: qapp, - }); - }} - > - - - - center-icon - - - - - {qapp?.metadata?.title || qapp?.name} - - - - ); - })} - - - - - - {hasPublishApp ? 'Update Apps!' : 'Create Apps!'} - - - - - - - - - - - - - - - - - { - setMode('publish'); - }} - > - - {hasPublishApp ? 'Update' : 'Publish'} - - - - - - - - - - Categories - - - - - {categories?.map((category) => { - return ( - { - executeEvent('selectedCategory', { - data: category, - }); - }} - > - - {category?.name} - - - ); - })} - - - - )} - - ); -}; diff --git a/src/components/Apps/AppsNavBar.tsx b/src/components/Apps/AppsNavBar.tsx deleted file mode 100644 index 9731bd5..0000000 --- a/src/components/Apps/AppsNavBar.tsx +++ /dev/null @@ -1,367 +0,0 @@ -import { useEffect, useMemo, useRef, useState } from 'react'; -import { - AppsNavBarLeft, - AppsNavBarParent, - AppsNavBarRight, -} from './Apps-styles'; -import { NavBack } from '../../assets/Icons/NavBack.tsx'; -import { NavAdd } from '../../assets/Icons/NavAdd.tsx'; -import { NavMoreMenu } from '../../assets/Icons/NavMoreMenu.tsx'; -import { - ButtonBase, - ListItemIcon, - ListItemText, - Menu, - MenuItem, - Tab, - Tabs, -} from '@mui/material'; -import { - executeEvent, - subscribeToEvent, - unsubscribeFromEvent, -} from '../../utils/events'; -import TabComponent from './TabComponent'; -import PushPinIcon from '@mui/icons-material/PushPin'; -import RefreshIcon from '@mui/icons-material/Refresh'; -import { useRecoilState, useSetRecoilState } from 'recoil'; -import { - navigationControllerAtom, - settingsLocalLastUpdatedAtom, - sortablePinnedAppsAtom, -} from '../../atoms/global'; - -export function saveToLocalStorage( - key, - subKey, - newValue, - otherRootData = {}, - deleteWholeKey -) { - try { - if (deleteWholeKey) { - localStorage.setItem(key, null); - return; - } - // Fetch existing data - const existingData = localStorage.getItem(key); - let combinedData = {}; - - if (existingData) { - // Parse the existing data - const parsedData = JSON.parse(existingData); - // Merge with the new data under the subKey - combinedData = { - ...parsedData, - ...otherRootData, - timestamp: Date.now(), // Update the root timestamp - [subKey]: newValue, // Assuming the data is an array - }; - } else { - // If no existing data, just use the new data under the subKey - combinedData = { - ...otherRootData, - timestamp: Date.now(), // Set the initial root timestamp - [subKey]: newValue, - }; - } - - // Save combined data back to localStorage - const serializedValue = JSON.stringify(combinedData); - localStorage.setItem(key, serializedValue); - } catch (error) { - console.error('Error saving to localStorage:', error); - } -} - -export const AppsNavBar = () => { - const [tabs, setTabs] = useState([]); - const [selectedTab, setSelectedTab] = useState(null); - const [isNewTabWindow, setIsNewTabWindow] = useState(false); - const tabsRef = useRef(null); - const [anchorEl, setAnchorEl] = useState(null); - const open = Boolean(anchorEl); - const [sortablePinnedApps, setSortablePinnedApps] = useRecoilState( - sortablePinnedAppsAtom - ); - const [navigationController, setNavigationController] = useRecoilState( - navigationControllerAtom - ); - - const isDisableBackButton = useMemo(() => { - if (selectedTab && navigationController[selectedTab?.tabId]?.hasBack) - return false; - if (selectedTab && !navigationController[selectedTab?.tabId]?.hasBack) - return true; - return false; - }, [navigationController, selectedTab]); - - const setSettingsLocalLastUpdated = useSetRecoilState( - settingsLocalLastUpdatedAtom - ); - - const handleClick = (event) => { - setAnchorEl(event.currentTarget); - }; - - const handleClose = () => { - setAnchorEl(null); - }; - - useEffect(() => { - // Scroll to the last tab whenever the tabs array changes (e.g., when a new tab is added) - if (tabsRef.current) { - const tabElements = tabsRef.current.querySelectorAll('.MuiTab-root'); - if (tabElements.length > 0) { - const lastTab = tabElements[tabElements.length - 1]; - lastTab.scrollIntoView({ - behavior: 'smooth', - block: 'nearest', - inline: 'end', - }); - } - } - }, [tabs.length]); // Dependency on the number of tabs - - const setTabsToNav = (e) => { - const { tabs, selectedTab, isNewTabWindow } = e.detail?.data; - - setTabs([...tabs]); - setSelectedTab(!selectedTab ? null : { ...selectedTab }); - setIsNewTabWindow(isNewTabWindow); - }; - - useEffect(() => { - subscribeToEvent('setTabsToNav', setTabsToNav); - - return () => { - unsubscribeFromEvent('setTabsToNav', setTabsToNav); - }; - }, []); - - const isSelectedAppPinned = !!sortablePinnedApps?.find( - (item) => - item?.name === selectedTab?.name && item?.service === selectedTab?.service - ); - return ( - - - { - executeEvent('navigateBack', selectedTab?.tabId); - }} - disabled={isDisableBackButton} - sx={{ - opacity: !isDisableBackButton ? 1 : 0.3, - cursor: !isDisableBackButton ? 'pointer' : 'default', - }} - > - - - - - {tabs?.map((tab) => ( - - } // Pass custom component - sx={{ - '&.Mui-selected': { - color: 'white', - }, - padding: '0px', - margin: '0px', - minWidth: '0px', - width: '50px', - }} - /> - ))} - - - - {selectedTab && ( - - { - setSelectedTab(null); - executeEvent('newTabWindow', {}); - }} - > - - - - { - if (!selectedTab) return; - handleClick(e); - }} - > - - - - )} - - - { - if (!selectedTab) return; - - setSortablePinnedApps((prev) => { - let updatedApps; - - if (isSelectedAppPinned) { - // Remove the selected app if it is pinned - updatedApps = prev.filter( - (item) => - !( - item?.name === selectedTab?.name && - item?.service === selectedTab?.service - ) - ); - } else { - // Add the selected app if it is not pinned - updatedApps = [ - ...prev, - { - name: selectedTab?.name, - service: selectedTab?.service, - }, - ]; - } - - saveToLocalStorage( - 'ext_saved_settings', - 'sortablePinnedApps', - updatedApps - ); - return updatedApps; - }); - setSettingsLocalLastUpdated(Date.now()); - - handleClose(); - }} - > - - - - - - - - { - executeEvent('refreshApp', { - tabId: selectedTab?.tabId, - }); - handleClose(); - }} - > - - - - - - - - - ); -}; diff --git a/src/components/Mobile/MobileFooter.tsx b/src/components/Mobile/MobileFooter.tsx deleted file mode 100644 index 52e5c7c..0000000 --- a/src/components/Mobile/MobileFooter.tsx +++ /dev/null @@ -1,203 +0,0 @@ -import * as React from "react"; -import { - BottomNavigation, - BottomNavigationAction, - ButtonBase, - Typography, -} from "@mui/material"; -import { Home, Groups, Message, ShowChart } from "@mui/icons-material"; -import Box from "@mui/material/Box"; -import BottomLogo from "../../assets/svgs/BottomLogo5.svg"; -import LogoSelected from "../../assets/svgs/LogoSelected.svg"; -import { Browser } from '@capacitor/browser'; - -import { CustomSvg } from "../../common/CustomSvg"; -import { WalletIcon } from "../../assets/Icons/WalletIcon"; -import { HubsIcon } from "../../assets/Icons/HubsIcon"; -import { TradingIcon } from "../../assets/Icons/TradingIcon"; -import { MessagingIcon } from "../../assets/Icons/MessagingIcon"; -import { executeEvent } from "../../utils/events"; - -const IconWrapper = ({ children, label, color }) => { - return ( - - {children} - - {label} - - - ); -}; - -export const MobileFooter = ({ - selectedGroup, - groupSection, - isUnread, - goToAnnouncements, - isUnreadChat, - goToChat, - goToThreads, - setOpenManageMembers, - groupChatHasUnread, - groupsAnnHasUnread, - directChatHasUnread, - chatMode, - openDrawerGroups, - goToHome, - setIsOpenDrawerProfile, - mobileViewMode, - setMobileViewMode, - setMobileViewModeKeepOpen, - hasUnreadGroups, - hasUnreadDirects -}) => { - const [value, setValue] = React.useState(0); - return ( - - setValue(newValue)} - sx={{ backgroundColor: "transparent", flexGrow: 1 }} - > - { - // setMobileViewMode('wallet') - setIsOpenDrawerProfile(true); - }} - icon={ - - - - } - sx={{ color: value === 0 ? "white" : "gray", padding: "0px 10px" }} - /> - { - setMobileViewMode("groups"); - }} - icon={ - - - - } - sx={{ - color: value === 0 ? "white" : "gray", - paddingLeft: "10px", - paddingRight: "42px", - }} - /> - - - {/* Floating Center Button */} - - { - if(mobileViewMode === 'home'){ - setMobileViewMode('apps') - - } else { - setMobileViewMode('home') - - } - }}> - - {/* Custom Center Icon */} - center-icon - - - - - setValue(newValue)} - sx={{ backgroundColor: "transparent", flexGrow: 1 }} - > - { - setMobileViewModeKeepOpen("messaging"); - }} - icon={ - - - - } - sx={{ - color: value === 2 ? "white" : "gray", - paddingLeft: "55px", - paddingRight: "10px", - }} - /> - { - executeEvent("addTab", { data: { service: 'APP', name: 'q-trade' } }); - executeEvent("open-apps-mode", { }); - }} - - icon={ - - - - } - sx={{ color: value === 3 ? "white" : "gray", padding: "0px 10px" }} - /> - - - ); -}; diff --git a/src/components/Mobile/MobileHeader.tsx b/src/components/Mobile/MobileHeader.tsx deleted file mode 100644 index 1ab74dc..0000000 --- a/src/components/Mobile/MobileHeader.tsx +++ /dev/null @@ -1,528 +0,0 @@ -import React, { useState } from "react"; -import { - AppBar, - Toolbar, - IconButton, - Typography, - Box, - MenuItem, - Select, - ButtonBase, - Menu, - ListItemIcon, - ListItemText, -} from "@mui/material"; -import { HomeIcon } from "../../assets/Icons/HomeIcon"; -import { LogoutIcon } from "../../assets/Icons/LogoutIcon"; -import { NotificationIcon } from "../../assets/Icons/NotificationIcon"; -import { ArrowDownIcon } from "../../assets/Icons/ArrowDownIcon"; -import { MessagingIcon } from "../../assets/Icons/MessagingIcon"; -import { MessagingIcon2 } from "../../assets/Icons/MessagingIcon2"; -import { HubsIcon } from "../../assets/Icons/HubsIcon"; -import { Save } from "../Save/Save"; -import CloseFullscreenIcon from "@mui/icons-material/CloseFullscreen"; -import { useRecoilState } from "recoil"; -import { fullScreenAtom, hasSettingsChangedAtom } from "../../atoms/global"; -import { useAppFullScreen } from "../../useAppFullscreen"; - -const Header = ({ - logoutFunc, - goToHome, - setIsOpenDrawerProfile, - isThin, - setMobileViewModeKeepOpen, - hasUnreadGroups, - hasUnreadDirects, - setMobileViewMode, - myName, - setSelectedDirect, - setNewChat, -}) => { - const [anchorEl, setAnchorEl] = useState(null); - const open = Boolean(anchorEl); - const [fullScreen, setFullScreen] = useRecoilState(fullScreenAtom); - const { exitFullScreen } = useAppFullScreen(setFullScreen); - const handleClick = (event) => { - setAnchorEl(event.currentTarget); - }; - - const handleClose = () => { - setAnchorEl(null); - }; - - if (isThin) { - return ( - - - {/* Left Home Icon */} - - { - setMobileViewModeKeepOpen(""); - goToHome(); - }} - // onClick={onHomeClick} - > - - - - - - {fullScreen && ( - { - exitFullScreen(); - setFullScreen(false); - }} - > - - - )} - - - {/* Center Title */} - - QORTAL - - - {/* Right Logout Icon */} - - { - setMobileViewModeKeepOpen("messaging"); - }} - > - - - - - - - - - - { - setSelectedDirect(null); - setNewChat(false); - setMobileViewMode("groups"); - setMobileViewModeKeepOpen(""); - handleClose(); - }} - > - - - - - - { - setMobileViewModeKeepOpen("messaging"); - - handleClose(); - }} - > - - - - - - - - ); - } - return ( - <> - {/* Main Header */} - - - {/* Left Home Icon */} - - - - - {fullScreen && ( - { - exitFullScreen(); - setFullScreen(false); - }} - > - - - )} - - {/* Center Title */} - - QORTAL - - - {/* Right Logout Icon */} - - - - - - - - - {/* Secondary Section */} - - - - {myName} - - {/* - */} - - - - - - - - - {/* Right Dropdown */} - {/* { - setIsOpenDrawerProfile(true); - }} - > - - - View Wallet - - - - - */} - - - - { - setMobileViewMode("groups"); - setMobileViewModeKeepOpen(""); - handleClose(); - }} - > - - - - - - - { - setMobileViewModeKeepOpen("messaging"); - - handleClose(); - }} - > - - - - - - - - ); -}; - -export default Header;