Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(improvements) Navigation tabs #853

Merged
merged 25 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fe31d52
Merge pull request #848 from bitfinexcom/staging
prdn Aug 28, 2024
0940ac4
Adjust summary spacing
alexstotsky Aug 30, 2024
86ad876
Add section switch styling
alexstotsky Aug 30, 2024
47e9e28
Update styles import
alexstotsky Aug 30, 2024
d4f66b7
Style section swicth tabs
alexstotsky Aug 30, 2024
eef0b53
Adjust spacing
alexstotsky Aug 30, 2024
a25c4ec
Improve tabs postioning
alexstotsky Aug 30, 2024
67e8b1d
Rework and improve trades tabs positioning
alexstotsky Sep 1, 2024
f89ada6
Actualize trades targets sections handling flow
alexstotsky Sep 1, 2024
50cb20e
Improve candles tabs positioning
alexstotsky Sep 1, 2024
2ee408d
Adjust candles header elements
alexstotsky Sep 1, 2024
3782486
Improve got-to btn styling
alexstotsky Sep 1, 2024
4f80074
Actualize positions tabs navigation
alexstotsky Sep 2, 2024
deef860
Update getSections tabs helper flow
alexstotsky Sep 2, 2024
976ae59
Improve active positions tabs navigation
alexstotsky Sep 2, 2024
08a2952
Rework and improve pos audit tabs positioning
alexstotsky Sep 2, 2024
b3795c1
Actualize snapshots tabs placement
alexstotsky Sep 2, 2024
25e10db
Improve nav switcher styling
alexstotsky Sep 2, 2024
04f7a88
Adjust snapshots header styling
alexstotsky Sep 2, 2024
8dfe7d8
Improve nav-switcher spacing
alexstotsky Sep 2, 2024
d6d9bfc
Minor tweak
alexstotsky Sep 2, 2024
8287425
Lint fix
alexstotsky Sep 2, 2024
b9e841e
Minor tweak
alexstotsky Sep 2, 2024
0546284
Improve section switch spacing
alexstotsky Sep 3, 2024
89a39ff
Adjust nav switcher styling
alexstotsky Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/components/AppSummary/_AppSummary.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.app-summary {
&-card {
padding-left: 32px;
padding-right: 32px;
padding-top: 18px;
padding-bottom: 0;
}

Expand All @@ -11,7 +10,7 @@

&-title {
max-height: 35px;
margin-bottom: 5px;
margin-bottom: 18px;
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/components/Candles/Candles.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ class Candles extends PureComponent {
return (
<Card
elevation={Elevation.ZERO}
className='col-lg-12 col-md-12 col-sm-12 col-xs-12'
className='candles col-lg-12 col-md-12 col-sm-12 col-xs-12'
>
<SectionHeader>
<SectionHeaderTitle>
{t('candles.title')}
</SectionHeaderTitle>
<SectionSwitch target={TYPE} />
<SectionHeaderRow>
<SectionHeaderItem>
<SectionHeaderItemLabel>
Expand Down Expand Up @@ -165,12 +166,9 @@ class Candles extends PureComponent {
/>
<RefreshButton onClick={refresh} />
<CandlesSyncPref />
<GoToButton onClick={toggleGoToRangeDialog} />
</SectionHeaderRow>
</SectionHeader>
<div className='candles-header'>
<SectionSwitch target={TYPE} hasSubSections />
<GoToButton onClick={toggleGoToRangeDialog} />
</div>
{showContent}
</Card>
)
Expand Down
9 changes: 2 additions & 7 deletions src/components/Candles/_Candles.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
.candles-header {
display: flex;

.section-switch {
margin-right: 20px;
}

.candles {
.go-to-button {
margin-top: 3px;
cursor: pointer;
transform: scale(0.9);
}
}
2 changes: 0 additions & 2 deletions src/components/Positions/Positions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import DataTable from 'ui/DataTable'
import Pagination from 'ui/Pagination'
import { getPath } from 'state/query/utils'
import SectionHeader from 'ui/SectionHeader'
import SectionSwitch from 'ui/SectionSwitch'
import queryConstants from 'state/query/constants'
import {
checkInit,
Expand Down Expand Up @@ -161,7 +160,6 @@ class Positions extends PureComponent {
refresh={refresh}
clearTargetPairs={this.clearPairs}
/>
<SectionSwitch target={TYPE} hasSubSections />
{showContent}
</Card>
)
Expand Down
8 changes: 2 additions & 6 deletions src/components/PositionsActive/PositionsActive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import DataTable from 'ui/DataTable'
import { checkFetch } from 'state/utils'
import { getPath } from 'state/query/utils'
import SectionHeader from 'ui/SectionHeader'
import SectionSwitch from 'ui/SectionSwitch'
import queryConstants from 'state/query/constants'
import getColumns from 'components/Positions/Positions.columns'

Expand Down Expand Up @@ -110,13 +109,10 @@ class PositionsActive extends PureComponent {
<SectionHeader
filter={false}
target={TYPE}
showHeaderTabs
timeframe={false}
title='activepositions.title'
/>
<SectionSwitch
target={TYPE}
hasSubSections
refresh={refresh}
title='activepositions.title'
/>
{showContent}
</Card>
Expand Down
8 changes: 2 additions & 6 deletions src/components/PositionsAudit/PositionsAudit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import DataTable from 'ui/DataTable'
import Pagination from 'ui/Pagination'
import { getPath } from 'state/query/utils'
import SectionHeader from 'ui/SectionHeader'
import SectionSwitch from 'ui/SectionSwitch'
import queryConstants from 'state/query/constants'
import { checkInit, checkFetch } from 'state/utils'
import getColumns from 'components/Positions/Positions.columns'
Expand Down Expand Up @@ -113,12 +112,9 @@ class PositionsAudit extends PureComponent {
<SectionHeader
filter={false}
target={TYPE}
title='paudit.title'
/>
<SectionSwitch
target={TYPE}
hasSubSections
showHeaderTabs
refresh={refresh}
title='paudit.title'
/>
{showContent}
</Card>
Expand Down
21 changes: 10 additions & 11 deletions src/components/Snapshots/Snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,18 @@ class Snapshots extends PureComponent {
}

return (
<Card elevation={Elevation.ZERO} className='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
<Card elevation={Elevation.ZERO} className='snapshots col-lg-12 col-md-12 col-sm-12 col-xs-12'>
<SectionHeader>
<SectionHeaderTitle>{t('snapshots.title')}</SectionHeaderTitle>
<NavSwitcher
items={[
{ value: MENU_POSITIONS, label: t('positions.title') },
{ value: MENU_TICKERS, label: t('tickers.title') },
{ value: MENU_WALLETS, label: t('wallets.title') },
]}
onChange={this.switchSection}
value={section}
/>
<SectionHeaderRow>
<SectionHeaderItem>
<SectionHeaderItemLabel>
Expand All @@ -175,16 +184,6 @@ class Snapshots extends PureComponent {
<RefreshButton onClick={refresh} />
</SectionHeaderRow>
</SectionHeader>

<NavSwitcher
items={[
{ value: MENU_POSITIONS, label: t('positions.title') },
{ value: MENU_TICKERS, label: t('tickers.title') },
{ value: MENU_WALLETS, label: t('wallets.title') },
]}
onChange={this.switchSection}
value={section}
/>
{showContent}
</Card>
)
Expand Down
22 changes: 15 additions & 7 deletions src/components/Snapshots/_Snapshots.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
.snapshots {
.section-header {
&-title {
margin-bottom: 29px;
}
}

.tickers {
.tables-row {
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-between;
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-between;

&-item {
width: 49%;
margin-right: 0;
min-width: 300px;
width: 49%;
margin-right: 0;
min-width: 300px;
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/Trades/Trades.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { isEmpty } from '@bitfinex/lib-js-util-base'
import DataTable from 'ui/DataTable'
import Pagination from 'ui/Pagination'
import SectionHeader from 'ui/SectionHeader'
import SectionSwitch from 'ui/SectionSwitch'
import queryConstants from 'state/query/constants'
import {
checkInit,
Expand Down Expand Up @@ -102,7 +101,6 @@ class Trades extends PureComponent {
refresh={refresh}
clearTargetPairs={this.clearPairs}
/>
<SectionSwitch target={TYPE} hasSubSections />
{showContent}
</Card>
)
Expand Down
2 changes: 1 addition & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ a {

.section-switch {
margin-left: 1px;
margin-bottom: 30px;
margin-bottom: 20px;

.bp3-button-group {
display: block;
Expand Down
25 changes: 13 additions & 12 deletions src/ui/NavSwitcher/_NavSwitcher.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
.nav-switcher {
width: 100%;
border-bottom: 1px solid var(--borderColor);
padding-bottom: 5px;
margin-bottom: 40px;
margin-bottom: 20px;
padding-bottom: 6px;
border-bottom: 2px solid var(--borderColor);

&-item {
width: fit-content;
margin-bottom: 10px;
padding: 0 3px 6px 3px;
border: none;
padding: 7px 0;
border-radius: 0;
margin-right: 20px;
color: var(--color2);
min-width: fit-content;
background-color: var(--bgColor2);
border-bottom: 2px solid var(--borderColor);
cursor: pointer;

&:not(:last-child) {
margin-right: 24px;
}

&--active {
color: var(--activeColor);
border-bottom: 4px solid var(--activeColor);
color: var(--color);
border-bottom: 2px solid var(--color);
}
}
}
6 changes: 3 additions & 3 deletions src/ui/SectionSwitch/SectionSwitch.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ export const POSITIONS_SECTIONS = [
},
]

export const getSections = (target, hasSubSections) => {
if (_includes(TRADES_TARGETS, target) && hasSubSections) return TRADES_SECTIONS
if (_includes(POSITIONS_TARGETS, target) && hasSubSections) return POSITIONS_SECTIONS
export const getSections = (target) => {
if (_includes(TRADES_TARGETS, target)) return TRADES_SECTIONS
if (_includes(POSITIONS_TARGETS, target)) return POSITIONS_SECTIONS
if (_includes(ANALYSIS_STAT_TARGETS, target)) return ANALYSIS_STAT_SECTIONS
if (_includes(FUNDING_TARGETS, target)) return FUNDING_SECTIONS
if (_includes(EARNINGS_TARGETS, target)) return EARNINGS_SECTIONS
Expand Down
29 changes: 29 additions & 0 deletions src/ui/SectionSwitch/_SectionSwitch.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.section-switch {
width: 100%;
margin-bottom: 20px;
border-bottom: 2px solid var(--borderColor);

.bp3-button-group {
margin-bottom: -2px;

.bp3-button {
border: none;
padding: 17px 0;
border-radius: 0;
color: var(--color2);
min-width: fit-content;
margin-right: 20px !important;
background-color: var(--bgColor2);
border-bottom: 2px solid var(--borderColor);

&:hover {
color: var(--color);
}

&.bp3-intent-primary {
color: var(--color);
border-bottom: 2px solid var(--color);
}
}
}
}
1 change: 1 addition & 0 deletions src/ui/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@import "./RefreshButton/_RefreshButton.scss";
@import "./ClearFiltersButton/_ClearFiltersButton.scss";
@import "./SectionHeader/_SectionHeader.scss";
@import "./SectionSwitch/_SectionSwitch.scss";
@import "./Select/_Select.scss";
@import "./SyncButton/_SyncButton.scss";
@import "./SyncPrefButton/_SyncPrefButton.scss";
Expand Down