Skip to content

Commit 0b801b4

Browse files
authored
Fix providers and re-create DB (#94)
1 parent 13e2216 commit 0b801b4

File tree

21 files changed

+219
-111
lines changed

21 files changed

+219
-111
lines changed

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
NEXTAUTH_SECRET=toBeChanged
44
GOOGLE_CLIENT_ID=toBeChanged
55
GOOGLE_CLIENT_SECRET=toBeChanged
6-
FACEBOOK_CLIENT_ID=toBeChanged
7-
FACEBOOK_CLIENT_SECRET=toBeChanged
86

97
# If not set, BASE_URL and NEXTAUTH_URL will default to VERCEL_URL
108
BASE_URL=http://localhost:3000

drizzle/0000_nebulous_mauler.sql renamed to drizzle/0000_mute_harrier.sql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
CREATE TABLE `place` (
22
`id` serial AUTO_INCREMENT NOT NULL,
3-
`title` text NOT NULL,
4-
`createdAt` timestamp NOT NULL DEFAULT (now()),
3+
`name` text NOT NULL,
54
CONSTRAINT `place_id` PRIMARY KEY(`id`)
65
);
76
--> statement-breakpoint
@@ -15,7 +14,7 @@ CREATE TABLE `account` (
1514
`expires_at` int,
1615
`token_type` varchar(255),
1716
`scope` varchar(255),
18-
`id_token` varchar(255),
17+
`id_token` text,
1918
`session_state` varchar(255),
2019
CONSTRAINT `account_provider_providerAccountId` PRIMARY KEY(`provider`,`providerAccountId`)
2120
);

drizzle/meta/0000_snapshot.json

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": "5",
33
"dialect": "mysql",
4-
"id": "5b2a885d-a094-435d-9d05-24c29fb45d98",
4+
"id": "7ed78391-6147-422a-aabe-4142c0e039c0",
55
"prevId": "00000000-0000-0000-0000-000000000000",
66
"tables": {
77
"place": {
@@ -14,20 +14,12 @@
1414
"notNull": true,
1515
"autoincrement": true
1616
},
17-
"title": {
18-
"name": "title",
17+
"name": {
18+
"name": "name",
1919
"type": "text",
2020
"primaryKey": false,
2121
"notNull": true,
2222
"autoincrement": false
23-
},
24-
"createdAt": {
25-
"name": "createdAt",
26-
"type": "timestamp",
27-
"primaryKey": false,
28-
"notNull": true,
29-
"autoincrement": false,
30-
"default": "(now())"
3123
}
3224
},
3325
"indexes": {},
@@ -110,7 +102,7 @@
110102
},
111103
"id_token": {
112104
"name": "id_token",
113-
"type": "varchar(255)",
105+
"type": "text",
114106
"primaryKey": false,
115107
"notNull": false,
116108
"autoincrement": false

drizzle/meta/_journal.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
{
66
"idx": 0,
77
"version": "5",
8-
"when": 1697215727115,
9-
"tag": "0000_nebulous_mauler",
8+
"when": 1697892204087,
9+
"tag": "0000_mute_harrier",
1010
"breakpoints": true
1111
}
1212
]

src/app/[locale]/(app)/explore/_components/place-list.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ export const PlaceList: FC<Omit<HTMLAttributes<HTMLElement>, 'children'>> = ({
3434
key={place.id}
3535
className="flex items-center justify-between rounded border border-gray-500 px-4 py-2"
3636
>
37-
<span className="text-lg">{place.title}</span>
38-
<span className="text-sm text-gray-500">
39-
{t('createdDate', { createdDate: place.createdAt })}
40-
</span>
37+
<span className="text-lg">{place.name}</span>
4138
</li>
4239
))}
4340
</ul>
Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,31 @@
11
'use client'
22

33
import { Button } from '@nextui-org/button'
4-
import { IconBrandFacebook, IconBrandGoogle } from '@tabler/icons-react'
54
import { signIn } from 'next-auth/react'
65
import { useTranslations } from 'next-intl'
76
import { FC } from 'react'
7+
import { GoogleGLogo } from '~/components/icons/google-g-logo'
88
import { cn } from '~/helpers/cn'
99

