Skip to content

Commit

Permalink
Merge branch 'main' into testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBeardEth committed Dec 5, 2023
2 parents 290c8a3 + 76dc284 commit cf742cf
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 23 deletions.
4 changes: 2 additions & 2 deletions apps/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"@realms-world/db": "workspace:*",
"@realms-world/graphql-server": "workspace:*",
"@reservoir0x/reservoir-kit-ui": "^1.20.0",
"@starknet-react/chains": "next",
"@starknet-react/core": "next",
"@starknet-react/chains": "^0.1.0",
"@starknet-react/core": "^2.1.1",
"@starkware-industries/commons-js-enums": "^1.2.0",
"@starkware-industries/commons-js-utils": "^1.2.2",
"@svgr/webpack": "^8.1.0",
Expand Down
27 changes: 17 additions & 10 deletions apps/nextjs/src/app/_components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const DialogOverlay = React.forwardRef<
asChild
>
<motion.div
className="bg-medium-dark-green/50 fixed inset-0 z-50 cursor-pointer backdrop-blur-[10px]"
className="bg-medium-dark-green/50 fixed inset-0 z-40 cursor-pointer backdrop-blur-[10px]"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
Expand All @@ -49,32 +49,39 @@ const DialogOverlay = React.forwardRef<
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;

interface DialogContentProps
extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
close?: boolean;
}

const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>,
DialogContentProps
>(({ close, className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<motion.div
initial={{ y: "200%" }}
animate={{ y: 0 }}
exit={{ y: "200%" }}
transition={{ duration: 0.4, ease: "easeInOut" }}
className="fixed bottom-0 top-0 z-[100] flex items-center"
className="fixed bottom-0 top-0 z-50 flex items-center"
>
<DialogPrimitive.Content
ref={ref}
className={cn(
"bg-dark-green animate-in data-[state=open]:fade-in-90 data-[state=open]:slide-in-from-bottom-10 sm:zoom-in-90 data-[state=open]:sm:slide-in-from-bottom-0 relative my-auto grid max-h-screen w-full gap-4 rounded-b-lg border p-6 sm:max-w-lg sm:rounded-lg",
"bg-dark-green animate-in data-[state=open]:fade-in-90 data-[state=open]:slide-in-from-bottom-10 sm:zoom-in-90 data-[state=open]:sm:slide-in-from-bottom-0 relative z-50 my-auto grid max-h-screen w-full gap-4 rounded-b-lg border p-6 sm:max-w-lg sm:rounded-lg",
className,
)}
{...props}
>
{children}
<DialogPrimitive.Close className="absolute right-5 top-5 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-slate-100 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=open]:bg-slate-800">
<X className="h-6 w-6" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
{close && (
<DialogPrimitive.Close className="absolute right-5 top-5 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-slate-100 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-900 dark:data-[state=open]:bg-slate-800">
<X className="h-6 w-6" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Content>
</motion.div>
</DialogPortal>
Expand Down
6 changes: 3 additions & 3 deletions apps/nextjs/src/app/_components/ui/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Sheet = SheetPrimitive.Root;

const SheetTrigger = SheetPrimitive.Trigger;

const portalVariants = cva("fixed inset-0 z-50 flex", {
const portalVariants = cva("fixed inset-0 z-40 flex", {
variants: {
position: {
top: "items-start",
Expand Down Expand Up @@ -53,7 +53,7 @@ const SheetOverlay = React.forwardRef<
ref={ref}
>
<motion.div
className="fixed inset-0 z-50 cursor-pointer bg-black/50 backdrop-blur-[10px]"
className="fixed inset-0 z-40 cursor-pointer bg-black/50 backdrop-blur-[10px]"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
Expand All @@ -64,7 +64,7 @@ const SheetOverlay = React.forwardRef<
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;

const sheetVariants = cva(
"fixed z-50 scale-100 gap-4 bg-white p-6 opacity-80 bg-dark-green",
"fixed z-40 scale-100 gap-4 bg-white p-6 opacity-80 bg-dark-green",
{
variants: {
position: {
Expand Down
20 changes: 12 additions & 8 deletions apps/nextjs/src/app/_components/wallet/WalletSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ import { StarknetLoginModal } from "./StarknetLoginModal";
},
];*/
export const WalletSheet = () => {
const { address: l2Address, isConnected: isL2Connected } = useL2Account();
const {
address: l2Address,
isConnected: isL2Connected,
chainId,
} = useL2Account();
const { chain } = useNetwork();
const { disconnect } = useDisconnect();
const [isWrongNetwork, setIsWrongNetwork] = useState(false);
Expand All @@ -60,15 +64,15 @@ export const WalletSheet = () => {
process.env.NEXT_PUBLIC_IS_TESTNET === "true" ? "goerli" : "mainnet";

const NETWORK_ID = {
mainnet: "0x534e5f4d41494e",
goerli: "0x534e5f474f45524c49",
mainnet: 23448594291968334n,
goerli: 1536727068981429685321n,
};

useEffect(() => {
if (isL2Connected) {
if (isL2Connected && chainId) {
if (
(chain?.id.toString() === NETWORK_ID.goerli && network === "mainnet") ||
(chain?.id.toString() === NETWORK_ID.mainnet && network === "goerli")
(chainId === NETWORK_ID.goerli && network === "mainnet") ||
(chainId === NETWORK_ID.mainnet && network === "goerli")
) {
setIsWrongNetwork(true);
} else {
Expand Down Expand Up @@ -137,7 +141,7 @@ export const WalletSheet = () => {
Bridge Transactions
</Button>
</DialogTrigger>
<DialogContent className="h-full min-w-[500px] sm:max-h-[80%]">
<DialogContent className="flex h-full min-w-[500px] flex-col sm:max-h-[80%]">
<DialogHeader>
<h6 className="my-0 py-0">Bridge Transactions</h6>
</DialogHeader>
Expand Down Expand Up @@ -174,7 +178,7 @@ export const WalletSheet = () => {

{isWrongNetwork && (
<Dialog open={isWrongNetwork}>
<DialogContent className="w-full">
<DialogContent close={false} className="z-50 h-72 w-full">
<DialogHeader>
<DialogTitle>Wrong Network</DialogTitle>
</DialogHeader>
Expand Down
Binary file modified bun.lockb
Binary file not shown.

0 comments on commit cf742cf

Please sign in to comment.