diff --git a/app/layout.tsx b/app/layout.tsx index a908796..11bfc26 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,5 +1,5 @@ import { Metadata } from 'next' -import '@/styles/globals.css'; +import '../styles/globals.css'; import Nav from '../components/Nav'; import { Suspense } from 'react'; import CSSLoader from '../components/CSSLoader'; diff --git a/app/page.tsx b/app/page.tsx index 257b1bb..18fe310 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -8,7 +8,7 @@ import { DEFAULT_CHAIN, SUPPORTED_CHAINS } from "../const/chains"; import { QueryAlliances } from "../lib/AllianceQuery"; import { AllianceAsset } from "@terra-money/feather.js/dist/client/lcd/api/AllianceAPI"; import Link from "next/link"; -import { useSearchParams } from "next/navigation"; +import { useSearchParams, useRouter } from "next/navigation"; import { Suspense, useEffect, useState } from "react"; import { mergePrices, Prices, TerraPriceServerResponse } from "../models/Prices"; import { Kpis } from "../const/kpis"; @@ -17,7 +17,13 @@ export default function Home() { const [prices, setPrices] = useState({}); const [data, setData] = useState(undefined); const params = useSearchParams(); - const selectedChain = SUPPORTED_CHAINS[params.get("selected") ?? DEFAULT_CHAIN]; + let selectedChain = SUPPORTED_CHAINS[params.get("selected") ?? DEFAULT_CHAIN]; + const router = useRouter(); + + if (selectedChain === undefined) { + selectedChain = SUPPORTED_CHAINS[DEFAULT_CHAIN]; + router.push(`?selected=${SUPPORTED_CHAINS[DEFAULT_CHAIN].id}`) + } useEffect(() => { setData(undefined); diff --git a/components/Dropdown.tsx b/components/Dropdown.tsx index f56155e..8e3e771 100644 --- a/components/Dropdown.tsx +++ b/components/Dropdown.tsx @@ -1,7 +1,7 @@ "use client"; import { useState } from "react"; -import styles from "@/styles/Dropdown.module.css"; +import styles from "../styles/Dropdown.module.css"; import { useRouter, useSearchParams } from "next/navigation"; import { DEFAULT_CHAIN, SUPPORTED_CHAINS } from "../const/chains"; diff --git a/const/chains.ts b/const/chains.ts index d41e94c..21804f6 100644 --- a/const/chains.ts +++ b/const/chains.ts @@ -83,7 +83,7 @@ export const SUPPORTED_CHAINS: { [key: string]: Chain } = { allianceCoins: { "ibc/0E90026619DD296AD4EF9546396F292B465BAB6B5BE00ABD6162AA1CE8E68098": { name: "rSWTH", - priceKey: "ibc/0E90026619DD296AD4EF9546396F292B465BAB6B5BE00ABD6162AA1CE8E68098", + priceKey: "rSWTH", icon: "https://raw.githubusercontent.com/terra-money/station-assets/main/img/coins/rSWTH.svg", color: "#324ab2", },