Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const PublicationTitleDescription: FC<PublicationTitleDescriptionProps> =
opacity: 0.8,
}}
>
<Markdown children={trimPublicationContentExtraText(publication?.description)} />
<Markdown children={trimPublicationContentExtraText(publication?.description ?? '')} />
</Box>
{showButton && (
<Button variant="outlined" onClick={toggleDescription} sx={{ mt: 2 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ export function PublicationSponsorsAndBackers({ postId }: Props) {

return (
<>
<Box sx={{ display: 'flex', flexDirection: 'column', mt: 4 }}>
<m.div variants={variants}>
<Typography variant="h5" sx={{ fontWeight: 'bold', mb: 0.5 }} gutterBottom>
Sponsors
</Typography>
</m.div>
<Box sx={{ mt: 2, opacity: 0.8 }}>
<m.div variants={variants}>
<Typography variant="body1" color="textSecondary" gutterBottom>
No sponsors yet. Be the first to join and support!
</Typography>
</m.div>
</Box>
</Box>
{/*<Box sx={{ display: 'flex', flexDirection: 'column', mt: 4 }}>*/}
{/* <m.div variants={variants}>*/}
{/* <Typography variant="h5" sx={{ fontWeight: 'bold', mb: 0.5 }} gutterBottom>*/}
{/* Sponsors*/}
{/* </Typography>*/}
{/* </m.div>*/}
{/* <Box sx={{ mt: 2, opacity: 0.8 }}>*/}
{/* <m.div variants={variants}>*/}
{/* <Typography variant="body1" color="textSecondary" gutterBottom>*/}
{/* No sponsors yet. Be the first to join and support!*/}
{/* </Typography>*/}
{/* </m.div>*/}
{/* </Box>*/}
{/*</Box>*/}

<Box sx={{ display: 'flex', flexDirection: 'column', mt: 4 }}>
<m.div variants={variants}>
Expand Down
17 changes: 7 additions & 10 deletions src/sections/publication/views/publication-details-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { useAuth } from '@src/hooks/use-auth.ts';
// import { GLOBAL_CONSTANTS } from '@src/config-global.ts';
// import { PublicationPosterWallpaper } from '@src/sections/publication/components/publication-poster-wallpaper.tsx';
// import { useGetSubscriptionCampaign } from '@src/hooks/protocol/use-get-subscription-campaign.ts';
// import { PublicationHidden } from '@src/sections/publication/components/publication-hidden.tsx';
import { PublicationDetailsViewProps } from '@src/sections/publication/types.ts';
import { SubscribeProfileModal } from '@src/components/subscribe-profile-modal.tsx';
import { PublicationTitleDescription } from '@src/sections/publication/components/publication-description.tsx';
Expand All @@ -32,9 +33,7 @@ import { PublicationSponsorsAndBackers } from '@src/sections/publication/compone
import { useGetPostLazyQuery, useGetPostsByAuthorLazyQuery } from '@src/graphql/generated/hooks.tsx';
import { Post } from '@src/graphql/generated/graphql.ts';
import { Address } from 'viem';
import { PublicationHidden } from '@src/sections/publication/components/publication-hidden.tsx';
import { PublicationDetailViewSkeleton } from '@src/sections/publication/views/publication-details-view.skeleton.tsx';
import { UserProfileViewSkeleton } from '@src/sections/user/views/user-profile-view.skeleton.tsx';
import { LoadingFade } from '@src/components/LoadingFade.tsx';

// ----------------------------------------------------------------------
Expand All @@ -47,21 +46,19 @@ export default function PublicationDetailsView({ id }: Readonly<PublicationDetai
const [loadPublication, { data: publicationData, loading: publicationLoading }] = useGetPostLazyQuery();
const publication: Post = publicationData?.getPost;
const ownerAddress: Address = publication?.author?.address as Address;
const [loadPublications, { data: profilePublications }] = useGetPostsByAuthorLazyQuery();
// const { hasAccess, loading: accessLoading, fetch: refetchAccess } = useHasAccess(ownerAddress);
// const { isAuthorized, loading: isAuthorizedLoading } = useIsPolicyAuthorized(GLOBAL_CONSTANTS.SUBSCRIPTION_POLICY_ADDRESS, ownerAddress);
// const { campaign, loading: campaignLoading, fetchSubscriptionCampaign } = useGetSubscriptionCampaign();
// const { isActive: isCampaignActive, loading: isActiveLoading, fetchIsActive } = useGetCampaignIsActive();
const [loadPublications, { data: profilePublications, loading: profilePublicationsLoading }] = useGetPostsByAuthorLazyQuery();

// const isAccessFullyChecked = !accessLoading && !isAuthorizedLoading && !isActiveLoading && !campaignLoading;
// const allLoaded = !publicationLoading && !isAuthLoading && !profilePublicationsLoading && isAccessFullyChecked;
const allLoaded = !publicationLoading && !isAuthLoading && !profilePublicationsLoading;
// const isSponsoredButtonVisible = isCampaignActive && isAuthorized && isAccessFullyChecked;
// const isJoinButtonVisible = isAuthorized && !isCampaignActive && isAccessFullyChecked && !isSponsoredButtonVisible;
// const isPlayerVisible = hasAccess && session.authenticated && !accessLoading && !isAuthLoading;
// const accessChecked = hasAccess !== undefined;
// const loading = (!(allLoaded && accessChecked) && !isAuthLoading) || !publication;
const loading = (!allLoaded && !isAuthLoading) || !publication;

useEffect(() => {
if (!ownerAddress || publicationLoading || profilePublications?.getPostsByAuthor) return;
Expand Down Expand Up @@ -95,12 +92,12 @@ export default function PublicationDetailsView({ id }: Readonly<PublicationDetai
}

const filteredPublications = profilePublications?.getPostsByAuthor?.filter((publication: Post) => publication.id !== id) ?? [];
const loading = (publicationLoading || isAuthLoading) && !publication

if (loading) return <PublicationDetailViewSkeleton />;
if (publication?.hidden || (!publication && !publicationLoading)) return <PublicationHidden />;
if (loading || !publication) return <PublicationDetailViewSkeleton />;

return (
<LoadingFade loading={loading} skeleton={<UserProfileViewSkeleton />}>
<LoadingFade loading={loading} skeleton={<PublicationDetailViewSkeleton />}>
<StyledContainer>
<StyledStack>
<StyledCard>
Expand All @@ -127,8 +124,8 @@ export default function PublicationDetailsView({ id }: Readonly<PublicationDetai
{/*)}*/}
<StyledInnerBox>
<PublicationTitleDescription publication={publication} />
<PublicationSponsorsAndBackers postId={publication.id} />
<PublicationRecommendations author={publication?.author?.displayName.split(' ')[0]} publications={filteredPublications} />
<PublicationSponsorsAndBackers postId={publication?.id} />
<PublicationRecommendations author={publication?.author?.displayName?.split?.(' ')?.[0] ?? ''} publications={filteredPublications} />
</StyledInnerBox>
</StyledCardContent>
</StyledCard>
Expand Down
Loading