Implement basic account page

Created a new page to display account info. Just shows a link
to the user's home instance and their bio, plus indicators showing
whether the user is a bot and whether their account is locked.
This commit is contained in:
St John Karp 2018-10-07 20:50:15 -07:00
parent a765bb5552
commit d6b3c8eae1
5 changed files with 66 additions and 2 deletions

View File

@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Mastodon;
use Illuminate\Http\Request;
class AccountController extends Controller
{
public function view_account(Request $request, string $account_id)
{
$user = session('user');
$account = Mastodon::domain(env('MASTODON_DOMAIN'))
->token($user->token)
->get('/accounts/' . $account_id);
$vars = [
'account' => $account,
'mastodon_domain' => explode('//', env('MASTODON_DOMAIN'))[1]
];
return view('account', $vars);
}
}

View File

@ -50,7 +50,7 @@ article figure img, article video {
max-width: 100%;
}
article img.avatar {
img.avatar {
max-width: 48px;
}

View File

@ -0,0 +1,34 @@
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ $mastodon_domain }} | {{ $account['acct'] }}</title>
<link rel="stylesheet" href="{{ url('css/styles.css') }}" />
</head>
<body>
<h1>{{ $mastodon_domain }} | {{ $account['acct'] }}</h1>
@component('navigation')
@endcomponent
<div>
<span class="account" title="{{ $account['acct'] }}">
<a href="{{ $account['url'] }}">
<img
src="{{ $account['avatar'] }}"
alt="{{ $account['acct'] }}"
class="avatar"
/>
{{ $account['display_name'] }}
@if ($account['bot'] ?? false) &#129302; @endif
@if ($account['locked']) &#128274; @endif
</a>
</span>
{!! $account['note'] !!}
</div>
</body>
</html>

View File

@ -1,6 +1,6 @@
<aside>
<span class="account" title="{{ $account['acct'] }}">
<a href="{{ $account['url'] }}">
<a href="{{ route('account', ['account_id' => $account['id']]) }}">
<img
src="{{ $account['avatar'] }}"
alt="{{ $account['acct'] }}"

View File

@ -59,6 +59,10 @@ Route::get('/notifications', 'NotificationsController@get_notifications')
->name('notifications')
->middleware('authorize');
Route::get('/account/{account_id}', 'AccountController@view_account')
->name('account')
->middleware('authorize');
Route::get('/login', 'LoginController@login')
->name('login');