diff --git a/assets/less/mio/classes/index.less b/assets/less/mio/classes/index.less new file mode 100644 index 00000000..91f63b2a --- /dev/null +++ b/assets/less/mio/classes/index.less @@ -0,0 +1,28 @@ +.index { + display: flex; + flex-direction: row-reverse; + + &__sidebar { + width: 300px; + margin-left: 2px; + } + + &__main { + flex: 1 1 auto; + } + + &__stats { + &__emphasis { + font-weight: 700; + } + + &__link { + color: inherit; + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } + } +} diff --git a/assets/less/mio/main.less b/assets/less/mio/main.less index 2b23af38..dd42f753 100644 --- a/assets/less/mio/main.less +++ b/assets/less/mio/main.less @@ -58,6 +58,8 @@ body { @import "classes/footer"; @import "classes/header"; @import "classes/profile"; +@import "classes/index"; +@import "classes/changelog"; // Settings @import "classes/settings/content"; @@ -89,6 +91,3 @@ body { // Member listing @import "classes/members/user"; @import "classes/members/users"; - -// Changelog -@import "classes/changelog"; diff --git a/public/index.php b/public/index.php index a25cd100..30c33541 100644 --- a/public/index.php +++ b/public/index.php @@ -5,6 +5,7 @@ require_once __DIR__ . '/../misuzu.php'; $config = $app->getConfig(); $tpl = $app->getTemplating(); +$db = Database::connection(); if ($config->get('Site', 'embed_linked_data', 'bool', false)) { $tpl->vars([ @@ -16,24 +17,60 @@ if ($config->get('Site', 'embed_linked_data', 'bool', false)) { ]); } -$featuredNews = Database::connection() - ->query(' - SELECT - p.`post_id`, p.`post_title`, p.`post_text`, p.`created_at`, - u.`user_id`, u.`username`, - COALESCE(r.`role_colour`, CAST(0x40000000 AS UNSIGNED)) as `user_colour` - FROM `msz_news_posts` as p - LEFT JOIN `msz_users` as u - ON p.`user_id` = u.`user_id` - LEFT JOIN `msz_roles` as r - ON u.`display_role` = r.`role_id` - WHERE p.`is_featured` = true - ORDER BY p.`created_at` DESC - LIMIT 3 - ')->fetchAll(); +$featuredNews = $db->query(' + SELECT + p.`post_id`, p.`post_title`, p.`post_text`, p.`created_at`, + u.`user_id`, u.`username`, + COALESCE(r.`role_colour`, CAST(0x40000000 AS UNSIGNED)) as `user_colour` + FROM `msz_news_posts` as p + LEFT JOIN `msz_users` as u + ON p.`user_id` = u.`user_id` + LEFT JOIN `msz_roles` as r + ON u.`display_role` = r.`role_id` + WHERE p.`is_featured` = true + ORDER BY p.`created_at` DESC + LIMIT 3 +')->fetchAll(PDO::FETCH_ASSOC); + +$usersCount = (int)$db->query(' + SELECT COUNT(`user_id`) + FROM `msz_users` +')->fetchColumn(); + +$lastUser = $db->query(' + SELECT + u.`user_id`, u.`username`, u.`created_at`, + COALESCE(r.`role_colour`, CAST(0x40000000 AS UNSIGNED)) as `user_colour` + FROM `msz_users` as u + LEFT JOIN `msz_roles` as r + ON r.`role_id` = u.`display_role` + ORDER BY u.`created_at` DESC + LIMIT 1 +')->fetch(PDO::FETCH_ASSOC); + +$featuredChangelog = $db->query(' + SELECT + c.`change_id`, c.`change_log`, + a.`action_name`, a.`action_colour`, a.`action_class`, + DATE(`change_created`) as `change_date`, + !ISNULL(c.`change_text`) as `change_has_text` + FROM `msz_changelog_changes` as c + LEFT JOIN `msz_changelog_actions` as a + ON a.`action_id` = c.`action_id` + WHERE DATE(c.`change_created`) >= ( + SELECT DATE(`change_created`) + FROM `msz_changelog_changes` + ORDER BY `change_created` DESC + LIMIT 2, 1 + ) + ORDER BY c.`change_created` DESC +')->fetchAll(PDO::FETCH_ASSOC); //var_dump(Database::connection()->query('SHOW SESSION STATUS LIKE "Questions"')->fetch()['Value']); -echo $tpl->render('home.landing', [ +echo $tpl->render('home.index', [ + 'users_count' => $usersCount, + 'last_user' => $lastUser, + 'featured_changelog' => $featuredChangelog, 'featured_news' => $featuredNews, ]); diff --git a/views/mio/changelog/macros.twig b/views/mio/changelog/macros.twig index db79381a..c8c5a166 100644 --- a/views/mio/changelog/macros.twig +++ b/views/mio/changelog/macros.twig @@ -9,7 +9,7 @@ {% if not hide_dates and last_date != change.change_date %} {% set last_date = change.change_date %} - + {{ last_date }} {% endif %} @@ -30,23 +30,25 @@
You have 0 new messages because the PM system doesn't exist yet, have a nice day.
+You have 0 new messages because the PM system doesn't exist yet, have a nice day.
-