Skip to content

Commit

Permalink
add back embed pages in pages router
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjORbj committed Dec 28, 2024
1 parent 26c29ce commit 876ea41
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/web/pages/[user]/[type]/embed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import withEmbedSsr from "@lib/withEmbedSsr";

import PageWrapper from "@components/PageWrapper";

import { getServerSideProps as _getServerSideProps } from "@server/lib/[user]/[type]/getServerSideProps";

import type { PageProps } from "~/users/views/users-type-public-view";
import TypePage from "~/users/views/users-type-public-view";

export const getServerSideProps = withEmbedSsr(_getServerSideProps);

const Type = (props: PageProps) => <TypePage {...props} />;

Type.PageWrapper = PageWrapper;

export default Type;
15 changes: 15 additions & 0 deletions apps/web/pages/[user]/embed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import withEmbedSsr from "@lib/withEmbedSsr";

import PageWrapper from "@components/PageWrapper";

import { getServerSideProps as _getServerSideProps } from "@server/lib/[user]/getServerSideProps";

import User, { type PageProps } from "~/users/views/users-public-view";

export const getServerSideProps = withEmbedSsr(_getServerSideProps);

const UserPage = (props: PageProps) => <User {...props} />;

UserPage.PageWrapper = PageWrapper;

export default UserPage;
20 changes: 20 additions & 0 deletions apps/web/pages/org/[orgSlug]/[user]/[type]/embed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { getServerSideProps as _getServerSideProps } from "@lib/org/[orgSlug]/[user]/[type]/getServerSideProps";
import withEmbedSsr from "@lib/withEmbedSsr";

import PageWrapper from "@components/PageWrapper";

import type { PageProps as TeamTypePageProps } from "~/team/type-view";
import TeamTypePage from "~/team/type-view";
import UserTypePage from "~/users/views/users-type-public-view";
import type { PageProps as UserTypePageProps } from "~/users/views/users-type-public-view";

export type PageProps = UserTypePageProps | TeamTypePageProps;

export default function Page(props: PageProps) {
if ((props as TeamTypePageProps)?.teamId) return <TeamTypePage {...(props as TeamTypePageProps)} />;
return <UserTypePage {...(props as UserTypePageProps)} />;
}

Page.PageWrapper = PageWrapper;

export const getServerSideProps = withEmbedSsr(_getServerSideProps);
1 change: 1 addition & 0 deletions apps/web/pages/org/[orgSlug]/[user]/embed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default, getServerSideProps } from "@pages/[user]/embed";
14 changes: 14 additions & 0 deletions apps/web/pages/org/[orgSlug]/embed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { getServerSideProps as _getServerSideProps } from "@lib/team/[slug]/getServerSideProps";
import withEmbedSsr from "@lib/withEmbedSsr";

import PageWrapper from "@components/PageWrapper";

import TeamPage, { type PageProps } from "~/team/team-view";

const Page = (props: PageProps) => <TeamPage {...props} />;

Page.PageWrapper = PageWrapper;

export default Page;

export const getServerSideProps = withEmbedSsr(_getServerSideProps);
14 changes: 14 additions & 0 deletions apps/web/pages/team/[slug]/[type]/embed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { getServerSideProps as _getServerSideProps } from "@lib/team/[slug]/[type]/getServerSideProps";
import withEmbedSsr from "@lib/withEmbedSsr";

import PageWrapper from "@components/PageWrapper";

import TypePage, { type PageProps } from "~/team/type-view";

export const getServerSideProps = withEmbedSsr(_getServerSideProps);

const Page = (props: PageProps) => <TypePage {...props} />;

Page.PageWrapper = PageWrapper;

export default Page;
14 changes: 14 additions & 0 deletions apps/web/pages/team/[slug]/embed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { getServerSideProps as _getServerSideProps } from "@lib/team/[slug]/getServerSideProps";
import withEmbedSsr from "@lib/withEmbedSsr";

import PageWrapper from "@components/PageWrapper";

import TeamPage, { type PageProps } from "~/team/team-view";

export const getServerSideProps = withEmbedSsr(_getServerSideProps);

const Page = (props: PageProps) => <TeamPage {...props} />;

Page.PageWrapper = PageWrapper;

export default Page;

0 comments on commit 876ea41

Please sign in to comment.