This repository was archived by the owner on Oct 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
src/Twig/Components/Challenge Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 1111use App \Repository \SolutionEventRepository ;
1212use App \Service \PassRateService ;
1313use App \Service \Types \PassRate ;
14- use Symfony \UX \TwigComponent \Attribute \AsTwigComponent ;
14+ use Symfony \UX \LiveComponent \Attribute \AsLiveComponent ;
15+ use Symfony \UX \LiveComponent \Attribute \LiveListener ;
16+ use Symfony \UX \LiveComponent \Attribute \LiveProp ;
17+ use Symfony \UX \LiveComponent \DefaultActionTrait ;
1518
16- #[AsTwigComponent ]
19+ #[AsLiveComponent ]
1720final class Header
1821{
22+ use DefaultActionTrait;
23+
24+ #[LiveProp]
1925 public User $ user ;
26+
27+ #[LiveProp]
2028 public Question $ question ;
21- public int $ limit ;
2229
2330 public function __construct (
2431 private readonly SolutionEventRepository $ solutionEventRepository ,
@@ -50,4 +57,10 @@ public function getPassRate(): PassRate
5057 {
5158 return $ this ->passRateService ->getPassRate ($ this ->question , $ this ->user ->getGroup ());
5259 }
60+
61+ #[LiveListener('app:challenge-executor:query-created ' )]
62+ public function onQueryUpdated (): void
63+ {
64+ // Update "Solve State" and "Pass Rate" after a new query is created.
65+ }
5366}
Original file line number Diff line number Diff line change 1414use Symfony \Component \Serializer \SerializerInterface ;
1515use Symfony \Contracts \Translation \TranslatorInterface ;
1616use Symfony \UX \LiveComponent \Attribute \AsLiveComponent ;
17+ use Symfony \UX \LiveComponent \Attribute \LiveArg ;
18+ use Symfony \UX \LiveComponent \Attribute \LiveListener ;
1719use Symfony \UX \LiveComponent \Attribute \LiveProp ;
1820use Symfony \UX \LiveComponent \DefaultActionTrait ;
1921use Symfony \UX \TwigComponent \Attribute \PostMount ;
@@ -116,4 +118,10 @@ public function getDiff(): ?string
116118
117119 return $ result ;
118120 }
121+
122+ #[LiveListener('app:challenge-executor:query-created ' )]
123+ public function onQueryUpdated (#[LiveArg] string $ query ): void
124+ {
125+ $ this ->query = $ query ;
126+ }
119127}
You can’t perform that action at this time.
0 commit comments