aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/actor_profile.php
blob: fed8e3bd9cab04330cafc8949f69c43d9783fe43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
use Digitigrade\Model\UserAccount;

$user = UserAccount::findByCurrentSession();
?>
<div class="fullProfile">
    <div class="basicInfo">
        <?php if ($addLink ?? false): ?>
            <a href="/@/<?= $actor->getFullHandle() ?>">
            <?php endif; ?>
            <?php call_template('actor_avatar', ['actor' => $actor]); ?>
            <?php if ($addLink ?? false): ?>
            </a>
        <?php endif; ?>
        <div>
            <div class="displayName"><?= htmlspecialchars($actor->displayName) ?></div>
            <div class="handle">@<?= $actor->getFullHandle() ?></div>
            <div class="joinedDate"><?= sprintf(__('user.profile.createdAt'), $actor->created->format('Y-m-d')) ?></div>
        </div>
        <div>
            <?php if (!$actor->isLocal): ?>
                <a class="icon material-symbols-outlined" href="<?= $actor->homepage ?>"
                    title="<?= __('user.profile.openRemote') ?>" target="_blank">open_in_new</a>
            <?php endif; ?>
        </div>
    </div>
    <?php if (isset($actor->bio) && $actor->bio != '') { ?>
        <pre class="bio"><?= htmlspecialchars($actor->bio) ?></pre>
    <?php } else {
        call_template('placeholder_text', ['message' => __('user.profile.bio.placeholder')]);
    } ?>

    <?php if (isset($user) && $actor->id != $user->actor->id): ?>
        <div class="profileActions">
            <?php if ($actor->followsPending($user->actor))
                call_template('actor_profile_pending_follow', ['subject' => $actor, 'object' => $user->actor]); ?>
            <?php if ($actor->follows($user->actor)): ?>
                <?= __('user.profile.followsYou') ?>
            <?php endif; ?>
            <?php call_template('actor_profile_follow_button', ['actor' => $actor, 'user' => $user]); ?>
        </div>
    <?php elseif ($actor->id == $user->actor->id): ?>
        <div class="profileActions">
            <button class="primary" hx-get="/fragment/profile" hx-target="closest .fullProfile" hx-swap="outerHTML">
                <?= __('form.edit') ?>
            </button>
        </div>
    <?php endif; ?>
</div>