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

feat(bridge-ui): support route param to directly open transactions tab #13281

Merged
merged 1 commit into from
Mar 9, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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({
jscriptcoder marked this conversation as resolved.
Show resolved Hide resolved
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