Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add statistics page #105

Merged
merged 27 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bc991ec
add statistics page
Nasirdin Apr 25, 2022
84977cd
Merge branch 'main' into add-statistics-page
Nasirdin Apr 25, 2022
96e2976
delete line 138 on Product file
Nasirdin Apr 25, 2022
64e7e5d
error correction
Nasirdin Apr 25, 2022
362c0ff
error correction
Nasirdin Apr 27, 2022
271283c
edit feedback message
Nasirdin Apr 27, 2022
97ca79c
Merge branch 'main' into add-statistics-page
Nasirdin Apr 27, 2022
66ee787
refactoring code
Nasirdin Apr 28, 2022
82cf3a6
draf
Nasirdin May 2, 2022
47c18d5
removing duplicates
Nasirdin May 3, 2022
d1cc274
Merge branch 'main' into add-statistics-page
Nasirdin May 3, 2022
0a7b714
feedback error
Nasirdin May 3, 2022
3b6ec93
error correction
Nasirdin May 6, 2022
a404de1
removing duplicates
Nasirdin May 9, 2022
8466d64
Merge branch 'main' into add-statistics-page
Nasirdin May 9, 2022
ff468fa
refactoring getTransactionsBalance function
Nasirdin May 10, 2022
4d3ac94
Merge branch 'main' into add-statistics-page
Nasirdin May 10, 2022
9606573
refactoring statistics page
Nasirdin May 16, 2022
ee72a10
Merge branch 'main' into add-statistics-page
Nasirdin May 16, 2022
4e5e6f3
refactoring statistics page
Nasirdin May 16, 2022
1398285
add new constants and word correction
Nasirdin May 17, 2022
b8b233d
Merge branch 'main' into add-statistics-page
Nasirdin May 17, 2022
964ad66
add loading
Nasirdin May 19, 2022
1c946a2
add loading
Nasirdin May 19, 2022
82ea524
add loading
Nasirdin May 19, 2022
66febd5
refactoring
Nasirdin May 19, 2022
31067dd
wrapped the function
Nasirdin May 19, 2022
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
2 changes: 1 addition & 1 deletion src/components/Affiliate/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useContext, useState, useEffect } from "react";
import bonusAndDiscountContractAbi from "../../constants/bonusAndDiscountContractAbi.json";
import {
bonusAndDiscountContractsByNetworkId,
cashbackTokenAddresses,
} from "../../constants";
import { Web3ConnecStateContext } from "../WithWeb3Connect";
import bonusAndDiscountContractAbi from "../../constants/bonusAndDiscountContractAbi.json";

import "./index.css";

Expand Down
30 changes: 30 additions & 0 deletions src/components/Footer/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@ footer {
padding: 2rem 0 1rem;
}

.footerItems {
margin-bottom: 20px;
display: flex;
justify-content: center;
list-style-type: none;
}
.footerItem {
position: relative;
padding: 0 10px;
}
.footerLink {
text-decoration: none;
color: var(--link-color);
}
.footerLink:hover {
color: var(--color-notice);
}
.footerItem::after{
content: "";
position: absolute;
right: 0px;
bottom: 0;
height: 20px;
width: 2px;
background-color: #fff;
}
.footerItem:last-child::after{
content: none;
}

