Skip to content

Commit

Permalink
Landing table - update mobile interaction, fix urlKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
manishiwa committed Oct 22, 2024
1 parent 0231762 commit 5072627
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions components/layout/LandingMetricsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { useRouter } from 'next/navigation'
import { getFundamentalsByKey } from "@/lib/navigation";
import { metricItems } from "@/lib/metrics";
import { GTPMetricIcon, RankIcon } from "./GTPIcon";
import { useUIContext } from "@/contexts/UIContext";

function formatNumber(number: number, decimals?: number): string {
if (number === 0) {
Expand Down Expand Up @@ -174,7 +175,7 @@ export default function LandingMetricsTable({
<>
<>
<GridTableHeader
gridDefinitionColumns="grid-cols-[26px_125px_190px_minmax(100px,800px)_140px_125px_71px]"
gridDefinitionColumns="grid-cols-[26px_125px_190px_minmax(285px,800px)_140px_125px_71px]"
className="text-[14px] !font-bold gap-x-[15px] z-[2] !pl-[5px] !pr-[15px] !pt-[15px] pb-[5px] select-none overflow-visible"

>
Expand Down Expand Up @@ -233,7 +234,7 @@ export default function LandingMetricsTable({
}}
>
<GridTableRow
gridDefinitionColumns="grid-cols-[26px_125px_190px_minmax(100px,800px)_140px_125px_71px]"
gridDefinitionColumns="grid-cols-[26px_125px_190px_minmax(285px,800px)_140px_125px_71px]"
className="relative group text-[14px] gap-x-[15px] z-[2] !pl-[5px] !pr-[15px] select-none h-[34px] !pb-0 !pt-0"
bar={{
origin_key: item.chain.key,
Expand Down Expand Up @@ -364,6 +365,7 @@ const ChainRankCell = memo(function ChainRankIcon(
const { data: master } = useMaster();

const router = useRouter();
const { isMobile } = useUIContext();

const [selectedFundamentalsChains, setSelectedFundamentalsChains] = useSessionStorage(
"fundamentalsChains",
Expand Down Expand Up @@ -465,6 +467,8 @@ const ChainRankCell = memo(function ChainRankIcon(
onClick={(e) => {
e.stopPropagation();

if (isMobile && hoveredMetric !== metric) return;

setSelectedFundamentalsChains((prev: string[]) => {
if (!prev.includes(item.chain.key)) {
return [...prev, item.chain.key];
Expand Down
3 changes: 2 additions & 1 deletion lib/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ export const navigationItems: NavigationItem[] = [
{
name: "Economics",
label: "Economics",
key: "economics",
icon: "gtp-metrics-economics",
newChild: true,
options: [
Expand Down Expand Up @@ -575,7 +576,7 @@ export const getFundamentalsByKey = (() => {

// Loop through each item in navigationItems
for (const item of navigationItems) {
if (item.key === "metrics" && item.options && item.options.length > 0) {
if (item.key && ["metrics", "economics"].includes(item.key) && item.options && item.options.length > 0) {
// Loop through each option
for (const option of item.options) {
if (option.key) {
Expand Down

0 comments on commit 5072627

Please sign in to comment.