Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/components/feed/SingleFeed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { hasMirrored } from "lens/check-mirror.js";
import { Link } from "react-router-dom";
import { useEffect, useState } from "react";
import PostStatus from "../post/PostStatus.jsx";
import defaultUserIcon from "assets/defaultUserIcon.png";

const SingleFeed = ({ data }) => {
const stats = data.postStats;
Expand Down Expand Up @@ -35,6 +36,10 @@ const SingleFeed = ({ data }) => {
}
}, [loading]);

function addDefaultPFP(ev) {
ev.target.src = defaultUserIcon;
}

return (
<>
{/* <div className="bg-gray-700 flex justify-center flex-col items-center text-white border border-rose-300 ">
Expand Down Expand Up @@ -62,6 +67,7 @@ const SingleFeed = ({ data }) => {
className="h-9 w-9 rounded-full ring-2 ring-blue-100 hover:brightness-90"
src={userProPic}
alt="profile picture"
onError={addDefaultPFP}
/>
</Link>
<div className="space-y-1 w-full flex flex-col overflow-hidden">
Expand Down
7 changes: 6 additions & 1 deletion src/components/post/FullPost.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ const FullPost = ({ postData, mirrored, mirrorFunc, mirrorsCount }) => {
}
}, []);

const resolveLink = (url) => {
if (!url || !url.includes("ipfs://")) return url;
return url.replace("ipfs://", "https://gateway.ipfs.io/ipfs/");
};

return (
<>
<div className="flex p-5 bg-white rounded-xl flex-col w-full self-start">
Expand Down Expand Up @@ -74,7 +79,7 @@ const FullPost = ({ postData, mirrored, mirrorFunc, mirrorsCount }) => {
) : (
<div className="post picture flex justify-center">
<img
src={postData.metadata.image}
src={resolveLink(postData.metadata.image)}
alt="post image"
className="rounded w-96 pr-2"
/>
Expand Down
5 changes: 5 additions & 0 deletions src/components/profile/ProfilePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ export default function ProfilePage() {
return <p>This profile doesn&apos;t exist</p>;
}

function addDefaultPFP(ev) {
ev.target.src = defaultUserIcon;
}

const profileName = profile?.name
? profile?.handle
: profile?.handle
Expand Down Expand Up @@ -191,6 +195,7 @@ export default function ProfilePage() {
className="inline-block h-16 w-16 sm:h-20 sm:w-20 rounded-full"
src={profile?.picture?.original?.url || defaultUserIcon}
alt="profile picture"
onError={addDefaultPFP}
/>
</div>
<div className="">
Expand Down