2023-09-19 00:35:58 +08:00
|
|
|
import { IconX } from '@tabler/icons-solidjs'
|
2023-09-10 17:55:53 +08:00
|
|
|
import { Component, Show } from 'solid-js'
|
2023-09-15 23:43:55 +08:00
|
|
|
import { MODAL } from '~/constants'
|
2023-09-10 17:55:53 +08:00
|
|
|
import { allConnections } from '~/signals'
|
2023-09-19 00:35:58 +08:00
|
|
|
import { Button } from './Button'
|
2023-09-10 17:55:53 +08:00
|
|
|
|
|
|
|
export const ConnectionsTableDetailsModal: Component<{
|
|
|
|
selectedConnectionID?: string
|
|
|
|
}> = (props) => {
|
2023-09-19 00:35:58 +08:00
|
|
|
const modalID = MODAL.CONNECTIONS_TABLE_DETAILS
|
|
|
|
|
2023-09-10 17:55:53 +08:00
|
|
|
return (
|
2023-09-19 00:35:58 +08:00
|
|
|
<dialog id={modalID} class="modal modal-bottom sm:modal-middle">
|
2023-09-10 17:55:53 +08:00
|
|
|
<div class="modal-box">
|
2023-09-19 00:35:58 +08:00
|
|
|
<div class="sticky top-0 z-50 flex items-center justify-end">
|
|
|
|
<Button
|
|
|
|
class="btn-circle btn-sm"
|
|
|
|
onClick={() => {
|
|
|
|
const modal = document.querySelector(
|
|
|
|
`#${modalID}`,
|
|
|
|
) as HTMLDialogElement | null
|
|
|
|
|
|
|
|
modal?.close()
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<IconX size={20} />
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
|
2023-09-10 17:55:53 +08:00
|
|
|
<Show when={props.selectedConnectionID}>
|
|
|
|
<pre>
|
|
|
|
<code>
|
|
|
|
{JSON.stringify(
|
2023-09-16 23:31:40 +08:00
|
|
|
allConnections().find(
|
2023-09-10 17:55:53 +08:00
|
|
|
({ id }) => id === props.selectedConnectionID,
|
|
|
|
),
|
|
|
|
null,
|
|
|
|
2,
|
|
|
|
)}
|
|
|
|
</code>
|
|
|
|
</pre>
|
|
|
|
</Show>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<form method="dialog" class="modal-backdrop">
|
|
|
|
<button />
|
|
|
|
</form>
|
|
|
|
</dialog>
|
|
|
|
)
|
|
|
|
}
|