Ignore:
Timestamp:
10/01/22 22:56:40 (21 months ago)
Author:
Marko <Marko@…>
Branches:
master
Children:
ffd50db
Parents:
895cd87
Message:

Edited filter components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • phonelux-frontend/src/components/PhoneOfferDetailsComponent/PhoneOfferDetailsComponent.js

    r895cd87 rfd5b100  
    77import { Link } from 'react-router-dom'
    88import Tippy from '@tippyjs/react'
     9import VisibilityIcon from '@mui/icons-material/Visibility';
     10import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
    911
    1012
     
    1618      this.state = {
    1719        offerId: window.location.href.split('/')[4],
    18         offer: null
     20        offer: null,
     21        showAllSpecs: false
    1922      }
    2023    }
     
    5154    }
    5255
     56
     57    changeShownSpecs = () => {
     58      this.setState({
     59          showAllSpecs: !this.state.showAllSpecs
     60      })
     61  }
     62
    5363  render() {
    5464    console.log(this.state)
     
    5969          <h3 className='phone-offer-details-last-updated-header'>Последно ажурирана: {this.state.offer == null ||
    6070          this.state.offer.last_updated == null ? '#' : this.state.offer.last_updated.split('T')[0]}</h3>
     71          {
     72            localStorage.getItem('token') ?
     73            this.state.showAllSpecs ?
     74              <Tippy placement='bottom' content='Прикажи ги избраните спецификации'>
     75                 <VisibilityOffIcon className='offerdetails-show-all-specs-icon' onClick={this.changeShownSpecs} style={{fontSize: '45px'}}/>
     76              </Tippy> :
     77              <Tippy placement='bottom' content='Прикажи ги сите спецификации'>
     78                <VisibilityIcon className='offerdetails-show-all-specs-icon' onClick={this.changeShownSpecs} style={{fontSize: '45px'}}/>
     79              </Tippy> : <></>
     80          }
     81
    6182          {
    6283            localStorage.getItem('token') && (this.context.role == 'ADMIN' || this.context.role == 'SUPERADMIN') ?
     
    106127              this.state.offer.price == null ? '/' : this.state.offer.price+' ден.'}</td>
    107128            </tr>
    108             { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Предна камера") ?
     129            { this.state.showAllSpecs ||
     130            !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Предна камера") ?
    109131            <tr className='phone-offer-details-table-row'>
    110132              <td>Предна камера</td><td>{this.state.offer == null ||
     
    113135            }
    114136
    115              { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Задна камера") ?
     137             { this.state.showAllSpecs ||
     138             !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Задна камера") ?
    116139            <tr className='phone-offer-details-table-row'>
    117140              <td>Задна камера</td><td>{this.state.offer == null ||
     
    120143            }
    121144
    122             { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("РОМ меморија") ?
     145            { this.state.showAllSpecs ||
     146            !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("РОМ меморија") ?
    123147            <tr className='phone-offer-details-table-row'>
    124148              <td>РОМ меморија</td><td>{this.state.offer == null ||
     
    127151            }
    128152
    129             { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("РАМ меморија") ?
     153            { this.state.showAllSpecs ||
     154            !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("РАМ меморија") ?
    130155            <tr className='phone-offer-details-table-row'>
    131156              <td>РАМ меморија</td><td>{this.state.offer == null ||
     
    134159            }
    135160
    136             { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Оперативен систем") ?
     161            { this.state.showAllSpecs ||
     162            !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Оперативен систем") ?
    137163            <tr className='phone-offer-details-table-row'>
    138164              <td>Оперативен систем</td><td>{this.state.offer == null ||
     
    141167             }
    142168
    143             { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Чипсет") ?
     169            { this.state.showAllSpecs ||
     170            !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Чипсет") ?
    144171            <tr className='phone-offer-details-table-row'>
    145172              <td>Чипсет</td><td>{this.state.offer == null ||
     
    148175            }
    149176
    150             { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Процесор") ?
     177            { this.state.showAllSpecs ||
     178            !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Процесор") ?
    151179            <tr className='phone-offer-details-table-row'>
    152180              <td>Процесор</td><td>{this.state.offer == null ||
     
    155183            }
    156184
    157             { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Батерија") ?
     185            { this.state.showAllSpecs ||
     186            !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Батерија") ?
    158187            <tr className='phone-offer-details-table-row'>
    159188              <td>Батерија</td><td>{this.state.offer == null ||
     
    162191            }
    163192
    164             { !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Боја") ?
     193            { this.state.showAllSpecs ||
     194            !localStorage.getItem('pickedSpecifications') || localStorage.getItem('pickedSpecifications').includes("Боја") ?
    165195            <tr className='phone-offer-details-table-row'>
    166196              <td>Боја</td><td>{this.state.offer == null ||
Note: See TracChangeset for help on using the changeset viewer.