|
1 | | -import React, { useState, useEffect } from 'react'; |
| 1 | +import React, { useState, useEffect, useMemo } from 'react'; |
2 | 2 | import PT from 'prop-types'; |
3 | 3 | import { connect } from 'react-redux'; |
4 | 4 | import TopBanner from 'assets/images/timeline-wall/top-banner.png'; |
5 | 5 | import TopBannerMobile from 'assets/images/timeline-wall/top-banner-mobile.png'; |
6 | 6 | import IconCheveronDownBlue from 'assets/images/timeline-wall/cheveron-down-blue.svg'; |
| 7 | +import IconArrowRight from 'assets/images/timeline-wall/icon-arrow-right.svg'; |
7 | 8 | import { deleteEventById, approveEventById, rejectEventById } from 'services/timelineWall'; |
8 | 9 | import cn from 'classnames'; |
9 | 10 | import moment from 'moment'; |
@@ -134,10 +135,23 @@ function TimelineWallContainer(props) { |
134 | 135 | }; |
135 | 136 |
|
136 | 137 | const sortedEvents = _.orderBy(events, ['eventDate'], ['desc']); |
| 138 | + const shouldShowDiscuss = useMemo(() => { |
| 139 | + if (tab !== 0) { |
| 140 | + return false; |
| 141 | + } |
| 142 | + if (isAdmin) { |
| 143 | + return !isMobile; |
| 144 | + } |
| 145 | + return true; |
| 146 | + }, [isAdmin, isMobile, tab]); |
137 | 147 |
|
138 | 148 | return ( |
139 | 149 | <div styleName="container"> |
140 | | - <div styleName={isAdmin ? 'header header-admin' : 'header'}> |
| 150 | + <div styleName={cn('header', { |
| 151 | + 'header-admin': isAdmin, |
| 152 | + 'header-with-discuss': shouldShowDiscuss, |
| 153 | + })} |
| 154 | + > |
141 | 155 | <img src={TopBanner} alt="top-banner" styleName="header-bg hide-mobile" /> |
142 | 156 | <img src={TopBannerMobile} alt="top-banner" styleName="header-bg hide-desktop show-mobile" /> |
143 | 157 |
|
@@ -167,6 +181,16 @@ function TimelineWallContainer(props) { |
167 | 181 | </div> |
168 | 182 | ) : (<h1 styleName="header-content-1">Topcoder Timeline Wall</h1>)} |
169 | 183 |
|
| 184 | + {shouldShowDiscuss ? ( |
| 185 | + <button |
| 186 | + type="button" |
| 187 | + styleName="btn-discuss" |
| 188 | + > |
| 189 | + <span>DISCUSS</span> |
| 190 | + <IconArrowRight /> |
| 191 | + </button> |
| 192 | + ) : null} |
| 193 | + |
170 | 194 | <button |
171 | 195 | onClick={() => { |
172 | 196 | setShowRightFilterMobile(true); |
|
0 commit comments