aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorwinter2024-12-23 22:17:41 +0000
committerwinter2024-12-23 22:17:41 +0000
commit916d4521cb595493bc5df8b7f9ef52310b6d013a (patch)
treed12b54f32339c2e6ae0bafc12bd4c30262615a5d /templates
parent8f1f84d92cabf3a606585bc79eba14e63c149b60 (diff)
actor profile page
Diffstat (limited to 'templates')
-rw-r--r--templates/actor_avatar.php4
-rw-r--r--templates/actor_profile.php11
-rw-r--r--templates/actor_profile_page.php16
-rw-r--r--templates/note.php12
-rw-r--r--templates/skeleton.php4
5 files changed, 37 insertions, 10 deletions
diff --git a/templates/actor_avatar.php b/templates/actor_avatar.php
new file mode 100644
index 0000000..d428006
--- /dev/null
+++ b/templates/actor_avatar.php
@@ -0,0 +1,4 @@
+<picture class="avatar">
+ <source srcset="<?= $actor->avatar ?>">
+ <img src="/static/default-avatar.svg">
+</picture> \ No newline at end of file
diff --git a/templates/actor_profile.php b/templates/actor_profile.php
new file mode 100644
index 0000000..45a0a59
--- /dev/null
+++ b/templates/actor_profile.php
@@ -0,0 +1,11 @@
+<div class="fullProfile">
+ <div class="basicInfo">
+ <?php call_template('actor_avatar', ['actor' => $actor]); ?>
+ <div>
+ <div class="displayName"><?= $actor->displayName ?></div>
+ <div class="handle">@<?= $actor->getFullHandle() ?></div>
+ <div class="joinedDate">Joined on <?= $actor->created->format('Y-m-d') ?></div>
+ </div>
+ </div>
+ <p class="bio"><?= $actor->bio ?></p>
+</div> \ No newline at end of file
diff --git a/templates/actor_profile_page.php b/templates/actor_profile_page.php
new file mode 100644
index 0000000..e745433
--- /dev/null
+++ b/templates/actor_profile_page.php
@@ -0,0 +1,16 @@
+<?php
+
+use Digitigrade\Model\Note;
+
+call_template('skeleton', [
+ 'pageTitle' => "$actor->displayName - @" . $actor->getFullHandle(),
+ 'renderTitleHeading' => false
+], function () {
+ global $actor;
+ call_template('actor_profile', ['actor' => $actor]);
+ echo '<hr>';
+ $notes = Note::findAllWithAuthor($actor, 50);
+ foreach ($notes as $n) {
+ call_template('note', ['note' => $n]);
+ }
+}); \ No newline at end of file
diff --git a/templates/note.php b/templates/note.php
index 9c4f609..6fcb477 100644
--- a/templates/note.php
+++ b/templates/note.php
@@ -1,17 +1,11 @@
-<?php
-$fullHandle = $note->author->handle . ($note->author->isLocal ? '' : '@' . hostname_from_uri($note->author->uri));
-?>
<article class="note">
- <a href="/@/<?= $fullHandle ?>">
- <picture>
- <source srcset="<?= $note->author->avatar ?>">
- <img class="authorAvatar" src="/static/default-avatar.svg">
- </picture>
+ <a href="/@/<?= $note->author->getFullHandle() ?>">
+ <?php call_template('actor_avatar', ['actor' => $note->author]); ?>
</a>
<div>
<div class="infoLine">
<span class="authorName"><?= $note->author->displayName ?></span>
- <span class="authorHandle">@<?= $fullHandle ?></span>
+ <span class="authorHandle">@<?= $note->author->getFullHandle() ?></span>
<span class="timestamp">
<?=
$note->created->format('Y-m-d \a\t H:i')
diff --git a/templates/skeleton.php b/templates/skeleton.php
index 8a7fdf1..acf86bf 100644
--- a/templates/skeleton.php
+++ b/templates/skeleton.php
@@ -18,7 +18,9 @@
</nav>
</header>
<main>
- <h1><?= $pageTitle ?></h1>
+ <?php if (!isset($renderTitleHeading) || $renderTitleHeading): ?>
+ <h1><?= $pageTitle ?></h1>
+ <?php endif; ?>
<?php slot(); ?>
</main>
</body>