Skip to content

Commit

Permalink
SAVE
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Dec 1, 2024
1 parent 91e4031 commit cafd127
Show file tree
Hide file tree
Showing 122 changed files with 1,592 additions and 621 deletions.
12 changes: 12 additions & 0 deletions apps/e2e/features/exchanges/studient_filters.feature
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 4 additions & 1 deletion apps/www/app/(auth)/signup/student/page.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -37,7 +38,9 @@ async function Page() {

return (
<main className={base()}>
<Form categories={await TRPC_SSR.category.exchange.fetch()} />
<TrpcRootProvider>
<Form categories={await TRPC_SSR.category.exchange.fetch()} />
</TrpcRootProvider>
</main>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import type { Metadata, ResolvingMetadata } from "next";
import type { PropsWithChildren } from "react";
import { TrpcRootProvider } from ":trpc/root";

//

Expand All @@ -15,6 +16,11 @@ export async function generateMetadata(
}

//

export default function Layout({ children }: PropsWithChildren) {
return <div className="m-16 max-w-3xl">{children}</div>;
return (
<TrpcRootProvider>
<div className="m-16 max-w-3xl">{children}</div>
</TrpcRootProvider>
);
}
Original file line number Diff line number Diff line change
@@ -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";

//
Expand All @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 <Mutate_Exchange exchange={exchange} categories={categories} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -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";

//

Expand All @@ -23,8 +24,8 @@ export default async function Page(props: { params: Promise<Params> }) {
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 (
<TRPC_Hydrate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default async function Layout(
return <NotConnected_Placeholder />;
}

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}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default async function Page(props: { params: Promise<CodeParms> }) {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default async function Page(props: { params: Promise<Params> }) {
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,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export async function generateMetadata(
parent: ResolvingMetadata,
): Promise<Metadata> {
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}`;

Expand All @@ -35,7 +37,7 @@ export default async function Page(props: { params: Promise<Params> }) {
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 (
<main className="h-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<TRPC_Hydrate>
Expand Down
10 changes: 10 additions & 0 deletions apps/www/app/(main)/door/[code]/(private)/notifications/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//

import { TrpcRootProvider } from ":trpc/root";
import type { PropsWithChildren } from "react";

//

export default function Layout({ children }: PropsWithChildren) {
return <TrpcRootProvider>{children}</TrpcRootProvider>;
}
Original file line number Diff line number Diff line change
@@ -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";

//

Expand All @@ -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 (
<TRPC_Hydrate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand Down
14 changes: 9 additions & 5 deletions apps/www/app/(main)/door/[code]/(private)/parameters/page.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -38,7 +38,7 @@ export default async function Page(props: { params: Promise<CodeParms> }) {
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 (
<main className="mx-auto my-10 max-w-3xl px-4">
Expand Down Expand Up @@ -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 <Student_Editor categories={categories} student={student} />;
})
.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 <Partner_Editor partner={partner} />;
})
.otherwise(() => null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
19 changes: 0 additions & 19 deletions apps/www/app/(main)/door/[code]/(private)/welcome/page.client.tsx

This file was deleted.

17 changes: 6 additions & 11 deletions apps/www/app/(main)/door/[code]/(private)/welcome/page.tsx
Original file line number Diff line number Diff line change
@@ -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 <Spinner />;
},
});
import { Avatar } from "@1.ui/react/avatar";
import { auth } from "@1.modules/auth.next";

//

Expand All @@ -31,6 +23,8 @@ export async function generateMetadata(
//

export default async function Page() {
const session = await auth();

return (
<main className="flex h-full flex-col items-center justify-center">
<h1
Expand All @@ -45,7 +39,8 @@ export default async function Page() {
Welcome
</h1>
<div className="mx-auto mt-5 text-center">
<Welcome_Flow />
<Avatar image={session?.profile?.image} className="mt-5 h-32" />
<p className="mt-5 text-xl font-extrabold">{session?.profile?.name}</p>
</div>
</main>
);
Expand Down
Loading

0 comments on commit cafd127

Please sign in to comment.