From cafd1275b67096a71e9ac34cefc11713bfb3ef4f Mon Sep 17 00:00:00 2001 From: Douglas DUTEIL Date: Mon, 18 Nov 2024 02:55:31 +0100 Subject: [PATCH] SAVE --- .../exchanges/studient_filters.feature | 12 + apps/www/app/(auth)/signup/student/page.tsx | 5 +- .../[code]/(private)/bookmarks/layout.tsx | 8 +- .../bookmarks/opportunities/page.tsx | 4 +- .../[exchange_id]/edit/page.client.tsx | 5 +- .../exchanges/[exchange_id]/edit/page.tsx | 7 +- .../[thread_id]/_client/Conversation_Form.tsx | 2 +- .../[code]/(private)/exchanges/layout.tsx | 2 +- .../[code]/(private)/exchanges/mine/page.tsx | 2 +- .../[thread_id]/_client/Conversation_Form.tsx | 2 +- .../(private)/inbox/[thread_id]/page.tsx | 2 +- .../inbox/write_to/[profile_id]/page.tsx | 6 +- .../_client/Infinite_Contacts_List.tsx | 2 +- .../[code]/(private)/inbox/write_to/page.tsx | 2 +- .../[code]/(private)/notifications/layout.tsx | 10 + .../[code]/(private)/notifications/page.tsx | 5 +- .../[code]/(private)/opportunities/layout.tsx | 2 +- .../parameters/_client/Avatar_Editor.tsx | 2 +- .../parameters/_client/Profile_Editor.tsx | 6 +- .../door/[code]/(private)/parameters/page.tsx | 14 +- .../[code]/(private)/parameters/upload.tsx | 7 +- .../[code]/(private)/welcome/page.client.tsx | 19 -- .../door/[code]/(private)/welcome/page.tsx | 17 +- .../door/[code]/(public)/(about)/page.tsx | 6 +- .../[code]/(public)/@header/AddedByCount.tsx | 2 +- .../[code]/(public)/@header/CircleCount.tsx | 2 +- .../door/[code]/(public)/@header/default.tsx | 8 +- .../(public)/@navbar/_client/AddContact.tsx | 22 +- .../door/[code]/(public)/@navbar/default.tsx | 2 +- .../_client/Infinite_Contacts_List.tsx | 2 +- .../door/[code]/(public)/contacts/page.tsx | 2 +- .../(public)/following/_client/List.tsx | 2 +- .../door/[code]/(public)/following/page.tsx | 2 +- .../door/[code]/(public)/history/page.tsx | 2 +- .../[code]/(public)/opportunities/page.tsx | 2 +- .../door/[code]/(public)/proposals/layout.tsx | 8 + .../door/[code]/(public)/proposals/page.tsx | 11 +- .../(main)/door/[code]/@navbar/default.tsx | 6 +- .../app/(main)/door/[code]/report/action.ts | 2 +- .../(main)/exchanges/[exchange_id]/Card.tsx | 4 +- .../(main)/exchanges/[exchange_id]/layout.tsx | 5 +- .../(main)/exchanges/[exchange_id]/page.tsx | 4 +- apps/www/app/(main)/exchanges/layout.tsx | 11 +- apps/www/app/(main)/exchanges/page.tsx | 15 +- apps/www/app/(main)/forum/_client/List.tsx | 2 +- apps/www/app/(main)/forum/layout.tsx | 12 +- apps/www/app/(main)/layout.tsx | 4 +- .../opportunities/[slug]/@see_also/page.tsx | 7 +- .../(main)/opportunities/[slug]/delete.tsx | 6 +- .../(main)/opportunities/[slug]/layout.tsx | 8 +- .../app/(main)/opportunities/_client/List.tsx | 4 +- apps/www/components/Share_Button.tsx | 1 + apps/www/components/button/AddToMyCircles.tsx | 11 +- apps/www/components/button/BlockProfile.tsx | 7 +- .../navbar/UserBar.client.tsx} | 7 +- .../navbar/UserBar.tsx} | 12 +- apps/www/components/navbar/aside_navbar.tsx | 9 +- .../BlockedProfile_Placeholder.tsx | 2 +- apps/www/components/shell/RootProviders.tsx | 4 +- apps/www/widgets/exchanges/card/actions.tsx | 4 +- apps/www/widgets/exchanges/card/bookmark.tsx | 8 +- apps/www/widgets/exchanges/card/index.tsx | 8 +- apps/www/widgets/exchanges/card/share.tsx | 2 +- apps/www/widgets/exchanges/list/List.tsx | 6 +- .../widgets/inbox/BlockedProfileWarning.tsx | 2 +- apps/www/widgets/opportunities/list/index.tsx | 18 +- .../database/seeding/studient/douglas.ts | 2 + .../database/seeding/studient/joedart.ts | 2 + .../infra/database/seeding/studient/johan.ts | 4 + packages/@1/infra/database/testing/index.ts | 1 + packages/@1/infra/trpc/src/index.ts | 2 + packages/@1/modules/auth/api/src/index.ts | 4 +- .../@1/modules/auth/api/src/verify/index.ts | 16 +- .../auth/api/src/verify/verify.e2e.test.ts | 2 +- .../@1/modules/auth/api/src/verify/verify.ts | 17 ++ packages/@1/modules/bookmark/api/package.json | 1 + .../bookmark/api/src/check/check.e2e.test.ts | 66 ++++++ .../modules/bookmark/api/src/check/check.ts | 32 +++ .../modules/bookmark/api/src/check/index.ts | 3 + packages/@1/modules/bookmark/api/src/index.ts | 48 +--- .../@1/modules/bookmark/api/src/procedure.ts | 11 + .../@1/modules/bookmark/api/tsconfig.json | 2 +- .../__snapshots__/delete.e2e.test.ts.snap | 39 ++++ .../api/src/me/delete/delete.e2e.test.ts | 42 ++++ .../exchange/api/src/me/delete/delete.ts | 17 ++ .../exchange/api/src/me/delete/index.ts | 3 + .../exchange/api/src/me/find.e2e.test.ts | 4 +- .../@1/modules/exchange/api/src/me/index.ts | 32 +-- .../exchange/api/src/public/by_id.e2e.test.ts | 8 +- .../exchange/api/src/public/find.e2e.test.ts | 24 +- packages/@1/modules/forum/api/src/answers.ts | 76 ++----- .../__snapshots__/create.e2e.test.ts.snap | 13 ++ .../api/src/answers/create/create.e2e.test.ts | 66 ++++++ .../forum/api/src/answers/create/create.ts | 54 +++++ .../forum/api/src/answers/create/index.ts | 3 + .../__snapshots__/delete.e2e.test.ts.snap | 12 + .../api/src/answers/delete/delete.e2e.test.ts | 70 ++++++ .../forum/api/src/answers/delete/delete.ts | 27 +++ .../forum/api/src/answers/delete/index.ts | 3 + .../forum/api/src/answers/procedure.ts | 10 + packages/@1/modules/forum/api/src/question.ts | 40 +--- .../__snapshots__/create.e2e.test.ts.snap | 13 ++ .../src/question/create/create.e2e.test.ts | 54 +++++ .../forum/api/src/question/create/create.ts | 23 ++ .../forum/api/src/question/create/index.ts | 3 + .../__snapshots__/delete.e2e.test.ts.snap | 13 ++ .../src/question/delete/delete.e2e.test.ts | 60 +++++ .../forum/api/src/question/delete/delete.ts | 16 ++ .../forum/api/src/question/delete/index.ts | 3 + .../find/__snapshots__/find.e2e.test.ts.snap | 209 ++++++++++++++++++ .../{index.e2e.test.ts => find.e2e.test.ts} | 118 ++++------ .../forum/api/src/question/find/find.ts | 142 ++++++++++++ .../forum/api/src/question/find/index.ts | 135 +---------- packages/@1/modules/forum/domain/src/index.ts | 9 +- .../__snapshots__/find_by_id.e2e.test.ts.snap | 17 ++ .../api/src/find_by_id/find_by_id.e2e.test.ts | 73 ++++++ .../profile/api/src/find_by_id/find_by_id.ts | 29 +++ .../profile/api/src/find_by_id/index.ts | 3 + packages/@1/modules/profile/api/src/index.ts | 63 +----- packages/@1/modules/profile/api/src/legacy.ts | 63 ++++++ packages/@1/modules/trpc/src/index.ts | 1 + pnpm-lock.yaml | 3 + 122 files changed, 1592 insertions(+), 621 deletions(-) create mode 100644 apps/e2e/features/exchanges/studient_filters.feature create mode 100644 apps/www/app/(main)/door/[code]/(private)/notifications/layout.tsx delete mode 100644 apps/www/app/(main)/door/[code]/(private)/welcome/page.client.tsx create mode 100644 apps/www/app/(main)/door/[code]/(public)/proposals/layout.tsx rename apps/www/{app/(main)/navbar.client.tsx => components/navbar/UserBar.client.tsx} (94%) rename apps/www/{app/(main)/navbar.tsx => components/navbar/UserBar.tsx} (93%) create mode 100644 packages/@1/modules/auth/api/src/verify/verify.ts create mode 100644 packages/@1/modules/bookmark/api/src/check/check.e2e.test.ts create mode 100644 packages/@1/modules/bookmark/api/src/check/check.ts create mode 100644 packages/@1/modules/bookmark/api/src/check/index.ts create mode 100644 packages/@1/modules/bookmark/api/src/procedure.ts create mode 100644 packages/@1/modules/exchange/api/src/me/delete/__snapshots__/delete.e2e.test.ts.snap create mode 100644 packages/@1/modules/exchange/api/src/me/delete/delete.e2e.test.ts create mode 100644 packages/@1/modules/exchange/api/src/me/delete/delete.ts create mode 100644 packages/@1/modules/exchange/api/src/me/delete/index.ts create mode 100644 packages/@1/modules/forum/api/src/answers/create/__snapshots__/create.e2e.test.ts.snap create mode 100644 packages/@1/modules/forum/api/src/answers/create/create.e2e.test.ts create mode 100644 packages/@1/modules/forum/api/src/answers/create/create.ts create mode 100644 packages/@1/modules/forum/api/src/answers/create/index.ts create mode 100644 packages/@1/modules/forum/api/src/answers/delete/__snapshots__/delete.e2e.test.ts.snap create mode 100644 packages/@1/modules/forum/api/src/answers/delete/delete.e2e.test.ts create mode 100644 packages/@1/modules/forum/api/src/answers/delete/delete.ts create mode 100644 packages/@1/modules/forum/api/src/answers/delete/index.ts create mode 100644 packages/@1/modules/forum/api/src/answers/procedure.ts create mode 100644 packages/@1/modules/forum/api/src/question/create/__snapshots__/create.e2e.test.ts.snap create mode 100644 packages/@1/modules/forum/api/src/question/create/create.e2e.test.ts create mode 100644 packages/@1/modules/forum/api/src/question/create/create.ts create mode 100644 packages/@1/modules/forum/api/src/question/create/index.ts create mode 100644 packages/@1/modules/forum/api/src/question/delete/__snapshots__/delete.e2e.test.ts.snap create mode 100644 packages/@1/modules/forum/api/src/question/delete/delete.e2e.test.ts create mode 100644 packages/@1/modules/forum/api/src/question/delete/delete.ts create mode 100644 packages/@1/modules/forum/api/src/question/delete/index.ts create mode 100644 packages/@1/modules/forum/api/src/question/find/__snapshots__/find.e2e.test.ts.snap rename packages/@1/modules/forum/api/src/question/find/{index.e2e.test.ts => find.e2e.test.ts} (57%) create mode 100644 packages/@1/modules/forum/api/src/question/find/find.ts create mode 100644 packages/@1/modules/profile/api/src/find_by_id/__snapshots__/find_by_id.e2e.test.ts.snap create mode 100644 packages/@1/modules/profile/api/src/find_by_id/find_by_id.e2e.test.ts create mode 100644 packages/@1/modules/profile/api/src/find_by_id/find_by_id.ts create mode 100644 packages/@1/modules/profile/api/src/find_by_id/index.ts create mode 100644 packages/@1/modules/profile/api/src/legacy.ts diff --git a/apps/e2e/features/exchanges/studient_filters.feature b/apps/e2e/features/exchanges/studient_filters.feature new file mode 100644 index 000000000..6b6372a67 --- /dev/null +++ b/apps/e2e/features/exchanges/studient_filters.feature @@ -0,0 +1,12 @@ +#language: fr +Fonctionnalité: Posez une question + + Scénario: Poser une question sur le forum + Soit une base de données nourrie au grain + * je navigue sur la page + * je me connecte en tant que "douglas@yopmail.com" + * je clique sur "Échanges" + * je vois dans le titre "Exchange :: Serkels" + + Quand je clique sur "Mes cercles" + Alors je vois "P'tit pause café avec l'ami Jackie" diff --git a/apps/www/app/(auth)/signup/student/page.tsx b/apps/www/app/(auth)/signup/student/page.tsx index dd43dbaa5..5bbafed62 100644 --- a/apps/www/app/(auth)/signup/student/page.tsx +++ b/apps/www/app/(auth)/signup/student/page.tsx @@ -1,5 +1,6 @@ // +import { TrpcRootProvider } from ":trpc/root"; import { TRPC_SSR } from ":trpc/server"; import Form from ":widgets/auth/SignUpForm"; import { auth } from "@1.modules/auth.next"; @@ -37,7 +38,9 @@ async function Page() { return (
-
+ + +
); } diff --git a/apps/www/app/(main)/door/[code]/(private)/bookmarks/layout.tsx b/apps/www/app/(main)/door/[code]/(private)/bookmarks/layout.tsx index 0f9f09c60..3fbb6b123 100644 --- a/apps/www/app/(main)/door/[code]/(private)/bookmarks/layout.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/bookmarks/layout.tsx @@ -2,6 +2,7 @@ import type { Metadata, ResolvingMetadata } from "next"; import type { PropsWithChildren } from "react"; +import { TrpcRootProvider } from ":trpc/root"; // @@ -15,6 +16,11 @@ export async function generateMetadata( } // + export default function Layout({ children }: PropsWithChildren) { - return
{children}
; + return ( + +
{children}
+
+ ); } diff --git a/apps/www/app/(main)/door/[code]/(private)/bookmarks/opportunities/page.tsx b/apps/www/app/(main)/door/[code]/(private)/bookmarks/opportunities/page.tsx index 82fab0c32..e86b46d65 100644 --- a/apps/www/app/(main)/door/[code]/(private)/bookmarks/opportunities/page.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/bookmarks/opportunities/page.tsx @@ -1,7 +1,7 @@ // -import { TRPC_SSR } from ":trpc/server"; import { Card } from ":widgets/opportunities/card"; +import { trpc_server } from "@1.infra/trpc/react-query/server"; import type { Metadata, ResolvingMetadata } from "next"; // @@ -18,7 +18,7 @@ export async function generateMetadata( // export default async function Page() { const { data: opportunities } = - await TRPC_SSR.bookmarks.opportunities.find.fetch(); + await trpc_server.bookmarks.opportunities.find.fetch(); if (opportunities.length === 0) return ( diff --git a/apps/www/app/(main)/door/[code]/(private)/exchanges/[exchange_id]/edit/page.client.tsx b/apps/www/app/(main)/door/[code]/(private)/exchanges/[exchange_id]/edit/page.client.tsx index 25f9842b6..c16760f48 100644 --- a/apps/www/app/(main)/door/[code]/(private)/exchanges/[exchange_id]/edit/page.client.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/exchanges/[exchange_id]/edit/page.client.tsx @@ -1,6 +1,7 @@ "use client"; import { TRPC_React } from ":trpc/client"; +import { trpc_client } from "@1.infra/trpc/react-query/client"; import type { Category } from "@1.modules/category.domain"; import { type Exchange_Flat_Schema } from "@1.modules/exchange.domain"; import { @@ -21,8 +22,8 @@ export function Mutate_Exchange_Island({ }: { exchange_id: string; }) { - const { data: exchange } = TRPC_React.exchanges.by_id.useQuery(exchange_id); - const { data: categories } = TRPC_React.category.exchange.useQuery(); + const { data: exchange } = trpc_client.exchanges.by_id.useQuery(exchange_id); + const { data: categories } = trpc_client.category.exchange.useQuery(); if (!exchange) return null; if (!categories) return null; return ; diff --git a/apps/www/app/(main)/door/[code]/(private)/exchanges/[exchange_id]/edit/page.tsx b/apps/www/app/(main)/door/[code]/(private)/exchanges/[exchange_id]/edit/page.tsx index 2be46764a..18513093a 100644 --- a/apps/www/app/(main)/door/[code]/(private)/exchanges/[exchange_id]/edit/page.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/exchanges/[exchange_id]/edit/page.tsx @@ -1,9 +1,10 @@ // import type { Params } from ":pipes/exchange_by_id"; -import { TRPC_Hydrate, TRPC_SSR } from ":trpc/server"; +import { TRPC_Hydrate } from ":trpc/server"; import type { Metadata, ResolvingMetadata } from "next"; import { Mutate_Exchange_Island } from "./page.client"; +import { trpc_server } from "@1.infra/trpc/react-query/server"; // @@ -23,8 +24,8 @@ export default async function Page(props: { params: Promise }) { const params = await props.params; const { exchange_id } = params; - await TRPC_SSR.exchanges.by_id.prefetch(exchange_id); - await TRPC_SSR.category.exchange.prefetch(); + await trpc_server.exchanges.by_id.prefetch(exchange_id); + await trpc_server.category.exchange.prefetch(); return ( diff --git a/apps/www/app/(main)/door/[code]/(private)/exchanges/inbox/[exchange_id]/[thread_id]/_client/Conversation_Form.tsx b/apps/www/app/(main)/door/[code]/(private)/exchanges/inbox/[exchange_id]/[thread_id]/_client/Conversation_Form.tsx index 3d2141e7e..e9652fa50 100644 --- a/apps/www/app/(main)/door/[code]/(private)/exchanges/inbox/[exchange_id]/[thread_id]/_client/Conversation_Form.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/exchanges/inbox/[exchange_id]/[thread_id]/_client/Conversation_Form.tsx @@ -25,7 +25,7 @@ export default function Conversation_Form({ const is_active = is_active_exchange(exchange); const send_message = TRPC_React.inbox.thread.send.useMutation(); const utils = TRPC_React.useUtils(); - const blacklist_item = TRPC_React.profile.me.blacklist.find.useQuery({ + const blacklist_item = TRPC_React.legacy_profile.me.blacklist.find.useQuery({ profile_id: recipient_id, }); const form = useForm({ diff --git a/apps/www/app/(main)/door/[code]/(private)/exchanges/layout.tsx b/apps/www/app/(main)/door/[code]/(private)/exchanges/layout.tsx index f7c3664b5..968296c0c 100644 --- a/apps/www/app/(main)/door/[code]/(private)/exchanges/layout.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/exchanges/layout.tsx @@ -34,7 +34,7 @@ export default async function Layout( return ; } - const profile = await TRPC_SSR.profile.by_id.fetch(profile_id); + const profile = await TRPC_SSR.legacy_profile.by_id.fetch(profile_id); if (profile.role !== PROFILE_ROLES.Enum.STUDENT) { redirect(`/@${params.code}`); } diff --git a/apps/www/app/(main)/door/[code]/(private)/exchanges/mine/page.tsx b/apps/www/app/(main)/door/[code]/(private)/exchanges/mine/page.tsx index 4fef1a7c5..55ce85e35 100644 --- a/apps/www/app/(main)/door/[code]/(private)/exchanges/mine/page.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/exchanges/mine/page.tsx @@ -27,7 +27,7 @@ export default async function Page(props: { params: Promise }) { notFound(); } - const profile = await TRPC_SSR.profile.by_id.fetch(profile_id); + const profile = await TRPC_SSR.legacy_profile.by_id.fetch(profile_id); const exchanges = await TRPC_SSR.exchanges.me.publications.fetch({}); const { base, empty } = main(); diff --git a/apps/www/app/(main)/door/[code]/(private)/inbox/[thread_id]/_client/Conversation_Form.tsx b/apps/www/app/(main)/door/[code]/(private)/inbox/[thread_id]/_client/Conversation_Form.tsx index 99f7feb29..1499c91c8 100644 --- a/apps/www/app/(main)/door/[code]/(private)/inbox/[thread_id]/_client/Conversation_Form.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/inbox/[thread_id]/_client/Conversation_Form.tsx @@ -16,7 +16,7 @@ export default function Conversation_Form({ recipient_id, }: Params & { recipient_id: string }) { const { mutateAsync } = TRPC_React.inbox.thread.send.useMutation(); - const blacklist_item = TRPC_React.profile.me.blacklist.find.useQuery({ + const blacklist_item = TRPC_React.legacy_profile.me.blacklist.find.useQuery({ profile_id: recipient_id, }); const is_blacklisted = blacklist_item.data?.profile.id === recipient_id; diff --git a/apps/www/app/(main)/door/[code]/(private)/inbox/[thread_id]/page.tsx b/apps/www/app/(main)/door/[code]/(private)/inbox/[thread_id]/page.tsx index 50c874958..33f8af7ab 100644 --- a/apps/www/app/(main)/door/[code]/(private)/inbox/[thread_id]/page.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/inbox/[thread_id]/page.tsx @@ -89,7 +89,7 @@ export default async function Page(props: { params: Promise }) { await TRPC_SSR.inbox.thread.messages.prefetchInfinite({ thread_id, }); - await TRPC_SSR.profile.me.blacklist.find.prefetch({ + await TRPC_SSR.legacy_profile.me.blacklist.find.prefetch({ profile_id: recipient.id, }); diff --git a/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/[profile_id]/page.tsx b/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/[profile_id]/page.tsx index 4b182bc29..f73d8a38b 100644 --- a/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/[profile_id]/page.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/[profile_id]/page.tsx @@ -17,7 +17,9 @@ export async function generateMetadata( parent: ResolvingMetadata, ): Promise { const params = await props.params; - const [, profile] = await to(TRPC_SSR.profile.by_id.fetch(params.profile_id)); + const [, profile] = await to( + TRPC_SSR.legacy_profile.by_id.fetch(params.profile_id), + ); const { name } = profile ?? { name: "O_0" }; const title = `${name} :: ${(await parent).title?.absolute}`; @@ -35,7 +37,7 @@ export default async function Page(props: { params: Promise }) { const params = await props.params; const inbox = await TRPC_SSR.inbox.by_profile_id.fetch(params); if (inbox) return redirect(`/@~/inbox/${inbox.thread.id}`); - const profile = await TRPC_SSR.profile.by_id.fetch(params.profile_id); + const profile = await TRPC_SSR.legacy_profile.by_id.fetch(params.profile_id); return (
diff --git a/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/_client/Infinite_Contacts_List.tsx b/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/_client/Infinite_Contacts_List.tsx index 635ae63ab..e2197c688 100644 --- a/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/_client/Infinite_Contacts_List.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/_client/Infinite_Contacts_List.tsx @@ -12,7 +12,7 @@ import { P, match } from "ts-pattern"; // export default function Infinite_Contacts_List() { - const info = TRPC_React.profile.me.contacts.useInfiniteQuery( + const info = TRPC_React.legacy_profile.me.contacts.useInfiniteQuery( {}, { getNextPageParam: ({ next_cursor }) => next_cursor }, ); diff --git a/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/page.tsx b/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/page.tsx index 8a55539d0..78142e378 100644 --- a/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/page.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/inbox/write_to/page.tsx @@ -25,7 +25,7 @@ export async function generateMetadata( // export default async function Page() { - await TRPC_SSR.profile.me.contacts.prefetchInfinite({}); + await TRPC_SSR.legacy_profile.me.contacts.prefetchInfinite({}); return ( diff --git a/apps/www/app/(main)/door/[code]/(private)/notifications/layout.tsx b/apps/www/app/(main)/door/[code]/(private)/notifications/layout.tsx new file mode 100644 index 000000000..3aa6292e0 --- /dev/null +++ b/apps/www/app/(main)/door/[code]/(private)/notifications/layout.tsx @@ -0,0 +1,10 @@ +// + +import { TrpcRootProvider } from ":trpc/root"; +import type { PropsWithChildren } from "react"; + +// + +export default function Layout({ children }: PropsWithChildren) { + return {children}; +} diff --git a/apps/www/app/(main)/door/[code]/(private)/notifications/page.tsx b/apps/www/app/(main)/door/[code]/(private)/notifications/page.tsx index 143c62257..e1db244b4 100644 --- a/apps/www/app/(main)/door/[code]/(private)/notifications/page.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/notifications/page.tsx @@ -1,8 +1,9 @@ // -import { TRPC_Hydrate, TRPC_SSR } from ":trpc/server"; +import { TRPC_Hydrate } from ":trpc/server"; import type { Metadata, ResolvingMetadata } from "next"; import { AsyncListInfinite } from "./List"; +import { trpc_server } from "@1.infra/trpc/react-query/server"; // @@ -23,7 +24,7 @@ export async function generateMetadata( // export default async function Page() { - await TRPC_SSR.notification.find.prefetchInfinite({}); + await trpc_server.notification.find.prefetchInfinite({}); // return ( diff --git a/apps/www/app/(main)/door/[code]/(private)/opportunities/layout.tsx b/apps/www/app/(main)/door/[code]/(private)/opportunities/layout.tsx index bb4630719..974132d7d 100644 --- a/apps/www/app/(main)/door/[code]/(private)/opportunities/layout.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/opportunities/layout.tsx @@ -33,7 +33,7 @@ export default async function Layout( return notFound(); } - const profile = await TRPC_SSR.profile.by_id.fetch(profile_id); + const profile = await TRPC_SSR.legacy_profile.by_id.fetch(profile_id); if (profile.role !== PROFILE_ROLES.Enum.PARTNER) { redirect(`/@${params.code}`); } diff --git a/apps/www/app/(main)/door/[code]/(private)/parameters/_client/Avatar_Editor.tsx b/apps/www/app/(main)/door/[code]/(private)/parameters/_client/Avatar_Editor.tsx index 355cc4378..a03a114ab 100644 --- a/apps/www/app/(main)/door/[code]/(private)/parameters/_client/Avatar_Editor.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/parameters/_client/Avatar_Editor.tsx @@ -24,7 +24,7 @@ export default function Avatar_Editor({ profile }: { profile: Profile }) { defaultValues: { profile_id: profile.id, image_file: new File([], "") }, }); const update_image_to_gravatar = - TRPC_React.profile.me.update_image_to_gravatar.useMutation(); + TRPC_React.legacy_profile.me.update_image_to_gravatar.useMutation(); const [preview, set_preview] = useState(profile.image); const { update } = useSession(); const router = useRouter(); diff --git a/apps/www/app/(main)/door/[code]/(private)/parameters/_client/Profile_Editor.tsx b/apps/www/app/(main)/door/[code]/(private)/parameters/_client/Profile_Editor.tsx index fa29c38f3..441929935 100644 --- a/apps/www/app/(main)/door/[code]/(private)/parameters/_client/Profile_Editor.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/parameters/_client/Profile_Editor.tsx @@ -24,10 +24,10 @@ export default function Profile_Editor({ const utils = TRPC_React.useUtils(); const router = useRouter(); - const query_profile = TRPC_React.profile.by_id.useQuery(profile_id, { + const query_profile = TRPC_React.legacy_profile.by_id.useQuery(profile_id, { select: ({ bio, name }) => ({ bio, name }), }); - const update_profile = TRPC_React.profile.me.update.useMutation(); + const update_profile = TRPC_React.legacy_profile.me.update.useMutation(); const profile = query_profile.data ?? initial; @@ -38,7 +38,7 @@ export default function Profile_Editor({ const data = await update_profile.mutateAsync({ ...values, }); - await utils.profile.by_id.invalidate(profile_id); + await utils.legacy_profile.by_id.invalidate(profile_id); await update(); formik.resetForm({ values: { ...data, email: values.email } }); router.refresh(); diff --git a/apps/www/app/(main)/door/[code]/(private)/parameters/page.tsx b/apps/www/app/(main)/door/[code]/(private)/parameters/page.tsx index ce3bcb74d..d982c3e60 100644 --- a/apps/www/app/(main)/door/[code]/(private)/parameters/page.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/parameters/page.tsx @@ -1,7 +1,7 @@ // import { code_to_profile_id, type CodeParms } from ":pipes/code"; -import { TRPC_SSR } from ":trpc/server"; +import { trpc_server } from "@1.infra/trpc/react-query/server"; import { AuthError } from "@1.modules/core/errors"; import { PROFILE_ROLES, type Profile } from "@1.modules/profile.domain"; import type { Metadata, ResolvingMetadata } from "next"; @@ -38,7 +38,7 @@ export default async function Page(props: { params: Promise }) { throw new AuthError("No profile id"); } - const profile = await TRPC_SSR.profile.by_id.fetch(profile_id); + const profile = await trpc_server.legacy_profile.by_id.fetch(profile_id); return (
@@ -67,13 +67,17 @@ async function Role_Editor({ return match(role) .with(PROFILE_ROLES.Enum.STUDENT, async () => { const student = - await TRPC_SSR.profile.student.by_profile_id.fetch(profile_id); - const categories = await TRPC_SSR.category.exchange.fetch(); + await trpc_server.legacy_profile.student.by_profile_id.fetch( + profile_id, + ); + const categories = await trpc_server.category.exchange.fetch(); return ; }) .with(PROFILE_ROLES.Enum.PARTNER, async () => { const partner = - await TRPC_SSR.profile.partner.by_profile_id.fetch(profile_id); + await trpc_server.legacy_profile.partner.by_profile_id.fetch( + profile_id, + ); return ; }) .otherwise(() => null); diff --git a/apps/www/app/(main)/door/[code]/(private)/parameters/upload.tsx b/apps/www/app/(main)/door/[code]/(private)/parameters/upload.tsx index 232f3445b..50530b70a 100644 --- a/apps/www/app/(main)/door/[code]/(private)/parameters/upload.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/parameters/upload.tsx @@ -21,8 +21,11 @@ export async function uploadImage(formData: FormData) { token, }); - const profile = await proxyClient.profile.by_id.query(profile_id); - await proxyClient.profile.me.update.mutate({ ...profile, image: blob.url }); + const profile = await proxyClient.legacy_profile.by_id.query(profile_id); + await proxyClient.legacy_profile.me.update.mutate({ + ...profile, + image: blob.url, + }); revalidatePath( `https://xliajqivstyuw7e1.public.blob.vercel-storage.com/${pathname}`, diff --git a/apps/www/app/(main)/door/[code]/(private)/welcome/page.client.tsx b/apps/www/app/(main)/door/[code]/(private)/welcome/page.client.tsx deleted file mode 100644 index 61ad72ec2..000000000 --- a/apps/www/app/(main)/door/[code]/(private)/welcome/page.client.tsx +++ /dev/null @@ -1,19 +0,0 @@ -"use client"; - -import { useSession } from "@1.modules/auth.next/react"; -import { Avatar } from "@1.ui/react/avatar"; - -// - -export default function Welcome_Flow() { - const { data: session } = useSession({ required: true }); - - return ( - <> -
- -

{session?.profile?.name}

-
- - ); -} diff --git a/apps/www/app/(main)/door/[code]/(private)/welcome/page.tsx b/apps/www/app/(main)/door/[code]/(private)/welcome/page.tsx index 7c8352473..d0a301477 100644 --- a/apps/www/app/(main)/door/[code]/(private)/welcome/page.tsx +++ b/apps/www/app/(main)/door/[code]/(private)/welcome/page.tsx @@ -1,16 +1,8 @@ // -import { Spinner } from "@1.ui/react/spinner"; import type { Metadata, ResolvingMetadata } from "next"; -import dynamic from "next/dynamic"; - -// - -const Welcome_Flow = dynamic(() => import("./page.client"), { - loading() { - return ; - }, -}); +import { Avatar } from "@1.ui/react/avatar"; +import { auth } from "@1.modules/auth.next"; // @@ -31,6 +23,8 @@ export async function generateMetadata( // export default async function Page() { + const session = await auth(); + return (

