Переглянути джерело

(refactor) api reference (#1828)

* (refactor)-api-reference

* redirect

* refactor

* requested changes

* requested changes
Aditya Arora 1 рік тому
батько
коміт
1c0966ffd4

+ 7 - 0
apps/api-reference/next.config.js

@@ -9,6 +9,13 @@ export default {
     },
   },
 
+  redirects: async () => [
+    {
+      source: "/price-feeds/evm",
+      destination: "/price-feeds/evm/parsePriceFeedUpdates",
+      permanent: false,
+    },
+  ],
   webpack(config) {
     config.module.rules.push({
       test: /\.svg$/i,

+ 0 - 1
apps/api-reference/src/app/benchmarks/page.tsx

@@ -1 +0,0 @@
-export { Benchmarks as default } from "../../components/Benchmarks";

+ 0 - 12
apps/api-reference/src/components/Benchmarks/index.tsx

@@ -1,12 +0,0 @@
-import { ComingSoon } from "../ComingSoon";
-import { InlineLink } from "../InlineLink";
-
-export const Benchmarks = () => (
-  <ComingSoon>
-    We are working on adding references for our Benchmarks APIs soon. In the
-    meantime, take a look at{" "}
-    <InlineLink href="https://benchmarks.pyth.network/docs" target="_blank">
-      the Benchmarks OpenAPI explorer
-    </InlineLink>
-  </ComingSoon>
-);

+ 9 - 2
apps/api-reference/src/components/Header/index.tsx

@@ -31,10 +31,17 @@ export const Header = ({
           >
             <ul className="contents">
               <li className="contents">
-                <NavLink href="/price-feeds/evm/getPrice">Price Feeds</NavLink>
+                <NavLink href="/price-feeds/evm/getPriceNoOlderThan">
+                  Price Feeds
+                </NavLink>
               </li>
               <li className="contents">
-                <NavLink href="/benchmarks">Benchmarks</NavLink>
+                <NavLink
+                  href="https://benchmarks.pyth.network/docs#/"
+                  target="_blank"
+                >
+                  Benchmarks
+                </NavLink>
               </li>
               <li className="contents">
                 <NavLink href="/entropy">Entropy</NavLink>

+ 1 - 0
apps/api-reference/src/components/Header/nav-link.tsx

@@ -9,6 +9,7 @@ const baseClasses = "font-semibold text-sm py-2 px-3";
 
 type NavLinkProps = Omit<ComponentProps<typeof Link>, "href"> & {
   href: string;
+  target?: "_blank" | "_self";
 };
 
 export const NavLink = ({ className, ...props }: NavLinkProps) => {

+ 9 - 1
apps/api-reference/src/components/Home/index.tsx

@@ -29,7 +29,12 @@ export const Home = () => (
             </ProductLink>
           </li>
           <li className="contents">
-            <ProductLink icon={Benchmarks} href="/benchmarks" name="Benchmarks">
+            <ProductLink
+              icon={Benchmarks}
+              href="https://benchmarks.pyth.network/docs#/"
+              target="_blank"
+              name="Benchmarks"
+            >
               Get historical market data from any Pyth feed for use in both on-
               and off-chain applications
             </ProductLink>
@@ -49,6 +54,7 @@ export const Home = () => (
 type ProductLinkProps = {
   name: string;
   href: string;
+  target?: "_blank" | "_self";
   children: string;
   icon: ElementType<SVGProps<SVGSVGElement>>;
 };
@@ -57,11 +63,13 @@ const ProductLink = ({
   name,
   children,
   href,
+  target,
   icon: Icon,
 }: ProductLinkProps) => (
   <Button
     as={Link}
     href={href}
+    target={target}
     gradient
     className="flex max-w-2xl flex-col items-center gap-2 p-6 text-center sm:flex-row sm:gap-6 sm:pr-12 sm:text-left"
   >