Skip to content

Commit

Permalink
fikset å se bruker profil via id
Browse files Browse the repository at this point in the history
la til isPublic i databasen, og checkbox på profil siden

prøver å endre /profile til /user/:id

fikset nokon routes men still broke

flyttet til index tilbake profil tilbake

formatering..

parent c33e1f8
author herwal <[email protected]> 1726071554 +0200
committer Herwal <[email protected]> 1726585905 +0200

parent c33e1f8
author herwal <[email protected]> 1726071554 +0200
committer Herwal <[email protected]> 1726585885 +0200

parent c33e1f8
author herwal <[email protected]> 1726071554 +0200
committer Herwal <[email protected]> 1726585864 +0200

parent c33e1f8
author herwal <[email protected]> 1726071554 +0200
committer Herwal <[email protected]> 1726585838 +0200

parent c33e1f8
author herwal <[email protected]> 1726071554 +0200
committer Herwal <[email protected]> 1726585621 +0200

forandret etikett for profil siden, neste steg er å kunne gå til ander sine profiler

Lagt til navnet mitt på webkom siden. (#2230)

🔥 Remove boomtown (#2233)

Fix weird images (#2234)

change href for happening tab (#2235)

added name (#2236)

Ekstern link til påmelding + navn i webkom medlemsliste (#2232)

Update dependency jsdom to v25 (#2202)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @tailwindcss/forms to v0.5.9 (#2229)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @testing-library/react to v16.0.1 (#2217)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @sanity/icons to v3.4.0 (#2194)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency tsx to v4.19.0 (#2198)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @types/node to v20.16.5 (#2218)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency tsx to v4.19.1 (#2242)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

added tidspunkt to csv

Update dependency @types/pg to v8.11.9 (#2237)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @tailwindcss/typography to v0.5.15 (#2216)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update pnpm to v9.10.0 (#2192)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Karo/phd (#2246)

Update dependency @types/react to v18.3.5 (#2238)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency postcss to v8.4.45 (#2240)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency remove-markdown to v0.5.5 (#2241)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency tailwindcss to v3.4.11 (#2244)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency eslint-plugin-react to v7.36.1 (#2239)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency framer-motion to v11.5.4 (#2193)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @playwright/test to v1.47.1 (#2248)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Add renovate schedule

Update dependency styled-components to v6.1.13 (#2243)

Update dependency eslint-plugin-jsx-a11y to v6.10.0 (#2251)

Update dependency vite to ^5.4.5 (#2245)

Update dependency eslint-plugin-import to v2.30.0 (#2250)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update robots

🔥 Remove boomtown (#2233)

Fix weird images (#2234)

change href for happening tab (#2235)

added name (#2236)

Ekstern link til påmelding + navn i webkom medlemsliste (#2232)

Update dependency tsx to v4.19.1 (#2242)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

added tidspunkt to csv

Update pnpm to v9.10.0 (#2192)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Karo/phd (#2246)

Update dependency postcss to v8.4.45 (#2240)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency remove-markdown to v0.5.5 (#2241)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency tailwindcss to v3.4.11 (#2244)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency framer-motion to v11.5.4 (#2193)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @playwright/test to v1.47.1 (#2248)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Add renovate schedule

Update dependency styled-components to v6.1.13 (#2243)

Update dependency vite to ^5.4.5 (#2245)

Update dependency eslint-plugin-import to v2.30.0 (#2250)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update robots
  • Loading branch information
Herwal committed Sep 17, 2024
1 parent e268121 commit d6c68b7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 32 deletions.
35 changes: 19 additions & 16 deletions apps/web/src/app/(default)/auth/user/[id]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,37 @@ import {
} from "@/components/sidebar-layout";
import { getUser } from "@/lib/get-user";

const routes = [
{
label: "Profil",
href: "/auth/user/[id]/profil",
},
{
label: "Arrangementer",
href: "/auth/profil/arrangementer",
},
{
label: "Prikker",
href: "/auth/profil/prikker",
},
];
const getRoutes = (userId: string) => {
return [
{
label: "Profil",
href: `/auth/user/${userId}`,
},
{
label: "Arrangementer",
href: `/auth/user/${userId}/arrangementer`,
},
{
label: "Prikker",
href: `/auth/user/${userId}/prikker`,
},
];
};

export default async function ProfileLayout({ children }: { children: React.ReactNode }) {
const user = await getUser();

if (!user) {
return null;
}

const routes = getRoutes(user.id);

return (
<SidebarLayoutRoot>
<Sidebar>
{routes.map((route) => {
return (
<SidebarItem key={route.href} href={route.href.replace("[id", user.id)}>
<SidebarItem key={route.href} href={route.href}>
{route.label}
</SidebarItem>
);
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/app/(default)/auth/user/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ export default async function ProfilePage({ params }: { params: { id: string } }

return (
<div className="max-w-2xl space-y-4">
<Heading level={2}>Din profil</Heading>

<Heading level={2}>{`${user.name?.split(" ")[0]} sin profil`}</Heading>
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-6 md:flex-row">
<UploadProfilePicture name={user.name ?? "Bo Bakseter"} image={user.image} />
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/user-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const UserMenu = ({ user }: UserMenuProps) => {
<DropdownMenuSeparator />

<DropdownMenuItem asChild>
<Link href={`/user/${user.id}/profil`}>
<Link href={`auth/user/${user.id}`}>
<Person className="mr-2 h-4 w-4" />
<span>Min profil</span>
</Link>
Expand Down
26 changes: 13 additions & 13 deletions apps/web/src/lib/get-user.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { cache } from "react";
import { eq } from "drizzle-orm";

import { auth } from "@echo-webkom/auth";
import { eq } from "drizzle-orm";
import { users } from "@echo-webkom/db/schemas";
import { db } from "@echo-webkom/db";
import { users } from "@echo-webkom/db/schemas";

/**
* Wraps the `auth` function in a "cache" to prevent
Expand All @@ -15,17 +15,17 @@ import { db } from "@echo-webkom/db";
export const getUser = cache(auth);

export const getUserById = cache(async (id: string) => {
const user = await db.query.users.findFirst({
where: eq(users.id, id),
const user = await db.query.users.findFirst({
where: eq(users.id, id),
with: {
degree: true,
memberships: {
with: {
degree: true,
memberships: {
with: {
group: true,
},
},
},
});
group: true,
},
},
},
});

return user;
return user;
});

0 comments on commit d6c68b7

Please sign in to comment.