aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/skeleton.php
blob: 584805449f3498158e92adcda48705b0eaf7d99c (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
use Digitigrade\GlobalSettings;
use Digitigrade\Model\FollowRelation;
use Digitigrade\Model\UserAccount;

$user = UserAccount::findByCurrentSession();
$settings = GlobalSettings::getInstance();
?>
<!DOCTYPE html>
<html lang="<?= get_ui_language() ?>">

<head>
    <title><?= $pageTitle ?> &mdash; <?= $settings->get('instance.name') ?></title>
    <!-- metadata for link previews -->
    <meta property="og:type" content="<?= $ogType ?? 'website' ?>">
    <meta name="twitter:card" content="summary">
    <meta property="og:title" content="<?= htmlspecialchars($ogTitle ?? $pageTitle) ?>">
    <meta name="twitter:title" content="<?= htmlspecialchars($ogTitle ?? $pageTitle) ?>">
    <meta property="og:site_name" content="<?= htmlspecialchars($settings->get('instance.name')) ?>">
    <?php if (isset($ogDesc)): ?>
        <meta name="description" content="<?= htmlspecialchars($ogDesc) ?>">
        <meta property="og:description" content="<?= htmlspecialchars($ogDesc) ?>">
        <meta name="twitter:description" content="<?= htmlspecialchars($ogDesc) ?>">
    <?php endif; ?>
    <?php if (isset($ogImage)): ?>
        <meta property="og:image" content="<?= htmlspecialchars($ogImage) ?>">
        <meta name="twitter:image" content="<?= htmlspecialchars($ogImage) ?>">
    <?php endif; ?>
    <?php if (isset($ogHandle)): ?>
        <meta name="fediverse:creator" content="<?= $ogHandle ?>">
    <?php endif; ?>
    <!-- any custom links e.g. rss/atom feeds -->
    <?php foreach (($headLinks ?? []) as $link): ?>
        <link rel="<?= $link['rel'] ?>" type="<?= $link['type'] ?? '' ?>" href="<?= $link['href'] ?>"
            title="<?= $link['title'] ?? '' ?>">
    <?php endforeach; ?>
    <!-- other page resources -->
    <?php call_template('head_tags'); ?>
</head>

<body hx-boost="true" hx-indicator="#loadingIndicator">
    <header>
        <nav>
            <?php if ($user != null): ?>
                <a id="leftPaneActivator" href="/mobilepane/left" class="inlineIcon material-symbols menu"></a>
            <?php else: ?>
                <span id="leftPaneActivator"></span>
            <?php endif; ?>

            <?php
            $links = $user == null ? [] : ['/feed/home' => __('timeline.home.shortName')];
            $links = array_merge($links, [
                '/feed/global' => __('timeline.global.shortName'),
                '/feed/local' => __('timeline.local.shortName'),
            ]);
            call_template('navigation_links', ['links' => $links]);
            ?>
            <span id="siteTitle"><?= $settings->get('instance.name') ?></span>
            <img id="loadingIndicator" class="htmx-indicator" src="/static/tail-spin.svg">

            <?php if ($user != null): ?>
                <a id="rightPaneActivator" href="/mobilepane/right" class="inlineIcon material-symbols notifications"></a>
            <?php endif; ?>

            <?php if ($user == null):
                call_template('navigation_links', ['links' => [
                    '/login' => __('navigation.login')
                ]]);
            else: ?>
                <a href="/@/<?= $user->actor->handle ?>" id="currentUserInfo">
                    <?php call_template('actor_avatar', ['actor' => $user->actor]) ?>
                    <?= htmlspecialchars($user->actor->displayName) ?>
                </a>
            <?php endif; ?>
        </nav>
    </header>
    <main>
        <div>
            <section id="leftPane">
                <?php
                if ($user != null) {
                    call_template('write_note_form', ['actor' => $user->actor]);
                }
                call_template('left_side_navigation');
                ?>
                <p class="versionInfo"><?= sprintf(__('version'), get_version()) ?></p>
            </section>
        </div>
        <div>
            <section id="centrePane">
                <?php if (!isset($renderTitleHeading) || $renderTitleHeading): ?>
                    <h1><?= $pageTitle ?></h1>
                <?php endif; ?>
                <?php slot(); ?>
            </section>
        </div>
        <div>
            <section id="rightPane">
                <?php if ($user != null) {
                    call_template('notifications_panel', ['user' => $user]);
                } ?>
            </section>
        </div>
    </main>
</body>

</html>