predikt/oracle/web/components/editor/tiptap-grid-cards.tsx
caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
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>
2026-07-06 23:29:50 +03:00

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>
)
}