|
|
|
@ -26,7 +26,7 @@ final class Comments |
|
|
|
#[LiveProp(writable: false)] |
|
|
|
#[LiveProp(writable: false)] |
|
|
|
public string $current; |
|
|
|
public string $current; |
|
|
|
|
|
|
|
|
|
|
|
// same fields you used before (the template will read from the payload) |
|
|
|
#[LiveProp] |
|
|
|
public array $list = []; |
|
|
|
public array $list = []; |
|
|
|
public array $commentLinks = []; |
|
|
|
public array $commentLinks = []; |
|
|
|
public array $processedContent = []; |
|
|
|
public array $processedContent = []; |
|
|
|
@ -60,11 +60,11 @@ final class Comments |
|
|
|
#[LiveAction] |
|
|
|
#[LiveAction] |
|
|
|
public function loadComments(#[LiveArg] string $payload): void |
|
|
|
public function loadComments(#[LiveArg] string $payload): void |
|
|
|
{ |
|
|
|
{ |
|
|
|
$data = json_decode($payload,true); |
|
|
|
$data = json_decode($payload); |
|
|
|
|
|
|
|
|
|
|
|
// If your handler doesn’t compute zaps/links yet, reuse your helpers here: |
|
|
|
// If your handler doesn’t compute zaps/links yet, reuse your helpers here: |
|
|
|
$this->list = $data['comments']; |
|
|
|
$this->list = $data->comments; |
|
|
|
$this->authorsMetadata = $data['profiles'] ?? []; |
|
|
|
$this->authorsMetadata = $data->profiles ?? []; |
|
|
|
|
|
|
|
|
|
|
|
$this->parseZaps(); // your existing method – fills $zapAmounts & $zappers |
|
|
|
$this->parseZaps(); // your existing method – fills $zapAmounts & $zappers |
|
|
|
$this->parseNostrLinks(); // your existing method – fills $commentLinks & $processedContent |
|
|
|
$this->parseNostrLinks(); // your existing method – fills $commentLinks & $processedContent |
|
|
|
|