Skip to content
Closed
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
5 changes: 5 additions & 0 deletions .changeset/famous-pans-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@galacticcouncil/apps': minor
---

shorten long swap routes
4 changes: 4 additions & 0 deletions packages/apps/src/app/trade/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
stroke: #ecedef;
}
}

uigc-paper.main.form-tab {
overflow: inherit;
}
1 change: 1 addition & 0 deletions packages/apps/src/app/trade/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,7 @@ export class TradeApp extends PoolApp {
tab: true,
main: true,
active: this.tab == TradeTab.Form,
'form-tab': this.tab == TradeTab.Form,
};
return html`
<uigc-paper class=${classMap(classes)} id="default-tab">
Expand Down
37 changes: 37 additions & 0 deletions packages/apps/src/app/trade/Form.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,39 @@
color: var(--uigc-field__error-color);
}

.tooltip-text {
padding: 11px 16px;
border-radius: 4px;
background: #333750;
color: #fff;
font-family: 'Geist';
font-size: 11px;
font-style: normal;
font-weight: 500;
line-height: 140%;
text-align: left;
}

.middle-route-tooltip {
position: relative;
white-space: nowrap;
}

.middle-route-tooltip > .text {
visibility: hidden;
position: absolute;
display: flex;
align-items: center;
gap: 2px;
top: 25px;
left: 50%;
transform: translateX(-50%);
}

.middle-route-tooltip:hover > .text {
visibility: visible;
}

.tooltip {
position: relative;
width: 22px;
Expand Down Expand Up @@ -328,3 +361,7 @@
height: 22px;
width: 100%;
}

.middle-route {
color: var(--hex-bright-blue-200);
}
29 changes: 28 additions & 1 deletion packages/apps/src/app/trade/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,34 @@ export class TradeForm extends BaseElement {

bestRouteTemplate() {
const bestRoute = this.getBestRoute();
const lastRoute = bestRoute[bestRoute.length - 1];
const middleRoute = bestRoute.slice(0, -1);

if (middleRoute.length > 1) {
return html`
<span class="value">${this.assetIn.symbol}</span>
<uigc-icon-chevron-right></uigc-icon-chevron-right>
<span class="middle-route-tooltip">
<span class="middle-route">Hydration Router</span>
<span class="text tooltip-text">
${middleRoute.map(
(route, index) => html`
${when(
index > 0,
() => html`
<uigc-icon-chevron-right></uigc-icon-chevron-right>
`,
)}
<span>${route}</span>
`,
)}
</span>
</span>
<uigc-icon-chevron-right></uigc-icon-chevron-right>
<span class="value">${lastRoute}</span>
`;
}

return html`
<span class="value">${this.assetIn.symbol}</span>
${bestRoute.map(
Expand All @@ -474,7 +502,6 @@ export class TradeForm extends BaseElement {
<span class="value">${poolAsset}</span>
`,
)}
<uigc-icon-route></uigc-icon-route>
`;
}

Expand Down