-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…ctor GH-230 | Overview - Planets list summary refactor
- Loading branch information
Showing
12 changed files
with
146 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
2 changes: 1 addition & 1 deletion
2
...verview.cachebuster-1546565145290.min.css → ...verview.cachebuster-1657148521824.min.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
71 changes: 71 additions & 0 deletions
71
.../overview/screens/Overview/components/PlanetsListElement/PlanetsListElement.component.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace UniEngine\Engine\Modules\Overview\Screens\Overview\Components\PlanetsListElement; | ||
|
||
use UniEngine\Engine\Includes\Helpers\Planets\Queues\Structures; | ||
|
||
/** | ||
* @param array $props | ||
* @param arrayRef $props['planet'] | ||
* @param number $props['currentTimestamp'] | ||
*/ | ||
function render($props) { | ||
global $_Lang, $_SkinPath; | ||
|
||
$planet = &$props['planet']; | ||
$currentTimestamp = $props['currentTimestamp']; | ||
|
||
$localTemplateLoader = createLocalTemplateLoader(__DIR__); | ||
$tplBodyCache = [ | ||
'body' => $localTemplateLoader('body'), | ||
'queueStateBusy' => $localTemplateLoader('queueStateBusy'), | ||
'queueStateEmpty' => $localTemplateLoader('queueStateEmpty'), | ||
]; | ||
|
||
$queueStateHTML = null; | ||
|
||
if ($planet['buildQueue_firstEndTime'] > 0) { | ||
$buildingsQueue = Structures\parseQueueString( | ||
Structures\getQueueString($planet) | ||
); | ||
$firstQueueElement = $buildingsQueue[0]; | ||
$elementId = $firstQueueElement['elementID']; | ||
$elementLevel = $firstQueueElement['level']; | ||
|
||
$queueStateHTML = parsetemplate( | ||
$tplBodyCache['queueStateBusy'], | ||
[ | ||
'elementName' => $_Lang['tech'][$elementId], | ||
'elementLevel' => $elementLevel, | ||
'elementConstructionRestTime' => pretty_time( | ||
$firstQueueElement['endTimestamp'] - $currentTimestamp | ||
), | ||
] | ||
); | ||
} else { | ||
$queueStateHTML = parsetemplate( | ||
$tplBodyCache['queueStateEmpty'], | ||
$_Lang | ||
); | ||
} | ||
|
||
$tplBodyParams = [ | ||
'skinPath' => $_SkinPath, | ||
'planetName' => $planet['name'], | ||
'planetId' => $planet['id'], | ||
'planetImg' => $planet['image'], | ||
'queueStateHTML' => $queueStateHTML, | ||
]; | ||
$tplBodyParams = array_merge($_Lang, $tplBodyParams); | ||
|
||
$componentHTML = parsetemplate( | ||
$tplBodyCache['body'], | ||
$tplBodyParams | ||
); | ||
|
||
return [ | ||
'componentHTML' => $componentHTML, | ||
]; | ||
} | ||
|
||
?> |
18 changes: 18 additions & 0 deletions
18
modules/overview/screens/Overview/components/PlanetsListElement/body.tpl
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class="otherPlanetItem"> | ||
{planetName} | ||
<br/> | ||
<a | ||
href="?cp={planetId}&re=0" | ||
title="{planetName}" | ||
> | ||
<img | ||
src="{skinPath}planeten/small/s_{planetImg}.jpg" | ||
height="90" | ||
width="90" | ||
> | ||
</a> | ||
<br> | ||
<center> | ||
{queueStateHTML} | ||
</center> | ||
</div> |
5 changes: 5 additions & 0 deletions
5
modules/overview/screens/Overview/components/PlanetsListElement/index.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
header("Location: ../index.php"); | ||
|
||
?> |
5 changes: 5 additions & 0 deletions
5
modules/overview/screens/Overview/components/PlanetsListElement/queueStateBusy.tpl
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{elementName} ({elementLevel}) | ||
<br> | ||
<span style="color: #7f7f7f;"> | ||
({elementConstructionRestTime}) | ||
</span> |
3 changes: 3 additions & 0 deletions
3
modules/overview/screens/Overview/components/PlanetsListElement/queueStateEmpty.tpl
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{Free} | ||
<br/> | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
header("Location: ../index.php"); | ||
|
||
?> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
header("Location: ../index.php"); | ||
|
||
?> |
This file contains 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
This file contains 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