From 97b1b3230e109979e5e1be21c07a02bc1dddb03b Mon Sep 17 00:00:00 2001 From: liushuxiang <276900785@qq.com> Date: Tue, 16 May 2023 18:19:49 +0800 Subject: [PATCH] feat: add announcement --- package.json | 1 + pnpm-lock.yaml | 26 ++++++++ prisma/schema.prisma | 20 ++++++ src/app/[locale]/(account)/account/page.tsx | 2 + .../[locale]/(account)/account/team/page.tsx | 3 +- .../[locale]/(authentication)/login/page.tsx | 7 +-- src/app/[locale]/layout.tsx | 2 + src/app/api/auth/[...nextauth]/route.ts | 21 +++---- src/app/layout.tsx | 6 +- src/components/announcement/index.tsx | 62 +++++++++++++++++++ src/components/auth/avatar.tsx | 6 +- src/components/auth/form.tsx | 24 ++++++- src/locales/en.json | 8 ++- src/locales/zh-CN.json | 6 ++ 14 files changed, 170 insertions(+), 24 deletions(-) create mode 100644 src/components/announcement/index.tsx diff --git a/package.json b/package.json index 9fb2f14..6b64124 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@radix-ui/react-popover": "1.0.5", "@radix-ui/react-select": "1.2.1", "@radix-ui/react-slider": "1.1.1", + "@radix-ui/react-toast": "^1.1.3", "@sentry/nextjs": "7.52.1", "@svgr/webpack": "8.0.1", "@types/node": "20.1.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 374c704..078e78e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,6 +31,9 @@ dependencies: '@radix-ui/react-slider': specifier: 1.1.1 version: 1.1.1(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-toast': + specifier: ^1.1.3 + version: 1.1.3(react-dom@18.2.0)(react@18.2.0) '@sentry/nextjs': specifier: 7.52.1 version: 7.52.1(next@13.4.2)(react@18.2.0) @@ -2250,6 +2253,29 @@ packages: react: 18.2.0 dev: false + /@radix-ui/react-toast@1.1.3(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-yHFgpxi9wjbfPvpSPdYAzivCqw48eA1ofT8m/WqYOVTxKPdmQMuVKRYPlMmj4C1d6tJdFj/LBa1J4iY3fL4OwQ==} + peerDependencies: + react: ^16.8 || ^17.0 || ^18.0 + react-dom: ^16.8 || ^17.0 || ^18.0 + dependencies: + '@babel/runtime': 7.21.5 + '@radix-ui/primitive': 1.0.0 + '@radix-ui/react-collection': 1.0.2(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-compose-refs': 1.0.0(react@18.2.0) + '@radix-ui/react-context': 1.0.0(react@18.2.0) + '@radix-ui/react-dismissable-layer': 1.0.3(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-portal': 1.0.2(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-presence': 1.0.0(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-primitive': 1.0.2(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-use-callback-ref': 1.0.0(react@18.2.0) + '@radix-ui/react-use-controllable-state': 1.0.0(react@18.2.0) + '@radix-ui/react-use-layout-effect': 1.0.0(react@18.2.0) + '@radix-ui/react-visually-hidden': 1.0.2(react-dom@18.2.0)(react@18.2.0) + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + /@radix-ui/react-use-callback-ref@1.0.0(react@18.2.0): resolution: {integrity: sha512-GZtyzoHz95Rhs6S63D2t/eqvdFCm7I+yHMLVQheKM7nBD8mbZIt+ct1jz4536MDnaOGKIxynJ8eHTkVGVVkoTg==} peerDependencies: diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 70c92e1..7a4fa5e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -10,6 +10,25 @@ datasource db { url = env("DATABASE_URL") } +model Account { + id String @id @default(cuid()) + userId String + type String + provider String + providerAccountId String + refresh_token String? @db.Text + access_token String? @db.Text + expires_at Int? + token_type String? + scope String? + id_token String? @db.Text + session_state String? + + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + + @@unique([provider, providerAccountId]) +} + model Session { id String @id @default(cuid()) sessionToken String @unique @@ -25,6 +44,7 @@ model User { emailVerified DateTime? image String? sessions Session[] + accounts Account[] } model VerificationToken { diff --git a/src/app/[locale]/(account)/account/page.tsx b/src/app/[locale]/(account)/account/page.tsx index 7051369..d33bc2a 100644 --- a/src/app/[locale]/(account)/account/page.tsx +++ b/src/app/[locale]/(account)/account/page.tsx @@ -114,6 +114,8 @@ const Account: React.FC = () => {