This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d1214f
commit e14fdf7
Showing
21 changed files
with
1,686 additions
and
1,710 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,69 @@ | ||
import { useState } from "react"; | ||
import { useState } from 'react'; | ||
import { | ||
Dialog, | ||
DialogPanel, | ||
DialogTitle, | ||
Transition, | ||
TransitionChild, | ||
} from "@headlessui/react"; | ||
import { | ||
BackwardIcon | ||
} from "@heroicons/react/24/outline"; | ||
import { BackIcon2 } from "@/assets/icons/icons"; | ||
Dialog, | ||
DialogPanel, | ||
DialogTitle, | ||
Transition, | ||
TransitionChild, | ||
} from '@headlessui/react'; | ||
import { BackwardIcon } from '@heroicons/react/24/outline'; | ||
import { BackIcon2 } from '@/assets/icons/icons'; | ||
|
||
type ModalProps = { | ||
open: boolean; | ||
close: () => void; | ||
title: string; | ||
children: React.ReactNode; | ||
open: boolean; | ||
close: () => void; | ||
title: string; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export default function Modal({ open, title, children, close }: ModalProps) { | ||
return ( | ||
<Transition show={open}> | ||
<Dialog className="relative z-10" onClose={close}> | ||
<TransitionChild | ||
enter="ease-out duration-300" | ||
enterFrom="opacity-0" | ||
enterTo="opacity-100" | ||
leave="ease-in duration-200" | ||
leaveFrom="opacity-100" | ||
leaveTo="opacity-0" | ||
> | ||
<div className="fixed inset-0 bg-black bg-opacity-75 transition-opacity" > | ||
</div> | ||
</TransitionChild> | ||
return ( | ||
<Transition show={open}> | ||
<Dialog className="relative z-10" onClose={close}> | ||
<TransitionChild | ||
enter="ease-out duration-300" | ||
enterFrom="opacity-0" | ||
enterTo="opacity-100" | ||
leave="ease-in duration-200" | ||
leaveFrom="opacity-100" | ||
leaveTo="opacity-0" | ||
> | ||
<div className="fixed inset-0 bg-black bg-opacity-75 transition-opacity"></div> | ||
</TransitionChild> | ||
|
||
<div className="fixed inset-0 z-10 w-screen overflow-y-auto"> | ||
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"> | ||
<TransitionChild | ||
enter="ease-out duration-300" | ||
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" | ||
enterTo="opacity-100 translate-y-0 sm:scale-100" | ||
leave="ease-in duration-200" | ||
leaveFrom="opacity-100 translate-y-0 sm:scale-100" | ||
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" | ||
> | ||
<DialogPanel className="relative w-full transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-6xl sm:p-6"> | ||
<div onClick={close} className="w-[38px] cusor-pointer h-[32px] rounded-full flex items-center justify-between px-2 ml-1 bg-primary mt-4 "> | ||
<BackIcon2 /> | ||
</div> | ||
<div className="sm:flex sm:items-start"> | ||
|
||
<div className="mt-3 sm:ml-4 sm:mt-0 sm:text-left"> | ||
<DialogTitle | ||
as="h3" | ||
className="text-base font-semibold leading-6 text-gray-900" | ||
> | ||
{title} | ||
</DialogTitle> | ||
<div className="mt-2">{children}</div> | ||
</div> | ||
</div> | ||
</DialogPanel> | ||
</TransitionChild> | ||
</div> | ||
</div> | ||
</Dialog> | ||
</Transition> | ||
); | ||
<div className="fixed inset-0 z-10 w-screen overflow-y-auto"> | ||
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"> | ||
<TransitionChild | ||
enter="ease-out duration-300" | ||
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" | ||
enterTo="opacity-100 translate-y-0 sm:scale-100" | ||
leave="ease-in duration-200" | ||
leaveFrom="opacity-100 translate-y-0 sm:scale-100" | ||
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" | ||
> | ||
<DialogPanel className="relative w-full transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-6xl sm:p-6"> | ||
<div | ||
onClick={close} | ||
className="w-[38px] cusor-pointer h-[32px] rounded-full flex items-center justify-between px-2 ml-1 bg-primary mt-4 " | ||
> | ||
<BackIcon2 /> | ||
</div> | ||
<div className="sm:flex sm:items-start"> | ||
<div className="mt-3 sm:ml-4 sm:mt-0 sm:text-left"> | ||
<DialogTitle | ||
as="h3" | ||
className="text-base font-semibold leading-6 text-gray-900" | ||
> | ||
{title} | ||
</DialogTitle> | ||
<div className="mt-2">{children}</div> | ||
</div> | ||
</div> | ||
</DialogPanel> | ||
</TransitionChild> | ||
</div> | ||
</div> | ||
</Dialog> | ||
</Transition> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
"use client"; | ||
'use client'; | ||
import { | ||
useAccount, | ||
useDisconnect, | ||
useStarkProfile, | ||
} from "@starknet-react/core"; | ||
import Image from "next/image"; | ||
import { Dispatch, SetStateAction, useEffect, useState } from "react"; | ||
import GenericModal from "./GenericModal"; | ||
useAccount, | ||
useDisconnect, | ||
useStarkProfile, | ||
} from '@starknet-react/core'; | ||
import Image from 'next/image'; | ||
import { Dispatch, SetStateAction, useEffect, useState } from 'react'; | ||
import GenericModal from './GenericModal'; | ||
|
||
const AddressBar = ({ | ||
setOpenConnectedModal, | ||
setOpenConnectedModal, | ||
}: { | ||
setOpenConnectedModal: Dispatch<SetStateAction<boolean>>; | ||
setOpenConnectedModal: Dispatch<SetStateAction<boolean>>; | ||
}) => { | ||
const { address } = useAccount(); | ||
const { data: starkProfile } = useStarkProfile({ | ||
address, | ||
}); | ||
const { address } = useAccount(); | ||
const { data: starkProfile } = useStarkProfile({ | ||
address, | ||
}); | ||
|
||
const toggleModal = () => { | ||
setOpenConnectedModal((prev) => !prev); | ||
}; | ||
const toggleModal = () => { | ||
setOpenConnectedModal((prev) => !prev); | ||
}; | ||
|
||
if (!address) { | ||
return null; | ||
} | ||
if (!address) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<button | ||
onClick={toggleModal} | ||
className="bg-primary py-2 px-4 text-white rounded-full transition duration-300" | ||
> | ||
<span> | ||
{address?.slice(0, 6).concat("...").concat(address?.slice(-5))} | ||
</span> | ||
</button> | ||
); | ||
return ( | ||
<button | ||
onClick={toggleModal} | ||
className="bg-primary py-2 px-4 text-white rounded-full transition duration-300" | ||
> | ||
<span> | ||
{address?.slice(0, 6).concat('...').concat(address?.slice(-5))} | ||
</span> | ||
</button> | ||
); | ||
}; | ||
|
||
export default AddressBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.