1010
export const ContinueWithProvider: FC<{
1111
className?: string
12-
isProduction?: boolean
13-
}> = ({ className, isProduction }) => {
12+
}> = ({ className }) => {
1413
const t = useTranslations('profile.login')
1514

1615
return (
1716
<div
18-
className={cn(
19-
'grid grid-cols-2 gap-2 xs:gap-4',
20-
!isProduction &&
21-
'relative cursor-not-allowed after:pointer-events-none after:absolute after:-inset-2 after:z-10 after:flex after:items-center after:justify-center after:rounded-xl after:bg-stone-200/70 after:px-4 after:text-center after:font-bold after:opacity-0 after:transition-opacity after:duration-300 after:ease-in-out after:content-[attr(data-after)] hover:after:opacity-100',
22-
className
23-
)}
17+
className={cn('flex flex-wrap items-center justify-center', className)}
2418
data-after={t('not-supported')}
25-
tabIndex={isProduction ? undefined : -1}
26-
aria-hidden={!isProduction}
2719
>
2820
<Button
29-
onClick={() =>
30-
signIn('google', { callbackUrl: '/api/auth/callback/google' })
31-
}
21+
onClick={() => signIn('google')}
3222
variant="solid"
33-
className="bg-rose-600 text-white"
34-
startContent={<IconBrandGoogle size={20} />}
23+
className=" border border-stone-200 bg-white text-stone-800 shadow-md"
24+
fullWidth
25+
startContent={<GoogleGLogo size={20} />}
3526
>
3627
<span className="flex-grow">{t('providers.google')}</span>
3728
</Button>
38-
<Button
39-
onClick={() =>
40-
signIn('facebook', { callbackUrl: '/api/auth/callback/facebook' })
41-
}
42-
variant="solid"
43-
className="bg-blue-600 text-white"
44-
startContent={<IconBrandFacebook size={20} />}
45-
>
46-
<span className="flex-grow">{t('providers.facebook')}</span>
47-
</Button>
4829
</div>
4930
)
5031
}

src/app/[locale]/(app)/profile/_components/profile-login.tsx

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,37 @@ import { FC } from 'react'
33
import { LinkButton } from '~/components/link-button'
44
import { ContinueWithProvider } from './continue-with-provider'
55
import { ContinueWithEmail } from './continue-with-email'
6-
import { env } from 'process'
6+
import { RegisterBanner } from './register-banner'
77

