diff options
| author | winter | 2025-01-13 20:57:26 +0000 |
|---|---|---|
| committer | winter | 2025-01-13 20:57:26 +0000 |
| commit | 5e5b7c5d6d4bbdd4acaea7d4b6c5be1e27b04a86 (patch) | |
| tree | cb8c66bc1cc02df8e01ee5c8ec18ec74d3dde739 | |
| parent | f31d2abc237958bd9f33875f20198c4510389556 (diff) | |
make the thread page work
| -rw-r--r-- | Digitigrade/Model/Note.php | 6 | ||||
| -rw-r--r-- | static/style.css | 12 | ||||
| -rw-r--r-- | templates/note.php | 2 | ||||
| -rw-r--r-- | templates/thread_page.php | 7 |
4 files changed, 25 insertions, 2 deletions
diff --git a/Digitigrade/Model/Note.php b/Digitigrade/Model/Note.php index 6d83a90..277b503 100644 --- a/Digitigrade/Model/Note.php +++ b/Digitigrade/Model/Note.php @@ -111,6 +111,12 @@ class Note extends PushableModel implements TimelineIncludeable { return self::findAllWhere($where, [$author->id], $limit, $offset, 'created DESC'); } + public static function findAllInThread(Note $threadApex, ?int $limit = null, int $offset = 0): array { + $notes = self::findAllWhere('thread_apex = ? AND deleted = false', [$threadApex->id], $limit, $offset, 'created ASC'); + array_splice($notes, 0, 0, [$threadApex]); // since the apex itself has threadApex = null + return $notes; + } + public function getInteractions(): array { return Interaction::findAllWithTarget($this); } diff --git a/static/style.css b/static/style.css index f963802..698113d 100644 --- a/static/style.css +++ b/static/style.css @@ -151,6 +151,18 @@ article.note { aspect-ratio: 1; } + &.selected { + background: #ebf4; + } + + .content { + font-size: 12pt; + padding: 4px 0; + .selected & { + font-size: 16pt; + } + } + .infoLine { display: grid; grid-template-columns: max-content 1fr max-content; diff --git a/templates/note.php b/templates/note.php index 3fc86ba..56f1322 100644 --- a/templates/note.php +++ b/templates/note.php @@ -9,7 +9,7 @@ if ($user != null) { $interKinds = array_map(fn($inter) => $inter->kind, $interactions); } ?> -<article class="note"> +<article class="note <?= $selected ? 'selected' : '' ?>"> <a href="/@/<?= $note->author->getFullHandle() ?>"> <?php call_template('actor_avatar', ['actor' => $note->author]); ?> </a> diff --git a/templates/thread_page.php b/templates/thread_page.php index 73d8f0b..e5e5389 100644 --- a/templates/thread_page.php +++ b/templates/thread_page.php @@ -1,8 +1,13 @@ <?php +use Digitigrade\Model\Note; + call_template('skeleton', [ 'pageTitle' => '"' . $note->plainContent . '" - @' . $note->author->getFullHandle(), 'renderTitleHeading' => false ], function () { global $note; - call_template('note', ['note' => $note]); + $notes = Note::findAllInThread($note->threadApex ?? $note); + foreach ($notes as $n) { + call_template('note', ['note' => $n, 'selected' => $n == $note]); + } });
\ No newline at end of file |
