Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for displaying threads #31

Open
sudarshang opened this issue Mar 20, 2018 · 4 comments
Open

Add support for displaying threads #31

sudarshang opened this issue Mar 20, 2018 · 4 comments

Comments

@sudarshang
Copy link

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

@mannynotfound
Copy link
Owner

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.

@sudarshang
Copy link
Author

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.

@mannynotfound
Copy link
Owner

mannynotfound commented Mar 21, 2018

@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} />
))

@sudarshang
Copy link
Author

Got you! Thanks for your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants