Skip to content

Commit

Permalink
Better approach
Browse files Browse the repository at this point in the history
  • Loading branch information
jscriptcoder committed Mar 21, 2023
1 parent 3358e29 commit 92866f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/bridge-ui/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
pausable: false,
};
// TODO: Not found route
const routes = {
'/:tab?': wrap({
component: Home,
Expand Down
13 changes: 9 additions & 4 deletions packages/bridge-ui/src/pages/home/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
let bridgeWidth: number;
let bridgeHeight: number;
$: activeTab = $location.replace('/', '').startsWith('transactions')
? 'transactions'
: 'bridge';
// TODO: think about a more general approach here.
// We're assuming we have two tabs. The base location
// corresponds with `bridge` tab => `/`, otherwise we're
// opening the second tab `transactions` => `/transactions`.
// What if we add a new tab?. Also, routes are coupled to
// tab's name. We might want to have this configuration
// somewhere.
$: activeTab = $location === '/' ? 'bridge' : 'transactions';
// TODO: do we really need all these tricks to style containers
// Rethink this part: fluid, fixing on small screens
// Rethink this part: fluid, fixing on bigger screens
$: isBridge = activeTab === 'bridge';
$: styleContainer = isBridge ? '' : `min-width: ${bridgeWidth}px;`;
$: fitClassContainer = isBridge ? 'max-w-fit' : 'w-fit';
Expand Down

0 comments on commit 92866f4

Please sign in to comment.