-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from maxpetretta/dev
Dev
- Loading branch information
Showing
24 changed files
with
233 additions
and
119 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Tweet as TweetType } from "../lib/types" | ||
import { useTweets } from "./AppProvider" | ||
import Tweet from "./Tweet" | ||
|
||
export default function TweetList(props) { | ||
const { tweets } = useTweets() | ||
|
||
/** | ||
* Filter for all tweets from the specified address | ||
* @returns {Array} | ||
*/ | ||
const getAuthorTweets = (): TweetType[] => { | ||
let filtered = [...tweets.values()].filter( | ||
(tweet) => tweet.replyID.eq(0) && !tweet.deleted | ||
) | ||
if (props.author) { | ||
filtered = filtered.filter((tweet) => tweet.from == props.author) | ||
} | ||
return filtered | ||
} | ||
|
||
/** | ||
* Filter for all replies to a tweet | ||
* @param {number} id | ||
* @returns {Array} | ||
*/ | ||
const getReplies = (id: number): TweetType[] => { | ||
let replies = [...tweets.entries()].filter( | ||
(tweet) => tweet[1].replyID.eq(id) && !tweet[1].deleted | ||
) | ||
return replies | ||
} | ||
|
||
return ( | ||
<section> | ||
{tweets && | ||
getAuthorTweets() | ||
.map((tweet) => { | ||
const replies = getReplies(tweet.id) | ||
return ( | ||
<div key={tweet.id} className="border-b"> | ||
<Tweet id={tweet.id} key={tweet.id} replies={replies} /> | ||
</div> | ||
) | ||
}) | ||
.reverse()} | ||
</section> | ||
) | ||
} |
Oops, something went wrong.
b093102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
twitt3r – ./
twitt3r-maxpetretta.vercel.app
twitt3r.xyz
twitt3r-git-master-maxpetretta.vercel.app