feat(panel-app): S6 — componente Livewire Reactions (#545) - #568
Merged
danielhe4rt merged 1 commit intoSep 28, 2026
Merged
Conversation
AdryanneKelly
requested review from
BrunaDomingues,
GabrielFVDev,
danielhe4rt,
davicbtoliveira,
hefeus and
stherzada
September 26, 2026 14:41
hefeus
reviewed
Sep 26, 2026
|
|
||
| public function reactWith(string $reaction, #[CurrentUser] ?User $user): void | ||
| { | ||
| if (!$user instanceof User) { |
Contributor
There was a problem hiding this comment.
Aqui poderia usar o user vindo do auth para garantir que um usuário não autenticado ou usar credenciais de outro usuário na requisição.
$user = auth()->user();
If (!$user instanceof User) {
return;
}
| public string $timelineId; | ||
|
|
||
| /** @var array<string, int> */ | ||
| public array $counts = []; |
Contributor
There was a problem hiding this comment.
#[Locked]
Faz o uso aqui do Locked e em $mine também. Faz sentido por que esses valores são definidos no servidor e impede do usuário conseguir alterar.
|
|
||
| $summary = resolve(ReactionSummary::class) | ||
| ->forTimelines([$this->timelineId], $user->id) | ||
| ->first(); |
Contributor
There was a problem hiding this comment.
Aqui é mais uma sugestão, já que vão retornar Coleciona, mas se usar o get vai dizer exatamente qual post você quer na requisição.
get($this->timelineId)
danielhe4rt
approved these changes
Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexto
A timeline web (épico de reações, #539) precisa de uma superfície interativa pra reagir a posts — um componente Livewire por post que grava a reação, faz toggle e substitui reações existentes. As peças de domínio já existem e estão mergeadas: o enum
TimelineReaction(S2, #540), a actionReactWith+ReactWithDTO(S4, #543) e o query objectReactionSummary(S5, #544). Faltava a camada de UI que consome tudo isso.Este PR implementa a S6: o componente
Reactionsque expõe os 6 emojis, chamaReactWithno clique, e atualiza seu próprio estado (counts/mine) recalculando viaReactionSummarypara o post em questão.Alterações
app-modules/panel-app/src/Livewire/Timeline/Reactions.php— componente final,mount(timelineId, counts, mine)recebendo estado inicial já resolvido pelo pai;reactWith()valida usuário autenticado e reação dentro do enum, delega paraReactWith, recalculacounts/minee despachatimeline.reaction-updated.app-modules/panel-app/resources/views/livewire/timeline/reactions.blade.php— picker com os 6 emojis (ícone + rótulo viatitle), botão com contagem total e destaque visual da reação própria.app-modules/panel-app/src/PanelAppServiceProvider.php— registroLivewire::component('timeline-reactions', Reactions::class).app-modules/panel-app/tests/Feature/Timeline/ReactionsTest.php— os 6 cenários BDD da issue.Plano de Testes
make checkmake testlivewire(Reactions::class, ['timelineId' => ...])->call('reactWith', 'love')grava a reação e despachatimeline.reaction-updatedreactWith('xpto')não altera o banco e não despacha nadareactWithnão altera o banco$counts/$minerefletem o novo estado após a açãoEvidências
Sem impacto visual na tela ainda: o componente não está plugado em nenhuma tela real porque a S8 (o pai —
PostShow/Feed— calculandocounts/mineviaReactionSummarye passando pro<livewire:timeline-reactions>) é uma issue separada, ainda não implementada. A validação deste PR é via os testes Livewire (ReactionsTest.php), que exercitam o componente isoladamente com props diretas.Issues Relacionadas
Closes #545
Related to #539