Skip to content

Commit

Permalink
chore(): hide long beams on profile feed
Browse files Browse the repository at this point in the history
  • Loading branch information
quininez committed May 27, 2024
1 parent d3cd265 commit 4524789
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ProfileBeamsPage: React.FC<ProfileBeamsPageProps> = props => {
})
}
showNSFWCard={itemData.node.nsfw}
showHiddenContent={true}
showHiddenContent={false}
/>
);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const ContentBlockRenderer: React.FC<ContentBlockRendererProps> = props => {
beamIsNsfw,
showBlockName,
onBlockInfoChange,
onContentClick,
} = props;
const { navigateToModal, getExtensionsPlugin, getRoutingPlugin } = useRootComponentProps();
const contentBlockStoreRef = useRef(getExtensionsPlugin()?.contentBlockStore);
Expand All @@ -48,7 +47,6 @@ const ContentBlockRenderer: React.FC<ContentBlockRendererProps> = props => {
}, [contentBlockReq.data]);
const contentBlockPropertyType = blockData?.content?.[0]?.propertyType;
const contentBlockLabel = blockData?.content?.[0]?.label;
const nsfw = !!blockData?.nsfw;
useEffect(() => {
_onBlockInfoChange.current?.({
appName: BLOCK_LABEL_TO_APP_DISPLAY_NAME_MAP[contentBlockLabel],
Expand Down Expand Up @@ -94,17 +92,7 @@ const ContentBlockRenderer: React.FC<ContentBlockRendererProps> = props => {
};

return (
<Card
type="plain"
onClick={() => {
if (!(showNSFWCard && nsfw)) {
if (typeof onContentClick === 'function') {
onContentClick();
}
}
}}
customStyle="w-full"
>
<Card type="plain" customStyle="w-full">
{!showNSFWCard && (
<>
<Transition
Expand Down
8 changes: 7 additions & 1 deletion libs/feed/src/components/cards/beam-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ const BeamCard: React.FC<BeamCardProps> = props => {
}
onReflect();
}}
onContentClick={() => {
if (!showNSFWCard) {
if (typeof onContentClick === 'function') {
onContentClick();
}
}
}}
onEntryFlag={handleFlagBeam}
profileAvatarExt={
<AuthorProfileAvatar
Expand Down Expand Up @@ -139,7 +146,6 @@ const BeamCard: React.FC<BeamCardProps> = props => {
setAppName(blockInfo?.appName);
setBlockNameMap(new Map(blockNameMap.set(blockID, blockInfo?.blockName)));
}}
onContentClick={onContentClick}
/>
</React.Suspense>
)}
Expand Down

0 comments on commit 4524789

Please sign in to comment.