Commit e14a962d authored by Pavel Kuzmenko's avatar Pavel Kuzmenko

Merge branch 'issue_479/rewrite_anchor' into 'master'

Rewrite anchor in english auction

See merge request !542
parents 9ba16ffa 4a865445
......@@ -86,7 +86,7 @@ export default function done(props) {
<Accordion>
<BidsHistory isPriorityEnglishStep={activeBidsCount && true}/>
</Accordion>
<h2 className='secondary-title' id='prioritystep'>{t('priorityStep')}</h2>
<h2 className='secondary-title' id='priorityround'>{t('priorityStep')}</h2>
<div className='results-wrapper'>
{priorityStepBlockResult}
</div>
......
......@@ -9,7 +9,7 @@ import './Timeline.scss';
import iconCurrent from '~/assets/images/steps_current.svg';
import iconFuture from '~/assets/images/steps_future.svg';
import iconSuccess from '~/assets/images/steps_success.svg';
import { DONE_STATE, ENGLISH_AUCTION, PRIORITY_ENGLISH_AUCTION } from '~/constants';
import { DONE_STATE, ENGLISH_AUCTION, PRIORITY_ENGLISH_AUCTION, PRE_PRECEDENCE_PAUSE_STATE, PRECEDENCE_ROUND_STATE } from '~/constants';
import Tooltip from '-/Tooltip';
import { ReactComponent as QuestionSvg } from '~/assets/images/question_mark.svg';
......@@ -47,7 +47,9 @@ const Timeline = () => {
}
const isPriorityTimeline = getTranslation(message.title, state.language) === t('priorityStep');
const isShowPeriodTimeline = !isPriorityTimeline || (['pre_precedence_round_pause', 'precedence_round', 'done'].includes(state.current_state) || (state.initialBids?.[state.bidderId]?.isCurrentTenant || false));
const isShowPeriodTimeline = !isPriorityTimeline ||
([PRE_PRECEDENCE_PAUSE_STATE, PRECEDENCE_ROUND_STATE, DONE_STATE].includes(state.current_state) ||
(state.initialBids?.[state.bidderId]?.isCurrentTenant || false));
const priorityTimelineTooltip = isPriorityTimeline ?
<Tooltip contentText={t('tooltipTitle.priorityText')}>
<div className={'tooltip-priority timeline-tooltip-priority'}><QuestionSvg /></div>
......@@ -57,27 +59,18 @@ const Timeline = () => {
periodTimeline = '\u00A0';
}
const addAnchorToItem = (index) => {
let anchor;
if(isPriorityTimeline){
anchor = '#priorityround';
} else if(index <= state.public_meta.round_counter){
anchor = `#round${index}`;
} else {
anchor ='#results';
}
return anchor;
};
return <li key={idx} className={classTimeline}>
<img className={'icon-image-timeline'} src={iconTimeline} alt="icon"/>
<div className="steps-list-item-text">
<div className="steps-list-item-time">{periodTimeline}</div>
{
([ENGLISH_AUCTION, PRIORITY_ENGLISH_AUCTION].includes(state.auctionTypeGlobal) &&
((state.current_state === DONE_STATE || idx <= state.public_meta.round_counter) && idx !== 0))
([ENGLISH_AUCTION, PRIORITY_ENGLISH_AUCTION].includes(state.auctionTypeGlobal) && idx !== 0 &&
(((state.current_state === DONE_STATE || idx <= state.public_meta.round_counter) ||
([PRE_PRECEDENCE_PAUSE_STATE, PRECEDENCE_ROUND_STATE].includes(state.current_state) &&
idx !== state.public_meta.timeline.length - 1))
))
? <a
href={addAnchorToItem(idx)}
href={message.anchor}
onClick={() => window.ga('send', {
hitType: 'event',
eventCategory: 'timeline_anchor',
......
......@@ -28,11 +28,18 @@ const Round = ({ roundTitle, bids, roundNum, isHistory, isFuture, isCurrentRound
}
}, [] );
let idRound = '';
if(roundNum){
idRound = `round${roundNum}`;
} else if([PRECEDENCE_ROUND_STATE, PRE_PRECEDENCE_PAUSE_STATE].includes(state.current_state) && !isInitialBids){
idRound = 'priorityround';
}
return (
<li className={ `accordion-item ${(closed && isShouldBeInteractive) ? 'closed' : ''}` } data-title={JSON.stringify(roundTitle)}>
<label
className={ `accordion-label ${isShouldBeInteractive ? 'interactive': ''}` }
id={`round${roundNum ?? ''}`}
id={idRound}
onClick={ isShouldBeInteractive
? () => {
if (closed) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment