diff --git a/apps/insights/src/components/PublisherTag/index.module.scss b/apps/insights/src/components/PublisherTag/index.module.scss index ed4e0612ce..439a20e797 100644 --- a/apps/insights/src/components/PublisherTag/index.module.scss +++ b/apps/insights/src/components/PublisherTag/index.module.scss @@ -3,12 +3,18 @@ .publisherTag { display: flex; flex-flow: row nowrap; - gap: theme.spacing(4); + gap: theme.spacing(3); align-items: center; + width: 100%; + + .icon, + .undisclosedIconWrapper { + width: theme.spacing(10); + height: theme.spacing(10); + } .icon { - width: theme.spacing(9); - height: theme.spacing(9); + flex: none; display: grid; place-content: center; @@ -20,16 +26,22 @@ } } + .name { + color: theme.color("heading"); + font-weight: theme.font-weight("medium"); + } + + .publisherKey, + .icon { + color: theme.color("foreground"); + } + .nameAndKey { display: flex; flex-flow: column nowrap; gap: theme.spacing(1); align-items: flex-start; - .name { - color: theme.color("heading"); - } - .key { margin-bottom: -#{theme.spacing(2)}; } @@ -55,4 +67,12 @@ border-radius: theme.border-radius("full"); } } + + &[data-compact] { + .icon, + .undisclosedIconWrapper { + width: theme.spacing(6); + height: theme.spacing(6); + } + } } diff --git a/apps/insights/src/components/PublisherTag/index.tsx b/apps/insights/src/components/PublisherTag/index.tsx index 3553f6a5b9..a5347fc8f9 100644 --- a/apps/insights/src/components/PublisherTag/index.tsx +++ b/apps/insights/src/components/PublisherTag/index.tsx @@ -1,49 +1,41 @@ import { Broadcast } from "@phosphor-icons/react/dist/ssr/Broadcast"; import { Skeleton } from "@pythnetwork/component-library/Skeleton"; import clsx from "clsx"; -import { type ComponentProps, type ReactNode } from "react"; +import type { ComponentProps, ReactNode } from "react"; import styles from "./index.module.scss"; import { PublisherKey } from "../PublisherKey"; -type Props = - | { isLoading: true } - | ({ - isLoading?: false; - publisherKey: string; - } & ( - | { name: string; icon: ReactNode } - | { name?: undefined; icon?: undefined } - )); +type Props = ComponentProps<"div"> & { compact?: boolean | undefined } & ( + | { isLoading: true } + | ({ + isLoading?: false; + publisherKey: string; + } & ( + | { name: string; icon: ReactNode } + | { name?: undefined; icon?: undefined } + )) + ); -export const PublisherTag = (props: Props) => ( +export const PublisherTag = ({ className, ...props }: Props) => (
{props.isLoading ? ( ) : (
{props.icon ?? }
)} - {props.isLoading ? ( - - ) : ( - <> - {props.name ? ( -
-
{props.name}
- -
- ) : ( - - )} - - )} +
); @@ -52,3 +44,38 @@ const UndisclosedIcon = ({ className, ...props }: ComponentProps<"div">) => ( ); + +const Contents = (props: Props) => { + if (props.isLoading) { + return ; + } else if (props.compact) { + return props.name ? ( +
{props.name}
+ ) : ( + + ); + } else if (props.name) { + return ( +
+
{props.name}
+ +
+ ); + } else { + return ; + } +}; + +const omitKeys = >( + obj: T, + keys: string[], +) => { + const omitSet = new Set(keys); + return Object.fromEntries( + Object.entries(obj).filter(([key]) => !omitSet.has(key)), + ); +}; diff --git a/apps/insights/src/components/Root/index.tsx b/apps/insights/src/components/Root/index.tsx index d3d62d4969..6ef9c3a0aa 100644 --- a/apps/insights/src/components/Root/index.tsx +++ b/apps/insights/src/components/Root/index.tsx @@ -1,37 +1,69 @@ +import { lookup as lookupPublisher } from "@pythnetwork/known-publishers"; import { Root as BaseRoot } from "@pythnetwork/next-root"; import { NuqsAdapter } from "nuqs/adapters/next/app"; import type { ReactNode } from "react"; +import { createElement } from "react"; import { Footer } from "./footer"; import { Header } from "./header"; // import { MobileMenu } from "./mobile-menu"; import styles from "./index.module.scss"; +import { SearchDialogProvider } from "./search-dialog"; import { TabRoot, TabPanel } from "./tabs"; import { IS_PRODUCTION_SERVER, GOOGLE_ANALYTICS_ID, AMPLITUDE_API_KEY, } from "../../config/server"; +import { toHex } from "../../hex"; +import { getPublishers } from "../../services/clickhouse"; +import { getData } from "../../services/pyth"; import { LivePricesProvider } from "../LivePrices"; +import { PriceFeedIcon } from "../PriceFeedIcon"; type Props = { children: ReactNode; }; -export const Root = ({ children }: Props) => ( - - -
-
- {children} -
-