Skip to content

Commit

Permalink
disabled docs default access & now it's a link
Browse files Browse the repository at this point in the history
  • Loading branch information
dredshep committed Apr 25, 2024
1 parent 7928fa7 commit 7f259ef
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 143 deletions.
28 changes: 0 additions & 28 deletions components/doc/DocumentDisplay.tsx

This file was deleted.

42 changes: 42 additions & 0 deletions components/docs/DocumentDisplay.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { marked } from "marked";
import MarkdownStyledLayout from "@/components/docs/MarkdownStyledLayout";
import { getHtmlContent, replaceLinkPlaceholders } from "@/utils/docs/docUtils";
import { useEffect, useState } from "react";

export type DocumentDisplayProps = {
title?: string;
content: string;
};

const DocumentDisplay = ({ title, content }: DocumentDisplayProps) => {
const htmlContent = getHtmlContent(content);
const [stateContent, setContent] = useState<string>("");
useEffect(() => {
if (typeof htmlContent === "string") {
setContent(htmlContent);
}
// ensure it's Promise<string>
if (typeof htmlContent === "object") {
(
htmlContent as unknown as {
then: (arg0: (content: string) => void) => void;
}
).then((content) => setContent(content));
}
}, [htmlContent]);
const contentWithLinks = replaceLinkPlaceholders(stateContent);
return (
<MarkdownStyledLayout
style={{ width: "80%", padding: "20px", overflowY: "auto" }}
>
<MarkdownStyledLayout key={title}>
<h1>{title || "Untitled Document"}</h1>
<MarkdownStyledLayout
dangerouslySetInnerHTML={{ __html: contentWithLinks.join("") }}
/>
</MarkdownStyledLayout>
</MarkdownStyledLayout>
);
};

export default DocumentDisplay;
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type DocumentListProps = {
};

