diff --git a/apps/kampus/app/pano/PostListContainer.tsx b/apps/kampus/app/pano/PostListContainer.tsx
index c96f1d55..d3a93228 100644
--- a/apps/kampus/app/pano/PostListContainer.tsx
+++ b/apps/kampus/app/pano/PostListContainer.tsx
@@ -16,9 +16,7 @@ const query = graphql`
query PostListContainerQuery {
viewer {
...PanoFeedFragment
- actor {
- ...PanoFeed_viewer
- }
+ ...PanoFeed_viewer
}
}
`;
@@ -26,11 +24,10 @@ const query = graphql`
export const PostListContainer = (props: Props) => {
const queryRef = useSerializablePreloadedQuery(props.preloadedQuery);
const data = usePreloadedQuery(query, queryRef);
- console.log(data);
if (!data.viewer) {
return null;
}
- return
;
+ return
;
};
diff --git a/apps/kampus/app/pano/__generated__/PanoFeed_viewer.graphql.ts b/apps/kampus/app/pano/__generated__/PanoFeed_viewer.graphql.ts
index 57438047..a1aeb7a0 100644
--- a/apps/kampus/app/pano/__generated__/PanoFeed_viewer.graphql.ts
+++ b/apps/kampus/app/pano/__generated__/PanoFeed_viewer.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<<6909702fcff66160abb20fbbfeab1e64>>
+ * @generated SignedSource<<285a7607218f1bcd3ce4cf4f6613f8d0>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -11,7 +11,7 @@
import { Fragment, ReaderFragment } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type PanoFeed_viewer$data = {
- readonly displayName: string | null;
+ readonly " $fragmentSpreads": FragmentRefs<"PostItem_viewer">;
readonly " $fragmentType": "PanoFeed_viewer";
};
export type PanoFeed_viewer$key = {
@@ -26,17 +26,15 @@ const node: ReaderFragment = {
"name": "PanoFeed_viewer",
"selections": [
{
- "alias": null,
"args": null,
- "kind": "ScalarField",
- "name": "displayName",
- "storageKey": null
+ "kind": "FragmentSpread",
+ "name": "PostItem_viewer"
}
],
- "type": "Actor",
- "abstractKey": "__isActor"
+ "type": "Viewer",
+ "abstractKey": null
};
-(node as any).hash = "d899f3d2a551aba8616408feb294eb54";
+(node as any).hash = "aa9717b7dd3561c13af770ff24544e2d";
export default node;
diff --git a/apps/kampus/app/pano/__generated__/PostListContainerQuery.graphql.ts b/apps/kampus/app/pano/__generated__/PostListContainerQuery.graphql.ts
index dd07a0a1..e8ce0120 100644
--- a/apps/kampus/app/pano/__generated__/PostListContainerQuery.graphql.ts
+++ b/apps/kampus/app/pano/__generated__/PostListContainerQuery.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<
>
+ * @generated SignedSource<>
* @lightSyntaxTransform
* @nogrep
*/
@@ -13,10 +13,7 @@ import { FragmentRefs } from "relay-runtime";
export type PostListContainerQuery$variables = {};
export type PostListContainerQuery$data = {
readonly viewer: {
- readonly actor: {
- readonly " $fragmentSpreads": FragmentRefs<"PanoFeed_viewer">;
- } | null;
- readonly " $fragmentSpreads": FragmentRefs<"PanoFeedFragment">;
+ readonly " $fragmentSpreads": FragmentRefs<"PanoFeedFragment" | "PanoFeed_viewer">;
} | null;
};
export type PostListContainerQuery = {
@@ -74,20 +71,9 @@ return {
"name": "PanoFeedFragment"
},
{
- "alias": null,
"args": null,
- "concreteType": null,
- "kind": "LinkedField",
- "name": "actor",
- "plural": false,
- "selections": [
- {
- "args": null,
- "kind": "FragmentSpread",
- "name": "PanoFeed_viewer"
- }
- ],
- "storageKey": null
+ "kind": "FragmentSpread",
+ "name": "PanoFeed_viewer"
}
],
"storageKey": null
@@ -278,10 +264,6 @@ return {
"plural": false,
"selections": [
(v3/*: any*/),
- {
- "kind": "TypeDiscriminator",
- "abstractKey": "__isActor"
- },
(v2/*: any*/),
(v1/*: any*/)
],
@@ -293,16 +275,16 @@ return {
]
},
"params": {
- "cacheID": "03884b4e86f1ba9d6723df79bf407499",
+ "cacheID": "f17705aca1c90be09fad072eb42c4786",
"id": null,
"metadata": {},
"name": "PostListContainerQuery",
"operationKind": "query",
- "text": "query PostListContainerQuery {\n viewer {\n ...PanoFeedFragment\n actor {\n __typename\n ...PanoFeed_viewer\n id\n }\n }\n}\n\nfragment MoreOptions_post on PanoPost {\n id\n owner {\n username\n id\n }\n}\n\nfragment PanoFeedFragment on Viewer {\n panoFeed(first: 10) {\n edges {\n cursor\n node {\n id\n ...PostItem_post\n __typename\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment PanoFeed_viewer on Actor {\n __isActor: __typename\n displayName\n}\n\nfragment PostItem_post on PanoPost {\n id\n title\n content\n url\n createdAt\n site\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"
+ "text": "query PostListContainerQuery {\n viewer {\n ...PanoFeedFragment\n ...PanoFeed_viewer\n }\n}\n\nfragment MoreOptions_post on PanoPost {\n id\n owner {\n username\n id\n }\n}\n\nfragment MoreOptions_viewer on Viewer {\n actor {\n __typename\n displayName\n id\n }\n}\n\nfragment PanoFeedFragment on Viewer {\n panoFeed(first: 10) {\n edges {\n cursor\n node {\n id\n ...PostItem_post\n __typename\n }\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment PanoFeed_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 ...PostUpvoteButton_post\n owner {\n displayName\n id\n }\n ...MoreOptions_post\n}\n\nfragment PostItem_viewer on Viewer {\n ...MoreOptions_viewer\n}\n\nfragment PostUpvoteButton_post on PanoPost {\n id\n isUpvotedByViewer\n upvoteCount\n}\n"
}
};
})();
-(node as any).hash = "1a56ce0599346554f35cba75e9ef0e29";
+(node as any).hash = "246fd8479a18172b183f288ff6f3e842";
export default node;
diff --git a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx
index f685cedd..f2851838 100644
--- a/apps/kampus/app/pano/features/post-list/MoreOptions.tsx
+++ b/apps/kampus/app/pano/features/post-list/MoreOptions.tsx
@@ -22,26 +22,37 @@ import {
} from "@kampus/ui-next";
import { MoreOptions_post$key } from "./__generated__/MoreOptions_post.graphql";
+import { MoreOptions_viewer$key } from "./__generated__/MoreOptions_viewer.graphql";
interface Props {
post: MoreOptions_post$key;
+ viewerRef: MoreOptions_viewer$key | null;
}
-const moreOptionsPostFragment = graphql`
- fragment MoreOptions_post on PanoPost {
- id
- owner {
- username
- }
- }
-`;
+const useMoreOptionsPostFragment = (key: MoreOptions_post$key | null) =>
+ useFragment(
+ graphql`
+ fragment MoreOptions_post on PanoPost {
+ id
+ owner {
+ username
+ }
+ }
+ `,
+ key
+ );
-// const moreOptionsViewerFragment = graphql`
-// fragment MoreOptions_viewer on Actor {
-// displayName
-// id
-// }
-// `;
+const useMoreOptionsViewerFragment = (key: MoreOptions_viewer$key | null) =>
+ useFragment(
+ graphql`
+ fragment MoreOptions_viewer on Viewer {
+ actor {
+ displayName
+ }
+ }
+ `,
+ key
+ );
function canUserEdit(session?: any, owner?: any) {
if (!owner) return false;
@@ -52,15 +63,15 @@ function canUserEdit(session?: any, owner?: any) {
}
export const MoreOptionsDropdown = (props: Props) => {
- const post = useFragment(moreOptionsPostFragment, props.post);
- // const viewer = useFragment(moreOptionsViewerFragment, props.viewer);
+ const post = useMoreOptionsPostFragment(props.post);
+ const viewer = useMoreOptionsViewerFragment(props.viewerRef);
const { toast } = useToast();
const ownerItems: JSX.Element[] = [];
// if (canUserEdit(session, post.owner?.username)) {
ownerItems.push(
- Düzenle
+ Düzenle
);
ownerItems.push(
@@ -83,7 +94,7 @@ export const MoreOptionsDropdown = (props: Props) => {
{canUserEdit({ user: { name: "can" } }, "can") && (
<>
- Düzenle
+ Düzenle
Sil
diff --git a/apps/kampus/app/pano/features/post-list/PostItem.tsx b/apps/kampus/app/pano/features/post-list/PostItem.tsx
index e3f98c46..ae35785e 100644
--- a/apps/kampus/app/pano/features/post-list/PostItem.tsx
+++ b/apps/kampus/app/pano/features/post-list/PostItem.tsx
@@ -7,6 +7,7 @@ import { cn } from "@kampus/ui-next/utils";
import { TimeAgo } from "~/../../packages/ui";
import { type PostItem_post$key } from "./__generated__/PostItem_post.graphql";
+import { type PostItem_viewer$key } from "./__generated__/PostItem_viewer.graphql";
import { MoreOptionsDropdown } from "./MoreOptions";
import { UpvoteButton } from "./PostUpvoteButton";
@@ -46,13 +47,25 @@ const usePanoPostFragment = (key: PostItem_post$key | null) =>
key
);
+const usePanoViewerFragment = (key: PostItem_viewer$key | null) =>
+ useFragment(
+ graphql`
+ fragment PostItem_viewer on Viewer {
+ ...MoreOptions_viewer
+ }
+ `,
+ key
+ );
+
interface PostItemProps {
post: PostItem_post$key;
+ viewerRef: PostItem_viewer$key;
showContent?: boolean;
}
export const PostItem = (props: PostItemProps) => {
const post = usePanoPostFragment(props.post);
+ const viewer = usePanoViewerFragment(props.viewerRef);
if (!post) {
return null;
@@ -77,7 +90,7 @@ export const PostItem = (props: PostItemProps) => {
0 yorum |