Skip to content

Commit

Permalink
Merge pull request #599 from tradingstrategy-ai/design-system-139-len…
Browse files Browse the repository at this point in the history
…ding-reserve-chart

Lending Reserve Chart UI improvements
  • Loading branch information
kenkunz authored Sep 26, 2023
2 parents 9ba05be + 4fc4e39 commit 4a6a817
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/lib/chart/HudRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Use in conjunction with HudMetric to display chart HUD (heads-up-display) data.
.hud-row {
display: flex;
flex-wrap: wrap;
gap: var(--space-ss);
gap: var(--space-sm);
font: var(--hud-font, var(--f-ui-xs-roman));
letter-spacing: var(--hud-letter-spacing, var(--f-ui-xs-spacing, normal));
padding-block: var(--space-xxxs);
Expand Down
29 changes: 19 additions & 10 deletions src/lib/chart/PairCandleChart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,18 @@ Display trading pair candles (ohlc+v) charts, with attached quoteFeed for chart
{@const priceChangePct = priceChangeAmt / cursor.data.Open}
{@const direction = Math.sign(priceChangeAmt)}

<HudRow>
<HudMetric label="O" value={formatForHud(cursor.data.Open)} {direction} />
<HudMetric label="H" value={formatForHud(cursor.data.High)} {direction} />
<HudMetric label="L" value={formatForHud(cursor.data.Low)} {direction} />
<HudMetric label="C" value={formatForHud(cursor.data.Close)} {direction} />
<HudMetric value={formatForHud(priceChangeAmt)} {direction} />
<HudMetric value={formatPriceChange(priceChangePct)} {direction} />
</HudRow>

<slot name="hud-row-volume" {cursor} formatter={formatForHud} />
<div class="pair-candle-chart-hud">
<HudRow>
<HudMetric label="O" value={formatForHud(cursor.data.Open)} {direction} />
<HudMetric label="H" value={formatForHud(cursor.data.High)} {direction} />
<HudMetric label="L" value={formatForHud(cursor.data.Low)} {direction} />
<HudMetric label="C" value={formatForHud(cursor.data.Close)} {direction} />
<HudMetric value={formatForHud(priceChangeAmt)} {direction} />
<HudMetric value={formatPriceChange(priceChangePct)} {direction} />
</HudRow>

<slot name="hud-row-volume" {cursor} formatter={formatForHud} />
</div>
{/if}

{#if !hasData}
Expand All @@ -127,6 +129,13 @@ Display trading pair candles (ohlc+v) charts, with attached quoteFeed for chart
</ChartIQ>

<style lang="postcss">
.pair-candle-chart-hud {
background: hsla(var(--hsla-box-3));
display: inline-grid;
gap: var(--space-ss);
padding: var(--space-md);
}
.no-chart-data {
max-width: min(65ch, 90vw);
margin-top: 2rem;
Expand Down
9 changes: 5 additions & 4 deletions src/lib/chart/ReserveInterestChart.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" context="module">
const rateTypes = {
supply_apr: { label: 'Supply APR', color: 'slateblue' },
supply_apr: { label: 'Supply APR', color: 'mediumslateblue' },
stable_borrow_apr: { label: 'Stable Borrow APR', color: 'darkorange' },
variable_borrow_apr: { label: 'Variable Borrow APR', color: 'gray' }
} as const;
Expand Down Expand Up @@ -118,9 +118,10 @@

<style lang="postcss">
.reserve-interest-rate-hud {
background: hsla(var(--hsl-box), var(--a-box-a));
display: inline-block;
padding: var(--space-xs) var(--space-sl);
background: hsla(var(--hsla-box-3));
display: inline-grid;
gap: var(--space-ss);
padding: var(--space-md);
h3 {
margin: 0;
Expand Down
4 changes: 3 additions & 1 deletion src/lib/chart/chart.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
.stx_xaxis,
.stx-float-date,
.stx-float-price {
font: var(--f-ui-xs-roman);
font: var(--f-ui-sm-medium);
letter-spacing: var(--f-ui-xs-spacing, normal);
}

Expand All @@ -58,8 +58,10 @@
}

.stx-float-date {
border-radius: var(--radius-xs);
width: auto;
min-width: 5rem;
padding: var(--space-sm);
}

.stx-panel-title {
Expand Down

0 comments on commit 4a6a817

Please sign in to comment.