More user page tweaks
This commit is contained in:
parent
065290e8e6
commit
e6d71d3cce
@ -16,7 +16,9 @@ use Aviat\AnimeClient\Kitsu;
|
||||
<aside class="info">
|
||||
<table class="media-details invisible">
|
||||
<tr>
|
||||
<td><?= $helper->img($data['avatar'], ['alt' => '']); ?></td>
|
||||
<?php if($data['avatar'] !== null): ?>
|
||||
<td><?= $helper->img($data['avatar'], ['alt' => '', 'width' => '225']); ?></td>
|
||||
<?php endif ?>
|
||||
<td><?= $escape->html($data['about']) ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -25,6 +27,7 @@ use Aviat\AnimeClient\Kitsu;
|
||||
<?php foreach ([
|
||||
'joinDate' => 'Joined',
|
||||
'birthday' => 'Birthday',
|
||||
'gender' => 'Gender',
|
||||
'location' => 'Location'
|
||||
] as $key => $label): ?>
|
||||
<?php if ($data[$key] !== null): ?>
|
||||
@ -42,7 +45,7 @@ use Aviat\AnimeClient\Kitsu;
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ( ! empty($data['waifu'])): ?>
|
||||
<?php if ($data['waifu']['character'] !== null): ?>
|
||||
<tr>
|
||||
<td><?= $escape->html($data['waifu']['label']) ?></td>
|
||||
<td>
|
||||
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "Anilist Schema",
|
||||
"schemaPath": "schema.graphql",
|
||||
"extensions": {
|
||||
"endpoints": {
|
||||
"Anilist": {
|
||||
"url": "https://graphql.anilist.co",
|
||||
"headers": {
|
||||
"user-agent": "JS GraphQL"
|
||||
},
|
||||
"introspect": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
8
src/AnimeClient/API/Anilist/graphql.config.yml
Normal file
8
src/AnimeClient/API/Anilist/graphql.config.yml
Normal file
@ -0,0 +1,8 @@
|
||||
schema: schema.graphql
|
||||
extensions:
|
||||
endpoints:
|
||||
Anilist:
|
||||
url: https://graphql.anilist.co
|
||||
headers:
|
||||
user-agent: JS GraphQL
|
||||
introspect: true
|
@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "Kitsu Schema",
|
||||
"schemaPath": "schema.graphql",
|
||||
"extensions": {
|
||||
"endpoints": {
|
||||
"Kitsu": {
|
||||
"url": "https://kitsu.io/api/graphql",
|
||||
"headers": {
|
||||
"user-agent": "JS GraphQL"
|
||||
},
|
||||
"introspect": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ query ($slug: String!) {
|
||||
createdAt
|
||||
id
|
||||
location
|
||||
gender
|
||||
name
|
||||
proMessage
|
||||
proTier
|
||||
|
@ -39,17 +39,18 @@ final class UserTransformer extends AbstractTransformer
|
||||
] : [];
|
||||
|
||||
return User::from([
|
||||
'about' => $base['about'],
|
||||
'avatar' => $base['avatarImage']['original']['url'],
|
||||
'birthday' => Kitsu::formatDate($base['birthday']) . ' (' . Kitsu::friendlyTime(Kitsu::getDateDiff($base['birthday']), 'year') . ')',
|
||||
'joinDate' => Kitsu::formatDate($base['createdAt']) . ' (' . Kitsu::friendlyTime(Kitsu::getDateDiff($base['createdAt']), 'day') . ')',
|
||||
'about' => $base['about'] ?? '',
|
||||
'avatar' => $base['avatarImage']['original']['url'] ?? null,
|
||||
'birthday' => $base['birthday'] !== null ? Kitsu::formatDate($base['birthday']) . ' (' . Kitsu::friendlyTime(Kitsu::getDateDiff($base['birthday']), 'year') . ')' : null,
|
||||
'joinDate' => Kitsu::formatDate($base['createdAt']) . ' (' . Kitsu::friendlyTime(Kitsu::getDateDiff($base['createdAt']), 'day') . ' ago)',
|
||||
'gender' => $base['gender'],
|
||||
'favorites' => $this->organizeFavorites($favorites),
|
||||
'location' => $base['location'],
|
||||
'name' => $base['name'],
|
||||
'slug' => $base['slug'],
|
||||
'stats' => $this->organizeStats($stats),
|
||||
'waifu' => $waifu,
|
||||
'website' => $base['siteLinks']['nodes'][0]['url'],
|
||||
'website' => $base['siteLinks']['nodes'][0]['url'] ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
|
8
src/AnimeClient/API/Kitsu/graphql.config.yml
Normal file
8
src/AnimeClient/API/Kitsu/graphql.config.yml
Normal file
@ -0,0 +1,8 @@
|
||||
schema: schema.graphql
|
||||
extensions:
|
||||
endpoints:
|
||||
Kitsu:
|
||||
url: https://kitsu.io/api/graphql
|
||||
headers:
|
||||
user-agent: JS GraphQL
|
||||
introspect: true
|
@ -69,6 +69,12 @@ final class User extends BaseController
|
||||
: $username;
|
||||
|
||||
$rawData = $this->kitsuModel->getUserData($username);
|
||||
if ($rawData['data']['findProfileBySlug'] === null)
|
||||
{
|
||||
$this->notFound('Sorry, user not found', "The user '$username' does not seem to exist.");
|
||||
return;
|
||||
}
|
||||
|
||||
$data = (new UserTransformer())->transform($rawData)->toArray();
|
||||
|
||||
$this->outputHTML('user/details', [
|
||||
|
@ -22,12 +22,13 @@ final class User extends AbstractType
|
||||
public ?string $about;
|
||||
public ?string $avatar;
|
||||
public ?string $birthday;
|
||||
public ?string $joinDate;
|
||||
public string $joinDate;
|
||||
public ?string $gender;
|
||||
public ?array $favorites;
|
||||
public ?string $location;
|
||||
public ?string $name;
|
||||
public ?string $slug;
|
||||
public ?array $stats;
|
||||
public ?array $waifu;
|
||||
public array $waifu;
|
||||
public ?string $website;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user