Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alimaktabi committed Jan 30, 2024
2 parents ab046ec + 25d0c00 commit aebb06f
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 15 deletions.
9 changes: 5 additions & 4 deletions components/containers/modals/brightConnectionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,13 @@ export const BrightConnectionModalBody = () => {
)}
<span className="flex mb-3">
<Icon
className="mr-2 mb-3"
className="mr-2 mb-4"
iconSrc="/assets/images/modal/gray-danger.svg"
/>
<p className="text-xs w-88 text-gray90 font-light">
Submit Verification after verifing with brighID app. This might take
up to 5 minutes.
<p className="text-xs text-center text-gray90 font-light">
Submit Verification after verifing with brighID app.
<br />
This might take up to 5 minutes.
</p>
</span>
{refreshUserProfile && (
Expand Down
44 changes: 44 additions & 0 deletions components/layout/UserAuthStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"use client";
import { useRef, useState } from "react";
import { useOutsideClick } from "@/utils/hooks/dom";
import { useUserProfileContext } from "@/context/userProfile";
import { RenderNavbarWalletAddress, ProfileDropdown } from "./auth";

export const UserAuthStatus = () => {
const divRef = useRef<HTMLDivElement>(null);

const [dropDownActive, setDropDownActive] = useState(false);

useOutsideClick(divRef, () => setDropDownActive(false));

const { userProfile } = useUserProfileContext();

return (
<div ref={divRef} className="md:relative ml-5">
<div className={`ml-5 p-[1px] rounded-lg mr-3`} id="profile-dropdown">
<div className="cursor-pointer flex rounded-lg h-9 items-center justify-between bg-gray40">
<div
onClick={() => {
if (!userProfile) return;
setDropDownActive(!dropDownActive);
}}
className="cursor-pointer relative z-20 pr-0.5 pl-2 flex rounded-lg h-9 items-center justify-between bg-gray40"
>
<span className="ml-2 hidden md:block text-sm">
@ {userProfile?.username || `User${userProfile.pk}`}
</span>

<span className="text-gray90 hidden md:block ml-8 mr-5">
level: ?{" "}
</span>
<RenderNavbarWalletAddress />
</div>

{dropDownActive && (
<ProfileDropdown setDropDownActive={setDropDownActive} />
)}
</div>
</div>
</div>
);
};
2 changes: 1 addition & 1 deletion components/layout/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const WalletItem = ({
);
};

const ProfileDropdown: FC<{
export const ProfileDropdown: FC<{
setDropDownActive: (isActive: boolean) => void;
}> = ({ setDropDownActive }) => {
const { userProfile, logout, setHoldUserLogout } = useUserProfileContext();
Expand Down
24 changes: 19 additions & 5 deletions constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ import {
optimism,
mainnet,
sepolia,
base,
mantle,
thunderTestnet,
} from "viem/chains";

const IDChain = {
Expand All @@ -45,7 +48,7 @@ const IDChain = {

export const kccMainnet = {
id: 321,
name: "KuCoin Community Chain",
name: "KCC Mainnet",
network: "KuCoin",
nativeCurrency: { name: "KuCoin Token", symbol: "KCS", decimals: 18 },
rpcUrls: {
Expand Down Expand Up @@ -88,8 +91,11 @@ export const kccMainnet = {
export const supportedChains = [
sepolia,
mainnet,
avalanche,
{ ...avalanche, name: "Avalanche C-Chain" },
bsc,
base,
mantle,
thunderTestnet,
{ ...polygon, name: "Polygon Mainnet" },
{
...fantom,
Expand All @@ -115,18 +121,26 @@ export const supportedChains = [
IDChain,
optimism,
meter,
zetachainAthensTestnet,
{
...zetachainAthensTestnet,
name: "ZetaChain Athens 3 Testnet",
rpcUrls: {
...zetachainAthensTestnet.rpcUrls,
default: { http: ["https://rpc.ankr.com/zetachain_evm_athens_testnet"] },
public: { http: ["https://rpc.ankr.com/zetachain_evm_athens_testnet"] },
},
},
scroll,
xdc,
arbitrum,
telos,
harmonyOne,
{ ...harmonyOne, name: "Harmony Mainnet Shard 0" },
celo,
opBNBTestnet,
linea,
lineaTestnet,
arbitrumNova,
scrollSepolia,
{ ...scrollSepolia, name: "Scroll Sepolia Testnet" },
kccMainnet,
opBNB,
];
Expand Down
6 changes: 3 additions & 3 deletions context/gasTapProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const GasTapProvider: FC<
);
}, []);

const updateOneTimeClaimedList = async () => {
const updateOneTimeClaimedList = useCallback(async () => {
if (!userToken) return;

try {
Expand All @@ -188,7 +188,7 @@ export const GasTapProvider: FC<
console.warn("error fetching users claimed list");
console.error(e);
}
};
}, [userToken]);

const updateActiveClaimHistory = useCallback(async () => {
if (userToken && userProfile) {
Expand Down Expand Up @@ -306,7 +306,7 @@ export const GasTapProvider: FC<
updateActiveClaimHistory();
updateOneTimeClaimedList();
updateFuelChampionList();
}, [updateChainList]);
}, []);

useEffect(() => {
if (!userToken || chainList.length) return;
Expand Down
4 changes: 4 additions & 0 deletions utils/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export async function loginOrRegister(
}
);

response.data.username = response.data.username ?? `User${response.data?.pk}`;

return response.data;
}

Expand All @@ -73,6 +75,8 @@ export async function getUserProfileWithTokenAPI(token: string) {
},
}
);

response.data.username = response.data.username ?? `User${response.data?.pk}`;
return response.data;
}

Expand Down
2 changes: 0 additions & 2 deletions utils/api/gastap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export async function getWeeklyChainClaimLimitAPI() {
return prev;
}, {} as Settings);

console.log(result);

return result;
}

Expand Down

0 comments on commit aebb06f

Please sign in to comment.