From 3ca716445522d3fdc2f685f5e8524f2356a7cd4a Mon Sep 17 00:00:00 2001 From: f0x52 Date: Thu, 13 Oct 2022 10:42:54 +0200 Subject: [frontend] Use new GET custom_emoji admin api (#908) * use new GET custom_emoji admin api * use url instead of static_url, add link to emoji admin api tracking issue * fetch all local emoji --- web/source/settings/admin/emoji.js | 57 +++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 20 deletions(-) (limited to 'web/source/settings/admin/emoji.js') diff --git a/web/source/settings/admin/emoji.js b/web/source/settings/admin/emoji.js index 1ef4a54a3..ad7fcab06 100644 --- a/web/source/settings/admin/emoji.js +++ b/web/source/settings/admin/emoji.js @@ -30,21 +30,11 @@ const { formFields } = require("../components/form-fields"); const api = require("../lib/api"); const adminActions = require("../redux/reducers/admin").actions; const submit = require("../lib/submit"); +const BackButton = require("../components/back-button"); const base = "/settings/admin/custom-emoji"; module.exports = function CustomEmoji() { - return ( - - - - - - - ); -}; - -function EmojiOverview() { const dispatch = Redux.useDispatch(); const [loaded, setLoaded] = React.useState(false); @@ -74,12 +64,25 @@ function EmojiOverview() { return ( <> -

Custom Emoji

- - {errorMsg.length > 0 &&
{errorMsg}
} + + + + + + + + ); +}; + +function EmojiOverview() { + return ( + <> +

Custom Emoji

+ + ); } @@ -176,10 +179,10 @@ function EmojiCategory({category, entries}) {
{entries.map((e) => { return ( - // - + + {/* */} - {e.shortcode} + {e.shortcode} ); @@ -195,6 +198,13 @@ function EmojiDetailWrapped() { inputs get re-created on every change, causing them to lose focus, and bad performance */ let [_match, {emojiId}] = useRoute(`${base}/:emojiId`); + const emojiById = Redux.useSelector((state) => state.admin.emojiById); + const emoji = emojiById[emojiId]; + if (emoji == undefined) { + return ( +

Custom Emoji:

+ ); + } function alterEmoji([key, val]) { return adminActions.updateDomainBlockVal([emojiId, key, val]); @@ -202,11 +212,18 @@ function EmojiDetailWrapped() { const fields = formFields(alterEmoji, (state) => state.admin.blockedInstances[emojiId]); - return ; + return ; } -function EmojiDetail({id, Form}) { +function EmojiDetail({emoji, Form}) { return ( - "Not implemented yet" +
+

Custom Emoji: {emoji.shortcode}

+

+ Editing custom emoji isn't implemented yet.
+ View implementation progress. +

+ {emoji.shortcode} +
); } \ No newline at end of file -- cgit v1.2.3