From 33fd114a314212b8759b525fb9e08d4ff4ca8869 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Tue, 14 Oct 2025 15:36:31 +0500 Subject: feat: web frontend --- web/config.php | 12 +++++ web/index.php | 103 ++++++++++++++++++++++++++++++++++++++++++ web/partials.php | 23 ++++++++++ web/static/img/icons/word.png | Bin 0 -> 567 bytes web/static/style.css | 99 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 237 insertions(+) create mode 100644 web/config.php create mode 100644 web/index.php create mode 100644 web/partials.php create mode 100755 web/static/img/icons/word.png create mode 100644 web/static/style.css diff --git a/web/config.php b/web/config.php new file mode 100644 index 0000000..bee8597 --- /dev/null +++ b/web/config.php @@ -0,0 +1,12 @@ +prepare('SELECT w.name, SUM(cw.usage_count) AS usage_count + FROM channel_words cw + INNER JOIN words w ON w.id = cw.word_id + INNER JOIN channels c ON c.alias_name = ? + INNER JOIN users u ON u.alias_name = ? + WHERE cw.channel_id = c.id AND cw.user_id = u.id + GROUP BY cw.word_id + ORDER BY usage_count DESC + LIMIT 100 + '); + $stmt->execute([$channel, $user]); +} else if (isset($channel)) { + $stmt = $db->prepare('SELECT w.name, SUM(cw.usage_count) AS usage_count + FROM channel_words cw + INNER JOIN words w ON w.id = cw.word_id + INNER JOIN channels c ON c.alias_name = ? + WHERE cw.channel_id = c.id + GROUP BY cw.word_id + ORDER BY usage_count DESC + LIMIT 100 + '); + $stmt->execute([$channel]); +} else if (isset($user)) { + $stmt = $db->prepare('SELECT w.name, SUM(cw.usage_count) AS usage_count + FROM channel_words cw + INNER JOIN words w ON w.id = cw.word_id + INNER JOIN users u ON u.alias_name = ? + WHERE cw.user_id = u.id + GROUP BY cw.word_id + ORDER BY usage_count DESC + LIMIT 100 + '); + $stmt->execute([$user]); +} else { + $stmt = $db->prepare('SELECT w.name, SUM(cw.usage_count) AS usage_count + FROM channel_words cw + INNER JOIN words w ON w.id = cw.word_id + GROUP BY cw.word_id + ORDER BY usage_count DESC + LIMIT 100 + '); + $stmt->execute(); +} + +$words = $stmt->fetchAll(PDO::FETCH_ASSOC); +?> + + + + + <?= INSTANCE_NAME ?> + + + + + + +
+
+
+
Search
+
+ + + +
+
+
+
+
+
+

+ Words +

+
+ +

No words.

+ + $word): ?> +
+

.

+

+

+
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/web/partials.php b/web/partials.php new file mode 100644 index 0000000..adbbd01 --- /dev/null +++ b/web/partials.php @@ -0,0 +1,23 @@ + +
+ + +

> #

+ + +

>

+ + +

> in #

+ +
+ .tab { + background: var(--box-tab-background); + color: var(--box-tab-color); + padding: 2px; + border-bottom: 2px solid var(--box-border); + display: flex; + align-items: center; +} + +.box>.content { + padding: 4px; +} + +.box>.content.scoreboard { + padding: 0 4px; +} + +.scoreboard-showcase { + display: grid; + grid-template-columns: auto auto auto; + gap: 4px; + flex-grow: 1; +} + +.scoreboard { + max-height: 256px; + overflow-y: scroll; +} + +.scoreboard-item { + display: flex; + flex-direction: row; +} + +.scoreboard-name { + flex-grow: 1; +} + +.scoreboard-place { + width: 38px; +} + +.row { + display: flex; + flex-direction: row; +} + +.column { + display: flex; + flex-direction: column; +} + +.grow { + flex-grow: 1; +} + +.gap-8 { + gap: 8px; +} \ No newline at end of file -- cgit v1.2.3