The task is to create a Twitter-like website. Please read through the document and try to solve the following tasks step-by-step.
- Create a small web application that runs completely in the browser.
- It must be a web-application using react and rxjs.
- Make sure that the application is build / running locally.
- Take the tweets observable and render it as a list
- Use a Twitter-like structure/style.
- Order the list by date descending.
- Do not change the tweets observable.
- Tweets older than 30 secs should not be shown in the list anymore.
- Add the ability to like and unlike tweets.
- A liked tweet must look visually different than the other tweets.
- Above the list of tweets is a counter that shows the number of liked tweets contained within the list.
- It must be possible to toggle between "all tweets" and "liked tweets".
- It must be possible to clear the list of tweets.
// rxjs is exposed by// https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.4.0/rxjs.umd.min.jsconst{ interval, merge }=rxjs;const{ map }=rxjs.operators;constcreateTweetSource=(frequency,account,attribute)=>{returninterval(frequency).pipe(map(i=>({
account,timestamp: Date.now(),content: `${attribute} Tweet number ${i+1}`})));}consttweets=merge(createTweetSource(5000,'AwardsDarwin','Facepalm'),createTweetSource(3000,'iamdevloper','Expert'),createTweetSource(5000,'CommitStrip','Funny'));tweets.subscribe(console.log.bind(console));run local:
yarn install
yarn start
build project:
yarn install
yarn build
I was developing under
node@12.20.1andyarn@1.22.10if there should be any issues due to breaking changes in some packages sincenode@14(a.nvmrcis also packed).I have tried to style the components according to the system-ui & styled-system specification. But I am not a designer and trying to define meaningful tokens was definitely not my best part here :)
I would have liked to implement unit tests for the reducer component but I could not find a good solution to reacts own reducer like I would have done it with them from redux. I could only find an article in which was described to trigger actions and test against the rendered visual output. That seemed a bit strange for me and not like a good workaround. Then I didn't spend more time on it. Due to some time loss in trying I also skipped testing the representational components as I would only generate snapshots of them.
I did not find the time to add Storybook and add an example story to it.