Link name to bookmarked page (#14)

- Tweak CSS
This commit is contained in:
Daniel J. Summers 2024-05-25 12:31:48 -04:00
parent 2495136fc9
commit c4e85e6734
3 changed files with 18 additions and 22 deletions

View File

@ -97,8 +97,6 @@ article {
img { img {
max-width: 100%; max-width: 100%;
object-fit: contain; object-fit: contain;
height: unset;
width: unset;
} }
} }
@ -159,13 +157,13 @@ p.back-link {
&.add { &.add {
background-color: lightgray; background-color: lightgray;
:hover { &:hover {
background: linear-gradient(lightgreen, gray); background: linear-gradient(lightgreen, gray);
} }
} }
&.remove { &.remove {
background: linear-gradient(lightgreen, green); background: linear-gradient(lightgreen, green);
:hover { &:hover {
background: linear-gradient(gray, lightgreen); background: linear-gradient(gray, lightgreen);
} }
} }

View File

@ -2,7 +2,7 @@
/** /**
* Home Page * Home Page
* *
* Displays a list of unread feed items for the current user * Displays a list of unread or bookmarked items for the current user
*/ */
include '../start.php'; include '../start.php';
@ -46,17 +46,18 @@ $item = $result ? $result->fetchArray(SQLITE3_ASSOC) : false;
page_head($title); ?> page_head($title); ?>
<h1> <h1>
<?=$title?><?php <?=$title?><?php
if (!$type == 'Unread') { ?> &nbsp; if ($type == 'Unread'): ?> &nbsp;
<a class=refresh href=/?refresh hx-get=/?refresh hx-indicator="closest h1">(Refresh All Feeds)</a> <?=hx_get('/?refresh', '(Refresh All Feeds)', 'class=refresh hx-indicator="closest h1"')?>
<span class=loading>Refreshing&hellip;</span><?php <span class=loading>Refreshing&hellip;</span><?php
} ?> endif; ?>
</h1> </h1>
<article><?php <article><?php
if ($item) { if ($item) {
while ($item) { ?> while ($item) { ?>
<p><?=hx_get("/item?id={$item['id']}$returnURL", strip_tags($item['item_title']))?><br> <p><?=hx_get("/item?id={$item['id']}$returnURL", strip_tags($item['item_title']))?><br>
<small><?=date_time($item['as_of'])?> &bull; <small><?=date_time($item['as_of'])?> &bull;
<?=hx_get("/feed/items?id={$item['feed_id']}&unread", htmlentities($item['feed_title']))?></small><?php <?=hx_get("/feed/items?id={$item['feed_id']}&" . strtolower($type), htmlentities($item['feed_title']))?>
</small><?php
$item = $result->fetchArray(SQLITE3_ASSOC); $item = $result->fetchArray(SQLITE3_ASSOC);
} }
} else { ?> } else { ?>

View File

@ -64,20 +64,19 @@ function title_bar(): void {
WHERE feed.user_id = :id AND item.is_bookmarked = 1) WHERE feed.user_id = :id AND item.is_bookmarked = 1)
SQL); SQL);
$bookQuery->bindValue(':id', $_SESSION[Key::USER_ID]); $bookQuery->bindValue(':id', $_SESSION[Key::USER_ID]);
$bookResult = $bookQuery->execute(); $bookResult = $bookQuery->execute();
$hasBookmarks = $bookResult ? $bookResult->fetchArray(SQLITE3_NUM)[0] : false; ?> $hasBookmarks = $bookResult && $bookResult->fetchArray(SQLITE3_NUM)[0];
<?=hx_get('/feeds', 'Feeds')?> | echo hx_get('/feeds', 'Feeds') . ' | ';
<?=$hasBookmarks ? hx_get('/?bookmarked', 'Bookmarked') . ' | ' : ''?> if ($hasBookmarks) echo hx_get('/?bookmarked', 'Bookmarked') . ' | ';
<?=hx_get('/docs/', 'Docs')?> | echo hx_get('/docs/', 'Docs') . ' | <a href=/user/log-off>Log Off</a>';
<a href=/user/log-off>Log Off</a><?php if ($_SESSION[Key::USER_EMAIL] != Security::SINGLE_USER_EMAIL) {
if ($_SESSION[Key::USER_EMAIL] != Security::SINGLE_USER_EMAIL) { ?> echo " | {$_SESSION[Key::USER_EMAIL]}";
| <?=$_SESSION[Key::USER_EMAIL]?><?php
} }
} finally { } finally {
$db->close(); $db->close();
} }
} else { ?> } else {
<?=hx_get('/user/log-on', 'Log On')?> | <?=hx_get('/docs/', 'Docs')?><?php echo hx_get('/user/log-on', 'Log On') . ' | ' . hx_get('/docs/', 'Docs');
} ?> } ?>
</div> </div>
</header> </header>
@ -122,9 +121,7 @@ function page_head(string $title): void {
function page_foot(): void { function page_foot(): void {
global $is_htmx; ?> global $is_htmx; ?>
</main><?php </main><?php
if (!$is_htmx) { ?> if (!$is_htmx) echo '<script src=/assets/htmx.min.js></script>'; ?>
<script src=/assets/htmx.min.js></script><?php
} ?>
</body> </body>
</html><?php </html><?php
session_commit(); session_commit();