diff --git a/apps/gql/schema/resolvers/index.ts b/apps/gql/schema/resolvers/index.ts index 786eef35..76075fd9 100644 --- a/apps/gql/schema/resolvers/index.ts +++ b/apps/gql/schema/resolvers/index.ts @@ -46,7 +46,7 @@ export const resolvers = { Query: { // @see Viewer field resolvers - viewer: () => ({ actor: null, panoFeed: null }), + viewer: () => ({ actor: null, panoFeed: null, panoFeedBySite: null }), // @see SozlukQuery field resolvers sozluk: () => ({ term: null, terms: null }), // @see PanoQuery field resolvers @@ -102,6 +102,13 @@ export const resolvers = { new ConnectionKey(null, parseConnectionArgs(args), { orderBy: { createdAt: "desc" } }) ); + return transformPanoPostConnection(posts); + }, + panoFeedBySite: async (_, args, { loaders }) => { + const posts = await loaders.pano.post.bySite.load( + new ConnectionKey(args.site, parseConnectionArgs(args), { orderBy: { createdAt: "desc" } }) + ); + return transformPanoPostConnection(posts); }, }, diff --git a/apps/gql/schema/schema.graphql b/apps/gql/schema/schema.graphql index 9fabae12..86d2f89d 100644 --- a/apps/gql/schema/schema.graphql +++ b/apps/gql/schema/schema.graphql @@ -56,6 +56,7 @@ type Viewer { last: Int filter: PanoPostFilter ): PanoPostConnection + panoFeedBySite(site: String!, after: String, first: Int): PanoPostConnection } type User implements Node & Actor { diff --git a/apps/gql/schema/types.generated.ts b/apps/gql/schema/types.generated.ts index 6ffba627..7955c505 100644 --- a/apps/gql/schema/types.generated.ts +++ b/apps/gql/schema/types.generated.ts @@ -388,6 +388,7 @@ export type Viewer = { __typename?: "Viewer"; actor: Maybe; panoFeed: Maybe; + panoFeedBySite: Maybe; }; export type ViewerPanoFeedArgs = { @@ -398,6 +399,12 @@ export type ViewerPanoFeedArgs = { last: InputMaybe; }; +export type ViewerPanoFeedBySiteArgs = { + after: InputMaybe; + first: InputMaybe; + site: Scalars["String"]["input"]; +}; + export type WithIndex = TObject & Record; export type ResolversObject = WithIndex; @@ -1088,6 +1095,12 @@ export type ViewerResolvers< ContextType, Partial >; + panoFeedBySite: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; __isTypeOf?: IsTypeOfResolverFn; }>; diff --git a/apps/kampus/app/pano/features/post-list/PostItem.tsx b/apps/kampus/app/pano/features/post-list/PostItem.tsx index 5aeeb7f7..e8fe41db 100644 --- a/apps/kampus/app/pano/features/post-list/PostItem.tsx +++ b/apps/kampus/app/pano/features/post-list/PostItem.tsx @@ -90,7 +90,7 @@ export const PostItem = (props: PostItemProps) => {
- + {post.site ?? ""} diff --git a/apps/kampus/app/pano/site/[...site]/PanoFeedBySite.tsx b/apps/kampus/app/pano/site/[...site]/PanoFeedBySite.tsx new file mode 100644 index 00000000..96aceb6e --- /dev/null +++ b/apps/kampus/app/pano/site/[...site]/PanoFeedBySite.tsx @@ -0,0 +1,83 @@ +import { Suspense } from "react"; +import { graphql, useFragment, usePaginationFragment } from "react-relay"; + +import { Button } from "@kampus/ui"; + +import { PostItem } from "~/app/pano/features/post-list/PostItem"; +import { type PanoFeedBySite_viewer$key } from "./__generated__/PanoFeedBySite_viewer.graphql"; +import { type PanoFeedBySiteFragment$key } from "./__generated__/PanoFeedBySiteFragment.graphql"; + +const fragment = graphql` + fragment PanoFeedBySiteFragment on Viewer + @argumentDefinitions( + site: { type: "String!" } + after: { type: "String" } + first: { type: "Int", defaultValue: 10 } + ) + @refetchable(queryName: "PanoFeedBySitePaginationQuery") { + panoFeedBySite(after: $after, first: $first, site: $site) + @connection(key: "PanoFeedBySiteFragment__panoFeedBySite") { + __id + edges { + cursor + node { + id + ...PostItem_post + } + } + } + } +`; + +const viewerFragment = graphql` + fragment PanoFeedBySite_viewer on Viewer { + ...PostItem_viewer + } +`; + +interface Props { + panoFeedBySite: PanoFeedBySiteFragment$key; + panoViewerBySite: PanoFeedBySite_viewer$key; +} + +export function PanoFeedBySite(props: Props) { + const { data, hasNext, hasPrevious, loadNext, loadPrevious } = usePaginationFragment( + fragment, + props.panoFeedBySite + ); + const viewer = useFragment(viewerFragment, props.panoViewerBySite); + + const feed = data.panoFeedBySite; + + return ( + <> + +
+ {feed?.edges?.map((edge) => { + if (!edge?.node) { + return null; + } + + return ( + + ); + })} + +
+ + +
+
+
+ + ); +} diff --git a/apps/kampus/app/pano/site/[...site]/PostListBySiteContainer.tsx b/apps/kampus/app/pano/site/[...site]/PostListBySiteContainer.tsx new file mode 100644 index 00000000..db6f8f78 --- /dev/null +++ b/apps/kampus/app/pano/site/[...site]/PostListBySiteContainer.tsx @@ -0,0 +1,33 @@ +"use client"; + +import { graphql, usePreloadedQuery } from "react-relay"; + +import { type SerializablePreloadedQuery } from "@kampus/relay"; +import useSerializablePreloadedQuery from "@kampus/relay/use-serializable-preloaded-query"; + +import { type PostListBySiteContainerQuery } from "./__generated__/PostListBySiteContainerQuery.graphql"; +import { PanoFeedBySite } from "./PanoFeedBySite"; + +interface Props { + preloadedQuery: SerializablePreloadedQuery; +} + +const query = graphql` + query PostListBySiteContainerQuery($site: String!) { + viewer { + ...PanoFeedBySiteFragment @arguments(site: $site) + ...PanoFeedBySite_viewer + } + } +`; + +export const PostListBySiteContainer = (props: Props) => { + const queryRef = useSerializablePreloadedQuery(props.preloadedQuery); + const data = usePreloadedQuery(query, queryRef); + + if (!data.viewer) { + return null; + } + + return ; +}; diff --git a/apps/kampus/app/pano/site/[...site]/__generated__/PanoFeedBySiteFragment.graphql.ts b/apps/kampus/app/pano/site/[...site]/__generated__/PanoFeedBySiteFragment.graphql.ts new file mode 100644 index 00000000..9237fd98 --- /dev/null +++ b/apps/kampus/app/pano/site/[...site]/__generated__/PanoFeedBySiteFragment.graphql.ts @@ -0,0 +1,190 @@ +/** + * @generated SignedSource<<8b97acf2030f40e9fd4eb8160fe8f870>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ReaderFragment, RefetchableFragment } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type PanoFeedBySiteFragment$data = { + readonly panoFeedBySite: { + readonly __id: string; + readonly edges: ReadonlyArray<{ + readonly cursor: string; + readonly node: { + readonly id: string; + readonly " $fragmentSpreads": FragmentRefs<"PostItem_post">; + } | null; + } | null> | null; + } | null; + readonly " $fragmentType": "PanoFeedBySiteFragment"; +}; +export type PanoFeedBySiteFragment$key = { + readonly " $data"?: PanoFeedBySiteFragment$data; + readonly " $fragmentSpreads": FragmentRefs<"PanoFeedBySiteFragment">; +}; + +const node: ReaderFragment = (function(){ +var v0 = [ + "panoFeedBySite" +]; +return { + "argumentDefinitions": [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "after" + }, + { + "defaultValue": 10, + "kind": "LocalArgument", + "name": "first" + }, + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "site" + } + ], + "kind": "Fragment", + "metadata": { + "connection": [ + { + "count": "first", + "cursor": "after", + "direction": "forward", + "path": (v0/*: any*/) + } + ], + "refetch": { + "connection": { + "forward": { + "count": "first", + "cursor": "after" + }, + "backward": null, + "path": (v0/*: any*/) + }, + "fragmentPathInResult": [ + "viewer" + ], + "operation": require('./PanoFeedBySitePaginationQuery.graphql') + } + }, + "name": "PanoFeedBySiteFragment", + "selections": [ + { + "alias": "panoFeedBySite", + "args": [ + { + "kind": "Variable", + "name": "site", + "variableName": "site" + } + ], + "concreteType": "PanoPostConnection", + "kind": "LinkedField", + "name": "__PanoFeedBySiteFragment__panoFeedBySite_connection", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "PanoPostEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PanoPost", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "args": null, + "kind": "FragmentSpread", + "name": "PostItem_post" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": null + } + ], + "type": "Viewer", + "abstractKey": null +}; +})(); + +(node as any).hash = "a1858424257de428f52a047f9c4c99fb"; + +export default node; diff --git a/apps/kampus/app/pano/site/[...site]/__generated__/PanoFeedBySitePaginationQuery.graphql.ts b/apps/kampus/app/pano/site/[...site]/__generated__/PanoFeedBySitePaginationQuery.graphql.ts new file mode 100644 index 00000000..96a1e7d4 --- /dev/null +++ b/apps/kampus/app/pano/site/[...site]/__generated__/PanoFeedBySitePaginationQuery.graphql.ts @@ -0,0 +1,300 @@ +/** + * @generated SignedSource<> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest, Query } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type PanoFeedBySitePaginationQuery$variables = { + after?: string | null; + first?: number | null; + site: string; +}; +export type PanoFeedBySitePaginationQuery$data = { + readonly viewer: { + readonly " $fragmentSpreads": FragmentRefs<"PanoFeedBySiteFragment">; + } | null; +}; +export type PanoFeedBySitePaginationQuery = { + response: PanoFeedBySitePaginationQuery$data; + variables: PanoFeedBySitePaginationQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "after" + }, + { + "defaultValue": 10, + "kind": "LocalArgument", + "name": "first" + }, + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "site" + } +], +v1 = [ + { + "kind": "Variable", + "name": "after", + "variableName": "after" + }, + { + "kind": "Variable", + "name": "first", + "variableName": "first" + }, + { + "kind": "Variable", + "name": "site", + "variableName": "site" + } +], +v2 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "PanoFeedBySitePaginationQuery", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Viewer", + "kind": "LinkedField", + "name": "viewer", + "plural": false, + "selections": [ + { + "args": (v1/*: any*/), + "kind": "FragmentSpread", + "name": "PanoFeedBySiteFragment" + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "PanoFeedBySitePaginationQuery", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Viewer", + "kind": "LinkedField", + "name": "viewer", + "plural": false, + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": "PanoPostConnection", + "kind": "LinkedField", + "name": "panoFeedBySite", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "PanoPostEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PanoPost", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "title", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "content", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "url", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "site", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "commentCount", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "isUpvotedByViewer", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "upvoteCount", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "User", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "displayName", + "storageKey": null + }, + (v2/*: any*/) + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": null + }, + { + "alias": null, + "args": (v1/*: any*/), + "filters": [ + "site" + ], + "handle": "connection", + "key": "PanoFeedBySiteFragment__panoFeedBySite", + "kind": "LinkedHandle", + "name": "panoFeedBySite" + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "720475be983f481d4bf824d7be1cdfea", + "id": null, + "metadata": {}, + "name": "PanoFeedBySitePaginationQuery", + "operationKind": "query", + "text": "query PanoFeedBySitePaginationQuery(\n $after: String\n $first: Int = 10\n $site: String!\n) {\n viewer {\n ...PanoFeedBySiteFragment_25cAeP\n }\n}\n\nfragment MoreOptions_post on PanoPost {\n id\n owner {\n displayName\n id\n }\n}\n\nfragment PanoFeedBySiteFragment_25cAeP on Viewer {\n panoFeedBySite(after: $after, first: $first, site: $site) {\n edges {\n cursor\n node {\n id\n ...PostItem_post\n __typename\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment PostItem_post on PanoPost {\n id\n title\n content\n url\n createdAt\n site\n commentCount\n ...PostUpvoteButton_post\n owner {\n displayName\n id\n }\n ...MoreOptions_post\n}\n\nfragment PostUpvoteButton_post on PanoPost {\n id\n isUpvotedByViewer\n upvoteCount\n}\n" + } +}; +})(); + +(node as any).hash = "a1858424257de428f52a047f9c4c99fb"; + +export default node; diff --git a/apps/kampus/app/pano/site/[...site]/__generated__/PanoFeedBySite_viewer.graphql.ts b/apps/kampus/app/pano/site/[...site]/__generated__/PanoFeedBySite_viewer.graphql.ts new file mode 100644 index 00000000..4a31ba5a --- /dev/null +++ b/apps/kampus/app/pano/site/[...site]/__generated__/PanoFeedBySite_viewer.graphql.ts @@ -0,0 +1,40 @@ +/** + * @generated SignedSource<<5963b49e55a3bdc409ab12e7ce8959e9>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { Fragment, ReaderFragment } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type PanoFeedBySite_viewer$data = { + readonly " $fragmentSpreads": FragmentRefs<"PostItem_viewer">; + readonly " $fragmentType": "PanoFeedBySite_viewer"; +}; +export type PanoFeedBySite_viewer$key = { + readonly " $data"?: PanoFeedBySite_viewer$data; + readonly " $fragmentSpreads": FragmentRefs<"PanoFeedBySite_viewer">; +}; + +const node: ReaderFragment = { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": null, + "name": "PanoFeedBySite_viewer", + "selections": [ + { + "args": null, + "kind": "FragmentSpread", + "name": "PostItem_viewer" + } + ], + "type": "Viewer", + "abstractKey": null +}; + +(node as any).hash = "0345e9f43077fa9ebb6f7848f3eb0300"; + +export default node; diff --git a/apps/kampus/app/pano/site/[...site]/__generated__/PostListBySiteContainerQuery.graphql.ts b/apps/kampus/app/pano/site/[...site]/__generated__/PostListBySiteContainerQuery.graphql.ts new file mode 100644 index 00000000..066e47b3 --- /dev/null +++ b/apps/kampus/app/pano/site/[...site]/__generated__/PostListBySiteContainerQuery.graphql.ts @@ -0,0 +1,307 @@ +/** + * @generated SignedSource<<99e9d9c483e3ec59ed137fbab70e8ba6>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest, Query } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type PostListBySiteContainerQuery$variables = { + site: string; +}; +export type PostListBySiteContainerQuery$data = { + readonly viewer: { + readonly " $fragmentSpreads": FragmentRefs<"PanoFeedBySiteFragment" | "PanoFeedBySite_viewer">; + } | null; +}; +export type PostListBySiteContainerQuery = { + response: PostListBySiteContainerQuery$data; + variables: PostListBySiteContainerQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "site" + } +], +v1 = { + "kind": "Variable", + "name": "site", + "variableName": "site" +}, +v2 = [ + { + "kind": "Literal", + "name": "first", + "value": 10 + }, + (v1/*: any*/) +], +v3 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "displayName", + "storageKey": null +}, +v5 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "PostListBySiteContainerQuery", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Viewer", + "kind": "LinkedField", + "name": "viewer", + "plural": false, + "selections": [ + { + "args": [ + (v1/*: any*/) + ], + "kind": "FragmentSpread", + "name": "PanoFeedBySiteFragment" + }, + { + "args": null, + "kind": "FragmentSpread", + "name": "PanoFeedBySite_viewer" + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "PostListBySiteContainerQuery", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Viewer", + "kind": "LinkedField", + "name": "viewer", + "plural": false, + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "PanoPostConnection", + "kind": "LinkedField", + "name": "panoFeedBySite", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "PanoPostEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PanoPost", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v3/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "title", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "content", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "url", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "site", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "commentCount", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "isUpvotedByViewer", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "upvoteCount", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "User", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + (v4/*: any*/), + (v3/*: any*/) + ], + "storageKey": null + }, + (v5/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": null + }, + { + "alias": null, + "args": (v2/*: any*/), + "filters": [ + "site" + ], + "handle": "connection", + "key": "PanoFeedBySiteFragment__panoFeedBySite", + "kind": "LinkedHandle", + "name": "panoFeedBySite" + }, + { + "alias": null, + "args": null, + "concreteType": null, + "kind": "LinkedField", + "name": "actor", + "plural": false, + "selections": [ + (v5/*: any*/), + (v4/*: any*/), + (v3/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "a9652ab6b0fb7122397f1a086a24b7d2", + "id": null, + "metadata": {}, + "name": "PostListBySiteContainerQuery", + "operationKind": "query", + "text": "query PostListBySiteContainerQuery(\n $site: String!\n) {\n viewer {\n ...PanoFeedBySiteFragment_QaI6y\n ...PanoFeedBySite_viewer\n }\n}\n\nfragment MoreOptions_post on PanoPost {\n id\n owner {\n displayName\n id\n }\n}\n\nfragment MoreOptions_viewer on Viewer {\n actor {\n __typename\n displayName\n id\n }\n}\n\nfragment PanoFeedBySiteFragment_QaI6y on Viewer {\n panoFeedBySite(first: 10, site: $site) {\n edges {\n cursor\n node {\n id\n ...PostItem_post\n __typename\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment PanoFeedBySite_viewer on Viewer {\n ...PostItem_viewer\n}\n\nfragment PostItem_post on PanoPost {\n id\n title\n content\n url\n createdAt\n site\n commentCount\n ...PostUpvoteButton_post\n owner {\n displayName\n id\n }\n ...MoreOptions_post\n}\n\nfragment PostItem_viewer on Viewer {\n ...MoreOptions_viewer\n actor {\n __typename\n displayName\n id\n }\n}\n\nfragment PostUpvoteButton_post on PanoPost {\n id\n isUpvotedByViewer\n upvoteCount\n}\n" + } +}; +})(); + +(node as any).hash = "90544bd6f6e1e746981397e9609fffa5"; + +export default node; diff --git a/apps/kampus/app/pano/site/[...site]/page.tsx b/apps/kampus/app/pano/site/[...site]/page.tsx new file mode 100644 index 00000000..e2d0a4a6 --- /dev/null +++ b/apps/kampus/app/pano/site/[...site]/page.tsx @@ -0,0 +1,18 @@ +import loadSerializableQuery from "@kampus/relay/load-serializable-query"; + +import query, { + type PostListBySiteContainerQuery, +} from "../[...site]/__generated__/PostListBySiteContainerQuery.graphql"; +import { PostListBySiteContainer } from "../[...site]/PostListBySiteContainer"; + +export default async function PostSitePage({ params }: { params: { site: string[] } }) { + const preloadedQuery = await loadSerializableQuery(query, { + site: params.site.join("/"), + }); + + return ( +
+ +
+ ); +} diff --git a/apps/kampus/app/pano/site/[site]/page.tsx b/apps/kampus/app/pano/site/[site]/page.tsx deleted file mode 100644 index 27fb5c1f..00000000 --- a/apps/kampus/app/pano/site/[site]/page.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export default function PostSitePage() { - return
PostSitePage
; -}