improvement(plugins-page): Use i18n Text

Note that, since the translation PR has not been made yet, this patch
was used to test the changes: https://public.alyxia.dev/revolt/lang.diff
This commit is contained in:
Alyxia Sother 2022-03-29 13:32:59 +02:00 committed by Paul Makles
parent 07439bd5f6
commit 0d6720e3b1
3 changed files with 16 additions and 4 deletions

View file

@ -166,8 +166,7 @@ export default observer(() => {
{ {
id: "plugins", id: "plugins",
icon: <Plug size={20} />, icon: <Plug size={20} />,
// TODO(lexisother): Replace this with the actual i18n <Text /> title: <Text id="app.settings.pages.plugins.title" />,
title: <p>Plugins</p>,
hidden: !experiments.isEnabled("plugins"), hidden: !experiments.isEnabled("plugins"),
}, },
{ {

View file

@ -532,6 +532,13 @@
h1 { h1 {
margin-bottom: 20px !important; margin-bottom: 20px !important;
} }
.empty {
display: flex;
justify-content: center;
align-items: center;
margin-top: 1rem;
}
} }
.myBots { .myBots {

View file

@ -1,6 +1,7 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import styles from "./Panes.module.scss"; import styles from "./Panes.module.scss";
import { Text } from "preact-i18n";
import { useApplicationState } from "../../../mobx/State"; import { useApplicationState } from "../../../mobx/State";
@ -11,12 +12,11 @@ export const PluginsPage = observer(() => {
const plugins = useApplicationState().plugins; const plugins = useApplicationState().plugins;
return ( return (
<div className={styles.plugins}> <div className={styles.plugins}>
{/* TODO(lexisother): Wrap in <h3><Text /></h3> */}
<h1>Plugins</h1>
<Tip error hideSeparator> <Tip error hideSeparator>
Warning: This feature is still in development. Warning: This feature is still in development.
</Tip> </Tip>
{plugins.list().map((plugin) => { {plugins.list().map((plugin) => {
// TODO(lexisother): Stop using Checkbox, write a custom component
return ( return (
<Checkbox <Checkbox
key={plugin.id} key={plugin.id}
@ -31,6 +31,12 @@ export const PluginsPage = observer(() => {
</Checkbox> </Checkbox>
); );
})} })}
{plugins.list().length === 0 && (
<div className={styles.empty}>
<Text id="app.settings.pages.plugins.no_plugins" />
</div>
)}
</div> </div>
); );
}); });