Skip to content

Commit

Permalink
refactor: Update GraphQL fragments (#5536)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint authored Mar 1, 2025
2 parents d60818c + 0dfeefe commit 3740a2e
Show file tree
Hide file tree
Showing 242 changed files with 1,173 additions and 1,211 deletions.
2 changes: 1 addition & 1 deletion apps/api/railway.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion apps/cron/railway.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion apps/og/railway.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import type { Metadata } from "next";
import defaultMetadata from "src/defaultMetadata";

interface Props {
params: Promise<{ slug: string }>;
params: Promise<{ id: string }>;
}

export const generateMetadata = async ({
params
}: Props): Promise<Metadata> => {
const { slug } = await params;
const { id } = await params;

const { data } = await apolloClient().query({
query: PostDocument,
variables: { request: { post: slug } }
variables: { request: { post: id } }
});

if (!data.post) {
Expand All @@ -39,18 +39,18 @@ export const generateMetadata = async ({
const description = (filteredContent || title).slice(0, 155);

return {
alternates: { canonical: `https://hey.xyz/posts/${targetPost.slug}` },
alternates: { canonical: `https://hey.xyz/posts/${targetPost.id}` },
applicationName: APP_NAME,
authors: { name, url: `https://hey.xyz${link}` },
creator: name,
description: description,
metadataBase: new URL(`https://hey.xyz/posts/${targetPost.slug}`),
metadataBase: new URL(`https://hey.xyz/posts/${targetPost.id}`),
openGraph: {
description: description,
images: getPostOGImages(metadata) as any,
siteName: "Hey",
type: "article",
url: `https://hey.xyz/posts/${targetPost.slug}`
url: `https://hey.xyz/posts/${targetPost.id}`
},
other: {
"count:collects": targetPost.stats.collects,
Expand All @@ -59,7 +59,7 @@ export const generateMetadata = async ({
"count:likes": targetPost.stats.reactions,
"count:reposts": targetPost.stats.reposts,
"count:quotes": targetPost.stats.quotes,
"lens:slug": targetPost.slug
"lens:id": targetPost.id
},
publisher: name,
title: title,
Expand All @@ -71,16 +71,16 @@ export const generateMetadata = async ({
};

const Page = async ({ params }: Props) => {
const { slug } = await params;
const { id } = await params;
const metadata = await generateMetadata({ params });

if (!metadata) {
return <h1>{slug}</h1>;
return <h1>{id}</h1>;
}

const postUrl = `https://hey.xyz/posts/${metadata.other?.["lens:slug"]}`;
const postUrl = `https://hey.xyz/posts/${metadata.other?.["lens:id"]}`;

logger.info(`[OG] Fetched post /posts/${metadata.other?.["lens:slug"]}`);
logger.info(`[OG] Fetched post /posts/${metadata.other?.["lens:id"]}`);

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions apps/og/src/app/u/[username]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { APP_NAME } from "@hey/data/constants";
import getAccount from "@hey/helpers/getAccount";
import getAvatar from "@hey/helpers/getAvatar";
import logger from "@hey/helpers/logger";
import { type Account, AccountDocument } from "@hey/indexer";
import { AccountDocument } from "@hey/indexer";
import apolloClient from "@hey/indexer/apollo/client";
import type { Metadata } from "next";
import defaultMetadata from "src/defaultMetadata";
Expand All @@ -25,7 +25,7 @@ export const generateMetadata = async ({
return defaultMetadata;
}

const account = data.account as Account;
const account = data.account;
const { name, link, usernameWithPrefix } = getAccount(account);
const title = `${name} (${usernameWithPrefix}) • ${APP_NAME}`;
const description = (account?.metadata?.bio || title).slice(0, 155);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/railway.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
}
}
}
}
}
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/CreatorTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Permission, PermissionId } from "@hey/data/permissions";
import getInternalAccount, {
GET_INTERNAL_ACCOUNT_QUERY_KEY
} from "@hey/helpers/api/getInternalAccount";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import { Toggle } from "@hey/ui";
import { useQuery } from "@tanstack/react-query";
import axios from "axios";
Expand All @@ -15,7 +15,7 @@ import { useEffect, useState } from "react";
import toast from "react-hot-toast";

interface CreatorToolProps {
account: Account;
account: AccountFragment;
}

const CreatorTool: FC<CreatorToolProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/DeletedDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Slug from "@components/Shared/Slug";
import { STATIC_IMAGES_URL } from "@hey/data/constants";
import getAccount from "@hey/helpers/getAccount";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import { H3, Image } from "@hey/ui";
import type { FC } from "react";

interface DeletedDetailsProps {
account: Account;
account: AccountFragment;
}

const DeletedDetails: FC<DeletedDetailsProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import getAccountAttribute from "@hey/helpers/getAccountAttribute";
import getAvatar from "@hey/helpers/getAvatar";
import getFavicon from "@hey/helpers/getFavicon";
import getMentions from "@hey/helpers/getMentions";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import { Button, H3, Image, LightBox, Tooltip } from "@hey/ui";
import { useFlag } from "@unleash/proxy-client-react";
import { useTheme } from "next-themes";
Expand Down Expand Up @@ -47,7 +47,7 @@ const MetaDetails = ({

interface DetailsProps {
isSuspended: boolean;
account: Account;
account: AccountFragment;
}

const Details: FC<DetailsProps> = ({ isSuspended = false, account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/Followerings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import Following from "@components/Shared/Modal/Following";
import GraphStatsShimmer from "@components/Shared/Shimmer/GraphStatsShimmer";
import getAccount from "@hey/helpers/getAccount";
import humanize from "@hey/helpers/humanize";
import { type Account, useAccountStatsQuery } from "@hey/indexer";
import { type AccountFragment, useAccountStatsQuery } from "@hey/indexer";
import { H4, Modal } from "@hey/ui";
import plur from "plur";
import { type FC, useState } from "react";

interface FolloweringsProps {
account: Account;
account: AccountFragment;
}

const Followerings: FC<FolloweringsProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/InternalTools.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { FeatureFlag } from "@hey/data/feature-flags";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import { Card } from "@hey/ui";
import { useFlag } from "@unleash/proxy-client-react";
import type { FC } from "react";
import CreatorTool from "./CreatorTool";
import StaffTool from "./StaffTool";

interface InternalToolsProps {
account: Account;
account: AccountFragment;
}

const InternalTools: FC<InternalToolsProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/Menu/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { MenuItem } from "@headlessui/react";
import { NoSymbolIcon } from "@heroicons/react/24/outline";
import getAccount from "@hey/helpers/getAccount";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import cn from "@hey/ui/cn";
import type { FC } from "react";
import { useBlockAlertStore } from "src/store/non-persisted/alert/useBlockAlertStore";

interface BlockProps {
account: Account;
account: AccountFragment;
}

const Block: FC<BlockProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/Menu/CopyLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { MenuItem } from "@headlessui/react";
import { LinkIcon } from "@heroicons/react/24/outline";
import getAccount from "@hey/helpers/getAccount";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import cn from "@hey/ui/cn";
import type { FC } from "react";
import toast from "react-hot-toast";

interface CopyLinkProps {
account: Account;
account: AccountFragment;
}

const CopyLink: FC<CopyLinkProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/Menu/Mute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { MenuItem } from "@headlessui/react";
import { SpeakerWaveIcon, SpeakerXMarkIcon } from "@heroicons/react/24/outline";
import getAccount from "@hey/helpers/getAccount";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import cn from "@hey/ui/cn";
import type { FC } from "react";
import { useMuteAlertStore } from "src/store/non-persisted/alert/useMuteAlertStore";

interface MuteProps {
account: Account;
account: AccountFragment;
}

const Mute: FC<MuteProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/Menu/Report.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { MenuItem } from "@headlessui/react";
import { FlagIcon } from "@heroicons/react/24/outline";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import cn from "@hey/ui/cn";
import type { FC } from "react";
import { useReportAccountModalStore } from "src/store/non-persisted/modal/useReportAccountModalStore";

interface ReportProps {
account: Account;
account: AccountFragment;
}

const Report: FC<ReportProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/Menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import MenuTransition from "@components/Shared/MenuTransition";
import { Menu, MenuButton, MenuItems } from "@headlessui/react";
import { EllipsisVerticalIcon } from "@heroicons/react/24/outline";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import type { FC } from "react";
import { Fragment } from "react";
import { useAccountStore } from "src/store/persisted/useAccountStore";
Expand All @@ -12,7 +12,7 @@ import Mute from "./Mute";
import Report from "./Report";

interface AccountMenuProps {
account: Account;
account: AccountFragment;
}

const AccountMenu: FC<AccountMenuProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/StaffTool.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Suspend from "@components/Shared/Account/Suspend";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import type { FC } from "react";

interface StaffToolProps {
account: Account;
account: AccountFragment;
}

const StaffTool: FC<StaffToolProps> = ({ account }) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Account/SuspendedDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Slug from "@components/Shared/Slug";
import { STATIC_IMAGES_URL } from "@hey/data/constants";
import getAccount from "@hey/helpers/getAccount";
import type { Account } from "@hey/indexer";
import type { AccountFragment } from "@hey/indexer";
import { H3, Image } from "@hey/ui";
import type { FC } from "react";

interface SuspendedDetailsProps {
account: Account;
account: AccountFragment;
}

const SuspendedDetails: FC<SuspendedDetailsProps> = ({ account }) => {
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/components/Account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import getAccountDetails, {
} from "@hey/helpers/api/getAccountDetails";
import getAccount from "@hey/helpers/getAccount";
import isAccountDeleted from "@hey/helpers/isAccountDeleted";
import { type Account, useAccountQuery } from "@hey/indexer";
import { useAccountQuery } from "@hey/indexer";
import { EmptyState, GridItemEight, GridItemFour, GridLayout } from "@hey/ui";
import { useQuery } from "@tanstack/react-query";
import { useFlag } from "@unleash/proxy-client-react";
Expand Down Expand Up @@ -58,7 +58,7 @@ const ViewProfile: NextPage = () => {
}
});

const account = data?.account as Account;
const account = data?.account;

const { data: accountDetails, isLoading: accountDetailsLoading } = useQuery({
enabled: Boolean(account?.address),
Expand Down Expand Up @@ -101,13 +101,13 @@ const ViewProfile: NextPage = () => {
<GridLayout>
<GridItemFour>
{isDeleted ? (
<DeletedDetails account={account as Account} />
<DeletedDetails account={account} />
) : isSuspended ? (
<SuspendedDetails account={account as Account} />
<SuspendedDetails account={account} />
) : (
<Details
isSuspended={accountDetails?.isSuspended || false}
account={account as Account}
account={account}
/>
)}
</GridItemFour>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/Common/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BottomNavigation from "@components/Shared/Navbar/BottomNavigation";
import PageMetatags from "@components/Shared/PageMetatags";
import getCurrentSession from "@helpers/getCurrentSession";
import getToastOptions from "@helpers/getToastOptions";
import { type Account, useMeQuery } from "@hey/indexer";
import { useMeQuery } from "@hey/indexer";
import { useIsClient } from "@uidotdev/usehooks";
import { useTheme } from "next-themes";
import { useRouter } from "next/router";
Expand Down Expand Up @@ -44,7 +44,7 @@ const Layout: FC<LayoutProps> = ({ children }) => {
const { loading } = useMeQuery({
onCompleted: ({ me }) => {
setCurrentAccount({
currentAccount: me.loggedInAs.account as Account,
currentAccount: me.loggedInAs.account,
isSignlessEnabled: me.isSignless
});
},
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Common/Providers/Web3Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { LENS_TESTNET_RPCS } from "@hey/data/rpcs";
import { chains } from "@lens-network/sdk/viem";
import { ConnectKitProvider, getDefaultConfig } from "connectkit";
import type { FC, ReactNode } from "react";
import { createConfig, fallback, http, WagmiProvider } from "wagmi";
import { http, WagmiProvider, createConfig, fallback } from "wagmi";

const config = createConfig(
getDefaultConfig({
Expand Down
5 changes: 2 additions & 3 deletions apps/web/src/components/Group/Settings/Approval/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Loader from "@components/Shared/Loader";
import SingleAccount from "@components/Shared/SingleAccount";
import { CheckCircleIcon } from "@heroicons/react/24/outline";
import {
type Account,
type Group,
type GroupMembershipRequestsRequest,
PageSize,
Expand Down Expand Up @@ -78,14 +77,14 @@ const List: FC<ListProps> = ({ group }) => {
<SingleAccount
hideFollowButton
hideUnfollowButton
account={bannedAccount.account as Account}
account={bannedAccount.account}
/>
<Button
onClick={() =>
setShowBanOrUnbanAlert(
true,
false,
bannedAccount.account as Account,
bannedAccount.account,
group.address
)
}
Expand Down
Loading

0 comments on commit 3740a2e

Please sign in to comment.