-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Safities User Settings (#102)"
This reverts commit 9b001c4.
- Loading branch information
1 parent
9b001c4
commit 05f4b00
Showing
12 changed files
with
114 additions
and
1,510 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,3 @@ yarn-error.log* | |
|
||
# vscode | ||
.vscode | ||
|
||
#Jetbrians | ||
.idea |
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
17 changes: 7 additions & 10 deletions
17
...eb/src/app/settings/registration/page.tsx → apps/web/src/app/settings/account/page.tsx
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,21 +1,18 @@ | ||
import RegisterFormSettings from "@/components/settings/RegistrationForm/RegisterFormSettings"; | ||
import AccountSettings from "@/components/settings/AccountSettings"; | ||
import { users } from "db/schema"; | ||
import { eq } from "db/drizzle"; | ||
import { auth } from "@clerk/nextjs"; | ||
import { db } from "db"; | ||
import { eq } from "db/drizzle"; | ||
import { users } from "db/schema"; | ||
import { redirect } from "next/navigation"; | ||
|
||
export default async function Page() { | ||
const { userId } = auth(); | ||
if (!userId) return redirect("/sign-in"); | ||
const user = await db.query.users.findFirst({ | ||
with: { | ||
registrationData: true, | ||
profileData: true, | ||
}, | ||
with: { registrationData: true }, | ||
where: eq(users.clerkID, userId!), | ||
}); | ||
if (!user) return redirect("/sign-in"); | ||
|
||
return <RegisterFormSettings data={user.registrationData} />; | ||
return <AccountSettings user={user} />; | ||
} | ||
|
||
export const runtime = "edge"; |
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,43 +1,3 @@ | ||
import AccountSettings from "@/components/settings/AccountSettings"; | ||
import { users } from "db/schema"; | ||
import { eq } from "db/drizzle"; | ||
import { auth } from "@clerk/nextjs"; | ||
import { db } from "db"; | ||
import { redirect } from "next/navigation"; | ||
import ProfileSettings from "@/components/settings/ProfileSettings"; | ||
import RegistrationSettings from "@/components/settings/RegistrationSettings"; | ||
|
||
export default async function Page() { | ||
const { userId } = auth(); | ||
if (!userId) return redirect("/sign-in"); | ||
const user = await db.query.users.findFirst({ | ||
with: { | ||
registrationData: true, | ||
profileData: true, | ||
}, | ||
where: eq(users.clerkID, userId!), | ||
}); | ||
if (!user) return redirect("/sign-in"); | ||
|
||
function Header({ tag }: { tag: string }) { | ||
return ( | ||
<h1 | ||
id={tag.toLowerCase()} | ||
className="mt-10 pb-5 text-4xl font-bold" | ||
> | ||
{tag} | ||
</h1> | ||
); | ||
} | ||
|
||
return ( | ||
<div> | ||
<Header tag="Account" /> | ||
<AccountSettings user={user} /> | ||
<Header tag="Profile" /> | ||
<ProfileSettings profile={user.profileData} /> | ||
<Header tag={"Registration"} /> | ||
<RegistrationSettings /> | ||
</div> | ||
); | ||
export default function Page() { | ||
return <span>howdy</span>; | ||
} |
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,26 @@ | ||
import ProfileSettings from "@/components/settings/ProfileSettings"; | ||
import { db } from "db"; | ||
import { users } from "db/schema"; | ||
import { eq } from "db/drizzle"; | ||
import { auth } from "@clerk/nextjs"; | ||
|
||
export default async function Page() { | ||
const { userId } = auth(); | ||
if (!userId) throw new Error("User not found"); | ||
const user = await db.query.users.findFirst({ | ||
where: eq(users.clerkID, userId), | ||
with: { | ||
profileData: true, | ||
registrationData: true, | ||
}, | ||
}); | ||
if (!user) throw new Error("User not found"); | ||
return ( | ||
<ProfileSettings | ||
bio={user.profileData.bio} | ||
university={user.registrationData.university} | ||
/> | ||
); | ||
} | ||
|
||
export const runtime = "edge"; |
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
Oops, something went wrong.