-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
177 changed files
with
11,305 additions
and
3,728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Ignore artifacts: | ||
build | ||
coverage | ||
dist | ||
# ignore JS for now because of vanilla JS file imports might mess up some text replacement. Can revisit in the future but not high priority | ||
*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"semi": false, | ||
"endOfLine": "auto" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Next.js: debug full stack", | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"command": "yarn dev", | ||
"serverReadyAction": { | ||
"pattern": "- Local:.+(https?://.+)", | ||
"uriFormat": "%s", | ||
"action": "debugWithChrome" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,150 +1,150 @@ | ||
"use server"; | ||
'use server' | ||
|
||
import { createServerClient } from "@/utils/supabase/server"; | ||
import { encodedRedirect } from "@/utils/utils"; | ||
import { headers } from "next/headers"; | ||
import { redirect } from "next/navigation"; | ||
import { createServerClient } from '@/utils/supabase/server' | ||
import { encodedRedirect } from '@/utils/utils' | ||
import { headers } from 'next/headers' | ||
import { redirect } from 'next/navigation' | ||
|
||
export const createAccountAction = async (formData: FormData) => { | ||
const email = formData.get("email")?.toString(); | ||
const password = formData.get("password")?.toString(); | ||
const supabase = createServerClient(); | ||
const origin = headers().get("origin"); | ||
const email = formData.get('email')?.toString() | ||
const password = formData.get('password')?.toString() | ||
const supabase = createServerClient() | ||
const origin = headers().get('origin') | ||
|
||
if (!email || !password) { | ||
return { error: "Email and password are required" }; | ||
return { error: 'Email and password are required' } | ||
} | ||
|
||
const { error } = await supabase.auth.signUp({ | ||
email, | ||
password, | ||
options: { | ||
emailRedirectTo: `${origin}/auth/callback`, | ||
}, | ||
}); | ||
emailRedirectTo: `${origin}/auth/callback` | ||
} | ||
}) | ||
|
||
if (error) { | ||
console.error(error.code + " " + error.message); | ||
return encodedRedirect("error", "/create-account", error.message); | ||
console.error(error.code + ' ' + error.message) | ||
return encodedRedirect('error', '/create-account', error.message) | ||
} else { | ||
return encodedRedirect( | ||
"success", | ||
"/create-account", | ||
"Thanks for signing up! Please check your email for a verification link." | ||
); | ||
'success', | ||
'/create-account', | ||
'Thanks for signing up! Please check your email for a verification link.' | ||
) | ||
} | ||
}; | ||
} | ||
|
||
export const loginAction = async (formData: FormData) => { | ||
const email = formData.get("email") as string; | ||
const password = formData.get("password") as string; | ||
const supabase = createServerClient(); | ||
const email = formData.get('email') as string | ||
const password = formData.get('password') as string | ||
const supabase = createServerClient() | ||
|
||
const { error } = await supabase.auth.signInWithPassword({ | ||
email, | ||
password, | ||
}); | ||
password | ||
}) | ||
|
||
if (error) { | ||
return encodedRedirect("error", "/login", error.message); | ||
return encodedRedirect('error', '/login', error.message) | ||
} | ||
|
||
return redirect("/home"); | ||
}; | ||
return redirect('/home') | ||
} | ||
|
||
export const forgotPasswordAction = async (formData: FormData) => { | ||
const email = formData.get("email")?.toString(); | ||
const supabase = createServerClient(); | ||
const origin = headers().get("origin"); | ||
const callbackUrl = formData.get("callbackUrl")?.toString(); | ||
const email = formData.get('email')?.toString() | ||
const supabase = createServerClient() | ||
const origin = headers().get('origin') | ||
const callbackUrl = formData.get('callbackUrl')?.toString() | ||
|
||
if (!email) { | ||
return encodedRedirect("error", "/forgot-password", "Email is required"); | ||
return encodedRedirect('error', '/forgot-password', 'Email is required') | ||
} | ||
|
||
const { error } = await supabase.auth.resetPasswordForEmail(email, { | ||
redirectTo: `${origin}/auth/callback?redirect_to=/protected/reset-password`, | ||
}); | ||
redirectTo: `${origin}/auth/callback?redirect_to=/protected/reset-password` | ||
}) | ||
|
||
if (error) { | ||
console.error(error.message); | ||
console.error(error.message) | ||
return encodedRedirect( | ||
"error", | ||
"/forgot-password", | ||
"Could not reset password" | ||
); | ||
'error', | ||
'/forgot-password', | ||
'Could not reset password' | ||
) | ||
} | ||
|
||
if (callbackUrl) { | ||
return redirect(callbackUrl); | ||
return redirect(callbackUrl) | ||
} | ||
|
||
return encodedRedirect( | ||
"success", | ||
"/forgot-password", | ||
"Check your email for a link to reset your password." | ||
); | ||
}; | ||
'success', | ||
'/forgot-password', | ||
'Check your email for a link to reset your password.' | ||
) | ||
} | ||
|
||
export const resetPasswordAction = async (formData: FormData) => { | ||
const supabase = createServerClient(); | ||
const supabase = createServerClient() | ||
|
||
const password = formData.get("password") as string; | ||
const confirmPassword = formData.get("confirmPassword") as string; | ||
const password = formData.get('password') as string | ||
const confirmPassword = formData.get('confirmPassword') as string | ||
|
||
if (!password || !confirmPassword) { | ||
encodedRedirect( | ||
"error", | ||
"/protected/reset-password", | ||
"Password and confirm password are required" | ||
); | ||
'error', | ||
'/protected/reset-password', | ||
'Password and confirm password are required' | ||
) | ||
} | ||
|
||
if (password !== confirmPassword) { | ||
encodedRedirect( | ||
"error", | ||
"/protected/reset-password", | ||
"Passwords do not match" | ||
); | ||
'error', | ||
'/protected/reset-password', | ||
'Passwords do not match' | ||
) | ||
} | ||
|
||
const { error } = await supabase.auth.updateUser({ | ||
password: password, | ||
}); | ||
password: password | ||
}) | ||
|
||
if (error) { | ||
encodedRedirect( | ||
"error", | ||
"/protected/reset-password", | ||
"Password update failed" | ||
); | ||
'error', | ||
'/protected/reset-password', | ||
'Password update failed' | ||
) | ||
} | ||
|
||
encodedRedirect("success", "/protected/reset-password", "Password updated"); | ||
}; | ||
encodedRedirect('success', '/protected/reset-password', 'Password updated') | ||
} | ||
|
||
export const resetEmailAction = async (formData: FormData) => { | ||
const supabase = createServerClient(); | ||
const supabase = createServerClient() | ||
|
||
const email = formData.get("email") as string; | ||
const password = formData.get("password") as string; | ||
const email = formData.get('email') as string | ||
const password = formData.get('password') as string | ||
|
||
if (!email || !password) { | ||
encodedRedirect( | ||
"error", | ||
"/protected/reset-password", | ||
"Email and password are required" | ||
); | ||
'error', | ||
'/protected/reset-password', | ||
'Email and password are required' | ||
) | ||
} | ||
//NOTE: Need to match current password with entered password before updating the user's email. | ||
|
||
const { error } = await supabase.auth.updateUser({ | ||
email, | ||
}); | ||
}) | ||
|
||
if (error) { | ||
encodedRedirect("error", "/protected/reset-email", "Email update failed"); | ||
encodedRedirect('error', '/protected/reset-email', 'Email update failed') | ||
} | ||
|
||
encodedRedirect("success", "/protected/reset-email", "Email updated"); | ||
}; | ||
encodedRedirect('success', '/protected/reset-email', 'Email updated') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
"use server" | ||
import { uniqueNamesGenerator, Config, adjectives, colors, animals } from 'unique-names-generator'; | ||
|
||
'use server' | ||
import { | ||
uniqueNamesGenerator, | ||
Config, | ||
adjectives, | ||
colors, | ||
animals | ||
} from 'unique-names-generator' | ||
|
||
const randomName: string = uniqueNamesGenerator({ | ||
dictionaries: [adjectives, animals] | ||
}); | ||
|
||
}) | ||
|
||
export async function generateSpaceName() { | ||
const customConfig: Config = { | ||
dictionaries: [adjectives, animals], | ||
separator: ' ', | ||
length: 2, | ||
style: 'capital' | ||
}; | ||
|
||
return uniqueNamesGenerator(customConfig); | ||
} | ||
} | ||
|
||
return uniqueNamesGenerator(customConfig) | ||
} | ||
|
||
export async function generateSceneName() { | ||
const customConfig: Config = { | ||
dictionaries: [adjectives], | ||
separator: ' ', | ||
length: 1, | ||
style: 'capital' | ||
}; | ||
|
||
return uniqueNamesGenerator(customConfig); | ||
} | ||
|
||
|
||
return uniqueNamesGenerator(customConfig) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"Zone": "us", | ||
"OrgId": "308710", | ||
"WorkspaceId": "a2da908b-27c1-4013-b214-f7ce5531bbe7", | ||
"SourceId": "b077387d-b743-4f18-bd57-94effffd3ad1", | ||
"Runtime": "browser:typescript-ampli-v2", | ||
"Platform": "Browser", | ||
"Language": "TypeScript", | ||
"SDK": "@amplitude/analytics-browser@^1.0", | ||
"Branch": "main", | ||
"Version": "1.0.0", | ||
"VersionId": "84e8930d-d0e7-4c92-b6c6-629ff838c9a6", | ||
"Path": "./src/ampli" | ||
} |
Oops, something went wrong.