Skip to content

Commit

Permalink
Merge branch 'preview'
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelfan committed Feb 14, 2024
2 parents 380423d + 4d498f6 commit d261293
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
24 changes: 24 additions & 0 deletions src/components/contentDisplay/feedPost/FeedPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ export default function FeedPost(props: Props) {
const { showToggle, shouldHide, message } = getPostFilter(post, filter);
const [hidden, setHidden] = useState(shouldHide);
const router = useRouter();
const isAuthorMuted = post.post.author.viewer?.muted;
const [showPost, setShowPost] = useState(!isAuthorMuted);

if (!showPost) {
return (
<>
{reason && <Reason reason={reason} />}
<article>
<div className="relative flex items-start gap-3">
<Avatar size="md" className="z-20 shrink-0" />
<div className={`flex grow flex-col ${isParent && "pb-6"}`}>
{isParent && !reason && <Threadline />}
<PostHider
message={"Post by muted user"}
hidden={true}
onToggleVisibility={() => setShowPost(true)}
showToggle={true}
/>
</div>
</div>
</article>
</>
);
}

return (
<>
Expand Down
5 changes: 3 additions & 2 deletions src/components/dataDisplay/avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { getAvatarSize } from "@/lib/utils/image";
interface Props {
size?: AvatarSize;
src?: string;
className?: string;
}
export default function Avatar(props: Props) {
const { size, src } = props;
const { size, src, className } = props;
const [width, height] = getAvatarSize(size);

return (
Expand All @@ -16,7 +17,7 @@ export default function Avatar(props: Props) {
alt="Avatar"
width={width}
height={height}
className="rounded-full"
className={`rounded-full ${className}`}
/>
);
}
8 changes: 4 additions & 4 deletions src/components/dataDisplay/postHider/PostHider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Button from "@/components/actions/button/Button";
import { MdNoAdultContent } from "react-icons/md";
import { MdOutlineVisibilityOff } from "react-icons/md";
import { Dispatch, SetStateAction } from "react";

interface Props {
Expand All @@ -13,9 +13,9 @@ export default function PostHider(props: Props) {
const { message, hidden, onToggleVisibility, showToggle } = props;

return (
<div className="flex items-center justify-between gap-2 bg-neutral-100 p-3 rounded-lg font-medium text-neutral-600">
<div className="flex items-center justify-between gap-2 rounded-lg bg-neutral-100 p-3 font-medium text-neutral-600">
<div className="flex items-center gap-2">
<MdNoAdultContent className="shrink-0 text-2xl" />
<MdOutlineVisibilityOff className="shrink-0 text-2xl" />
<span>{message}</span>
</div>
{showToggle && (
Expand All @@ -24,7 +24,7 @@ export default function PostHider(props: Props) {
e.stopPropagation();
onToggleVisibility(hidden ? false : true);
}}
className="bg-white border px-2 py-1 rounded-lg hover:brightness-95"
className="rounded-lg border bg-white px-2 py-1 hover:brightness-95"
>
{hidden ? "Show" : "Hide"}
</Button>
Expand Down

0 comments on commit d261293

Please sign in to comment.