Skip to content

Commit 92039df

Browse files
rozsivalf3l1x
authored andcommitted
refactor: get rid of remainin wavevision deps
1 parent 8d9cdf2 commit 92039df

File tree

27 files changed

+63
-394
lines changed

27 files changed

+63
-394
lines changed

app/model/UI/BasePropsControl.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/modules/Front/Addon/AddonPresenter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected function createComponentAddon(): AddonDetail
3838

3939
private function getAddon(int $id): Addon
4040
{
41+
bdump($id);
4142
if (!($addon = $this->addonFacade->getDetail($id))) {
4243
$this->error('Addon not found');
4344
}

app/modules/Front/Addon/Controls/AddonDetail/templates/header.latte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{varType App\Model\Database\ORM\Addon\Addon $addon}
22
<div class="w-full flex flex-wrap justify-between">
33
<div class="flex items-center w-full px-5 pt-2 md:pt-0 lg:px-8 mb-3 lg:mb-6 lg:w-1/2">
4-
{control avatar, [addon => $addon, linkToGithub => true]}
4+
{control avatar, $addon, true}
55
<div class="flex flex-col flex-1">
6-
{control name, [addon => $addon, inverseTag => true, linkToGithub => true]}
7-
{control description, [addon => $addon]}
6+
{control name, $addon, true, true}
7+
{control description, $addon}
88
</div>
99
</div>
1010
<div n:if="$addon->isComposer && $addon->github->masterComposer"

app/modules/Front/Addon/Controls/AddonDetail/templates/sidebar.latte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</div>
1717
</div>
1818
<div class="bg-white rounded shadow-md relative z-10 mb-4">
19-
{control statistics, [addon => $addon]}
19+
{control statistics, $addon}
2020
</div>
2121
<div class="bg-white rounded shadow-md relative z-10 mb-4">
2222
<div class="flex flex-wrap items-center justify-start px-5 pt-3 lg:px-8 lg:pt-4 min-h-16">

app/modules/Front/Addon/Controls/FeaturedAddon/templates/default.latte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
</div>
1111
<div class="flex flex-wrap items-center justify-between px-5 pt-3 border-t lg:px-8 lg:pt-4">
1212
<div class="flex items-start w-full mb-3 lg:mb-5">
13-
{control avatar, [addon => $addon, small => true]}
13+
{control avatar, $addon, false, true}
1414
<div class="flex flex-col flex-1">
15-
{control name, [addon => $addon]}
16-
{control description, [addon => $addon]}
15+
{control name, $addon}
16+
{control description, $addon}
1717
</div>
1818
</div>
19-
{control statistics, [addon => $addon, featured => true, inline => true]}
19+
{control statistics, $addon, true, true}
2020
</div>
2121
</div>
2222
{include _shapes.latte}

app/modules/Front/Base/Controls/AddonList/AddonList.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,17 @@
77
use App\Model\Database\Query\LatestAddedAddonsQuery;
88
use App\Model\Database\Query\QueryObject;
99
use App\Model\Database\Query\SearchAddonsQuery;
10-
use App\Model\UI\BaseControl;
10+
use App\Model\UI\BaseRenderControl;
1111
use App\Modules\Front\Base\Controls\AddonList\Avatar\AvatarComponent;
1212
use App\Modules\Front\Base\Controls\AddonList\Description\DescriptionComponent;
1313
use App\Modules\Front\Base\Controls\AddonList\Name\NameComponent;
1414
use App\Modules\Front\Base\Controls\AddonList\Statistics\StatisticsComponent;
1515
use App\Modules\Front\Base\Controls\AddonMeta\AddonMeta;
1616
use App\Modules\Front\Base\Controls\Layout\Box\BoxComponent;
17-
use App\Modules\Front\Base\Controls\Layout\Box\BoxProps;
1817
use App\Modules\Front\Base\Controls\Layout\Heading\HeadingComponent;
1918
use Nette\Utils\Html;
20-
use Wavevision\PropsControl\Helpers\Render;
2119

22-
class AddonList extends BaseControl
20+
class AddonList extends BaseRenderControl
2321
{
2422

2523
use AvatarComponent;
@@ -50,13 +48,13 @@ protected function createComponentMeta(): AddonMeta
5048

5149
public function render(): void
5250
{
53-
$this->getBoxComponent()->render(new BoxProps([BoxProps::CONTENT => $this->renderContent()]));
51+
$this->getBoxComponent()->render($this->renderContent());
5452
}
5553

5654
private function renderContent(): Html
5755
{
5856
$addons = $this->addonRepository->fetchEntities($this->queryObject);
59-
return Render::toHtml(
57+
return Html::el()->setHtml(
6058
$this->template
6159
->setParameters([
6260
'addons' => $addons,
@@ -71,14 +69,11 @@ private function renderTitle(int $addonsCount): ?Html
7169
switch ($query) {
7270
case LatestActivityAddonsQuery::class:
7371
return Html::el()->setText('Latest updated addons');
74-
7572
case LatestAddedAddonsQuery::class:
7673
return Html::el()->setText('Latest indexed addons');
77-
7874
case SearchAddonsQuery::class:
7975
return $this->renderSearchTitle($addonsCount);
8076
}
81-
8277
return null;
8378
}
8479

@@ -91,19 +86,22 @@ private function renderSearchTitle(int $addonsCount): Html
9186
->addHtml(Html::el()->setText('By '))
9287
->addHtml(Html::el('strong')->setText($author));
9388
}
94-
9589
if ($tag = $query->getTag()) {
9690
return Html::el()
9791
->addHtml(Html::el()->setText('Tagged by #'))
9892
->addHtml(Html::el('strong')->setText($tag));
9993
}
100-
10194
return Html::el()
10295
->addHtml(Html::el()->setText('Searched for $'))
10396
->addHtml(Html::el('strong')->setText($query->getQuery()))
104-
->addHtml(Html::el('i')
105-
->setAttribute('class', 'ml-2 relative inline-block px-2 text-sm font-normal text-blue-700 bg-blue-100 rounded-full align-middle')
106-
->setText(sprintf('%d result%s', $addonsCount, $addonsCount > 1 ? 's' : '')));
97+
->addHtml(
98+
Html::el('i')
99+
->setAttribute(
100+
'class',
101+
'ml-2 relative inline-block px-2 text-sm font-normal text-blue-700 bg-blue-100 rounded-full align-middle'
102+
)
103+
->setText(sprintf('%d result%s', $addonsCount, $addonsCount > 1 ? 's' : ''))
104+
);
107105
}
108106

109107
}

app/modules/Front/Base/Controls/AddonList/Avatar/templates/default.latte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{varType App\Model\Database\ORM\Addon\Addon $addon}
2-
{varType bool $linkToGithub}
2+
{varType bool $linkToGitHub}
33
{varType bool $small}
4-
<a href="{if $linkToGithub}{$addon->github->linker->getRepoUrl()}{else}{plink Addon:detail, slug => $addon->id}{/if}"
4+
<a href="{if $linkToGitHub}{$addon->github->linker->getRepoUrl()}{else}{plink Addon:detail, slug => $addon->id}{/if}"
55
class="flex-shrink-0 mr-4"
66
>
77
<img loading="lazy" alt="{$addon->author}"

app/modules/Front/Base/Controls/AddonList/BaseAddonProps.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/modules/Front/Base/Controls/AddonList/CategorizedAddonList.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
use App\Modules\Front\Base\Controls\AddonList\Statistics\StatisticsComponent;
1313
use App\Modules\Front\Base\Controls\AddonMeta\AddonMeta;
1414
use App\Modules\Front\Base\Controls\Layout\Box\BoxComponent;
15-
use App\Modules\Front\Base\Controls\Layout\Box\BoxProps;
1615
use Nette\Utils\Html;
1716
use Nextras\Orm\Collection\ICollection;
18-
use Wavevision\PropsControl\Helpers\Render;
1917

2018
final class CategorizedAddonList extends BaseControl
2119
{
@@ -77,7 +75,7 @@ protected function getAddons(): ICollection
7775

7876
public function render(): void
7977
{
80-
$this->getBoxComponent()->render(new BoxProps([BoxProps::CONTENT => $this->renderContent()]));
78+
$this->getBoxComponent()->render($this->renderContent());
8179
}
8280

8381
private function renderContent(): Html
@@ -127,7 +125,7 @@ private function renderContent(): Html
127125
$this->template->list = $list;
128126
$this->template->title = null;
129127
// Render
130-
return Render::toHtml($this->template->renderToString(__DIR__ . '/templates/categorized.list.latte'));
128+
return Html::el()->setHtml($this->template->renderToString(__DIR__ . '/templates/categorized.list.latte'));
131129
}
132130

133131
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{varType App\Model\Database\ORM\Addon\Addon $addon}
2-
<p class="text-sm text-gray-700">{$addon->github->description|truncate:150|striptags|emojify|noescape}</p>
2+
<p n:if="$addon->github" class="text-sm text-gray-700">{$addon->github->description|truncate:150|striptags|emojify|noescape}</p>

0 commit comments

Comments
 (0)