Files
xrpl-dev-portal/resources/dev-tools/components/websocket-api/right-sidebar.tsx
mDuo13 dd3644ea36 Fix WS Tool links, examples, sidebar
- Update docs links for all methods.
- Add some missing methods.
- Add an icon for Clio-specific methods.
- Move the long list of ledger_entry examples below other types so those
  ones are not as buried.
- Remove unused old JS files.
- Make method list sidebar self-scrolling like docs TOC sidebar, so that
  links to methods lower in the list don't scroll the main UI up off the
  visible part of the page.
- Fix #2470.
- Fix a broken 'try it' link on the amm_info page that was causing an
  error page to display when clicked.
2024-03-22 15:20:26 -07:00

63 lines
2.2 KiB
TypeScript

import React, { Fragment } from 'react';
import { useTranslate } from "@portal/hooks";
import { Link } from "@portal/Link";
import { slugify } from "./slugify";
import { CommandGroup, CommandMethod } from './types';
interface RightSideBarProps {
commandList: CommandGroup[];
currentMethod: CommandMethod;
setCurrentMethod: any;
}
export const RightSideBar: React.FC<RightSideBarProps> = ({
commandList,
currentMethod,
setCurrentMethod,
}) => {
const { translate } = useTranslate();
return (
<div className="command-list-wrapper">
<div className="toc-header">
<h4>{translate("API Methods")}</h4>
</div>
<ul className="command-list" id="command_list">
{commandList.map((list, index) => (
<Fragment key={index}>
<li className="separator">{list.group}</li>
{list.methods.map((method) => (
<li
className={`method${method === currentMethod ? " active" : ""}`}
key={method.name}
>
<Link
to={`resources/dev-tools/websocket-api-tool#${slugify(method.name)}`}
onClick={() => setCurrentMethod(method)}
>
{method.name}&nbsp;
{method.status === "not_enabled" && (
<span
className="status not_enabled"
title="This feature is not currently enabled on the production XRP Ledger."
>
<i className="fa fa-flask"></i>
</span>
)}
{method.clio_only && (
<span
className="status clio_only"
title="This method is only available from the Clio server."
>
<i className=" fa fa-exclamation-circle"></i>
</span>
)}
</Link>
</li>
))}
</Fragment>
))}
</ul>
</div>
);
};