Skip to content

Commit

Permalink
profile view changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperbeisner committed Aug 29, 2022
1 parent 0738431 commit 61c2d3d
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 156 deletions.
48 changes: 48 additions & 0 deletions views/profile/_name-changes.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

use Jesperbeisner\Fwstats\Model\PlayerNameHistory;
use Jesperbeisner\Fwstats\Service\ViewRenderService;

/** @var ViewRenderService $this */
/** @var PlayerNameHistory[] $nameChanges */

?>
<div class="card mt-5">
<div class="card-header">
<p class="card-header-title">
Namensänderungen
</p>
</div>
<div class="card-content">
<div class="content">
<?php if (count($nameChanges) > 0): ?>
<div class="table-container">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<td>Alter Name</td>
<td>Neuer Name</td>
<td>Datum</td>
</tr>
</thead>
<tbody>
<?php foreach ($nameChanges as $nameChange): ?>
<tr>
<td><?= $nameChange->oldName ?></td>
<td><?= $nameChange->newName ?></td>
<td><?= $nameChange->created->format('d.m.Y') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p class="has-text-centered">
Keine Namensänderungen vorhanden.
</p>
<?php endif; ?>
</div>
</div>
</div>
55 changes: 55 additions & 0 deletions views/profile/_playtimes.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

declare(strict_types=1);

use Jesperbeisner\Fwstats\DTO\Playtime;
use Jesperbeisner\Fwstats\Service\ViewRenderService;

/** @var ViewRenderService $this */
/** @var array<string, Playtime|null> $weeklyPlaytimes */
/** @var Playtime $totalPlaytime */
/** @var Playtime $averagePlaytime */

?>
<div class="card">
<div class="card-header">
<p class="card-header-title">
Spielzeit der letzten 7 Tage
</p>
</div>
<div class="card-content">
<div class="content">
<div class="table-container">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<td>Stunden</td>
<td>Minuten</td>
<td>Sekunden</td>
<td>Datum</td>
</tr>
</thead>
<tbody>
<?php $date = new DateTime('+1 day') ?>
<?php foreach ($weeklyPlaytimes as $playtime): ?>
<tr>
<td><?= $playtime === null ? '-' : $playtime->getHours() ?></td>
<td><?= $playtime === null ? '-' : $playtime->getMinutes() ?></td>
<td><?= $playtime === null ? '-' : $playtime->getSeconds() ?></td>
<td><?= $date->modify('-1 day')->format('d.m.Y') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<footer class="card-footer">
<p class="card-footer-item">
Gesamt: <?= $totalPlaytime->getHours() ?> h <?= $totalPlaytime->getMinutes() ?> m <?= $totalPlaytime->getSeconds() ?> s
</p>
<p class="card-footer-item">
Im Durchschnitt: <?= $averagePlaytime->getHours() ?> h <?= $averagePlaytime->getMinutes() ?> m <?= $averagePlaytime->getSeconds() ?> s
</p>
</footer>
</div>
48 changes: 48 additions & 0 deletions views/profile/_profession-changes.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

use Jesperbeisner\Fwstats\Model\PlayerProfessionHistory;
use Jesperbeisner\Fwstats\Service\ViewRenderService;

/** @var ViewRenderService $this */
/** @var PlayerProfessionHistory[] $professionChanges */

?>
<div class="card mt-5 mb-5">
<div class="card-header">
<p class="card-header-title">
Berufsänderungen
</p>
</div>
<div class="card-content">
<div class="content">
<?php if (count($professionChanges) > 0): ?>
<div class="table-container">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<td>Alter Beruf</td>
<td>Neuer Beruf</td>
<td>Datum</td>
</tr>
</thead>
<tbody>
<?php foreach ($professionChanges as $professionChange): ?>
<tr>
<td><?= $professionChange->oldProfession ?? '-' ?></td>
<td><?= $professionChange->newProfession ?? '-' ?></td>
<td><?= $professionChange->created->format('d.m.Y') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p class="has-text-centered">
Keine Berufsänderungen vorhanden.
</p>
<?php endif; ?>
</div>
</div>
</div>
49 changes: 49 additions & 0 deletions views/profile/_race-changes.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

use Jesperbeisner\Fwstats\Model\PlayerRaceHistory;
use Jesperbeisner\Fwstats\Service\ViewRenderService;

/** @var ViewRenderService $this */
/** @var PlayerRaceHistory[] $raceChanges */

?>

