Add support for displaying threads
The twitter api does not directly support threads. We can still infer the start, end, and membership of a thread from the in_reply_to_status_id field. While displaying tweets it might be beneficial to indicate that they are part of a thread.
Here is how I would like to implement this:-
To mimic's Twitter desktops implementation of thread display we would need to add a pseudo div after the user avatar for adding a bar. The tweet data will have following boolean fields
isThreadStart, isThreadMember and isThreadEnd
im ok with this but can we leave these props out of data? Dont want to muddle the actual twitter data with additional styling information.
To implement threads I need to reorder the tweets data as provided by the home_timeline api because the tweets in the thread need to be contiguous. Once they are thus reordered it is simpler to stick the information about thread membership on the tweet data than to maintain an auxiliary data structure for the thread membership. If you have any thoughts on how to do this without muddling the twitter data please do let me know.
@sudarshang thats fine but I dont think you would need to do it in the data prop of the Tweet component. It may be that this is a high order component called TweetThread that does this logic for you but essentially some code that ends up like:
myOrderedTweets.map((tweet, idx, arr) => (
<Tweet data={tweet} isThreadStart={idx === 0} isThreadMember={idx > 0 && idx < arr.length -1}
isThreadEnd={idx === arr.length -1} />
))
Got you! Thanks for your suggestion.