feat: help modal for world page

This commit is contained in:
Julian Lam
2024-04-29 12:47:09 -04:00
parent b7ad4317cc
commit cf291a518d
5 changed files with 38 additions and 7 deletions

View File

@@ -103,7 +103,7 @@
"nodebb-plugin-ntfy": "1.7.4",
"nodebb-plugin-spam-be-gone": "2.2.2",
"nodebb-rewards-essentials": "1.0.0",
"nodebb-theme-harmony": "2.0.0-pre.18",
"nodebb-theme-harmony": "2.0.0-pre.19",
"nodebb-theme-lavender": "7.1.8",
"nodebb-theme-peace": "2.2.4",
"nodebb-theme-persona": "13.3.18",

View File

@@ -1,9 +1,18 @@
{
"world.name": "World",
"world.description": "This forum is federated, and can interact with the social web (or \"fediverse\"). Your corner of the fediverse consists of topics created by — and shared from — from users you follow.",
"world.popular": "Popular topics from the past day",
"world.description": "",
"world.popular": "Popular topics",
"world.recent": "All topics",
"world.help": "Help",
"no-topics": "This forum doesn't know of any other topics yet.",
"help.title": "What is this page?",
"help.intro": "Welcome to your corner of the fediverse.",
"help.fediverse": "The \"fediverse\" is a network of interconnected applications and websites that all talk to one another and whose users can see each other. This forum is federated, and can interact with that social web (or \"fediverse\"). This page is your corner of the fediverse. It consists solely of topics created by — and shared from — users <strong>you</strong> follow.",
"help.build": "There might not be a lot of topics here to start; that's normal. You will start to see more content here over time when you start following other users.",
"help.federating": "Likewise, if users from outside of this forum start following <em>you</em>, then your posts will start appearing on those apps and websites as well.",
"help.next-generation": "This is the next generation of social media, start contributing today!",
"topic-event-announce-ago": "%1 shared <a href=\"%2\">this post</a> %3",
"topic-event-announce-on": "%1 shared <a href=\"%2\">this post</a> on %3"
}

View File

@@ -1,6 +1,6 @@
'use strict';
define('forum/world', ['topicList', 'sort', 'hooks', 'alerts', 'api'], function (topicList, sort, hooks, alerts, api) {
define('forum/world', ['topicList', 'sort', 'hooks', 'alerts', 'api', 'bootbox'], function (topicList, sort, hooks, alerts, api, bootbox) {
const World = {};
World.init = function () {
@@ -10,6 +10,7 @@ define('forum/world', ['topicList', 'sort', 'hooks', 'alerts', 'api'], function
sort.handleSort('categoryTopicSort', 'world');
handleIgnoreWatch(-1);
handleHelp();
hooks.fire('action:topics.loaded', { topics: ajaxify.data.topics });
hooks.fire('action:category.loaded', { cid: ajaxify.data.cid });
@@ -42,5 +43,28 @@ define('forum/world', ['topicList', 'sort', 'hooks', 'alerts', 'api'], function
});
}
function handleHelp() {
const trigger = document.getElementById('world-help');
if (!trigger) {
return;
}
const content = [
'<p class="lead">[[activitypub:help.intro]]</p>',
'<p>[[activitypub:help.fediverse]]</p>',
'<p>[[activitypub:help.build]]</p>',
'<p>[[activitypub:help.federating]]</p>',
'<p>[[activitypub:help.next-generation]]</p>',
];
trigger.addEventListener('click', () => {
bootbox.dialog({
title: '[[activitypub:help.title]]',
message: content.join('\n'),
size: 'large',
});
});
}
return World;
});

View File

@@ -16,7 +16,7 @@ const intFields = [
const worldCategory = {
cid: -1,
name: 'Uncategorized',
description: 'Pseudo-category containing topics that do not strictly fit in with any existing categories',
description: 'Topics that do not strictly fit in with any existing categories',
icon: 'fa-globe',
imageClass: 'cover',
bgColor: '#eee',

View File

@@ -68,8 +68,6 @@ controller.list = async function (req, res) {
targetUid: targetUid,
});
data.name = '[[activitypub:world.name]]';
data.description = '[[activitypub:world.description]]';
data.descriptionParsed = data.description;
delete data.children;
data.topicCount = await db.sortedSetIntersectCard(sets);