15 |
16 |
17 |
--------------------------------------------------------------------------------
/exercise/js/index.js:
--------------------------------------------------------------------------------
1 | const URL = "http://localhost:3000/tweets";
2 |
3 | /**
4 | * Retrive Twitter Data from API
5 | */
6 | const getTwitterData = () => {
7 |
8 | }
9 |
10 | /**
11 | * Save the next page data
12 | */
13 | const saveNextPage = (metadata) => {
14 | }
15 |
16 | /**
17 | * Handle when a user clicks on a trend
18 | */
19 | const selectTrend = (e) => {
20 | }
21 |
22 | /**
23 | * Set the visibility of next page based on if there is data on next page
24 | */
25 | const nextPageButtonVisibility = (metadata) => {
26 | }
27 |
28 | /**
29 | * Build Tweets HTML based on Data from API
30 | */
31 | const buildTweets = (tweets, nextPage) => {
32 |
33 | }
34 |
35 | /**
36 | * Build HTML for Tweets Images
37 | */
38 | const buildImages = (mediaList) => {
39 |
40 | }
41 |
42 | /**
43 | * Build HTML for Tweets Video
44 | */
45 | const buildVideo = (mediaList) => {
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/exercise/style/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: Arial, Helvetica, sans-serif;
4 | }
5 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # General TODOS
2 |
3 | ## TODO(Together): Create the home page structure for index.html
4 |
5 | That involves the navigation, tweets list, and trending hashtags section.
6 |
7 | ## TODO: Create HTML and Style for Navigation
8 |
9 | Use Mockup for styles like border
10 |
11 | It needs to follow a class structure like this:
12 |
13 | class navigation
14 |
15 | class logo
16 |
17 |
18 |
19 | class home-link
20 |
21 |
22 |
23 | class profile-container
24 |
25 | class profile
26 |
27 | ## TODO(Together): Create HTML and Style for Input Box
28 |
29 | ## TODO(Together): Create HTML and Style for Individual Tweet
30 |
31 | ### TODO: Complete User Info HTML and Styling
32 |
33 | It needs to follow a class structure like this:
34 |
35 | class tweet-user-info
36 |
37 | class tweet-user-profile
38 |
39 | class tweet-user-name-container
40 |
41 | class tweet-user-fullname
42 |
43 | class tweet-user-username
44 |
45 | #### HINTS:
46 |
47 | User Profile: width: 30px; height: 30px;
48 |
49 | User Full Name: font-size: 10px
50 |
51 | User Twitter Handel: font-size: 8px
52 |
53 | ## TODO(Together): Create HTML and Style for Trending Box
54 |
55 | ### TODO: Complete styling for list of trends
56 |
57 | #### HINTS:
58 |
59 | List Item: padding-left: 20px; padding-top and bottom: 8px
60 |
61 | ## TODO(API): Set up NodeJS Server
62 |
63 | Return `Hello World` for the root `/` get request
64 |
65 | [Example](https://expressjs.com/en/starter/hello-world.html)
66 |
67 | ## TODO(API, TOGETHER): Create API endpoint `/tweeets` to return a list of tweets based on query
68 |
69 | Use [axios](https://github.com/axios/axios) for making an API request to Twitter API
70 |
71 | Console log the data
72 |
73 | Return as a response
74 |
75 | ## TODO(API): Create Twitter `get()` helper function to move the Twitter API logic
76 |
77 | #### HINTS:
78 |
79 | - Create Twitter class inside `api/helpers/twitter.js`
80 | - Create a `get()` function that takes in the necessary parameters
81 | - Inside `get()` return `axios.get(...)`
82 | - Import Twitter class in `app.js` with `const twitter = new Twitter();`
83 | - Initialize and use the `twitter` object to now do somethong like `twitter.get(...).then(...).catch(...)`
84 |
85 | ## TODO(API, TOGETHER): Move the API Token to .env file and import it
86 |
87 | ## TODO: Complete `getTwitterData()` function to retrieve data from our API
88 |
89 | For now, I want you to use the following static url to get data from api:
90 |
91 | ```http://localhost:3000/tweets?q=coding&count=10```
92 |
93 | #### HINTS:
94 |
95 | - Use `fetch()`
96 | - Call function on load of js
97 | - Console log response
98 |
99 | ## TODO: Get search input and use it to build a `url` like the one above
100 |
101 | This time you are building a dynamic url that will change based on the user's search input
102 |
103 | #### HINTS:
104 |
105 | - Call `getTwitterData()` function when a user clicks on search icon
106 | - Use string literals to build out the url
107 | - Console log response
108 |
109 | ### TODO(Together): Get twitter data when a user hits enter
110 |
111 |
112 | ## TODO: Complete `buildTweets()` function to show the Tweets List(only text)
113 |
114 | #### HINTS:
115 |
116 | - Call `buildTweets()` function from `getTwitterData()`
117 | - Use List.map() to loop over the list of tweets
118 | - Use string literals to replace html with the text from each tweet
119 | - Replace html content inside `.tweets-list`
120 |
121 | ## TODO: Add abiliy to show images in the tweets
122 |
123 | #### HNTS:
124 |
125 | - Use `buildImages()` function
126 | - Check if there is media using `.length`property to call `buildImages()` function
127 |
128 | ## TODO(Together): Add ability to show videos in the tweets
129 |
130 | ## TODO(Together): Add ability to show gifs in the tweets
131 |
132 | ## TODO: Show user info in the tweets
133 |
134 | ## TODO(Together): Use [moment.js](https://momentjs.com/) to show the date of tweet
135 |
136 | ## TODO: Complete `selectTrend()` function to allow a user to click on the trend and search for it
137 |
138 | #### HINTS:
139 |
140 | - Call `selectTrend()` function from list item click
141 | - Get the inner text of list item
142 | - Set the value of input search using the text
143 | - Call `getTwitterData()` function
144 |
145 | ## TODO: Create HTML and Style for Next Page Button
146 |
147 | #### HINTS:
148 |
149 | - Use `next-page-container` class
150 | - border-radius: 20px; margin-top: 20px;
151 | - Use arrow down font awesome icon
152 |
153 | ## TODO(Together): Showing Next Page of Tweets
154 |
155 | ### TODO: Save Next Page Url
156 |
157 | ### TODO: Load tweets when selecting the next page button
158 |
159 | [Here](https://developer.twitter.com/en/docs/tweets/timelines/guides/working-with-timelines) is how twitter pagination works
160 |
161 | ### TODO(API): ...something that has to do with `max_id`
162 |
163 | ### TODO: Fix logic to replace tweets when searching, but append tweets when going to next page
164 |
165 | ### TODO: Show next page button only when there is a next page
166 |
167 | ## TODO: Clean Up
168 |
169 | ## WE ARE DONE!
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/solution/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "liveServer.settings.port": 5501
3 | }
--------------------------------------------------------------------------------
/solution/assets/profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CleverProgrammers/pwj-twitter-clone-app/917497a748e2b21333d4aceae37e48653ede1278/solution/assets/profile.png
--------------------------------------------------------------------------------
/solution/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Twitter Tweet
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
Welcome to Twitter!
42 |
Use the search above to see what's happening around the world.