Files
xrpl-dev-portal/content/resources/dev-tools/components/websocket-api/right-sidebar.tsx
Caleb Kniffen 5a9b40e8c8 Migrate WebSocket Tool to Redocly
Recreate branch from base, add react-query-params, fix permalinks, fix sidebar

use correct params library and upgrade redocly.

Fix command text not working with permalink and move more modal logic out of main component.

Moved more connection selection logic to connection modal
Removed many `data-*` attributes previously used by bootstrap modal css

Created a shared modal component which removed 38 lines.

WS Tool: Fix Link import

fix UL error

toggle CurlModal to show/hide on button clicks

resolve error: <div> cannot appear as a descendant of <p>

remove <span>

WS tool: sidebar fixes
2024-01-31 16:10:32 -08:00

55 lines
1.9 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>
)}
</Link>
</li>
))}
</Fragment>
))}
</ul>
</div>
);
};