Add bookmark item search (#15)

- Implement form styling throughout
- Modify header links for narrower views
- Clean up CSS
This commit is contained in:
2024-05-26 16:56:30 -04:00
parent 9d59bfb1c6
commit 58dd7a4ffb
6 changed files with 116 additions and 58 deletions

View File

@@ -41,6 +41,11 @@ function add_info(string $message): void {
/** @var bool $is_htmx True if this request was initiated by htmx, false if not */
$is_htmx = key_exists('HTTP_HX_REQUEST', $_SERVER) && !key_exists('HTTP_HX_HISTORY_RESTORE_REQUEST', $_SERVER);
function nav_link(string $link, bool $isFirst = false) {
$sep = $isFirst ? '' : ' | ';
echo "<span>$sep$link</span>";
}
/**
* Render the title bar for the page
*/
@@ -52,7 +57,7 @@ function title_bar(): void {
}; ?>
<header hx-target=#main hx-push-url=true>
<div><a href=/ class=title>Feed Reader Central</a><span class=version>v<?=$version?></span></div>
<div><?php
<nav><?php
if (key_exists(Key::USER_ID, $_SESSION)) {
$db = Data::getConnection();
try {
@@ -65,20 +70,22 @@ function title_bar(): void {
$bookQuery->bindValue(':id', $_SESSION[Key::USER_ID]);
$bookResult = $bookQuery->execute();
$hasBookmarks = $bookResult && $bookResult->fetchArray(SQLITE3_NUM)[0];
echo hx_get('/feeds', 'Feeds') . ' | ';
if ($hasBookmarks) echo hx_get('/?bookmarked', 'Bookmarked') . ' | ';
echo hx_get('/search', 'Search') . ' | ' . hx_get('/docs/', 'Docs')
. ' | <a href=/user/log-off>Log Off</a>';
nav_link(hx_get('/feeds', 'Feeds'), true);
if ($hasBookmarks) nav_link(hx_get('/?bookmarked', 'Bookmarked'));
nav_link(hx_get('/search', 'Search'));
nav_link(hx_get('/docs/', 'Docs'));
nav_link('<a href=/user/log-off>Log Off</a>');
if ($_SESSION[Key::USER_EMAIL] != Security::SINGLE_USER_EMAIL) {
echo " | {$_SESSION[Key::USER_EMAIL]}";
nav_link($_SESSION[Key::USER_EMAIL]);
}
} finally {
$db->close();
}
} else {
echo hx_get('/user/log-on', 'Log On') . ' | ' . hx_get('/docs/', 'Docs');
nav_link(hx_get('/user/log-on', 'Log On'), true);
nav_link(hx_get('/docs/', 'Docs'));
} ?>
</div>
</nav>
</header>
<main id=main hx-target=this hx-push-url=true hx-swap="innerHTML show:window:top"><?php
}