Skip to content

Commit

Permalink
Merge branch 'stage' into JP69/token-add-yield-eth
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyParish69 authored Sep 11, 2023
2 parents 378e41c + 51f7e58 commit 908b3b8
Show file tree
Hide file tree
Showing 41 changed files with 1,400 additions and 573 deletions.
2 changes: 1 addition & 1 deletion packages/web/components/cards/rewards-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const RewardsCard: React.FC<{
{image}
<div className="relative z-10 flex items-center justify-end p-4">
<span className="text-osmoverse-white text-sm">{title}</span>
<div className="pl-2 text-osmoverse-600">
<div className="pl-2 text-osmoverse-600 sm:hidden">
<Tooltip content={tooltipContent}>
<Icon id="info" height="14px" width="14px" fill="#958FC0" />
</Tooltip>
Expand Down
7 changes: 4 additions & 3 deletions packages/web/components/cards/stake-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const StakeDashboard: React.FC<{

return (
<GenericMainCard title={t("stake.dashboard")} titleIcon={icon}>
<div className="flex w-full flex-row justify-between py-10">
<div className="flex w-full flex-row justify-between gap-4 py-10 sm:flex-col sm:py-4">
<StakeBalances
title={t("stake.stakeBalanceTitle")}
dollarAmount={String(fiatBalance)}
Expand Down Expand Up @@ -137,11 +137,12 @@ const StakeBalances: React.FC<{
osmoAmount?: string;
}> = ({ title, dollarAmount, osmoAmount }) => {
return (
<div className="flex w-full flex-col justify-center pl-10">
<div className="flex w-full flex-col items-center justify-center text-left">
{/* <div> */}
<span className="caption text-sm text-osmoverse-200 md:text-xs">
{title}
</span>
<h3>{dollarAmount}</h3>
<h3 className="whitespace-nowrap">{dollarAmount}</h3>
<span className="caption text-sm text-osmoverse-200 md:text-xs">
{osmoAmount}
</span>
Expand Down
25 changes: 6 additions & 19 deletions packages/web/components/layouts/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { MainMenu } from "~/components/main-menu";
import { NavBar } from "~/components/navbar";
import NavbarOsmoPrice from "~/components/navbar-osmo-price";
import { MainLayoutMenu } from "~/components/types";
import { useCurrentLanguage, useFeatureFlags, useWindowSize } from "~/hooks";
import { NotifiContextProvider } from "~/integrations/notifi";
import { useCurrentLanguage, useWindowSize } from "~/hooks";

export const MainLayout: FunctionComponent<{
menus: MainLayoutMenu[];
Expand All @@ -28,8 +27,6 @@ export const MainLayout: FunctionComponent<{
({ selectionTest }) => selectionTest?.test(router.pathname) ?? false
);

const featureFlags = useFeatureFlags();

return (
<React.Fragment>
{showFixedLogo && (
Expand All @@ -51,21 +48,11 @@ export const MainLayout: FunctionComponent<{
<NavbarOsmoPrice />
</div>
</article>
{featureFlags.notifications ? (
<NotifiContextProvider>
<NavBar
className="ml-sidebar md:ml-0"
title={selectedMenuItem?.label ?? ""}
menus={menus}
/>
</NotifiContextProvider>
) : (
<NavBar
className="ml-sidebar md:ml-0"
title={selectedMenuItem?.label ?? ""}
menus={menus}
/>
)}
<NavBar
className="ml-sidebar md:ml-0"
title={selectedMenuItem?.label ?? ""}
menus={menus}
/>
<div className="ml-sidebar h-content bg-osmoverse-900 md:ml-0 md:h-content-mobile">
{children}
</div>
Expand Down
19 changes: 9 additions & 10 deletions packages/web/components/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ import {
} from "~/hooks";
import { useFeatureFlags } from "~/hooks/use-feature-flags";
import { useWalletSelect } from "~/hooks/wallet-select";
import { NotifiModal, NotifiPopover } from "~/integrations/notifi";
import { useNotifiBreadcrumb } from "~/integrations/notifi/hooks";
import {
NotifiContextProvider,
NotifiModal,
NotifiPopover,
} from "~/integrations/notifi";
import { ModalBase, ModalBaseProps, SettingsModal } from "~/modals";
import { ProfileModal } from "~/modals/profile";
import { UserUpgradesModal } from "~/modals/user-upgrades";
Expand Down Expand Up @@ -116,8 +119,6 @@ export const NavBar: FunctionComponent<
const router = useRouter();
const { isLoading: isWalletLoading } = useWalletSelect();

const { hasUnreadNotification } = useNotifiBreadcrumb();

useEffect(() => {
const handler = () => {
closeMobileMenuRef.current();
Expand Down Expand Up @@ -309,16 +310,14 @@ export const NavBar: FunctionComponent<
</div>
)}
{featureFlags.notifications && walletSupportsNotifications && (
<>
<NotifiPopover
hasUnreadNotification={hasUnreadNotification}
className="z-40 px-3 outline-none"
/>
<NotifiContextProvider>
<NotifiPopover className="z-40 px-3 outline-none" />
<NotifiModal
isOpen={isNotifiOpen}
onRequestClose={onCloseNotifi}
onOpenNotifi={onOpenNotifi}
/>
</>
</NotifiContextProvider>
)}
<IconButton
aria-label="Open settings dropdown"
Expand Down
24 changes: 24 additions & 0 deletions packages/web/config/generate-chain-infos/source-chain-infos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,14 @@ export const mainnetChainInfos: SimplifiedChainInfo[] = [
coinGeckoId: "pool:watr",
coinImageUrl: "/tokens/watr.png",
},
{
coinDenom: "DGL",
coinMinimalDenom:
"factory/juno1u805lv20qc6jy7c3ttre7nct6uyl20pfky5r7e/DGL",
coinDecimals: 6,
coinGeckoId: "pool:dgl",
coinImageUrl: "/tokens/dgl.png",
},
],
features: ["ibc-transfer", "ibc-go", "wasmd_0.24+", "cosmwasm"],
explorerUrlToTx: "https://www.mintscan.io/juno/txs/{txHash}",
Expand Down Expand Up @@ -4129,6 +4137,22 @@ export const mainnetChainInfos: SimplifiedChainInfo[] = [
coinGeckoId: "pool:usdt.wh",
coinImageUrl: "/tokens/usdt.hole.svg",
},
{
coinDenom: "USDC.wh",
coinMinimalDenom:
"factory/wormhole14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les00fpjx/GGh9Ufn1SeDGrhzEkMyRKt5568VbbxZK2yvWNsd6PbXt",
coinDecimals: 6,
coinGeckoId: "pool:usdc.wh",
coinImageUrl: "/tokens/usdc.hole.svg",
},
{
coinDenom: "WETH.wh",
coinMinimalDenom:
"factory/wormhole14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les00fpjx/5BWqpR48Lubd55szM5i62zK7TFkddckhbT48yy6mNbDp",
coinDecimals: 8,
coinGeckoId: "pool:weth.wh",
coinImageUrl: "/tokens/weth.hole.svg",
},
],
features: ["ibc-transfer", "ibc-go", "cosmwasm"],
explorerUrlToTx: "https://bigdipper.live/wormhole/transactions/{txHash}",
Expand Down
27 changes: 27 additions & 0 deletions packages/web/config/ibc-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2096,6 +2096,33 @@ export const IBCAssetInfos: (IBCAsset & {
depositUrlOverride:
"https://blue.kujira.app/ibc?destination=osmosis-1&source=kaiyo-1&denom=factory%2Fkujira1643jxg8wasy5cfcn7xm8rd742yeazcksqlg4d7%2Fumnta",
},
{
counterpartyChainId: "wormchain",
sourceChannelId: "channel-2186",
destChannelId: "channel-3",
coinMinimalDenom:
"factory/wormhole14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les00fpjx/GGh9Ufn1SeDGrhzEkMyRKt5568VbbxZK2yvWNsd6PbXt",
isVerified: true,
depositUrlOverride: "https://portalbridge.com/cosmos/",
withdrawUrlOverride: "https://portalbridge.com/cosmos/",
},
{
counterpartyChainId: "wormchain",
sourceChannelId: "channel-2186",
destChannelId: "channel-3",
coinMinimalDenom:
"factory/wormhole14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les00fpjx/5BWqpR48Lubd55szM5i62zK7TFkddckhbT48yy6mNbDp",
isVerified: true,
depositUrlOverride: "https://portalbridge.com/cosmos/",
withdrawUrlOverride: "https://portalbridge.com/cosmos/",
},
{
counterpartyChainId: "juno-1",
sourceChannelId: "channel-42",
destChannelId: "channel-0",
coinMinimalDenom:
"factory/juno1u805lv20qc6jy7c3ttre7nct6uyl20pfky5r7e/DGL",
},
].filter((ibcAsset) => {
// validate IBC asset config
if (
Expand Down
33 changes: 33 additions & 0 deletions packages/web/config/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,39 @@ const mainnetPoolPriceRoutes: IntermediateRoute[] = [
spotPriceDestDenom: "uosmo",
destCoinId: "pool:uosmo",
},
{
alternativeCoinId: "pool:usdc.wh",
poolId: "1171",
spotPriceSourceDenom: DenomHelper.ibcDenom(
[{ portId: "transfer", channelId: "channel-2186" }],
"factory/wormhole14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les00fpjx/GGh9Ufn1SeDGrhzEkMyRKt5568VbbxZK2yvWNsd6PbXt"
),
spotPriceDestDenom: "uosmo",
destCoinId: "pool:uosmo",
},
{
alternativeCoinId: "pool:weth.wh",
poolId: "1149",
spotPriceSourceDenom: DenomHelper.ibcDenom(
[{ portId: "transfer", channelId: "channel-2186" }],
"factory/wormhole14ejqjyq8um4p3xfqj74yld5waqljf88fz25yxnma0cngspxe3les00fpjx/5BWqpR48Lubd55szM5i62zK7TFkddckhbT48yy6mNbDp"
),
spotPriceDestDenom: DenomHelper.ibcDenom(
[{ portId: "transfer", channelId: "channel-208" }],
"weth-wei"
),
destCoinId: "pool:weth-wei",
},
{
alternativeCoinId: "pool:dgl",
poolId: "1143",
spotPriceSourceDenom: DenomHelper.ibcDenom(
[{ portId: "transfer", channelId: "channel-42" }],
"factory/juno1u805lv20qc6jy7c3ttre7nct6uyl20pfky5r7e/DGL"
),
spotPriceDestDenom: "uosmo",
destCoinId: "pool:uosmo",
},
{
alternativeCoinId: "pool:yieldeth-wei",
poolId: "1148",
Expand Down
57 changes: 27 additions & 30 deletions packages/web/integrations/notifi/hooks/use-notifi-breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useNotifiClientContext } from "@notifi-network/notifi-react-card";
import dayjs from "dayjs";
import { useEffect, useState } from "react";
import { useEffect, useMemo, useState } from "react";

import { useStore } from "~/stores";

Expand All @@ -12,40 +11,38 @@ export const useNotifiBreadcrumb = () => {
accountStore,
} = useStore();
const { client } = useNotifiClientContext();
const [hasUnreadNotification, setHasUnreadNotification] = useState(false);
const [unreadNotificationCount, setUnreadNotificationCount] = useState(0);
const hasUnreadNotification = useMemo(
() => (unreadNotificationCount > 0 ? true : false),
[unreadNotificationCount]
);

useEffect(() => {
const wallet = accountStore.getWallet(chainId);
if (!wallet?.address || !client?.isAuthenticated) return;

client
.getUnreadNotificationHistoryCount()
.then((res) => {
const unreadNotificationCount = res.count;
setUnreadNotificationCount(unreadNotificationCount);
})
.catch((_e) => {
/* Intentionally empty (Concurrent can only possibly happens here instead of inside interval) */
});

const interval = setInterval(() => {
const wallet = accountStore.getWallet(chainId);
if (!wallet?.address || !client?.isAuthenticated)
return setHasUnreadNotification(true);
const localStorageKey = `lastStoredTimestamp:${wallet.address}`;

client
.getNotificationHistory({ first: 1 })
.then((res) => {
const newestHistoryItem = res.nodes?.[0];
const newestNotificationCreatedDate = newestHistoryItem?.createdDate
? dayjs(newestHistoryItem?.createdDate)
: dayjs("2022-01-05T12:30:00.792Z");

const lastStoredTimestamp = dayjs(
window.localStorage.getItem(localStorageKey)
).isValid()
? dayjs(window.localStorage.getItem(localStorageKey))
: dayjs("2022-01-05T10:30:00.792Z");

if (newestNotificationCreatedDate.isAfter(lastStoredTimestamp)) {
setHasUnreadNotification(true);
} else {
setHasUnreadNotification(false);
}
})
.catch(() => setHasUnreadNotification(true));
}, 5000);
if (!wallet?.address || !client?.isAuthenticated) return;

client.getUnreadNotificationHistoryCount().then((res) => {
const unreadNotificationCount = res.count;
setUnreadNotificationCount(unreadNotificationCount);
});
}, Math.floor(Math.random() * 5000) + 5000); // a random interval between 5 and 10 seconds to avoid spamming the server

return () => clearInterval(interval);
}, [client?.isAuthenticated]);

return { hasUnreadNotification };
return { hasUnreadNotification, unreadNotificationCount };
};
Loading

0 comments on commit 908b3b8

Please sign in to comment.