Skip to content

Commit

Permalink
final work
Browse files Browse the repository at this point in the history
  • Loading branch information
elcharitas committed Dec 7, 2023
1 parent 0f5ccd0 commit d95a85e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
21 changes: 10 additions & 11 deletions packages/frontend/src/api/services/lens-feed/types.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { TPagination, TSocialItem } from "../baseTypes";

export interface IRemoteLensPicture {
raw: IRemoteLensPictureMeta;
optimized: IRemoteLensPictureMeta;
export interface IRemoteLensMedia {
raw: IRemoteLensMediaMeta;
optimized: IRemoteLensMediaMeta;
}

export interface IRemoteLensAttachment {
video?: IRemoteLensPictureMeta;
cover?: IRemoteLensPictureMeta;
video?: IRemoteLensMedia;
cover?: IRemoteLensMedia;

image?: IRemoteLensPictureMeta;
image?: IRemoteLensMedia;

audio?: IRemoteLensPictureMeta;
audio?: IRemoteLensMedia;
credits?: string;

altTag?: string;
}

export interface IRemoteLensPictureMeta {
export interface IRemoteLensMediaMeta {
uri: string;
width?: string;
height?: string;
Expand All @@ -27,7 +27,7 @@ export interface IRemoteLensPictureMeta {
export interface IRemoteLensProfileMetadata {
bio: string;
rawURI: string;
picture: IRemoteLensPicture;
picture: IRemoteLensMedia;
displayName: string;
}

Expand Down Expand Up @@ -58,8 +58,7 @@ export interface IRemoteLensPost {
};
};
}[];
commentOn: IRemoteLensPost;
root: IRemoteLensPost;
mirrorOn: IRemoteLensPost;
createdAt: string;
}

Expand Down
28 changes: 16 additions & 12 deletions packages/frontend/src/components/feeds/LensFeedItem.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-underscore-dangle */
import { FC } from "react";
import moment from "moment";
import ReactMarkdown from "react-markdown";
Expand Down Expand Up @@ -35,7 +36,8 @@ const PLUGINS = [
];

const LensFeedItem: FC<TLensPost> = ({ tweet, url, social_account }) => {
const profile = tweet.by.metadata;
const profile = (tweet.__typename === "Mirror" ? tweet.mirrorOn : tweet).by
.metadata;
const profileUrl = `https://hey.xyz/u/${social_account.username}`;

return (
Expand All @@ -61,7 +63,7 @@ const LensFeedItem: FC<TLensPost> = ({ tweet, url, social_account }) => {
</TweetColumn>
<TweetColumn className="w-[80%]">
<div className="text-primaryVariant100 hover:text-primary">
{/* {postType === "Mirror" && (
{tweet.__typename === "Mirror" && (
<div className="fontGroup-supportBold">
<AuthorName
href={profileUrl}
Expand All @@ -73,7 +75,7 @@ const LensFeedItem: FC<TLensPost> = ({ tweet, url, social_account }) => {
</AuthorName>{" "}
mirrored
</div>
)} */}
)}

<AuthorName
href={profileUrl}
Expand All @@ -85,7 +87,6 @@ const LensFeedItem: FC<TLensPost> = ({ tweet, url, social_account }) => {
{social_account.username}{" "}
{moment(tweet.createdAt).fromNow()}
</AuthorName>
{/* {postType === "Comment" && <div>Replying to &#64;</div>} */}
</div>
<TweetContent>
<ReactMarkdown
Expand All @@ -96,20 +97,22 @@ const LensFeedItem: FC<TLensPost> = ({ tweet, url, social_account }) => {
{tweet.metadata.content}
</ReactMarkdown>

{tweet.metadata.attachments?.length && (
{Number(tweet.metadata.attachments?.length) > 0 && (
<TweetAttachment>
{tweet.metadata.attachments?.map(
(media, mediaIndex) => {
if (
media.video &&
!media.video.uri.includes("m3u8")
!media.video.optimized.uri.includes(
"m3u8"
)
) {
return (
<TweetMedia
// eslint-disable-next-line react/no-array-index-key
key={`${media.video.uri}${mediaIndex}`}
key={`${media.video.optimized.uri}${mediaIndex}`}
mediaType="video"
src={media.video.uri}
src={media.video.optimized.uri}
/>
);
}
Expand All @@ -118,9 +121,9 @@ const LensFeedItem: FC<TLensPost> = ({ tweet, url, social_account }) => {
return (
<TweetMedia
// eslint-disable-next-line react/no-array-index-key
key={`${media.audio.uri}${mediaIndex}`}
key={`${media.audio.optimized.uri}${mediaIndex}`}
mediaType="audio"
src={media.audio.uri}
src={media.audio.optimized.uri}
/>
);
}
Expand All @@ -129,9 +132,10 @@ const LensFeedItem: FC<TLensPost> = ({ tweet, url, social_account }) => {
return (
<TweetMedia
// eslint-disable-next-line react/no-array-index-key
key={`${media.image.uri}${mediaIndex}`}
key={`${media.image.optimized.uri}${mediaIndex}`}
mediaType="img"
src={media.image.uri}
src={media.image.optimized.uri}
alt={media.altTag}
/>
);
}
Expand Down

0 comments on commit d95a85e

Please sign in to comment.