-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v3-main' into add-guild-page
- Loading branch information
Showing
27 changed files
with
1,798 additions
and
24 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Badge } from "@/components/ui/Badge"; | ||
import { CHAINS, type SupportedChainID } from "@/config/chains"; | ||
|
||
export const ChainIndicator = ({ chain }: { chain: SupportedChainID }) => ( | ||
<Badge size="sm"> | ||
<img | ||
src={CHAINS[chain].icon} | ||
alt={CHAINS[chain].name} | ||
className="size-3.5" | ||
/> | ||
<span>{CHAINS[chain].name}</span> | ||
</Badge> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { PropsWithChildren } from "react"; | ||
|
||
export const DataBlock = ({ children }: PropsWithChildren): JSX.Element => { | ||
return ( | ||
<span className="h-6 break-words rounded-md bg-blackAlpha px-1.5 py-0.5 font-mono text-sm dark:bg-blackAlpha-hard"> | ||
{children} | ||
</span> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"use client"; | ||
|
||
import { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipPortal, | ||
TooltipTrigger, | ||
} from "@/components/ui/Tooltip"; | ||
import { Check } from "@phosphor-icons/react/dist/ssr"; | ||
import { useClipboard } from "foxact/use-clipboard"; | ||
import { useDebouncedState } from "foxact/use-debounced-state"; | ||
import { type PropsWithChildren, useEffect } from "react"; | ||
import { DataBlock } from "./DataBlock"; | ||
|
||
type Props = { | ||
text: string; | ||
}; | ||
|
||
export const DataBlockWithCopy = ({ | ||
text, | ||
children, | ||
}: PropsWithChildren<Props>): JSX.Element => { | ||
const { copied, copy } = useClipboard({ | ||
timeout: 1500, | ||
}); | ||
|
||
/** | ||
* Maintaining a debounced copied state too, so we can change the tooltip content only after the tooltip is actually invisible | ||
*/ | ||
|
||
const [debouncedCopied, debouncilySetState] = useDebouncedState(copied, 200); | ||
|
||
useEffect(() => { | ||
debouncilySetState(copied); | ||
}, [debouncilySetState, copied]); | ||
|
||
const tooltipInCopiedState = copied || debouncedCopied; | ||
|
||
return ( | ||
<Tooltip open={copied || undefined}> | ||
<TooltipTrigger | ||
onClick={() => copy(text)} | ||
className="inline-flex rounded-md" | ||
> | ||
<DataBlock> | ||
<span>{children ?? text}</span> | ||
</DataBlock> | ||
</TooltipTrigger> | ||
|
||
<TooltipPortal> | ||
<TooltipContent side="top" className="flex items-center gap-1.5"> | ||
{tooltipInCopiedState && <Check weight="bold" />} | ||
<span>{tooltipInCopiedState ? "Copied" : "Click to copy"}</span> | ||
</TooltipContent> | ||
</TooltipPortal> | ||
</Tooltip> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { cn } from "@/lib/cssUtils"; | ||
import type { PropsWithChildren } from "react"; | ||
|
||
export const Requirement = ({ | ||
className, | ||
children, | ||
}: PropsWithChildren<{ className?: string }>) => ( | ||
<div className={cn("flex w-full items-center gap-4 py-2", className)}> | ||
{children} | ||
</div> | ||
); | ||
|
||
export const RequirementImage = ({ | ||
className, | ||
children, | ||
}: PropsWithChildren<{ className?: string }>) => ( | ||
<div | ||
className={cn( | ||
"flex size-11 shrink-0 items-center justify-center overflow-hidden rounded-full bg-blackAlpha dark:bg-blackAlpha-hard", | ||
className, | ||
)} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
export const RequirementContent = ({ | ||
className, | ||
children, | ||
}: PropsWithChildren<{ className?: string }>) => ( | ||
<div className={cn("flex flex-grow flex-col items-start", className)}> | ||
{children} | ||
</div> | ||
); | ||
|
||
export const RequirementFooter = ({ | ||
className, | ||
children, | ||
}: PropsWithChildren<{ className?: string }>) => ( | ||
<div | ||
className={cn( | ||
"flex flex-wrap items-center gap-1.5 has-[>*]:mt-1", | ||
className, | ||
)} | ||
> | ||
{children} | ||
</div> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { PropsWithChildren } from "react"; | ||
import { Anchor } from "../ui/Anchor"; | ||
|
||
export const RequirementLink = ({ | ||
href, | ||
children, | ||
}: PropsWithChildren<{ href: string }>) => ( | ||
<Anchor | ||
href={href} | ||
target="_blank" | ||
rel="noopener" | ||
variant="secondary" | ||
showExternal | ||
className="font-medium text-xs" | ||
> | ||
{children} | ||
</Anchor> | ||
); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
"use client"; | ||
|
||
import { cn } from "@/lib/cssUtils"; | ||
import * as TooltipPrimitive from "@radix-ui/react-tooltip"; | ||
import { type VariantProps, cva } from "class-variance-authority"; | ||
import { | ||
type ComponentPropsWithoutRef, | ||
type ElementRef, | ||
type FC, | ||
forwardRef, | ||
} from "react"; | ||
|
||
const tooltipVariants = cva( | ||
"fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-sm animate-in px-3 py-1.5 text-center font-medium font-sans text-sm shadow-md data-[state=closed]:animate-out", | ||
{ | ||
variants: { | ||
variant: { | ||
tooltip: | ||
"bg-tooltip text-tooltip-foreground rounded-xl [&_svg.tooltip-arrow]:fill-tooltip", | ||
popover: | ||
"bg-popover text-popover-foreground rounded-lg outline outline-1 outline-border [&_svg.tooltip-arrow]:fill-popover [&_svg.tooltip-arrow]:[filter:drop-shadow(1px_0_0_hsl(var(--border)))_drop-shadow(-1px_0_0_hsl(var(--border)))_drop-shadow(0_1px_0_hsl(var(--border)))]", | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: "tooltip", | ||
}, | ||
}, | ||
); | ||
|
||
const TooltipProvider = TooltipPrimitive.Provider; | ||
|
||
const Tooltip: FC<ComponentPropsWithoutRef<typeof TooltipPrimitive.Root>> = ({ | ||
...props | ||
}) => <TooltipPrimitive.Root delayDuration={0} {...props} />; | ||
|
||
const TooltipTrigger = forwardRef< | ||
ElementRef<typeof TooltipPrimitive.Trigger>, | ||
ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger> | ||
>(({ className, children, ...props }, ref) => ( | ||
<TooltipPrimitive.Trigger | ||
ref={ref} | ||
className={cn( | ||
"outline-none focus-visible:ring-4 focus-visible:ring-ring", | ||
className, | ||
)} | ||
{...props} | ||
> | ||
{children} | ||
</TooltipPrimitive.Trigger> | ||
)); | ||
|
||
export interface TooltipContentProps | ||
extends ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>, | ||
VariantProps<typeof tooltipVariants> {} | ||
|
||
const TooltipContent = forwardRef< | ||
ElementRef<typeof TooltipPrimitive.Content>, | ||
TooltipContentProps | ||
>(({ className, sideOffset = 4, variant, children, ...props }, ref) => ( | ||
<TooltipPrimitive.Content | ||
ref={ref} | ||
sideOffset={sideOffset} | ||
className={cn(tooltipVariants({ variant, className }))} | ||
{...props} | ||
> | ||
{children} | ||
<TooltipPrimitive.Arrow className="tooltip-arrow" /> | ||
</TooltipPrimitive.Content> | ||
)); | ||
TooltipContent.displayName = TooltipPrimitive.Content.displayName; | ||
|
||
const TooltipPortal = TooltipPrimitive.Portal; | ||
|
||
export { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipProvider, | ||
TooltipTrigger, | ||
TooltipPortal, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { mainnet, sepolia } from "viem/chains"; | ||
import type { Register } from "wagmi"; | ||
|
||
export const CHAINS = { | ||
[mainnet.id]: { | ||
name: mainnet.name, | ||
icon: "/chainLogos/eth.svg", | ||
}, | ||
[sepolia.id]: { | ||
name: sepolia.name, | ||
icon: "/chainLogos/eth.svg", | ||
}, | ||
} satisfies Record< | ||
SupportedChainID, | ||
{ | ||
name: string; | ||
icon: string; | ||
} | ||
>; | ||
|
||
export type SupportedChainID = Register["config"]["chains"][number]["id"]; |
Oops, something went wrong.