import m, {MithrilComponent} from '@garage44/mithril' import {Button, Table} from '@garage44/mithril/components' import type {OwnedBuilding} from '@/types' import {$s} from '@/app' import {loadClaims, releaseClaim} from '@/lib/accounts' import {local} from '@/lib/reactive' import {formatTimestamp} from '@/lib/utils' /** * Who owns which building. * * This list *is* the dispute mechanism. Claiming is first come first served with * no proof of residence, so the only answer to "that is my house" is an operator * with this page and the button on the right of the row — which is why the row * shows the holder's name and the date, and not just the address. */ export class Claims extends MithrilComponent { s = local({confirming: ''}) oninit() { void loadClaims() } view() { const s = this.s const claims = $s.claims /* * Two presses, like the account delete: releasing a building takes it off * somebody who believes it is theirs, and there is no undo but asking them * to claim it again first. */ const release = (claim: OwnedBuilding) => s.confirming === claim.pand_id ? ( ) : ( ) return (
{claims.length} {claims.length === 1 ? 'building' : 'buildings'} claimed