aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/actor_profile.php
blob: 1e37f28760c02ff87ec86a9a7e693a5618dd808b (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
50
51
52
53
54
55
56
57
58
59
60
61
<?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 class="profileMiniActions">
            <?php call_template('menu_button', [], function () {
                global $actor;
                // i don't know why but `global $user` just straight up doesnt work?
                $user = UserAccount::findByCurrentSession();
                ?>
                <?php if ($user != null && $user->actor != $actor): ?>
                    <li><?php call_template('actor_profile_block_button', ['user' => $user, 'actor' => $actor]) ?></li>
                <?php endif; ?>
            <?php }); ?>
        </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>