'use client';
import { useState } from 'react';
import { Register, RegisterAccess, Note } from '@/utils/register_parser';
import { Form, Container, Row, Table, OverlayTrigger, Tooltip } from 'react-bootstrap';
import RegisterDetail from "@/app/registers/RegisterDetail";
interface RegisterBrowserProps {
registers: Register[];
}
/**
* Renders the access details for a register, including its description, operations, and notes.
* @param access The register access data to render.
* @param extraNotes Non access footnotes to include in the tooltip.
* @returns A React component that displays the register access details.
*/
export function renderAccess(access: RegisterAccess, extraNotes: Note[] = []) {
const renderTooltip = (notes: Note[]) => (
{note.ref} {note.text}
{access.description}}
{access.operations.length > 0 &&
| Bits | Description |
|---|---|
| {op.bits} |
{op.description}
{op.footnoteRef && notes.length > 0 && (
|
{note.ref} {note.text}
))} > ); } /** * A component for browsing and searching through a list of registers. * @param registers An array of Register objects to display. * @returns A React component that allows users to browse and search registers. */ export default function RegisterBrowser({ registers }: RegisterBrowserProps) { const [searchTerm, setSearchTerm] = useState(''); const filteredRegisters = registers.filter(register => register.name.toLowerCase().includes(searchTerm.toLowerCase()) || register.description.toLowerCase().includes(searchTerm.toLowerCase()) ); return (