88
export const ProfileLogin: FC = () => {
99
const t = useTranslations('profile.login')
1010

1111
return (
1212
<>
13-
<div className="h-auto rounded-xl bg-gradient-to-br from-indigo-500 via-purple-500 to-pink-500 bg-cover bg-center object-fill p-6 text-white shadow-lg shadow-purple-500/50">
14-
<div className="mb-10 ">
15-
<p className="text-sm font-bold uppercase">{t('banner.subtitle')}</p>
16-
<h3 className="font-title text-3xl font-bold">{t('banner.title')}</h3>
17-
<p className="text-lg leading-none">{t('banner.text')}</p>
13+
<RegisterBanner />
14+
15+
<div className="mx-auto mt-10 max-w-sm">
16+
<h2 className="mb-2 text-center font-title text-2xl font-semibold uppercase text-stone-800">
17+
{t('login')}
18+
</h2>
19+
<ContinueWithEmail />
20+
21+
<div className="mb-2 mt-4 flex items-center gap-2">
22+
<div className="flex-1 border-t border-stone-300" aria-hidden />
23+
<h3 className=" inline-block font-title text-sm font-medium uppercase text-stone-600">
24+
{t('continue-with')}
25+
</h3>
26+
<div className="flex-1 border-t border-stone-300" aria-hidden />
1827
</div>
28+
<ContinueWithProvider />
1929

20-
<LinkButton
21-
href="/register"
22-
radius="full"
23-
className="bg-white font-medium uppercase text-purple-500"
24-
>
30+
<h2 className="mb-2 mt-10 text-center font-title text-2xl font-semibold uppercase text-stone-800">
31+
{t('register')}
32+
</h2>
33+
<LinkButton href="/register" variant="solid" color="primary" fullWidth>
2534
{t('register')}
2635
</LinkButton>
2736
</div>
28-
29-
<h2 className="mt-8 font-title text-2xl font-medium">
30-
{t('login-with')}
31-
</h2>
32-
<ContinueWithEmail />
33-
<ContinueWithProvider
34-
className="mt-8"
35-
isProduction={env.NODE_ENV === 'production'}
36-
/>
37-
38-
<h2 className="mt-8 font-title text-2xl font-medium">{t('register')}</h2>
39-
<LinkButton href="/register" variant="solid" color="primary">
40-
{t('register')}
41-
</LinkButton>
4237
</>
4338
)
4439
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Button } from '@nextui-org/button'
2+
import { useTranslations } from 'next-intl'
3+
import Link from 'next-intl/link'
4+
import { FC } from 'react'
5+
import { cn } from '~/helpers/cn'
6+
7+
export const RegisterBanner: FC<{
8+
className?: string
9+
}> = ({ className }) => {
10+
const t = useTranslations('profile.register-banner')
11+
return (
12+
<Link
13+
href="/register"
14+
className="block h-auto rounded-xl bg-gradient-to-br from-indigo-500 via-purple-500 to-pink-500 bg-cover bg-center object-fill p-6 text-white shadow-lg shadow-purple-500/50"
15+
>
16+
<div className={cn('mb-10', className)}>
17+
<p className="text-sm font-bold uppercase">{t('subtitle')}</p>
18+
<h3 className="font-title text-3xl font-bold uppercase">
19+
{t('title')}
20+
</h3>
21+
<p className="text-lg leading-none">{t('text')}</p>
22+
</div>
23+
24+
<Button
25+
radius="full"
26+
className="bg-white font-medium uppercase text-purple-500"
27+
tabIndex={-1}
28+
>
29+
{t('register')}
30+
</Button>
31+
</Link>
32+
)
33+
}

src/app/[locale]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getTranslator } from 'next-intl/server'
44
import type { FC } from 'react'
55
import { LanguageSwitcher } from '~/components/language-switcher'
66
import { LinkButton } from '~/components/link-button'
7-
import { Logo } from '~/components/logo'
7+
import { Logo } from '~/components/icons/logo'
88
import type { LocaleRouteParams } from '~/i18n'
99