- + +

{session?.profile?.name}

); diff --git a/apps/www/app/(main)/door/[code]/(public)/(about)/page.tsx b/apps/www/app/(main)/door/[code]/(public)/(about)/page.tsx index 60704f8bc..9fa76acf9 100644 --- a/apps/www/app/(main)/door/[code]/(public)/(about)/page.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/(about)/page.tsx @@ -30,7 +30,7 @@ export default async function Page(props: { params: Promise }) { throw new AuthError("No profile id"); } - const profile = await TRPC_SSR.profile.by_id.fetch(profile_id); + const profile = await TRPC_SSR.legacy_profile.by_id.fetch(profile_id); return (
@@ -60,7 +60,7 @@ export default async function Page(props: { params: Promise }) { async function StudentMeta({ profile_id }: { profile_id: string }) { const student = - await TRPC_SSR.profile.student.by_profile_id.fetch(profile_id); + await TRPC_SSR.legacy_profile.student.by_profile_id.fetch(profile_id); return (
    @@ -83,7 +83,7 @@ async function StudentMeta({ profile_id }: { profile_id: string }) { async function PartnerMeta({ profile_id }: { profile_id: string }) { const partner = - await TRPC_SSR.profile.partner.by_profile_id.fetch(profile_id); + await TRPC_SSR.legacy_profile.partner.by_profile_id.fetch(profile_id); return (
      diff --git a/apps/www/app/(main)/door/[code]/(public)/@header/AddedByCount.tsx b/apps/www/app/(main)/door/[code]/(public)/@header/AddedByCount.tsx index f4d466129..b747fd4b0 100644 --- a/apps/www/app/(main)/door/[code]/(public)/@header/AddedByCount.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/@header/AddedByCount.tsx @@ -5,7 +5,7 @@ import { TRPC_React } from ":trpc/client"; // export function AddedByCount({ profile_id }: { profile_id: string }) { - const profile = TRPC_React.profile.by_id.useQuery(profile_id); + const profile = TRPC_React.legacy_profile.by_id.useQuery(profile_id); const count = profile.data?.in_contact_with.length ?? 0; return (
      diff --git a/apps/www/app/(main)/door/[code]/(public)/@header/CircleCount.tsx b/apps/www/app/(main)/door/[code]/(public)/@header/CircleCount.tsx index d40b258dd..48d436311 100644 --- a/apps/www/app/(main)/door/[code]/(public)/@header/CircleCount.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/@header/CircleCount.tsx @@ -5,7 +5,7 @@ import { TRPC_React } from ":trpc/client"; // export function CircleCount({ profile_id }: { profile_id: string }) { - const profile = TRPC_React.profile.by_id.useQuery(profile_id); + const profile = TRPC_React.legacy_profile.by_id.useQuery(profile_id); const count = profile.data?.contacts.length ?? 0; return (
      diff --git a/apps/www/app/(main)/door/[code]/(public)/@header/default.tsx b/apps/www/app/(main)/door/[code]/(public)/@header/default.tsx index 56c8dd0f0..25f57e04b 100644 --- a/apps/www/app/(main)/door/[code]/(public)/@header/default.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/@header/default.tsx @@ -27,13 +27,13 @@ export default async function Page(props: { params: Promise }) { throw new AuthError("Unkwon code", { cause: code_to_profile_id_err }); } const [profile_err, profile] = await to( - TRPC_SSR.profile.by_id.fetch(profile_id), + TRPC_SSR.legacy_profile.by_id.fetch(profile_id), ); if (!profile) { throw new AuthError("No profile", { cause: profile_err }); } - await TRPC_SSR.profile.by_id.prefetch(profile_id); + await TRPC_SSR.legacy_profile.by_id.prefetch(profile_id); return ( @@ -67,13 +67,13 @@ async function MaybeProfileLink( function ProfileAvatar({ profile }: { profile: Profile }) { return match(profile.role) .with(PROFILE_ROLES.Enum.STUDENT, async () => { - const student = await TRPC_SSR.profile.student.by_profile_id.fetch( + const student = await TRPC_SSR.legacy_profile.student.by_profile_id.fetch( profile.id, ); return ; }) .with(PROFILE_ROLES.Enum.PARTNER, async () => { - const partner = await TRPC_SSR.profile.partner.by_profile_id.fetch( + const partner = await TRPC_SSR.legacy_profile.partner.by_profile_id.fetch( profile.id, ); return ; diff --git a/apps/www/app/(main)/door/[code]/(public)/@navbar/_client/AddContact.tsx b/apps/www/app/(main)/door/[code]/(public)/@navbar/_client/AddContact.tsx index 766af0971..6a4ca9f8e 100644 --- a/apps/www/app/(main)/door/[code]/(public)/@navbar/_client/AddContact.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/@navbar/_client/AddContact.tsx @@ -20,23 +20,27 @@ export default function AddContact({ }) { const { data: session } = useSession(); const find_contact = - TRPC_React.profile.me.contact.find_by_profile_id.useQuery(profile_id, { - staleTime: Infinity, - }); - const toggle_contact = TRPC_React.profile.me.contact.toggle.useMutation(); + TRPC_React.legacy_profile.me.contact.find_by_profile_id.useQuery( + profile_id, + { + staleTime: Infinity, + }, + ); + const toggle_contact = + TRPC_React.legacy_profile.me.contact.toggle.useMutation(); const utils = TRPC_React.useUtils(); const { is_blocked } = useBlockProfile(profile_id); const toggle_add_contact = useCallback(async () => { await toggle_contact.mutateAsync(profile_id); await Promise.all([ - utils.profile.by_id.invalidate(profile_id), - utils.profile.by_id.invalidate(session?.profile.id), + utils.legacy_profile.by_id.invalidate(profile_id), + utils.legacy_profile.by_id.invalidate(session?.profile.id), - utils.profile.me.added_by.find.invalidate(), - utils.profile.me.contact.find_by_profile_id.invalidate(profile_id), + utils.legacy_profile.me.added_by.find.invalidate(), + utils.legacy_profile.me.contact.find_by_profile_id.invalidate(profile_id), - utils.profile.me.contacts.invalidate({}), + utils.legacy_profile.me.contacts.invalidate({}), ]); toggle_contact.reset(); }, [toggle_contact, utils, profile_id]); diff --git a/apps/www/app/(main)/door/[code]/(public)/@navbar/default.tsx b/apps/www/app/(main)/door/[code]/(public)/@navbar/default.tsx index a150d5fc2..2bfc16a2f 100644 --- a/apps/www/app/(main)/door/[code]/(public)/@navbar/default.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/@navbar/default.tsx @@ -19,7 +19,7 @@ export default async function Page(props: { params: Promise }) { } const param = { ...params, profile_id }; - const profile = await TRPC_SSR.profile.by_id.fetch(profile_id); + const profile = await TRPC_SSR.legacy_profile.by_id.fetch(profile_id); return match(profile.role) .with(PROFILE_ROLES.Enum.PARTNER, () => ) diff --git a/apps/www/app/(main)/door/[code]/(public)/contacts/_client/Infinite_Contacts_List.tsx b/apps/www/app/(main)/door/[code]/(public)/contacts/_client/Infinite_Contacts_List.tsx index 0ab9b5327..79857698a 100644 --- a/apps/www/app/(main)/door/[code]/(public)/contacts/_client/Infinite_Contacts_List.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/contacts/_client/Infinite_Contacts_List.tsx @@ -13,7 +13,7 @@ import Loading_Placeholder from "../loading"; // function useQueryContacts() { - return TRPC_React.profile.me.contacts.useInfiniteQuery( + return TRPC_React.legacy_profile.me.contacts.useInfiniteQuery( {}, { getNextPageParam: ({ next_cursor }) => next_cursor }, ); diff --git a/apps/www/app/(main)/door/[code]/(public)/contacts/page.tsx b/apps/www/app/(main)/door/[code]/(public)/contacts/page.tsx index 506a7ff15..56176173c 100644 --- a/apps/www/app/(main)/door/[code]/(public)/contacts/page.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/contacts/page.tsx @@ -31,7 +31,7 @@ export default async function Page(props: { params: Promise }) { redirect(`/@${params.code}`); } - await TRPC_SSR.profile.me.contacts.prefetchInfinite({}); + await TRPC_SSR.legacy_profile.me.contacts.prefetchInfinite({}); return (
      diff --git a/apps/www/app/(main)/door/[code]/(public)/following/_client/List.tsx b/apps/www/app/(main)/door/[code]/(public)/following/_client/List.tsx index ef49a6dec..6d6114ddf 100644 --- a/apps/www/app/(main)/door/[code]/(public)/following/_client/List.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/following/_client/List.tsx @@ -14,7 +14,7 @@ import { P, match } from "ts-pattern"; // function useQueryProfilesFollowingMe() { - return TRPC_React.profile.me.added_by.find.useInfiniteQuery( + return TRPC_React.legacy_profile.me.added_by.find.useInfiniteQuery( {}, { getNextPageParam: ({ next_cursor }) => next_cursor }, ); diff --git a/apps/www/app/(main)/door/[code]/(public)/following/page.tsx b/apps/www/app/(main)/door/[code]/(public)/following/page.tsx index f6465f0fc..0260c806e 100644 --- a/apps/www/app/(main)/door/[code]/(public)/following/page.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/following/page.tsx @@ -31,7 +31,7 @@ export default async function Page(props: { params: Promise }) { redirect(`/@${params.code}`); } - await TRPC_SSR.profile.me.added_by.find.prefetchInfinite({}); + await TRPC_SSR.legacy_profile.me.added_by.find.prefetchInfinite({}); return (
      diff --git a/apps/www/app/(main)/door/[code]/(public)/history/page.tsx b/apps/www/app/(main)/door/[code]/(public)/history/page.tsx index 26ffe3ca7..5f2eb21fa 100644 --- a/apps/www/app/(main)/door/[code]/(public)/history/page.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/history/page.tsx @@ -28,7 +28,7 @@ export default async function Page(props: { params: Promise }) { notFound(); } - const profile = await TRPC_SSR.profile.by_id.fetch(profile_id); + const profile = await TRPC_SSR.legacy_profile.by_id.fetch(profile_id); if (profile.role !== PROFILE_ROLES.Enum.STUDENT) { redirect(`/@${params.code}`); } diff --git a/apps/www/app/(main)/door/[code]/(public)/opportunities/page.tsx b/apps/www/app/(main)/door/[code]/(public)/opportunities/page.tsx index 75b20296d..0560176a8 100644 --- a/apps/www/app/(main)/door/[code]/(public)/opportunities/page.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/opportunities/page.tsx @@ -26,7 +26,7 @@ export default async function Page(props: { params: Promise }) { return notFound(); } - const profile = await TRPC_SSR.profile.by_id.fetch(profile_id); + const profile = await TRPC_SSR.legacy_profile.by_id.fetch(profile_id); if (profile.role !== PROFILE_ROLES.Enum.PARTNER) { redirect(`/@${params.code}`); } diff --git a/apps/www/app/(main)/door/[code]/(public)/proposals/layout.tsx b/apps/www/app/(main)/door/[code]/(public)/proposals/layout.tsx new file mode 100644 index 000000000..c0c75cf46 --- /dev/null +++ b/apps/www/app/(main)/door/[code]/(public)/proposals/layout.tsx @@ -0,0 +1,8 @@ +// + +import { TrpcRootProvider } from ":trpc/root"; +import type { PropsWithChildren } from "react"; + +export default function Layout({ children }: PropsWithChildren) { + return {children}; +} diff --git a/apps/www/app/(main)/door/[code]/(public)/proposals/page.tsx b/apps/www/app/(main)/door/[code]/(public)/proposals/page.tsx index d6991e4fe..566c39103 100644 --- a/apps/www/app/(main)/door/[code]/(public)/proposals/page.tsx +++ b/apps/www/app/(main)/door/[code]/(public)/proposals/page.tsx @@ -2,9 +2,10 @@ import { NotConnected_Placeholder } from ":components/placeholder/NotConnected_Placeholder"; import { code_to_profile_id, type CodeParms } from ":pipes/code"; -import { TRPC_Hydrate, TRPC_SSR } from ":trpc/server"; +import { TRPC_Hydrate } from ":trpc/server"; import { Exchange_Card } from ":widgets/exchanges/card"; -import { getServerSession } from "@1.modules/auth.next"; +import { trpc_server } from "@1.infra/trpc/react-query/server"; +import { auth } from "@1.modules/auth.next"; import { PROFILE_ROLES } from "@1.modules/profile.domain"; import type { Metadata, ResolvingMetadata } from "next"; import { notFound, redirect } from "next/navigation"; @@ -27,16 +28,16 @@ export default async function Page(props: { params: Promise }) { return notFound(); } - const profile = await TRPC_SSR.profile.by_id.fetch(profile_id); + const profile = await trpc_server.profile.by_id.fetch(profile_id); if (profile.role !== PROFILE_ROLES.Enum.STUDENT) { redirect(`/@${params.code}`); } - const { data: exchanges } = await TRPC_SSR.exchanges.by_profile.fetch({ + const { data: exchanges } = await trpc_server.exchanges.by_profile.fetch({ profile_id, }); - const session = await getServerSession(); + const session = await auth(); if (!session) { return ; diff --git a/apps/www/app/(main)/door/[code]/@navbar/default.tsx b/apps/www/app/(main)/door/[code]/@navbar/default.tsx index 8226fb393..65f5f38b9 100644 --- a/apps/www/app/(main)/door/[code]/@navbar/default.tsx +++ b/apps/www/app/(main)/door/[code]/@navbar/default.tsx @@ -26,16 +26,16 @@ export default async function Page(props: { params: Promise }) { return await match({ is_yours, role }) .with({ role: PROFILE_ROLES.Enum.STUDENT, is_yours: true }, async () => { const student = - await TRPC_SSR.profile.student.by_profile_id.fetch(profile_id); + await TRPC_SSR.legacy_profile.student.by_profile_id.fetch(profile_id); return ; }) .with({ role: PROFILE_ROLES.Enum.PARTNER, is_yours: true }, async () => { const partner = - await TRPC_SSR.profile.partner.by_profile_id.fetch(profile_id); + await TRPC_SSR.legacy_profile.partner.by_profile_id.fetch(profile_id); return ; }) .otherwise(() => null); - } catch (error) { + } catch { return notFound(); } } diff --git a/apps/www/app/(main)/door/[code]/report/action.ts b/apps/www/app/(main)/door/[code]/report/action.ts index f61c4c6e6..4556ffb0f 100644 --- a/apps/www/app/(main)/door/[code]/report/action.ts +++ b/apps/www/app/(main)/door/[code]/report/action.ts @@ -42,7 +42,7 @@ export async function report( const input = validatedFields.data; - const [report_error] = await to(trpc_caller.profile.me.report(input)); + const [report_error] = await to(trpc_caller.legacy_profile.me.report(input)); if (report_error) { return { ...state, diff --git a/apps/www/app/(main)/exchanges/[exchange_id]/Card.tsx b/apps/www/app/(main)/exchanges/[exchange_id]/Card.tsx index 738ad2d7e..07f82b956 100644 --- a/apps/www/app/(main)/exchanges/[exchange_id]/Card.tsx +++ b/apps/www/app/(main)/exchanges/[exchange_id]/Card.tsx @@ -2,8 +2,8 @@ import { Loading_Placeholder } from ":components/placeholder/Loading_Placeholder"; import type { Params } from ":pipes/exchange_by_id"; -import { TRPC_React } from ":trpc/client"; import { Exchange_Card } from ":widgets/exchanges/card"; +import { trpc_client } from "@1.infra/trpc/react-query/client"; import { useSession } from "@1.modules/auth.next/react"; import { notFound } from "next/navigation"; import { match, P } from "ts-pattern"; @@ -13,7 +13,7 @@ import { match, P } from "ts-pattern"; export function Card({ exchange_id }: Params) { const { data: session } = useSession(); const { data: exchange, status } = - TRPC_React.exchanges.by_id.useQuery(exchange_id); + trpc_client.exchanges.by_id.useQuery(exchange_id); return match({ exchange, status }) .with({ status: "error" }, () => notFound()) diff --git a/apps/www/app/(main)/exchanges/[exchange_id]/layout.tsx b/apps/www/app/(main)/exchanges/[exchange_id]/layout.tsx index e09061673..d5aaff9fa 100644 --- a/apps/www/app/(main)/exchanges/[exchange_id]/layout.tsx +++ b/apps/www/app/(main)/exchanges/[exchange_id]/layout.tsx @@ -1,7 +1,8 @@ // import type { Params } from ":pipes/exchange_by_id"; -import { TRPC_Hydrate, TRPC_SSR } from ":trpc/server"; +import { TRPC_Hydrate } from ":trpc/server"; +import { trpc_server } from "@1.infra/trpc/react-query/server"; import { notFound } from "next/navigation"; import type { PropsWithChildren } from "react"; @@ -16,7 +17,7 @@ export default async function Layout( const { exchange_id } = params; try { - await TRPC_SSR.exchanges.by_id.prefetch(exchange_id); + await trpc_server.exchanges.by_id.prefetch(exchange_id); } catch { notFound(); } diff --git a/apps/www/app/(main)/exchanges/[exchange_id]/page.tsx b/apps/www/app/(main)/exchanges/[exchange_id]/page.tsx index 11c65877a..ac6d7fe10 100644 --- a/apps/www/app/(main)/exchanges/[exchange_id]/page.tsx +++ b/apps/www/app/(main)/exchanges/[exchange_id]/page.tsx @@ -1,10 +1,10 @@ // import type { Params } from ":pipes/exchange_by_id"; -import { TRPC_SSR } from ":trpc/server"; import to from "await-to-js"; import type { Metadata, ResolvingMetadata } from "next"; import { Card } from "./Card"; +import { trpc_server } from "@1.infra/trpc/react-query/server"; // @@ -16,7 +16,7 @@ export async function generateMetadata( const { exchange_id } = params; - const [, exchange] = await to(TRPC_SSR.exchanges.by_id.fetch(exchange_id)); + const [, exchange] = await to(trpc_server.exchanges.by_id.fetch(exchange_id)); const title = exchange?.title ?? "Not Found"; return { diff --git a/apps/www/app/(main)/exchanges/layout.tsx b/apps/www/app/(main)/exchanges/layout.tsx index 20f1affc5..47cf92510 100644 --- a/apps/www/app/(main)/exchanges/layout.tsx +++ b/apps/www/app/(main)/exchanges/layout.tsx @@ -1,6 +1,7 @@ /// import { AsideFilter } from ":components/shell/AsideFilter"; +import { TrpcRootProvider } from ":trpc/root"; import { Exchanges_Filter } from ":widgets/exchanges/filter"; import { SearchForm } from ":widgets/exchanges/list"; import { Grid } from "@1.ui/react/grid"; @@ -27,10 +28,12 @@ export default async function Layout({ {categories} -
      {children}
      - {/* */} + +
      {children}
      +
      + ); } diff --git a/apps/www/app/(main)/exchanges/page.tsx b/apps/www/app/(main)/exchanges/page.tsx index 25ec083db..a0f932aac 100644 --- a/apps/www/app/(main)/exchanges/page.tsx +++ b/apps/www/app/(main)/exchanges/page.tsx @@ -1,5 +1,6 @@ // +import { TrpcRootProvider } from ":trpc/root"; import { TRPC_Hydrate } from ":trpc/server"; import { List } from ":widgets/exchanges/list"; import { trpc_server } from "@1.infra/trpc/react-query/server"; @@ -50,13 +51,15 @@ export default async function Page({ }); return ( - -
      - + + +
      + - -
      -
      + +
      +
      + ); } diff --git a/apps/www/app/(main)/forum/_client/List.tsx b/apps/www/app/(main)/forum/_client/List.tsx index 69f8c17a5..3fe6fd8da 100644 --- a/apps/www/app/(main)/forum/_client/List.tsx +++ b/apps/www/app/(main)/forum/_client/List.tsx @@ -138,7 +138,7 @@ function Delete_Answer_Button() { const is_owner = session.data?.profile.id === answer.owner.profile.id; async function deleteAnswer() { - await mutateAsync(answer.id); + await mutateAsync({ answers_id: answer.id, question_id: answer.parent_id }); await utils.forum.question.answers.find.invalidate(); } diff --git a/apps/www/app/(main)/forum/layout.tsx b/apps/www/app/(main)/forum/layout.tsx index 1b59091a1..1286e785b 100644 --- a/apps/www/app/(main)/forum/layout.tsx +++ b/apps/www/app/(main)/forum/layout.tsx @@ -1,6 +1,7 @@ // import { AsideFilter } from ":components/shell/AsideFilter"; +import { TrpcRootProvider } from ":trpc/root"; import { Grid } from "@1.ui/react/grid"; import InputSearch from "@1.ui/react/input/InputSearch"; import dynamic from "next/dynamic"; @@ -33,10 +34,13 @@ export default async function Layout({ {categories} -
      {children}
      - + + +
      {children}
      + +
      ); } diff --git a/apps/www/app/(main)/layout.tsx b/apps/www/app/(main)/layout.tsx index fa5dea27b..0654d0ac3 100644 --- a/apps/www/app/(main)/layout.tsx +++ b/apps/www/app/(main)/layout.tsx @@ -5,7 +5,7 @@ import { MobileNavBar } from ":components/shell/MobileNavBar"; import { TermAgreement } from ":components/terms/TermAgreement"; import type { PropsWithChildren } from "react"; import { tv } from "tailwind-variants"; -import Header from "./navbar"; +import UserBar from ":components/navbar/UserBar"; // @@ -14,7 +14,7 @@ export default function Main_Layout({ children }: PropsWithChildren) { return (
      -
      +
      {children} diff --git a/apps/www/app/(main)/opportunities/[slug]/@see_also/page.tsx b/apps/www/app/(main)/opportunities/[slug]/@see_also/page.tsx index d5ef30157..cc40b98ea 100644 --- a/apps/www/app/(main)/opportunities/[slug]/@see_also/page.tsx +++ b/apps/www/app/(main)/opportunities/[slug]/@see_also/page.tsx @@ -1,7 +1,8 @@ // import type { Params } from ":pipes/opportunity_slug"; -import { TRPC_Hydrate, TRPC_SSR } from ":trpc/server"; +import { TRPC_Hydrate } from ":trpc/server"; +import { trpc_server } from "@1.infra/trpc/react-query/server"; import { SeeAlso_Provider } from "./context"; import Page_Client from "./page.client"; @@ -10,13 +11,13 @@ import Page_Client from "./page.client"; export default async function Page({ params }: { params: Params }) { const { slug } = await params; - const opportunity = await TRPC_SSR.opportunity.by_slug.fetch(slug); + const opportunity = await trpc_server.opportunity.by_slug.fetch(slug); const { id, category: { slug: category }, } = opportunity; - await TRPC_SSR.opportunity.find.prefetchInfinite({ + await trpc_server.opportunity.find.prefetchInfinite({ category, limit: 5, }); diff --git a/apps/www/app/(main)/opportunities/[slug]/delete.tsx b/apps/www/app/(main)/opportunities/[slug]/delete.tsx index fbd36cbef..8036ada2b 100644 --- a/apps/www/app/(main)/opportunities/[slug]/delete.tsx +++ b/apps/www/app/(main)/opportunities/[slug]/delete.tsx @@ -1,6 +1,6 @@ "use client"; -import { TRPC_React } from ":trpc/client"; +import { trpc_client } from "@1.infra/trpc/react-query/client"; import { Button } from "@1.ui/react/button"; import { Trash } from "@1.ui/react/icons"; import { Spinner } from "@1.ui/react/spinner"; @@ -78,9 +78,9 @@ function Idle() { function Deleting() { const { id: opportunity_id } = useOpportunity(); - const delete_opportunity = TRPC_React.opportunity.delete.useMutation(); + const delete_opportunity = trpc_client.opportunity.delete.useMutation(); const router = useRouter(); - const utils = TRPC_React.useUtils(); + const utils = trpc_client.useUtils(); useTimeoutEffect(async () => { await delete_opportunity.mutateAsync(opportunity_id); diff --git a/apps/www/app/(main)/opportunities/[slug]/layout.tsx b/apps/www/app/(main)/opportunities/[slug]/layout.tsx index 735097b6f..0cd085705 100644 --- a/apps/www/app/(main)/opportunities/[slug]/layout.tsx +++ b/apps/www/app/(main)/opportunities/[slug]/layout.tsx @@ -1,8 +1,8 @@ // +import { TrpcRootProvider } from ":trpc/root"; import { Grid } from "@1.ui/react/grid"; import { type PropsWithChildren } from "react"; -// import SeeAlso_Page from "./@see_also/page"; // @@ -15,8 +15,10 @@ export default async function Opoortunity_Layout({ fluid className=" bg-white md:col-span-6 md:bg-transparent xl:col-span-9" > -
      {children}
      - + +
      {children}
      + +
      ); } diff --git a/apps/www/app/(main)/opportunities/_client/List.tsx b/apps/www/app/(main)/opportunities/_client/List.tsx index 29b34a48e..3e33b817a 100644 --- a/apps/www/app/(main)/opportunities/_client/List.tsx +++ b/apps/www/app/(main)/opportunities/_client/List.tsx @@ -1,7 +1,7 @@ "use client"; -import { TRPC_React } from ":trpc/client"; import { Card } from ":widgets/opportunities/card"; +import { trpc_client } from "@1.infra/trpc/react-query/client"; import { Partner_Filter } from "@1.modules/opportunity.domain"; import { Opportunity_InfiniteList } from "@1.modules/opportunity.ui/InfiniteList"; import { useSearchParams } from "next/navigation"; @@ -22,7 +22,7 @@ export default function List() { gtag("event", "search", { search, category, filter }); }, [search, category, filter]); - const info = TRPC_React.opportunity.find.useInfiniteQuery( + const info = trpc_client.opportunity.find.useInfiniteQuery( { category, search, diff --git a/apps/www/components/Share_Button.tsx b/apps/www/components/Share_Button.tsx index 927c2f8d1..073c5eaad 100644 --- a/apps/www/components/Share_Button.tsx +++ b/apps/www/components/Share_Button.tsx @@ -24,6 +24,7 @@ export function Share_Button({ 5_000, ); const copy_to_clipboard = useCallback(async () => { + if (!navigator.clipboard) return; await navigator.clipboard.writeText( href.startsWith("/") ? `${window.location.origin}${href}` : href, ); diff --git a/apps/www/components/button/AddToMyCircles.tsx b/apps/www/components/button/AddToMyCircles.tsx index 168ebe002..0a4bab5a9 100644 --- a/apps/www/components/button/AddToMyCircles.tsx +++ b/apps/www/components/button/AddToMyCircles.tsx @@ -10,8 +10,11 @@ import { match, P } from "ts-pattern"; export function AddToMyCircles({ profile_id }: { profile_id: string }) { const find_contact = - TRPC_React.profile.me.contact.find_by_profile_id.useQuery(profile_id); - const toggle_contact = TRPC_React.profile.me.contact.toggle.useMutation(); + TRPC_React.legacy_profile.me.contact.find_by_profile_id.useQuery( + profile_id, + ); + const toggle_contact = + TRPC_React.legacy_profile.me.contact.toggle.useMutation(); const utils = TRPC_React.useUtils(); const { is_blocked } = useBlockProfile(profile_id); @@ -19,8 +22,8 @@ export function AddToMyCircles({ profile_id }: { profile_id: string }) { await toggle_contact.mutateAsync(profile_id); await Promise.all([ utils.exchanges.find.invalidate({ category: "MY_CIRCLES" }), - utils.profile.me.contact.find_by_profile_id.invalidate(profile_id), - utils.profile.me.contacts.invalidate({}), + utils.legacy_profile.me.contact.find_by_profile_id.invalidate(profile_id), + utils.legacy_profile.me.contacts.invalidate({}), ]); toggle_contact.reset(); }, [toggle_contact, utils, profile_id]); diff --git a/apps/www/components/button/BlockProfile.tsx b/apps/www/components/button/BlockProfile.tsx index 456c89235..312169d79 100644 --- a/apps/www/components/button/BlockProfile.tsx +++ b/apps/www/components/button/BlockProfile.tsx @@ -42,16 +42,17 @@ export function BlockProfile({ profile_id }: { profile_id: ID_Schema }) { } export function useBlockProfile(profile_id: ID_Schema) { - const find_profile = TRPC_React.profile.me.blacklist.find.useQuery({ + const find_profile = TRPC_React.legacy_profile.me.blacklist.find.useQuery({ profile_id, }); - const toggle_mutation = TRPC_React.profile.me.blacklist.toggle.useMutation(); + const toggle_mutation = + TRPC_React.legacy_profile.me.blacklist.toggle.useMutation(); const utils = TRPC_React.useUtils(); const toggle_add_to_blacklist = useCallback(async () => { await toggle_mutation.mutateAsync({ profile_id }); await Promise.all([ - utils.profile.me.blacklist.find.refetch({ profile_id }), + utils.legacy_profile.me.blacklist.find.refetch({ profile_id }), utils.invalidate(), ]); toggle_mutation.reset(); diff --git a/apps/www/app/(main)/navbar.client.tsx b/apps/www/components/navbar/UserBar.client.tsx similarity index 94% rename from apps/www/app/(main)/navbar.client.tsx rename to apps/www/components/navbar/UserBar.client.tsx index f4cb379c3..b52974f20 100644 --- a/apps/www/app/(main)/navbar.client.tsx +++ b/apps/www/components/navbar/UserBar.client.tsx @@ -1,13 +1,10 @@ "use client"; -import { - Partner_NavBar, - Student_NavBar, -} from ":components/navbar/aside_navbar"; +import { Partner_NavBar, Student_NavBar } from "./aside_navbar"; import type { Partner, Student } from "@1.modules/profile.domain"; import { useToggle } from "@react-hookz/web"; - import { type PropsWithChildren, type ReactNode } from "react"; + // export function UserMenuToggleStudent({ student, diff --git a/apps/www/app/(main)/navbar.tsx b/apps/www/components/navbar/UserBar.tsx similarity index 93% rename from apps/www/app/(main)/navbar.tsx rename to apps/www/components/navbar/UserBar.tsx index e0fd2f7da..570566a89 100644 --- a/apps/www/app/(main)/navbar.tsx +++ b/apps/www/components/navbar/UserBar.tsx @@ -6,6 +6,7 @@ import { Notification_DotIndicator, } from ":components/navbar/notification_indicator.client"; import { MobileNavBar } from ":components/shell/MobileNavBar"; +import { TrpcRootProvider } from ":trpc/root"; import { TRPC_SSR } from ":trpc/server"; import { auth } from "@1.modules/auth.next"; import { PROFILE_ROLES, type AuthProfile } from "@1.modules/profile.domain"; @@ -17,7 +18,7 @@ import Link from "next/link"; import { type ComponentPropsWithoutRef } from "react"; import { tv } from "tailwind-variants"; import { match } from "ts-pattern"; -import { UserMenuTogglePartner, UserMenuToggleStudent } from "./navbar.client"; +import { UserMenuTogglePartner, UserMenuToggleStudent } from "./UserBar.client"; // @@ -32,8 +33,9 @@ export default function UserBar() { - - + + +
      ); @@ -107,7 +109,7 @@ const user_nav_group_variants = tv( }, ); async function MyStudentProfile({ profile }: { profile: AuthProfile }) { - const student = await TRPC_SSR.profile.student?.by_profile_id.fetch( + const student = await TRPC_SSR.legacy_profile.student?.by_profile_id.fetch( profile.id, ); @@ -139,7 +141,7 @@ async function MyStudentProfile({ profile }: { profile: AuthProfile }) { } async function MyPartnerProfile({ profile }: { profile: AuthProfile }) { - const partner = await TRPC_SSR.profile.partner?.by_profile_id.fetch( + const partner = await TRPC_SSR.legacy_profile.partner?.by_profile_id.fetch( profile.id, ); diff --git a/apps/www/components/navbar/aside_navbar.tsx b/apps/www/components/navbar/aside_navbar.tsx index 52b2b7c8e..6b27d9d01 100644 --- a/apps/www/components/navbar/aside_navbar.tsx +++ b/apps/www/components/navbar/aside_navbar.tsx @@ -23,6 +23,7 @@ import { NewsInExchange_Indicator, NewsInMessage_Indicator, } from "./notification_indicator.client"; +import { TrpcRootProvider } from ":trpc/root"; // @@ -50,7 +51,9 @@ export function Student_NavBar({ href="./exchanges/inbox" > Cercles d'échanges - + + + } href="./inbox"> Messages privés - + + + - {children} + {children} diff --git a/apps/www/widgets/exchanges/card/actions.tsx b/apps/www/widgets/exchanges/card/actions.tsx index 2a537f241..6e6ec68ce 100644 --- a/apps/www/widgets/exchanges/card/actions.tsx +++ b/apps/www/widgets/exchanges/card/actions.tsx @@ -1,6 +1,6 @@ // -import { TRPC_React } from ":trpc/client"; +import { trpc_client } from "@1.infra/trpc/react-query/client"; import { useSession } from "@1.modules/auth.next/react"; import { Exchange_TypeSchema, type Exchange } from "@1.modules/exchange.domain"; import { Exchange_Ask_Modal } from "@1.modules/exchange.ui/ask/modal"; @@ -32,7 +32,7 @@ export function Exchange_Actions() { function Exchange_Action_Ask(exchange: Exchange) { const { is_studient } = useExchangeMeta(); - const query = TRPC_React.exchanges.me.deal_by_exchange_id.useQuery( + const query = trpc_client.exchanges.me.deal_by_exchange_id.useQuery( exchange.id, { enabled: is_studient }, ); diff --git a/apps/www/widgets/exchanges/card/bookmark.tsx b/apps/www/widgets/exchanges/card/bookmark.tsx index 8b464cc5b..4631ebcae 100644 --- a/apps/www/widgets/exchanges/card/bookmark.tsx +++ b/apps/www/widgets/exchanges/card/bookmark.tsx @@ -1,7 +1,7 @@ // import { AppToastOptions } from ":components/toast"; -import { TRPC_React } from ":trpc/client"; +import { trpc_client } from "@1.infra/trpc/react-query/client"; import { useSession } from "@1.modules/auth.next/react"; import type { BookmarkButton_Props } from "@1.modules/bookmark.ui/BookmarkButton"; import { useExchange } from "@1.modules/exchange.ui/Card/context"; @@ -21,7 +21,7 @@ export function Exchange_Bookmark() { const { data: session } = useSession(); const is_student = session?.profile.role === PROFILE_ROLES.Enum.STUDENT; - const query = TRPC_React.bookmarks.check.useQuery( + const query = trpc_client.bookmarks.check.useQuery( { target_id: exchange.id, type: "exchange", @@ -54,8 +54,8 @@ export function Exchange_Bookmark() { function BookmarkItem_Toggle_Mutation(props: BookmarkButton_Props) { const { className, target_id, type, variants } = props; - const toggle = TRPC_React.bookmarks.toggle.useMutation(); - const utils = TRPC_React.useUtils(); + const toggle = trpc_client.bookmarks.toggle.useMutation(); + const utils = trpc_client.useUtils(); const { base, icon } = style({ ...variants }); return (