mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-24 20:07:51 +00:00
added sync indicator for q-apps
This commit is contained in:
parent
9b9facb711
commit
1b8137fe35
@ -651,6 +651,9 @@ function App() {
|
||||
if (message.action === "QORTAL_REQUEST_PERMISSION") {
|
||||
try {
|
||||
await showQortalRequestExtension(message?.payload);
|
||||
if(message?.payload?.checkbox1){
|
||||
qortalRequestCheckbox1Ref.current = message?.payload?.checkbox1
|
||||
}
|
||||
if (qortalRequestCheckbox1Ref.current) {
|
||||
event.source.postMessage(
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ export const groupApi = "https://ext-node.qortal.link";
|
||||
export const groupApiSocket = "wss://ext-node.qortal.link";
|
||||
export const groupApiLocal = "http://127.0.0.1:12391";
|
||||
export const groupApiSocketLocal = "ws://127.0.0.1:12391";
|
||||
const timeDifferenceForNotificationChatsBackground = 600000;
|
||||
const timeDifferenceForNotificationChatsBackground = 86400000;
|
||||
const requestQueueAnnouncements = new RequestQueueWithPromise(1);
|
||||
let isMobile = true;
|
||||
|
||||
@ -3212,4 +3212,27 @@ export const checkThreads = async (bringBack) => {
|
||||
// BackgroundFetch.finish(taskId);
|
||||
// });
|
||||
|
||||
let notificationCheckInterval
|
||||
|
||||
const createNotificationCheck = () => {
|
||||
// Check if an interval already exists before creating it
|
||||
if (!notificationCheckInterval) {
|
||||
notificationCheckInterval = setInterval(async () => {
|
||||
try {
|
||||
// This would replace the Chrome alarm callback
|
||||
const wallet = await getSaveWallet();
|
||||
const address = wallet?.address0;
|
||||
if (!address) return;
|
||||
|
||||
checkActiveChatsForNotifications();
|
||||
checkNewMessages();
|
||||
checkThreads();
|
||||
} catch (error) {
|
||||
console.error('Error checking notifications:', error);
|
||||
}
|
||||
}, 10 * 60 * 1000); // 10 minutes
|
||||
}
|
||||
};
|
||||
|
||||
// Call this function when initializing your app
|
||||
createNotificationCheck();
|
@ -20,6 +20,7 @@ import { HomeIcon } from "../../assets/Icons/HomeIcon";
|
||||
import { MessagingIcon } from "../../assets/Icons/MessagingIcon";
|
||||
import { Save } from "../Save/Save";
|
||||
import { HubsIcon } from "../../assets/Icons/HubsIcon";
|
||||
import { CoreSyncStatus } from "../CoreSyncStatus";
|
||||
|
||||
const uid = new ShortUniqueId({ length: 8 });
|
||||
|
||||
@ -299,7 +300,7 @@ export const AppsDesktop = ({ mode, setMode, show , myName, goToHome, setDesktop
|
||||
height: '100vh',
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
gap: '30px'
|
||||
gap: '25px'
|
||||
}}>
|
||||
<ButtonBase
|
||||
sx={{
|
||||
@ -356,7 +357,9 @@ export const AppsDesktop = ({ mode, setMode, show , myName, goToHome, setDesktop
|
||||
/>
|
||||
|
||||
</ButtonBase>
|
||||
<Save isDesktop />
|
||||
<Save isDesktop disableWidth />
|
||||
<CoreSyncStatus imageSize="30px" position="left" />
|
||||
|
||||
{mode !== 'home' && (
|
||||
<AppsNavBarDesktop />
|
||||
|
||||
|
@ -21,6 +21,7 @@ import { MessagingIcon } from "../../assets/Icons/MessagingIcon";
|
||||
import { Save } from "../Save/Save";
|
||||
import { HubsIcon } from "../../assets/Icons/HubsIcon";
|
||||
import { AppsDevModeNavBar } from "./AppsDevModeNavBar";
|
||||
import { CoreSyncStatus } from "../CoreSyncStatus";
|
||||
|
||||
const uid = new ShortUniqueId({ length: 8 });
|
||||
|
||||
@ -191,7 +192,7 @@ export const AppsDevMode = ({ mode, setMode, show , myName, goToHome, setDesktop
|
||||
height: '100vh',
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
gap: '30px'
|
||||
gap: '25px'
|
||||
}}>
|
||||
<ButtonBase
|
||||
sx={{
|
||||
@ -248,7 +249,8 @@ export const AppsDevMode = ({ mode, setMode, show , myName, goToHome, setDesktop
|
||||
/>
|
||||
|
||||
</ButtonBase>
|
||||
<Save isDesktop />
|
||||
<Save isDesktop disableWidth />
|
||||
<CoreSyncStatus imageSize="30px" position="left" />
|
||||
{mode !== 'home' && (
|
||||
<AppsDevModeNavBar />
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
.tooltip .bottom {
|
||||
min-width: 200px;
|
||||
min-width: 225px;
|
||||
max-width: 250px;
|
||||
top: 35px;
|
||||
right: 0px;
|
||||
|
@ -4,7 +4,7 @@ import syncedMintingImg from '../assets/syncStatus/synced.png'
|
||||
import syncingImg from '../assets/syncStatus/synced.png'
|
||||
import { getBaseApiReact } from '../App';
|
||||
import './CoreSyncStatus.css'
|
||||
export const CoreSyncStatus = () => {
|
||||
export const CoreSyncStatus = ({imageSize, position}) => {
|
||||
const [nodeInfos, setNodeInfos] = useState({});
|
||||
const [coreInfos, setCoreInfos] = useState({});
|
||||
const [isUsingGateway, setIsUsingGateway] = useState(false);
|
||||
@ -68,22 +68,27 @@ export const CoreSyncStatus = () => {
|
||||
imagePath = syncingImg
|
||||
} else if (isSynchronizing && !isMintingPossible && syncPercent === 100) {
|
||||
imagePath = syncingImg;
|
||||
message = `Synchronized (Not Minting)`
|
||||
message = `Synchronizing ${isUsingGateway ? '' :'(Not Minting)'}`
|
||||
} else if (!isSynchronizing && !isMintingPossible && syncPercent === 100) {
|
||||
imagePath = syncedImg
|
||||
message = `Synchronized (Not Minting)`
|
||||
message = `Synchronized ${isUsingGateway ? '' :'(Not Minting)'}`
|
||||
} else if (isSynchronizing && isMintingPossible && syncPercent === 100) {
|
||||
imagePath = syncedMintingImg;
|
||||
message = `Synchronized (Minting)`
|
||||
imagePath = syncingImg;
|
||||
message = `Synchronizing ${isUsingGateway ? '' :'(Minting)'}`
|
||||
} else if (!isSynchronizing && isMintingPossible && syncPercent === 100) {
|
||||
imagePath = syncedMintingImg;
|
||||
message = `Synchronized (Minting)`
|
||||
message = `Synchronized ${isUsingGateway ? '' :'(Minting)'}`
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className="tooltip" style={{ display: 'inline' }}>
|
||||
<span><img src={imagePath} style={{ height: 'auto', width: '24px' }} alt="sync status" /></span>
|
||||
<div className="bottom">
|
||||
<span><img src={imagePath} style={{ height: 'auto', width: imageSize ? imageSize : '24px' }} alt="sync status" /></span>
|
||||
<div className="bottom" style={{
|
||||
right: position && 'unset',
|
||||
left: position && '0px'
|
||||
}}>
|
||||
<h3>Core Information</h3>
|
||||
<h4 className="lineHeight">Core Version: <span style={{ color: '#03a9f4' }}>{buildVersion}</span></h4>
|
||||
<h4 className="lineHeight">{message}</h4>
|
||||
|
@ -20,7 +20,7 @@ import { Save } from "../Save/Save";
|
||||
import { useRecoilState } from "recoil";
|
||||
import { enabledDevModeAtom } from "../../atoms/global";
|
||||
|
||||
export const IconWrapper = ({ children, label, color, selected }) => {
|
||||
export const IconWrapper = ({ children, label, color, selected, disableWidth }) => {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@ -29,8 +29,8 @@ export const IconWrapper = ({ children, label, color, selected }) => {
|
||||
alignItems: "center",
|
||||
gap: "5px",
|
||||
flexDirection: "column",
|
||||
height: "89px",
|
||||
width: "89px",
|
||||
height: disableWidth ? 'auto' : "89px",
|
||||
width: disableWidth ? 'auto' : "89px",
|
||||
borderRadius: "50%",
|
||||
backgroundColor: selected ? "rgba(28, 29, 32, 1)" : "transparent",
|
||||
}}
|
||||
|
@ -16,7 +16,7 @@ import { getFee } from "../../background";
|
||||
import { CustomizedSnackbars } from "../Snackbar/Snackbar";
|
||||
import { SaveIcon } from "../../assets/svgs/SaveIcon";
|
||||
import { IconWrapper } from "../Desktop/DesktopFooter";
|
||||
export const Save = ({ isDesktop }) => {
|
||||
export const Save = ({ isDesktop, disableWidth }) => {
|
||||
const [pinnedApps, setPinnedApps] = useRecoilState(sortablePinnedAppsAtom);
|
||||
const [settingsQdnLastUpdated, setSettingsQdnLastUpdated] = useRecoilState(
|
||||
settingsQDNLastUpdatedAtom
|
||||
@ -160,6 +160,7 @@ export const Save = ({ isDesktop }) => {
|
||||
>
|
||||
{isDesktop ? (
|
||||
<IconWrapper
|
||||
disableWidth={disableWidth}
|
||||
color="rgba(250, 250, 250, 0.5)"
|
||||
label="Save"
|
||||
selected={false}
|
||||
|
Loading…
x
Reference in New Issue
Block a user