1010
export async function generateMetadata({
@@ -28,9 +28,10 @@ const HomePage: FC<LocaleRouteParams> = () => {
2828
<main className="mx-auto flex min-h-screen max-w-2xl flex-col items-center justify-center p-4 text-center text-stone-800">
2929
<div className="origin-bottom animate-wiggle">
3030
<Logo
31-
className="anima mb-4 h-24 animate-hover text-brand-600"
31+
className="anima mb-4 animate-hover text-brand-600"
3232
outline
3333
stroke={1.25}
34+
size={96}
3435
/>
3536
</div>
3637

src/app/[locale]/register/layout.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Navbar, NavbarContent, NavbarItem } from '@nextui-org/navbar'
2+
import { useTranslations } from 'next-intl'
3+
import type { FC, PropsWithChildren } from 'react'
4+
import { LinkButton } from '~/components/link-button'
5+
import type { LocaleRouteParams } from '~/i18n'
6+
7+
type RegisterLayoutProps = PropsWithChildren<LocaleRouteParams>
8+
9+
const RegisterLayout: FC<RegisterLayoutProps> = ({ children }) => {
10+
const t = useTranslations('register')
11+
12+
return (
13+
<>
14+
<Navbar
15+
shouldHideOnScroll
16+
isBlurred={false}
17+
isBordered
18+
classNames={{ wrapper: 'max-w-2xl' }}
19+
>
20+
<NavbarContent justify="start">
21+
<NavbarItem>
22+
<h1 className="font-title">{t('heading')}</h1>
23+
</NavbarItem>
24+
</NavbarContent>
25+
<NavbarContent justify="end">
26+
<NavbarItem>
27+
<LinkButton href="/profile" variant="solid" color="primary">
28+
{t('go-to-app')}
29+
</LinkButton>
30+
</NavbarItem>
31+
</NavbarContent>
32+
</Navbar>
33+
34+
<main className="mx-auto max-w-2xl px-6 py-3">{children}</main>
35+
</>
36+
)
37+
}
38+
39+
export default RegisterLayout

src/app/[locale]/register/page.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import type { Metadata } from 'next'
2+
import { useTranslations } from 'next-intl'
3+
import { getTranslator } from 'next-intl/server'
4+
import type { FC } from 'react'
5+
import { UnderConstruction } from '~/components/under-construction'
6+
import type { LocaleRouteParams } from '~/i18n'
7+
8+
export async function generateMetadata({
9+
params,
10+
}: LocaleRouteParams): Promise<Metadata> {
11+
const t = await getTranslator(params.locale, 'register')
12+
return {
13+
title: t('meta.title'),
14+
description: t('meta.description'),
15+
}
16+
}
17+
18+
const RegisterPage: FC<LocaleRouteParams> = () => {
19+
const t = useTranslations('register')
20+
return (
21+
<>
22+
<UnderConstruction />
23+
<p className="text-center">{t('content')}</p>
24+
</>
25+
)
26+
}
27+
28+
export default RegisterPage
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { FC } from 'react'
2+
3+
export const GoogleGLogo: FC<{
4+
className?: string
5+
size?: number
6+
}> = ({ className, size = 24 }) => {
7+
return (
8+
<svg
9+
xmlns="http://www.w3.org/2000/svg"
10+
height={size}
11+
viewBox="0 0 24 24"
12+
width={size}
13+
className={className}
14+
>
15+
<path
16+
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
17+
fill="#4285F4"
18+
/>
19+
<path
20+
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
21+
fill="#34A853"
22+
/>
23+
<path
24+
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
25+
fill="#FBBC05"
26+
/>
27+
<path
28+
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
29+
fill="#EA4335"
30+
/>
31+
<path d="M1 1h22v22H1z" fill="none" />
32+
</svg>
33+
)
34+
}
File renamed without changes.

src/components/navbar/bottom-navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const BottomNavbar = async () => {
6262
}
6363
/>
6464
</ul>
65-
<div className="-z-1 pointer-events-none absolute inset-0 flex items-center justify-center">
65+
<div className="pointer-events-none absolute inset-0 -z-10 flex items-center justify-center">
6666
<DbEnvironmentTag />
6767
</div>
6868
</nav>

src/env.mjs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const server = z.object({
1111

1212
GOOGLE_CLIENT_ID: z.string().min(1),
1313
GOOGLE_CLIENT_SECRET: z.string().min(1),
14-
FACEBOOK_CLIENT_ID: z.string().min(1),
15-
FACEBOOK_CLIENT_SECRET: z.string().min(1),
1614

1715
BASE_URL: z.string().regex(/https?:\/\/\w+(\.\w+)*(:\d{4})?/),
1816
NEXTAUTH_URL: z.string().regex(/https?:\/\/\w+(\.\w+)*(:\d{4})?/),
@@ -71,10 +69,6 @@ const processEnv = {
7169
process.env.GOOGLE_CLIENT_ID ?? FAKE_VALUE_ONLY_FOR_DEVELOPMENT,
7270
GOOGLE_CLIENT_SECRET:
7371
process.env.GOOGLE_CLIENT_SECRET ?? FAKE_VALUE_ONLY_FOR_DEVELOPMENT,
74-
FACEBOOK_CLIENT_ID:
75-
process.env.FACEBOOK_CLIENT_ID ?? FAKE_VALUE_ONLY_FOR_DEVELOPMENT,
76-
FACEBOOK_CLIENT_SECRET:
77-
process.env.FACEBOOK_CLIENT_SECRET ?? FAKE_VALUE_ONLY_FOR_DEVELOPMENT,
7872

7973
BASE_URL: process.env.BASE_URL ?? VERCEL_URL_WITH_PROTOCOL,
8074
VERCEL_URL: process.env.VERCEL_URL,

0 commit comments

Comments
 (0)