import { Col, Row } from "antd"; import { Link } from "react-router-dom"; import { MoodReadResponse } from "@newstackdev/iosdk-newgraph-client-js"; import { useParams } from "react-router"; import Avatar from "antd/lib/avatar/avatar"; // import { PremiumContent } from "../Components/PremiumContent"; import { ContentImage } from "../../Components/Image"; import { ContentLayout } from "../../Components/ContentLayout"; import { IOView, NLView } from "../../types"; import { LargeArrowBack } from "../../Components/Icons/LargeArrowBack"; import { MoodsGridRow } from "./MoodsGrid"; import { Share } from "../../Components/Share"; import { ThreeDots } from "../../Components/Icons/ThreeDots"; import { TopFoldersGrid } from "../../Components/TopFolders"; import { useActions, useAppState } from "../../overmind"; import { useCachedMood, useCachedMoodPosts, useCachedPool, useCachedUser } from "../../hooks/useCached"; import { useCurrentUserStakeEligibility, useFolderStakeInfo } from "../../hooks/useBlockchainInfo"; import { useEffect } from "react"; import { useVotingStreamMood } from "../Post/Post"; import PostReportModal from "../Post/components/PostModal"; // const useFolderStakeInfo = (folder: MoodReadResponse) => { // const moodDetails = useCachedMood(folder, true); // const state = useAppState(); // const user = useCachedUser(folder.author); // const pool = useCachedPool({ owner: user.username }) // const _stakeInfo = { // toAccess: moodDetails.stakeToAccess || 0, // currentUserStake: (state.newcoin.pools[pool.code] || 0) / 1000, // } // return { // ..._stakeInfo, // currentUserNeeds: _stakeInfo.currentUserStake - _stakeInfo.toAccess, // currency: `${user.username?.toUpperCase()}`, // currentUserEligible: _stakeInfo.currentUserStake - _stakeInfo.toAccess > 0, // }; // }; export const Mood: NLView = () => { const { moodId: id } = useParams<{ moodId: string }>(); const mood = useCachedMoodPosts({ id }, true); const moodDetails = useCachedMood({ id }, true); const user = useCachedUser(mood.author); const state = useAppState(); const actions = useActions(); const pool = useCachedPool({ owner: user.username }); const stakeInfo = useFolderStakeInfo(moodDetails); const nextInStream = useVotingStreamMood(); //useVotingStreamTags(); const { currPost } = nextInStream; // hide header useEffect(() => { actions.ux.setLayout({ headerShown: false }); actions.ux.setFooterVisibility({ footerShown: false }); return () => { actions.ux.setLayout({ headerShown: true }); actions.ux.setFooterVisibility({ footerShown: true }); }; }, []); // { // ..._stakeInfo, // currentUserNeeds: _stakeInfo.currentUserStake - _stakeInfo.toAccess, // currency: `${user.username?.toUpperCase()}`, // currentUserEligible: _stakeInfo.currentUserStake - _stakeInfo.toAccess > 0, // } // if(true) // return <>{JSON.stringify(moodDetails.stakeToAccess)} return (
} info={ } className="avatar-image-header" /> {user.username}

{moodDetails.title}

{moodDetails.description || ""}

{/* {moodDetails.stakeToAccess} */} {stakeInfo.toAccess ? ( !stakeInfo.currentUserEligible ? (

{ <> This content is accessible only to members of {user.username} dao.

Stake to access: {stakeInfo.toAccess || ""}
Your stake: {stakeInfo.currentUserStake}
Stake to enter: {stakeInfo.currentUserNeeds}
}

) : (
You are eligible to access this premium folder
) ) : ( <> )} {/* infobox */} {/* infobox */} } > {/* */} {/* */} {/* } /> */}
); }; export const MoodDetailed: NLView = () => { const { moodId: id } = useParams<{ moodId: string }>(); const mood = useCachedMood({ id }, true); const user = useCachedUser(mood.author); return ( {/* */}

{mood.title}

{user.username}

{mood.description}


{/* } /> */}
); };