.footerRiskNotice {
max-width: 44rem;
margin: 0 auto;
Expand Down
74 changes: 51 additions & 23 deletions src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import GA from 'react-ga';
import GA from "react-ga";
import { MdEmail, MdChat } from "react-icons/md";
import { SiTelegram, SiDiscord } from "react-icons/si";
import { Link } from "react-router-dom";
import useUser from "../../hooks/useUser";
import Referal from '../Referal';
import Referal from "../Referal";

import "./index.css";

const Footer = () => {

const { state: { signed, subscribed } } = useUser();
const {
state: { signed, subscribed },
} = useUser();

const links = [
{
Expand Down Expand Up @@ -41,24 +43,50 @@ const Footer = () => {
return (
<footer>
{signed && subscribed && (
<div>
<Referal/>
<p className="footerRiskNotice">
Risk notification: Our code is based on top audited sources, but our
changes are unaudited from 3rd party auditors. We improve security but a
lot of things are out of our control, for example, 3rd party software
like WordPress, your server's software, your hosting provider. We have
delivered dapps for hundreds of clients which handle tens of thousands
of users. For the past 3 years, we have received about 10 incident
reports kind of "a user lost funds". Unfortunately, not all of them have
been resolved. Ask yourself who other than you can access your server?
When was your last time installing security updates? The most secure
choice would be our cloud solution (with a "revenue-share" payment
model) contact support for more information. For WP standalone versions
please use as less plugins as you can and the "Simply Static plugin" and
"Wodefence" for security.
</p>
</div>
<div>
<Referal />
<ul className="footerItems">
<li className="footerItem">
<Link to="/statistics" className="footerLink">
stats
Disti4ct marked this conversation as resolved.
Show resolved Hide resolved
</Link>
</li>
<li className="footerItem">
<a
href="https://tools.onout.org/sponsor.md"
target="_blanck"
className="footerLink"
>
become a sponsor
</a>
</li>
<li className="footerItem">
<a
href="https://t.me/onoutsupportbot"
target="_blanck"
className="footerLink"
>
contact support
</a>
</li>
</ul>
<p className="footerRiskNotice">
Risk notification: Our code is based on top audited sources, but our
changes are unaudited from 3rd party auditors. We improve security
but a lot of things are out of our control, for example, 3rd party
software like WordPress, your server's software, your hosting
provider. We have delivered dapps for hundreds of clients which
handle tens of thousands of users. For the past 3 years, we have
received about 10 incident reports kind of "a user lost funds".
Unfortunately, not all of them have been resolved. Ask yourself who
other than you can access your server? When was your last time
installing security updates? The most secure choice would be our
cloud solution (with a "revenue-share" payment model) contact
support for more information. For WP standalone versions please use
as less plugins as you can and the "Simply Static plugin" and
"Wodefence" for security.
</p>
</div>
)}

<ul className="linksList">
Expand All @@ -71,7 +99,7 @@ const Footer = () => {
title={title}
onClick={() => {
GA.event({
category: 'Social links',
category: "Social links",
action: gaAction,
});
}}
Expand Down
59 changes: 32 additions & 27 deletions src/components/Product/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,32 +77,34 @@ const Product = ({ id }: ProductProps) => {
});
};

const sendFeedback = useCallback(({
amount,
prefix,
status,
extra,
}: {
amount?: number;
prefix: string;
status: STATUS;
extra?: string;
}) => {
sendMessage({
msg: `
const sendFeedback = useCallback(
({
amount,
prefix,
status,
extra,
}: {
amount?: number;
prefix: string;
status: STATUS;
extra?: string;
}) => {
sendMessage({
msg: `
${prefix} from: ${address};
usd_value: ${addressUSDValue || "don't have usd_value"}
Network: ${networkId || "unsupported"};
Product id: ${id};
USD cost: ${USDPrice};
Crypto cost: ${amount || "don't have amount"};
Date: ${new Date().toISOString()};
${extra || ""}
${extra || ""}
`,
status,
});
}, [address, networkId, addressUSDValue]);

status,
});
},
[address, networkId, addressUSDValue]
);
const getPaymentParameters = useCallback(async () => {
if (!PAYMENT_ADDRESS || !USDPrice || !networkId) return;

Expand Down Expand Up @@ -133,7 +135,7 @@ const Product = ({ id }: ProductProps) => {
const amount = new BigNumber(finalProductPriceInUSD)
.div(assetUSDPrice)
.toNumber();

return {
provider,
networkId,
Expand Down Expand Up @@ -242,14 +244,17 @@ const Product = ({ id }: ProductProps) => {
);
}, [paymentPending, paidFor, signed, isWeb3Loading, account, USDPrice]);

const promoFormHandle = useCallback((e: any) => {
e.preventDefault();
payForProduct();
GA.event({
category: id,
action: 'Press on the "Buy" button',
});
}, [payForProduct]);
const promoFormHandle = useCallback(
(e: any) => {
e.preventDefault();
payForProduct();
GA.event({
category: id,
action: 'Press on the "Buy" button',
});
},
[payForProduct]
);

return (
<div className="product">
Expand Down
4 changes: 3 additions & 1 deletion src/components/Sections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import Tabs from "../Tabs";
import Affiliate from "../Affiliate";

import "./index.css";
import Statistics from "../Statistics";

const Sections = () => {
const location = useLocation();

const { account } = useContext(Web3ConnecStateContext);
const { state } = useUser();
const { signed, subscribed, view} = state;
const { signed, subscribed, view } = state;

if (!signed || !subscribed || account.wrongNetwork) return null;

Expand All @@ -39,6 +40,7 @@ const Sections = () => {
element={<Product id={newView} />}
/>
<Route path={`/affiliate`} element={<Affiliate />} />
<Route path={`/statistics`} element={<Statistics />} />
</Routes>
</div>
);
Expand Down
14 changes: 14 additions & 0 deletions src/components/Statistics/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.statistics {
max-width: 40rem;
margin: 0 auto;
padding: 1.4rem;
border-radius: 1.2rem;
background-color: var(--card-color);
}

.graphUp {
color: greenyellow;
}
.graphDown {
color: red;
}
Loading