Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/components/OracleQueryList/ItemTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ChainNameAndIcon, TruncatedTitle } from "@/components";
import { getProjectIcon } from "@/constants";
import type { OracleQueryUI } from "@/types";
import { HeaderWrapper, TitleHeader, TitleText, TitleWrapper } from "./style";

Expand All @@ -11,13 +10,11 @@ export function ItemTitle({
timeFormatted,
expiryType,
}: OracleQueryUI) {
const ProjectIcon = getProjectIcon(project);
const isKnownProject = project !== "Unknown";

return (
<TitleWrapper>
<HeaderWrapper>
<ProjectIcon className="w-[18px] h-[18px] mt-[2px]" />
<TitleHeader>
<TruncatedTitle title={title} />
</TitleHeader>
Expand Down
3 changes: 0 additions & 3 deletions src/components/OracleQueryTable/TitleCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getProjectIcon } from "@/constants";
import type { OracleQueryUI } from "@/types";
import { ChainNameAndIcon } from "../ChainNameAndIcon";
import { TruncatedTitle } from "../TruncatedTitle";
Expand Down Expand Up @@ -28,13 +27,11 @@ export function TitleCell({
timeFormatted,
expiryType,
}: OracleQueryUI) {
const ProjectIcon = getProjectIcon(project);
const isKnownProject = project !== "Unknown";

return (
<TitleTD>
<TitleWrapper>
<ProjectIcon className="w-[clamp(24px,3vw,40px)] h-[clamp(24px,3vw,40px)] min-w-[24px]" />
<TextWrapper>
<TitleHeader>
<TruncatedTitle title={title} />
Expand Down
9 changes: 8 additions & 1 deletion src/components/Panel/InfoIcons/InfoIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ import type { OracleQueryUI } from "@/types";
import { ChainIcon } from "./ChainIcon";
import { ExpiryTypeIcon } from "./ExpiryTypeIcon";
import { OoTypeIcon } from "./OoTypeIcon";
import { ProjectTag } from "./ProjectTag";

export function InfoIcons({ chainId, oracleType, expiryType }: OracleQueryUI) {
export function InfoIcons({
chainId,
oracleType,
expiryType,
project,
}: OracleQueryUI) {
return (
<div className="flex flex-wrap gap-3 mt-5 px-page-padding lg:px-7 mb-11">
<ProjectTag project={project} />
<ChainIcon chainId={chainId} />
<OoTypeIcon ooType={oracleType} />
{expiryType && <ExpiryTypeIcon expiryType={expiryType} />}
Expand Down
21 changes: 21 additions & 0 deletions src/components/Panel/InfoIcons/ProjectTag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { PanelInfoIconText, PanelInfoIconWrapper } from "@/components/style";
import { getProjectIcon } from "@/constants";
import type { ProjectName } from "@/projects";

/**
* Displays a tag for the given project name.
* @param project The project name to display a tag for.
* @returns The tag for the given project, or null if the project is unknown or undefined.
*/
export function ProjectTag({ project }: { project: ProjectName | undefined }) {
if (!project || project === "Unknown") return null;

const Icon = getProjectIcon(project);

return (
<PanelInfoIconWrapper>
<Icon className="w-6 h-6" />
<PanelInfoIconText>{project}</PanelInfoIconText>
</PanelInfoIconWrapper>
);
}
14 changes: 2 additions & 12 deletions src/components/Panel/Title.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getProjectIcon } from "@/constants";
import { CloseButton } from "../CloseButton";
import { LoadingSkeleton } from "../LoadingSkeleton";
import { TruncatedTitle } from "../TruncatedTitle";
Expand All @@ -10,9 +9,7 @@ type Props = {
isLoading: boolean;
close: () => void;
};
export function Title({ project, title, isLoading, close }: Props) {
const ProjectIcon = getProjectIcon(project);

export function Title({ title, isLoading, close }: Props) {
const buttonMinWidth = "1rem";
const buttonMaxWidth = "1.25rem";
const buttonPreferredWidth = "calc(0.9rem + 0.4vw)";
Expand All @@ -21,14 +18,7 @@ export function Title({ project, title, isLoading, close }: Props) {
const iconStyles =
"min-w-[1.25rem] flex items-center justify-center w-[clamp(1.25rem,0.8rem+2vw,2.5rem)] h-[clamp(1.25rem,0.8rem+2vw,2.5rem)] rounded-full";
return (
<div className="grid grid-cols-[auto,1fr,auto] content-center gap-page-padding min-h-[84px] px-page-padding lg:px-7 py-5 bg-blue-grey-700">
{isLoading ? (
<div className={iconStyles}>
<LoadingSkeleton width="100%" height="100%" borderRadius="50%" />
</div>
) : (
<ProjectIcon className={iconStyles} />
)}
<div className="grid grid-cols-[1fr,auto] content-center gap-page-padding min-h-[84px] px-page-padding lg:px-7 py-5 bg-blue-grey-700">
<h1
className="inline-flex items-center max-w-[400px] text-lg text-light"
id="panel-title"
Expand Down