<div class="card mt-5">
<div class="card-header">
<p class="card-header-title">
Rassenänderungen
</p>
</div>
<div class="card-content">
<div class="content">
<?php if (count($raceChanges) > 0): ?>
<div class="table-container">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<td>Alte Rasse</td>
<td>Neue Rasse</td>
<td>Datum</td>
</tr>
</thead>
<tbody>
<?php foreach ($raceChanges as $raceChange): ?>
<tr>
<td><?= $raceChange->oldRace ?></td>
<td><?= $raceChange->newRace ?></td>
<td><?= $raceChange->created->format('d.m.Y') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p class="has-text-centered">
Keine Rassenänderungen vorhanden.
</p>
<?php endif; ?>
</div>
</div>
</div>
160 changes: 4 additions & 156 deletions views/profile/profile.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,160 +43,8 @@ $this->setTitle($player->name . ' - ' . $player->world->worldString());
</a>
</h1>

<div class="card">
<div class="card-header">
<p class="card-header-title">
Spielzeit der letzten 7 Tage
</p>
</div>
<div class="card-content">
<div class="content">
<div class="table-container">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<td>Stunden</td>
<td>Minuten</td>
<td>Sekunden</td>
<td>Datum</td>
</tr>
</thead>
<tbody>
<?php $date = new DateTime('+1 day') ?>
<?php foreach ($weeklyPlaytimes as $playtime): ?>
<tr>
<td><?= $playtime === null ? '-' : $playtime->getHours() ?></td>
<td><?= $playtime === null ? '-' : $playtime->getMinutes() ?></td>
<td><?= $playtime === null ? '-' : $playtime->getSeconds() ?></td>
<td><?= $date->modify('-1 day')->format('d.m.Y') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<footer class="card-footer">
<p class="card-footer-item">
Gesamt: <?= $totalPlaytime->getHours() ?> h <?= $totalPlaytime->getMinutes() ?> m <?= $totalPlaytime->getSeconds() ?> s
</p>
<p class="card-footer-item">
Im Durchschnitt: <?= $averagePlaytime->getHours() ?> h <?= $averagePlaytime->getMinutes() ?> m <?= $averagePlaytime->getSeconds() ?> s
</p>
</footer>
</div>

<div class="card mt-5">
<div class="card-header">
<p class="card-header-title">
Namensänderungen
</p>
</div>
<div class="card-content">
<div class="content">
<?php if (count($nameChanges) > 0): ?>
<div class="table-container">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<td>Alter Name</td>
<td>Neuer Name</td>
<td>Datum</td>
</tr>
</thead>
<tbody>
<?php foreach ($nameChanges as $nameChange): ?>
<tr>
<td><?= $nameChange->oldName ?></td>
<td><?= $nameChange->newName ?></td>
<td><?= $nameChange->created->format('d.m.Y') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p class="has-text-centered">
Keine Namensänderungen vorhanden.
</p>
<?php endif; ?>
</div>
</div>
</div>

<div class="card mt-5">
<div class="card-header">
<p class="card-header-title">
Rassenänderungen
</p>
</div>
<div class="card-content">
<div class="content">
<?php if (count($raceChanges) > 0): ?>
<div class="table-container">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<td>Alte Rasse</td>
<td>Neue Rasse</td>
<td>Datum</td>
</tr>
</thead>
<tbody>
<?php foreach ($raceChanges as $raceChange): ?>
<tr>
<td><?= $raceChange->oldRace ?></td>
<td><?= $raceChange->newRace ?></td>
<td><?= $raceChange->created->format('d.m.Y') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p class="has-text-centered">
Keine Rassenänderungen vorhanden.
</p>
<?php endif; ?>
</div>
</div>
</div>

<div class="card mt-5 mb-5">
<div class="card-header">
<p class="card-header-title">
Berufsänderungen
</p>
</div>
<div class="card-content">
<div class="content">
<?php if (count($professionChanges) > 0): ?>
<div class="table-container">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<td>Alter Beruf</td>
<td>Neuer Beruf</td>
<td>Datum</td>
</tr>
</thead>
<tbody>
<?php foreach ($professionChanges as $professionChange): ?>
<tr>
<td><?= $professionChange->oldProfession ?? '-' ?></td>
<td><?= $professionChange->newProfession ?? '-' ?></td>
<td><?= $professionChange->created->format('d.m.Y') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p class="has-text-centered">
Keine Berufsänderungen vorhanden.
</p>
<?php endif; ?>
</div>
</div>
</div>
<?php require __DIR__ . '/_playtimes.phtml' ?>
<?php require __DIR__ . '/_name-changes.phtml' ?>
<?php require __DIR__ . '/_race-changes.phtml' ?>
<?php require __DIR__ . '/_profession-changes.phtml' ?>
</div>

0 comments on commit 61c2d3d

Please sign in to comment.