Skip to content

Commit

Permalink
feat: add auth
Browse files Browse the repository at this point in the history
  • Loading branch information
vighnesh153 committed Jan 14, 2023
1 parent b7ab1d2 commit 03afd56
Show file tree
Hide file tree
Showing 29 changed files with 966 additions and 247 deletions.
83 changes: 80 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,83 @@
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser


# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
Expand All @@ -10,7 +90,6 @@ coverage

# next.js
.next/
out/
build

# misc
Expand All @@ -32,6 +111,4 @@ yarn-error.log*
# turbo
.turbo

.idea

dist
5 changes: 5 additions & 0 deletions .idea/.gitignore

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

62 changes: 62 additions & 0 deletions .idea/codeStyles/Project.xml

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

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

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

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

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

6 changes: 6 additions & 0 deletions .idea/prettier.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Checkout [more options here](https://github.com/raineorshine/npm-check-updates#o
- Update navbar
- dropdown for homepage links
- add blog
- make configurable
- Authentication
- Add social links in footer when sm screen
- Hide Sign in button on homepage
- Projects
- Groups/Permissions
- Embed GitHub commit snippet
Expand All @@ -52,6 +52,7 @@ Checkout [more options here](https://github.com/raineorshine/npm-check-updates#o
- API: https://api.github.com/repos/yusanshi/emgithub/commits/7879e517c6b1d6f7b539a7770aba9feb46ff4672
- Fetch commit information and store in Dynammo db
- API rate limiting for storing commit information
- https://docs.github.com/en/developers/apps/building-github-apps/rate-limits-for-github-apps
- Getting commit info: https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#get-a-commit
- Prism diff highlighter: https://prismjs.com/plugins/diff-highlight/
- Diff 2 html CLI: https://github.com/rtfpessoa/diff2html-cli
Expand Down
4 changes: 4 additions & 0 deletions apps/vighnesh153.com/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
NEXTAUTH_URL=https://vighnesh153.com
NEXTAUTH_SECRET="Charizard is the best and coolest pokemon ever ❤️"
1 change: 1 addition & 0 deletions apps/vighnesh153.com/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@vighnesh153/utils": "*",
"eslint-config-vighnesh153": "*",
"next": "^13.1.1",
"next-auth": "^4.18.8",
"next-transpile-modules": "^10.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
25 changes: 25 additions & 0 deletions apps/vighnesh153.com/src/modules/common/components/auth-box.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useSession, signIn } from 'next-auth/react';
import { CircularProgress, Box } from '@mui/material';
import { not } from '@vighnesh153/utils';
import { ProfileBox } from './profile-box';
import { SignInButton } from './sign-in-button';

export function AuthBox() {
const { data: session, status } = useSession();
const isLoading = status === 'loading';
const user = session?.user;

if (isLoading) {
return (
<Box sx={{ width: 40, display: 'grid', placeItems: 'center' }}>
<CircularProgress color="info" size={20} />
</Box>
);
}

if (not(session) || not(session?.user)) {
return <SignInButton onClick={() => signIn('google')} />;
}

return <ProfileBox user={user} />;
}
2 changes: 2 additions & 0 deletions apps/vighnesh153.com/src/modules/common/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
export * from './404-page';
export * from './aside-email-address';
export * from './aside-social-links';
export * from './auth-box';
export * from './border-corner-animation-link';
export * from './focus-dashed-outline';
export * from './head';
export * from './navbar';
export * from './next-link';
export * from './sign-in-button';
export * from './skip-to-main-content';
export * from './underlined-animation-link';
Loading

1 comment on commit 03afd56

@vercel
Copy link

@vercel vercel bot commented on 03afd56 Jan 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.