Trying to get a dokku build :)

This commit is contained in:
2025-10-07 22:01:08 +01:00
parent 365bbb11f9
commit 0aae6aebfd
14 changed files with 410 additions and 135 deletions

View File

@@ -1,6 +1,7 @@
'use client';
import { useState } from 'react';
import Link from 'next/link';
import { Register, RegisterAccess, Note } from './types';
import { Form, Card, Container, Row, Col, Tabs, Tab, Table, OverlayTrigger, Tooltip } from 'react-bootstrap';
@@ -8,7 +9,7 @@ interface RegisterBrowserProps {
registers: Register[];
}
function renderAccess(access: RegisterAccess) {
export function renderAccess(access: RegisterAccess) {
const renderTooltip = (notes: Note[]) => (
<Tooltip id="tooltip">
{notes.map((note, index) => (
@@ -19,32 +20,35 @@ function renderAccess(access: RegisterAccess) {
return (
<>
<Table striped bordered hover size="sm" className="bits-table">
<thead>
<tr>
<th>Bits</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{access.operations.map((op, index) => {
const notes = access.notes.filter(note => note.ref === op.footnoteRef);
return (
<tr key={index}>
<td>{op.bits}</td>
<td>
{op.description}
{op.footnoteRef && notes.length > 0 && (
<OverlayTrigger placement="top" overlay={renderTooltip(notes)}>
<span className="footnote-ref">{op.footnoteRef}</span>
</OverlayTrigger>
)}
</td>
</tr>
);
})}
</tbody>
</Table>
{access.description && <pre>{access.description}</pre>}
{access.operations.length > 0 &&
<Table striped bordered hover size="sm" className="bits-table">
<thead>
<tr>
<th>Bits</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{access.operations.map((op, index) => {
const notes = access.notes.filter(note => note.ref === op.footnoteRef);
return (
<tr key={index}>
<td>{op.bits}</td>
<td>
{op.description}
{op.footnoteRef && notes.length > 0 && (
<OverlayTrigger placement="top" overlay={renderTooltip(notes)}>
<span className="footnote-ref">{op.footnoteRef}</span>
</OverlayTrigger>
)}
</td>
</tr>
);
})}
</tbody>
</Table>
}
{access.notes.map((note, index) => (
<p key={index} className="small text-muted">{note.ref} {note.text}</p>
))}
@@ -84,17 +88,25 @@ export default function RegisterBrowser({ registers }: RegisterBrowserProps) {
<Col key={register.hex_address} xs={12} className="mb-4">
<Card>
<Card.Header>
<strong>{register.name}</strong> ({register.hex_address} / {register.dec_address})
<code>{register.hex_address}</code> ( {register.dec_address} ) <Link href={`https://wiki.specnext.dev/${encodeURIComponent((register.name).replace(' ','_'))}_Register`} className="text-decoration-none">
<strong>{register.name}</strong> {register.issue_4_only && <span className="badge bg-danger">Issue 4 Only</span>}
</Link>
</Card.Header>
<Card.Body>
<Tabs defaultActiveKey={defaultActiveKey} id={`register-tabs-${register.hex_address}`}>
{register.common && <Tab eventKey="common" title="R/W">{renderAccess(register.common)}</Tab>}
{register.common && <Tab eventKey="common" title="Read/Write">{renderAccess(register.common)}</Tab>}
{register.read && <Tab eventKey="read" title="Read">{renderAccess(register.read)}</Tab>}
{register.write && <Tab eventKey="write" title="Write">{renderAccess(register.write)}</Tab>}
</Tabs>
{register.notes.map((note, index) => (
<p key={index} className="small text-muted">{note.ref} {note.text}</p>
))}
{register.text && register.text.length > 0 && (
<div className="mt-3">
<h5>Notes:</h5>
<pre>{register.text}</pre>
</div>
)}
</Card.Body>
</Card>
</Col>