const DocumentList = ({ docs, currentSlug }: DocumentListProps) => {
console.log({ docs, currentSlug });
return (
<div style={{ width: "20%", overflowY: "auto" }}>
<ul className="flex flex-col gap-2 p-4 bg-adamant-app-box min-h-screen text-white">
Expand Down
File renamed without changes.
9 changes: 7 additions & 2 deletions pages/docs/[...slug].tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRouter } from "next/router";
import { useEffect } from "react";
import DocumentList from "@/components/doc/DocumentList";
import DocumentDisplay from "@/components/doc/DocumentDisplay";
import DocumentList from "@/components/docs/DocumentList";
import DocumentDisplay from "@/components/docs/DocumentDisplay";
import { Docs, Doc, getAllDocs, getDocBySlug } from "@/utils/docs/docUtils"; // Ensure these imports are correct
import fs from "fs";
import path from "path";
Expand All @@ -28,6 +28,11 @@ export default function DocPage({ docs }: { docs: Docs }) {
const documentSlug = decodeURIComponent(
Array.isArray(slug) ? slug.join("/") : slug || ""
);
console.log({
documentSlug,
slug,
docs,
});
const selectedDoc = getDocBySlug(docs, documentSlug);

useEffect(() => {
Expand Down
142 changes: 34 additions & 108 deletions pages/docs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,112 +1,38 @@
import MarkdownStyledLayout from "@/components/doc/MarkdownStyledLayout";
import Link from "next/link";

export default function DocumentationPage() {
const handleClick = () => {
// Handle the navigation back to the site
window.history.back();
};

export default function DocPage() {
return (
<MarkdownStyledLayout>
<h1 id="welcome-to-adamant-finance-documentation">
Welcome to Adamant Finance Documentation
</h1>
<p>
Welcome to the central hub for all Adamant Finance technical
documentation. Whether you are a developer, a stakeholder, or just
curious about the inner workings of Adamant Finance, you&#39;ll find
detailed documentation on our APIs, implementation procedures, and more.
</p>
<h2 id="what-you-will-find-here">What You Will Find Here</h2>
<h3 id="api-documentation">API Documentation</h3>
<p>
Dive into the specifics of our API, exploring endpoints, responses, and
detailed use cases. Our API documentation is structured to give you
insights into how to integrate and utilize our systems efficiently.
</p>
<ul>
<li>
<a href="./api/calls-and-responses/Azure%20API/Overview">
Azure API Overview
</a>
</li>
<li>
<a href="./api/calls-and-responses/Azure%20API/Endpoint%20Detais">
Endpoint Details
</a>
</li>
<li>
<a href="./api/calls-and-responses/Azure%20API/Response%20Interfaces">
Response Interfaces
</a>
</li>
</ul>
<p>Explore other API resources:</p>
<ul>
<li>
<a href="./api/calls-and-responses/24hr">24hr Volume</a>
</li>
<li>
<a href="./api/calls-and-responses/config_mainnet.json">
Config Mainnet
</a>
</li>
<li>
<a href="./api/calls-and-responses/rewards">Rewards</a>
</li>
<li>
<a href="./api/calls-and-responses/secret_tokens">Secret Tokens</a>
</li>
<li>
<a href="./api/calls-and-responses/sefi_comment.json">Sefi Comment</a>
</li>
<li>
<a href="./api/calls-and-responses/tokens">Tokens</a>
</li>
</ul>
<h3 id="standard-operating-procedures-sop-">
Standard Operating Procedures (SOP)
</h3>
<p>
For those looking to understand our operational frameworks and
procedures:
</p>
<ul>
<li>
<a href="./SOP/Generating%20Typescript%20interfaces%20from%20JSON">
Generating TypeScript Interfaces from JSON
</a>
</li>
<li>
<a href="./SOP/Setting%20up%20json-to-ts%20cli">
Setting up JSON-to-TS CLI
</a>
</li>
</ul>
<h3 id="miscellaneous-resources">Miscellaneous Resources</h3>
<ul>
<li>
<a href="./SecretSwap%20icons">SecretSwap Icons</a>
</li>
</ul>
<h2 id="getting-started">Getting Started</h2>
<p>
To get started with our documentation, we recommend reading the{" "}
<a href="./api/calls-and-responses/Azure%20API/Overview">
Azure API Overview
</a>{" "}
as it provides a comprehensive introduction to the capabilities and
design of our financial APIs.
</p>
<p>
Feel free to navigate through the sections using the links provided in
each document. Each section is designed to be standalone, allowing you
to jump directly to the information you need.
</p>
<h2 id="feedback">Feedback</h2>
<p>
Your feedback is important to us. If you have comments or questions,
please feel free to reach out to us at{" "}
<a href="mailto:[email protected]">[email protected]</a>. We are
committed to continuously improving our documentation to better serve
your needs.
</p>
<p>Thank you for choosing Adamant Finance. Happy exploring!</p>
</MarkdownStyledLayout>
<div className="bg-tubeshapes-dark dark:bg-tubeshapes-light bg-cover min-h-screen flex flex-col justify-center items-center w-full">
<div className="text-center p-8 max-w-2xl bg-adamant-app-box rounded-lg shadow-lg">
<h1 className="text-2xl font-bold text-white mb-4">
Developer Documentation
</h1>
<p className="text-gray-400 mb-6">
Access all the necessary documentation for developing on the AdamantFi
platform.
</p>
<div className="flex gap-2">
<button
onClick={handleClick}
className="bg-adamant-box-buttonDark hover:bg-adamant-box-buttonLight text-white font-bold py-2 px-4 rounded transition-colors duration-300 flex-1"
>
Back to Site
</button>
<Link
href="https://github.com/dredshep/AdamantFiSite/tree/main/docs"
className="inline-block bg-adamant-gradientBright hover:bg-adamant-gradientDark text-white font-bold py-2 px-4 rounded transition-colors duration-300 flex-1"
target="_blank"
referrerPolicy="no-referrer"
>
Go to Documentation
</Link>
</div>
</div>
</div>
);
}
117 changes: 117 additions & 0 deletions pages/docs/index2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import MarkdownStyledLayout from "@/components/docs/MarkdownStyledLayout";
import Link from "next/link";

export default function DocPage() {
return (
<MarkdownStyledLayout>
<h1 id="welcome-to-adamant-finance-documentation">
Welcome to Adamant Finance Documentation
</h1>
<p>
Welcome to the central hub for all Adamant Finance technical
documentation. Whether you are a developer, a stakeholder, or just
curious about the inner workings of Adamant Finance, you&#39;ll find
detailed documentation on our APIs, implementation procedures, and more.
</p>
<h2 id="what-you-will-find-here">What You Will Find Here</h2>
<h3 id="api-documentation">API Documentation</h3>
<p>
Dive into the specifics of our API, exploring endpoints, responses, and
detailed use cases. Our API documentation is structured to give you
insights into how to integrate and utilize our systems efficiently.
</p>
<ul>
<li>
<Link href="./docs/api/calls-and-responses/Azure%20API/Overview">
Azure API Overview
</Link>
</li>
<li>
<Link href="./docs/api/calls-and-responses/Azure%20API/Endpoint%20Detais">
Endpoint Details
</Link>
</li>
<li>
<Link href="./docs/api/calls-and-responses/Azure%20API/Response%20Interfaces">
Response Interfaces
</Link>
</li>
</ul>
<p>Explore other API resources:</p>
<ul>
<li>
<Link href="./docs/api/calls-and-responses/24hr">24hr Volume</Link>
</li>
<li>
<Link href="./docs/api/calls-and-responses/config_mainnet.json">
Config Mainnet
</Link>
</li>
<li>
<Link href="./docs/api/calls-and-responses/rewards">Rewards</Link>
</li>
<li>
<Link href="./docs/api/calls-and-responses/secret_tokens">
Secret Tokens
</Link>
</li>
<li>
<Link href="./docs/api/calls-and-responses/sefi_comment.json">
Sefi Comment
</Link>
</li>
<li>
<Link href="./docs/api/calls-and-responses/tokens">Tokens</Link>
</li>
</ul>
<h3 id="standard-operating-procedures-sop-">
Standard Operating Procedures (SOP)
</h3>
<p>
For those looking to understand our operational frameworks and
procedures:
</p>
<ul>
<li>
<Link href="./docs/SOP/Generating%20Typescript%20interfaces%20from%20JSON">
Generating TypeScript Interfaces from JSON
</Link>
</li>
<li>
<Link href="./docs/SOP/Setting%20up%20json-to-ts%20cli">
Setting up JSON-to-TS CLI
</Link>
</li>
</ul>
<h3 id="miscellaneous-resources">Miscellaneous Resources</h3>
<ul>
<li>
<Link href="./docs/SecretSwap%20icons">SecretSwap Icons</Link>
</li>
</ul>
<h2 id="getting-started">Getting Started</h2>
<p>
To get started with our documentation, we recommend reading the{" "}
<Link href="./docs/api/calls-and-responses/Azure%20API/Overview">
Azure API Overview
</Link>{" "}
as it provides a comprehensive introduction to the capabilities and
design of our financial APIs.
</p>
<p>
Feel free to navigate through the sections using the links provided in
each document. Each section is designed to be standalone, allowing you
to jump directly to the information you need.
</p>
<h2 id="feedback">Feedback</h2>
<p>
Your feedback is important to us. If you have comments or questions,
please feel free to reach out to us at{" "}
<Link href="mailto:[email protected]">[email protected]</Link>.
We are committed to continuously improving our documentation to better
serve your needs.
</p>
<p>Thank you for choosing Adamant Finance. Happy exploring!</p>
</MarkdownStyledLayout>
);
}
Loading

0 comments on commit 7f259ef

Please sign in to comment.