Skip to content

Commit 8d4dced

Browse files
committed
feat: added D_D image for the db user.image field
1 parent b5bab2f commit 8d4dced

File tree

3 files changed

+38
-37
lines changed

3 files changed

+38
-37
lines changed

next.config.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ const withMDX = nextMDX({
2020
/** @type {import("next").NextConfig} */
2121
const config = {
2222
reactStrictMode: true,
23-
23+
images: {
24+
remotePatterns: [
25+
{
26+
protocol: "https",
27+
hostname: "www.developerdao.com",
28+
port: "",
29+
pathname: "D_D_logo-dark.svg",
30+
},
31+
],
32+
},
2433
/**
2534
* If you have the "experimental: { appDir: true }" setting enabled, then you
2635
* must comment the below `i18n` config out.

src/components/Topbar.tsx

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import SchoolOfCodeLogo from "./SchoolOfCodeLogo";
2626
import { useRouter } from "next/router";
2727
import { getCsrfToken, signIn, signOut, useSession } from "next-auth/react";
2828
import { api } from "@/utils/api";
29-
// import { renderDataURI } from "@codingwithmanny/blockies";
3029
// SIWE Integration
3130
import { SiweMessage } from "siwe";
3231
import {
@@ -39,6 +38,28 @@ import {
3938
import { InjectedConnector } from "wagmi/connectors/injected";
4039
import { useEffect, useState } from "react";
4140

41+
interface NavItem {
42+
label: string;
43+
subLabel?: string;
44+
children?: Array<NavItem>;
45+
href?: string;
46+
}
47+
48+
const NAV_ITEMS: Array<NavItem> = [
49+
{
50+
label: "Home",
51+
href: "/",
52+
},
53+
{
54+
label: "Get Started",
55+
href: "/getting-started",
56+
},
57+
{
58+
label: "Tracks",
59+
href: "/lessons",
60+
},
61+
];
62+
4263
export default function Topbar() {
4364
const { isOpen, onToggle } = useDisclosure();
4465
const router = useRouter();
@@ -61,8 +82,6 @@ export default function Topbar() {
6182
const { disconnect } = useDisconnect();
6283
const { chain } = useNetwork();
6384

64-
console.log({ address, isConnected });
65-
6685
// Functions
6786
/**
6887
* Attempts SIWE and establish session
@@ -157,14 +176,6 @@ export default function Topbar() {
157176
<SchoolOfCodeLogo autoStart={true} loop={true} />
158177
)}
159178
</Link>
160-
{/* <Text
161-
textAlign={useBreakpointValue({ base: 'center', md: 'left' })}
162-
fontFamily={'heading'}
163-
color={useColorModeValue('gray.800', 'white')}
164-
>
165-
Logo
166-
</Text> */}
167-
168179
<Flex
169180
justify={"flex-end"}
170181
alignItems="center"
@@ -394,25 +405,3 @@ const MobileNavItem = ({ label, children, href }: NavItem) => {
394405
</Stack>
395406
);
396407
};
397-
398-
interface NavItem {
399-
label: string;
400-
subLabel?: string;
401-
children?: Array<NavItem>;
402-
href?: string;
403-
}
404-
405-
const NAV_ITEMS: Array<NavItem> = [
406-
{
407-
label: "Home",
408-
href: "/",
409-
},
410-
{
411-
label: "Get Started",
412-
href: "/getting-started",
413-
},
414-
{
415-
label: "Tracks",
416-
href: "/lessons",
417-
},
418-
];

src/server/auth.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ declare module "next-auth" {
2626
interface Session extends DefaultSession {
2727
user: {
2828
id: string;
29+
image: string;
2930
// ...other properties
3031
// role: UserRole;
3132
} & DefaultSession["user"];
@@ -55,7 +56,6 @@ export const authOptions: (ctxReq: CtxOrReq) => NextAuthOptions = ({
5556
user: {
5657
...session.user,
5758
id: token.sub,
58-
image: "https://www.fillmurray.com/128/128",
5959
},
6060
} as Session & { user: { id: string } }),
6161
// OTHER CALLBACKS to take advantage of but not needed
@@ -133,6 +133,7 @@ export const authOptions: (ctxReq: CtxOrReq) => NextAuthOptions = ({
133133
// }) => {},
134134
// session: async (message: { session: Session; token: JWT }) => {}
135135
// },
136+
// debug: true, // For debugging
136137
providers: [
137138
CredentialsProvider({
138139
// ! Don't add this
@@ -187,10 +188,11 @@ export const authOptions: (ctxReq: CtxOrReq) => NextAuthOptions = ({
187188
user = await prisma.user.create({
188189
data: {
189190
address: fields.address,
191+
image: "https://www.developerdao.com/D_D_logo-dark.svg",
190192
},
191193
});
192194
// create account
193-
const account = await prisma.account.create({
195+
await prisma.account.create({
194196
data: {
195197
userId: user.id,
196198
type: "credentials",
@@ -203,7 +205,8 @@ export const authOptions: (ctxReq: CtxOrReq) => NextAuthOptions = ({
203205
return {
204206
// Pass user id instead of address
205207
// id: fields.address
206-
id: user.id,
208+
// id: user.id,
209+
...user,
207210
};
208211
} catch (error) {
209212
// Uncomment or add logging if needed

0 commit comments

Comments
 (0)