Skip to content

Commit

Permalink
Merge branch 'add-guild-page' of github.com:guildxyz/guild.xyz into a…
Browse files Browse the repository at this point in the history
…dd-custom-error-handling
  • Loading branch information
dominik-stumpf committed Dec 10, 2024
2 parents 1b0e001 + b5215ec commit 1593e3d
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 28 deletions.
Binary file added public/guild-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions public/walletLogos/brave.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/walletLogos/coinbasewallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions public/walletLogos/walletconnect.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 40 additions & 28 deletions src/components/SignInDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ import {
ResponsiveDialogTitle,
} from "./ui/ResponsiveDialog";

const CUSTOM_CONNECTOR_ICONS = {
"com.brave.wallet": "/walletLogos/brave.svg",
walletConnect: "/walletLogos/walletconnect.svg",
coinbaseWalletSDK: "/walletLogos/coinbasewallet.png",
} as const;

export const SignInDialog = () => {
const { isConnected } = useAccount();
const [open, setOpen] = useAtom(signInDialogOpenAtom);
Expand Down Expand Up @@ -49,34 +55,40 @@ const WalletList = () => {
return (
<div className="grid gap-8">
<div className="grid gap-2">
{connectors.map((connector) => (
<Button
key={connector.uid}
onClick={() => connect({ connector })}
leftIcon={
connector.icon ? (
<img
src={connector.icon}
alt={`${connector.name} icon`}
className="size-6"
/>
) : (
<Wallet weight="bold" className="size-6" />
)
}
size="xl"
isLoading={
!!variables?.connector &&
"id" in variables.connector &&
variables.connector.id === connector.id &&
isPending
}
loadingText="Check your wallet"
className="justify-start"
>
{connector.name}
</Button>
))}
{connectors.map((connector) => {
const connetorIcon =
CUSTOM_CONNECTOR_ICONS[
connector.id as keyof typeof CUSTOM_CONNECTOR_ICONS
] ?? connector.icon;
return (
<Button
key={connector.uid}
onClick={() => connect({ connector })}
leftIcon={
connetorIcon ? (
<img
src={connetorIcon}
alt={`${connector.name} icon`}
className="size-6"
/>
) : (
<Wallet weight="bold" className="size-6" />
)
}
size="xl"
isLoading={
!!variables?.connector &&
"id" in variables.connector &&
variables.connector.id === connector.id &&
isPending
}
loadingText="Check your wallet"
className="justify-start"
>
{connector.name}
</Button>
);
})}
</div>

<div className="grid gap-2 text-center text-foreground-secondary text-sm">
Expand Down
14 changes: 14 additions & 0 deletions src/config/wagmi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { env } from "@/lib/env";
import { http, createConfig } from "wagmi";
import { mainnet, sepolia } from "wagmi/chains";
import { coinbaseWallet, injected, walletConnect } from "wagmi/connectors";

export const wagmiConfig = createConfig({
chains: [mainnet, sepolia],
Expand All @@ -8,6 +10,18 @@ export const wagmiConfig = createConfig({
[sepolia.id]: http(),
},
ssr: true,
connectors: [
injected(),
coinbaseWallet({
appName: "Guild.xyz",
appLogoUrl: "https://guild.xyz/guild-icon.png",
version: "4",
}),
walletConnect({
projectId: env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID,
showQrModal: true,
}),
],
});

declare module "wagmi" {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ export const env = createEnv({
client: {
NEXT_PUBLIC_API: z.string().url(),
NEXT_PUBLIC_PINATA_GATEWAY_URL: z.string().url(),
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID: z.string(),
},
runtimeEnv: {
NEXT_PUBLIC_API: process.env.NEXT_PUBLIC_API_V3,
PINATA_ADMIN_JWT: process.env.PINATA_ADMIN_JWT,
NEXT_PUBLIC_PINATA_GATEWAY_URL: process.env.NEXT_PUBLIC_PINATA_GATEWAY_URL,
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID:
process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID,
LOGGING: process.env.LOGGING,
},
});

0 comments on commit 1593e3d

Please sign in to comment.