Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
56 lines
1.1 KiB
TypeScript
56 lines
1.1 KiB
TypeScript
import { mergeAttributes, Node } from '@tiptap/core'
|
|
import { ContractsGrid } from '../contract/contracts-grid'
|
|
|
|
import { useContracts } from 'web/hooks/use-contract'
|
|
import { LoadingIndicator } from '../widgets/loading-indicator'
|
|
|
|
export default Node.create({
|
|
name: 'gridCardsComponent',
|
|
|
|
group: 'block',
|
|
|
|
atom: true,
|
|
|
|
addAttributes() {
|
|
return {
|
|
contractIds: [],
|
|
}
|
|
},
|
|
|
|
parseHTML() {
|
|
return [
|
|
{
|
|
tag: 'grid-cards-component',
|
|
},
|
|
]
|
|
},
|
|
|
|
renderHTML({ HTMLAttributes }) {
|
|
return ['grid-cards-component', mergeAttributes(HTMLAttributes)]
|
|
},
|
|
|
|
renderReact(attrs: any) {
|
|
return <GridComponent {...attrs} />
|
|
},
|
|
})
|
|
|
|
function GridComponent(attrs: any) {
|
|
const { contractIds } = attrs
|
|
|
|
const contracts = useContracts(contractIds.split(','))
|
|
const loaded = contracts.every((c) => c !== undefined)
|
|
|
|
return (
|
|
<div className=" not-prose font-normal">
|
|
{loaded ? (
|
|
<ContractsGrid
|
|
contracts={contracts}
|
|
breakpointColumns={{ default: 2, 650: 1 }}
|
|
/>
|
|
) : (
|
|
<LoadingIndicator />
|
|
)}
|
|
</div>
|
|
)
|
|
}
|