Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b25b705
add: 'Sign in with Google'
yuto-trd Aug 6, 2024
25c8eb0
feat: Persistent refresh token
yuto-trd Aug 6, 2024
649400c
feat: override linkAccount to update when account exists
yuto-trd Aug 7, 2024
cc79a8d
chore: Add Google authentication credentials to .env.local.sample
yuto-trd Aug 8, 2024
b08af05
feat: Add Google Calendar integration for Google sign-in users
yuto-trd Aug 8, 2024
a368384
fix: typo
yuto-trd Aug 8, 2024
4cb3ec2
feat: Update linkCalendar and unlinkCalendar functions to use async/a…
yuto-trd Aug 8, 2024
02a918a
fix: Add redirect after linking/unlinking calendar
yuto-trd Aug 8, 2024
4863e6e
feat: introduce vercel/postgres
yuto-trd Aug 9, 2024
a8203cf
feat: Add Discord API dependencies
yuto-trd Aug 9, 2024
b610634
feat: Synchronize events when calendar link settings are changed.
yuto-trd Aug 9, 2024
ae2a9cb
refactor: index.ts
yuto-trd Aug 9, 2024
1f7a78b
fix: recurrenceUtil.ts
yuto-trd Aug 9, 2024
b1a2a11
Update src/utils/calendar/recurrenceUtil.ts
yuto-trd Aug 11, 2024
8e8c21b
Update src/utils/calendar/types.ts
yuto-trd Aug 11, 2024
4fbc21d
Update src/auth.ts
yuto-trd Aug 13, 2024
54062ae
feat: Added Google Calendar API request body type
yuto-trd Aug 13, 2024
6ca6ea9
chore: Add description to biome-ignore
yuto-trd Aug 13, 2024
778b6ef
chore: rename linkAccount function called at "Update Google Profile" …
yuto-trd Aug 13, 2024
1a10f49
feat: Delete refresh token from db when it is invalid
yuto-trd Aug 13, 2024
0350ad8
feat: Show calendar link errors
yuto-trd Aug 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.local.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ AUTH_DISCORD_SECRET=
AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=

AUTH_GOOGLE_ID=
AUTH_GOOGLE_SECRET=

POSTGRES_URL=

AUDIT_LOG_WEBHOOK=
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"dependencies": {
"@auth/core": "^0.34.2",
"@auth/pg-adapter": "^1.4.2",
"@discordjs/rest": "^2.3.0",
"@neondatabase/serverless": "^0.9.4",
"@vercel/postgres": "^0.9.0",
"discord-api-types": "^0.37.93",
"next": "14.2.5",
"next-auth": "5.0.0-beta.20",
"react": "^18",
Expand Down
126 changes: 126 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 31 additions & 20 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
import { auth, signIn, signOut } from '@/auth';
import ButtonInForm from '@/components/ButtonInForm';
import LinkCalendarButton from '@/components/LinkCalendarButton';
import { createOrganizationInvitation } from '@/utils/github';

const ButtonInForm = ({
action,
text,
}: {
action: () => void;
text: string;
}) => (
<form action={action}>
<button
type='submit'
className='px-8 py-4 mt-8 text-lg font-semibold border border-gray-300 rounded-lg transition-colors hover:border-gray-400'
>
{text}
</button>
</form>
);

const SignInButton = ({
service,
text,
}: {
service: 'discord' | 'github';
service: 'discord' | 'github' | 'google';
text: string;
}) => (
<ButtonInForm
Expand Down Expand Up @@ -54,12 +39,19 @@ export default async function Home() {
);
}

const { isJoinedGuild, githubUserID, isJoinedOrganization, name } =
session.user || {};
const {
isJoinedGuild,
githubUserID,
googleUserID,
isJoinedOrganization,
isLinkedToCalendar,
name,
} = session.user || {};

return (
<main className='flex min-h-screen flex-col items-center justify-center p-24'>
<p className='text-2xl font-semibold'>Welcome {name}</p>

{!isJoinedGuild ? (
<DiscordLink />
) : !githubUserID ? (
Expand All @@ -75,10 +67,29 @@ export default async function Home() {
) : (
<></>
)}

{isJoinedGuild && !googleUserID && (
<SignInButton service='google' text='Sign in with Google' />
)}

<SignInButton service='discord' text='Update Discord Profile' />
{githubUserID && (
<SignInButton service='github' text='Update GitHub Profile' />
)}
{googleUserID && (
<>
<SignInButton service='google' text='Update Google Profile' />
{!isLinkedToCalendar ? (
<LinkCalendarButton action='link' text='Link to Google Calendar' />
) : (
<LinkCalendarButton
action='unlink'
text='Unlink from Google Calendar'
/>
)}
</>
)}

<ButtonInForm
action={async () => {
'use server';
Expand Down
Loading