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

Lending Reserve Chart UI improvements #599

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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