|
1 | | -import React, { useState, useEffect, useRef } from 'react'; |
| 1 | +import React, { |
| 2 | + useState, useEffect, useRef, useMemo, |
| 3 | +} from 'react'; |
2 | 4 | import PT from 'prop-types'; |
3 | 5 | import { connect } from 'react-redux'; |
4 | 6 | import TopBanner from 'assets/images/timeline-wall/top-banner.png'; |
5 | 7 | import TopBannerMobile from 'assets/images/timeline-wall/top-banner-mobile.png'; |
6 | 8 | import IconCheveronDownBlue from 'assets/images/timeline-wall/cheveron-down-blue.svg'; |
| 9 | +import IconArrowRight from 'assets/images/timeline-wall/icon-arrow-right.svg'; |
7 | 10 | import { deleteEventById, approveEventById, rejectEventById } from 'services/timelineWall'; |
8 | 11 | import cn from 'classnames'; |
9 | 12 | import moment from 'moment'; |
@@ -155,10 +158,23 @@ function TimelineWallContainer(props) { |
155 | 158 | }; |
156 | 159 |
|
157 | 160 | const sortedEvents = _.orderBy(events, ['eventDate'], ['desc']); |
| 161 | + const shouldShowDiscuss = useMemo(() => { |
| 162 | + if (tab !== 0) { |
| 163 | + return false; |
| 164 | + } |
| 165 | + if (isAdmin) { |
| 166 | + return !isMobile; |
| 167 | + } |
| 168 | + return true; |
| 169 | + }, [isAdmin, isMobile, tab]); |
158 | 170 |
|
159 | 171 | return ( |
160 | 172 | <div styleName="container"> |
161 | | - <div styleName={isAdmin ? 'header header-admin' : 'header'}> |
| 173 | + <div styleName={cn('header', { |
| 174 | + 'header-admin': isAdmin, |
| 175 | + 'header-with-discuss': shouldShowDiscuss, |
| 176 | + })} |
| 177 | + > |
162 | 178 | <img src={TopBanner} alt="top-banner" styleName="header-bg hide-mobile" /> |
163 | 179 | <img src={TopBannerMobile} alt="top-banner" styleName="header-bg hide-desktop show-mobile" /> |
164 | 180 |
|
@@ -188,6 +204,16 @@ function TimelineWallContainer(props) { |
188 | 204 | </div> |
189 | 205 | ) : (<h1 styleName="header-content-1">Topcoder Timeline Wall</h1>)} |
190 | 206 |
|
| 207 | + {shouldShowDiscuss ? ( |
| 208 | + <button |
| 209 | + type="button" |
| 210 | + styleName="btn-discuss" |
| 211 | + > |
| 212 | + <span>DISCUSS</span> |
| 213 | + <IconArrowRight /> |
| 214 | + </button> |
| 215 | + ) : null} |
| 216 | + |
191 | 217 | <button |
192 | 218 | onClick={() => { |
193 | 219 | setShowRightFilterMobile(true); |
|
0 commit comments