From ae8b6f88a0c31703d5e846fd1717a26b74d5da3b Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 9 Feb 2025 20:52:35 +0200 Subject: feat: Better home cards, show total view count of pages --- models/webpage.php | 9 +++++++++ views/admin/index.php | 6 ++++-- views/archive/index.php | 5 +++-- views/home/card.php | 4 ++-- views/styles.css | 16 +++++++++++++--- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/models/webpage.php b/models/webpage.php index 90ffb45..a42c300 100644 --- a/models/webpage.php +++ b/models/webpage.php @@ -70,6 +70,15 @@ class Webpage extends Table { ); } + function totalViewCount() : int { + return Table::_get_all( + 'Webpages', + 'Database\Webpage', + "WHERE URL = \"$this->URL\"", + "SUM(Visits) as WID" + )[0]->WID; + } + function previousPageId() : int { $foundId = Table::_get_all( "Webpages", diff --git a/views/admin/index.php b/views/admin/index.php index e633d32..fa3fc0f 100644 --- a/views/admin/index.php +++ b/views/admin/index.php @@ -3,9 +3,11 @@ ?> Role === 'Admin'): ?> +

Global settings

+

Change role

-
+ @@ -30,7 +32,7 @@

Delete

- +
diff --git a/views/archive/index.php b/views/archive/index.php index 11b4189..b39d641 100644 --- a/views/archive/index.php +++ b/views/archive/index.php @@ -20,8 +20,9 @@

URL ?>

- Archived times, - between + Viewed totalViewCount() ?> times, + accross archives, + created between Date; reset($archives); ?> and Date ?> diff --git a/views/home/card.php b/views/home/card.php index de7d6a6..2711b4a 100644 --- a/views/home/card.php +++ b/views/home/card.php @@ -8,8 +8,8 @@ Title ?>

- Visits: Visits ?> - + Visits: totalViewCount() ?> + Archives: allArchives()) ?>
diff --git a/views/styles.css b/views/styles.css index 07564ea..3817e0e 100644 --- a/views/styles.css +++ b/views/styles.css @@ -12,7 +12,8 @@ --blue: #add8e6; --cherry: #c26979; - --card-expand-with: 6em; + --card-height: 7em; + --card-expand-with: 2.5em; } /* Global */ @@ -240,7 +241,7 @@ hr.new-section { background-image: url(/img/paper.jpg); background-repeat: repeat; - height: 8.5em; + height: var(--card-height); overflow: hidden; mask-image: linear-gradient( to top, @@ -261,9 +262,13 @@ hr.new-section { pointer-events: none; } +.card strong:not(:first-of-type) { + margin-left: 1em; +} + .card:hover { cursor: pointer; - height: calc(8.5em + var(--card-expand-with)); + height: calc(var(--card-height) + var(--card-expand-with)); } .card > .quickinfo { @@ -272,6 +277,11 @@ hr.new-section { border-bottom: 3px dotted #909090; } +.card > .title { + font-size: 1.2em; + margin-bottom: 0.5em; +} + .card > .title img { vertical-align: middle; height: 2em; -- cgit v1.2.3