aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorwinter2025-01-19 23:12:10 +0000
committerwinter2025-01-19 23:12:10 +0000
commitf5ad15cc68804351389192f149b0f48866f1d9eb (patch)
tree9af66b2416b8f860ea489699a14228aa568a1eb4 /templates
parent8c6dad8c48d5d730b102d9de0079fee9752b0d35 (diff)
make left and right panes accessible on small screens
Diffstat (limited to 'templates')
-rw-r--r--templates/head_tags.php7
-rw-r--r--templates/left_side_navigation.php26
-rw-r--r--templates/mobilepane_left.php32
-rw-r--r--templates/mobilepane_right.php29
-rw-r--r--templates/skeleton.php40
5 files changed, 111 insertions, 23 deletions
diff --git a/templates/head_tags.php b/templates/head_tags.php
new file mode 100644
index 0000000..66c706a
--- /dev/null
+++ b/templates/head_tags.php
@@ -0,0 +1,7 @@
+<link rel="stylesheet" href="/static/style.css">
+<link rel="stylesheet" href="https://fonts.bunny.net/css?family=dm-sans:400,400i,800,800i">
+<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<script src="https://unpkg.com/htmx.org@2.0.4"></script>
+<script src="https://unpkg.com/hyperscript.org@0.9.13"></script>
+<script src="/static/language-switch.js" defer></script> \ No newline at end of file
diff --git a/templates/left_side_navigation.php b/templates/left_side_navigation.php
new file mode 100644
index 0000000..983aa07
--- /dev/null
+++ b/templates/left_side_navigation.php
@@ -0,0 +1,26 @@
+<?php
+use Digitigrade\Model\FollowRelation;
+use Digitigrade\Model\UserAccount;
+
+$links = [];
+$user = UserAccount::findByCurrentSession();
+
+if ($user != null) {
+ $links = [[
+ 'href' => '/followrequests',
+ 'icon' => 'person_add',
+ 'label' => __('navigation.followRequests'),
+ 'unreadCount' => FollowRelation::countWhere("object = ? AND status = 'pending'", [$user->actor->id])
+ ]];
+ if ($user->isAdmin) {
+ $links[] = ['href' => '/admin/settings/instance', 'icon' => 'settings', 'label' => __('navigation.instanceSettings')];
+ }
+ $links[] = [
+ 'href' => '/logout',
+ 'icon' => 'logout',
+ 'label' => __('navigation.logout'),
+ 'confirmation' => __('navigation.logout.confirmation')
+ ];
+
+ call_template('side_navigation', ['links' => $links]);
+}
diff --git a/templates/mobilepane_left.php b/templates/mobilepane_left.php
new file mode 100644
index 0000000..77925cc
--- /dev/null
+++ b/templates/mobilepane_left.php
@@ -0,0 +1,32 @@
+<?php
+use Digitigrade\GlobalSettings;
+
+$settings = GlobalSettings::getInstance();
+?>
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <title><?= __('writeNote.label') ?> &mdash; <?= $settings->get('instance.name') ?></title>
+ <?php call_template('head_tags'); ?>
+</head>
+
+<body hx-boost="true">
+ <header>
+ <nav>
+ <a id="leftPaneActivator" class="inlineIcon material-symbols-outlined" _="on click go back">close</a>
+ <span></span>
+ <span></span>
+ <span></span>
+ </nav>
+ </header>
+ <main class="mobilePane">
+ <?php
+ call_template('write_note_form');
+ call_template('left_side_navigation');
+ ?>
+ <p class="versionInfo"><?= sprintf(__('version'), get_version()) ?></p>
+ </main>
+</body>
+
+</html> \ No newline at end of file
diff --git a/templates/mobilepane_right.php b/templates/mobilepane_right.php
new file mode 100644
index 0000000..6372d83
--- /dev/null
+++ b/templates/mobilepane_right.php
@@ -0,0 +1,29 @@
+<?php
+use Digitigrade\GlobalSettings;
+use Digitigrade\Model\UserAccount;
+
+$settings = GlobalSettings::getInstance();
+?>
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <title><?= __('writeNote.label') ?> &mdash; <?= $settings->get('instance.name') ?></title>
+ <?php call_template('head_tags'); ?>
+</head>
+
+<body hx-boost="true">
+ <header>
+ <nav>
+ <span></span>
+ <span></span>
+ <span></span>
+ <a id="rightPaneActivator" class="inlineIcon material-symbols-outlined" _="on click go back">close</a>
+ </nav>
+ </header>
+ <main class="mobilePane">
+ <?php call_template('notifications_panel', ['user' => UserAccount::requireByCurrentSession()]); ?>
+ </main>
+</body>
+
+</html> \ No newline at end of file
diff --git a/templates/skeleton.php b/templates/skeleton.php
index 3b2a963..f7670c0 100644
--- a/templates/skeleton.php
+++ b/templates/skeleton.php
@@ -11,18 +11,20 @@ $settings = GlobalSettings::getInstance();
<head>
<title><?= $pageTitle ?> &mdash; <?= $settings->get('instance.name') ?></title>
- <link rel="stylesheet" href="/static/style.css">
- <link rel="stylesheet" href="https://fonts.bunny.net/css?family=dm-sans:400,400i,800,800i">
- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <script src="https://unpkg.com/htmx.org@2.0.4"></script>
- <script src="https://unpkg.com/hyperscript.org@0.9.13"></script>
- <script src="/static/language-switch.js" defer></script>
+ <?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-outlined">
+ menu
+ </a>
+ <?php else: ?>
+ <span id="leftPaneActivator"></span>
+ <?php endif; ?>
+
<?php
$links = $user == null ? [] : ['/feed/home' => __('timeline.home.shortName')];
$links = array_merge($links, [
@@ -33,6 +35,13 @@ $settings = GlobalSettings::getInstance();
?>
<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-outlined">
+ notifications
+ </a>
+ <?php endif; ?>
+
<?php if ($user == null):
call_template('navigation_links', ['links' => [
'/login' => __('navigation.login')
@@ -51,23 +60,8 @@ $settings = GlobalSettings::getInstance();
<?php
if ($user != null) {
call_template('write_note_form');
- $links = [[
- 'href' => '/followrequests',
- 'icon' => 'person_add',
- 'label' => __('navigation.followRequests'),
- 'unreadCount' => FollowRelation::countWhere("object = ? AND status = 'pending'", [$user->actor->id])
- ]];
- if ($user->isAdmin) {
- $links[] = ['href' => '/admin/settings/instance', 'icon' => 'settings', 'label' => __('navigation.instanceSettings')];
- }
- $links[] = [
- 'href' => '/logout',
- 'icon' => 'logout',
- 'label' => __('navigation.logout'),
- 'confirmation' => __('navigation.logout.confirmation')
- ];
- call_template('side_navigation', ['links' => $links]);
}
+ call_template('left_side_navigation');
?>
<p class="versionInfo"><?= sprintf(__('version'), get_version()) ?></p>
</section>