Skip to content

Commit

Permalink
feat(bridge-ui): support route param to directly open transactions tab (
Browse files Browse the repository at this point in the history
  • Loading branch information
shadab-taiko authored Mar 9, 2023
1 parent 178e382 commit b4c31cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/bridge-ui/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
};
const routes = {
"/": wrap({
"/:tab?": wrap({
component: Home,
props: {},
userData: {},
Expand Down
15 changes: 8 additions & 7 deletions packages/bridge-ui/src/pages/home/Home.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<script lang="ts">
import { _ } from 'svelte-i18n';
import { link, location } from 'svelte-spa-router';
import { transactions } from '../../store/transactions';
import BridgeForm from '../../components/form/BridgeForm.svelte';
import TaikoBanner from '../../components/TaikoBanner.svelte';
import Transactions from '../../components/Transactions.svelte';
let activeTab: string = 'bridge';
let bridgeWidth: number;
let bridgeHeight: number;
$: activeTab = $location.replace('/', '').startsWith('transactions') ? 'transactions' : 'bridge';
$: isBridge = activeTab === 'bridge';
$: styleContainer = isBridge ? '' : `min-width: ${bridgeWidth}px;`;
$: fitClassContainer = isBridge ? 'max-w-fit' : 'w-fit';
Expand All @@ -28,13 +29,13 @@
style={styleInner}>
<!-- TODO: extract this tab component into a general one? -->
<div class="tabs block mb-4">
<span
<a
class="tab tab-bordered {isBridge ? 'tab-active' : ''}"
on:click={() => (activeTab = 'bridge')}>Bridge</span>
<span
href="/" use:link>Bridge</a>
<a
class="tab tab-bordered {!isBridge ? 'tab-active' : ''}"
on:click={() => (activeTab = 'transactions')}
>Transactions ({$transactions.length})</span>
href="/transactions" use:link
>Transactions ({$transactions.length})</a>
</div>

{#if activeTab === 'bridge'}
Expand Down

0 comments on commit b4c31cd

Please sign in to comment.