diff --git a/shared/js/ui/modal/permission/ModalPermissionEditor.tsx b/shared/js/ui/modal/permission/ModalPermissionEditor.tsx index e08c5588..adf7cb14 100644 --- a/shared/js/ui/modal/permission/ModalPermissionEditor.tsx +++ b/shared/js/ui/modal/permission/ModalPermissionEditor.tsx @@ -34,6 +34,7 @@ import {InternalModal} from "tc-shared/ui/react-elements/internal-modal/Controll import {ErrorCode} from "tc-shared/connection/ErrorCode"; import {PermissionEditorTab} from "tc-shared/events/GlobalEvents"; import {LogCategory, logError, logWarn} from "tc-shared/log"; +import {useTr} from "tc-shared/ui/react-elements/Helper"; const cssStyle = require("./ModalPermissionEditor.scss"); @@ -44,12 +45,12 @@ export type PermissionEditorSubject = | "client" | "client-channel" | "none"; -export const PermissionTabName: { [T in PermissionEditorTab]: { name: string, translated: string } } = { - "groups-server": {name: "Server Groups", translated: tr("Server Groups")}, - "groups-channel": {name: "Channel Groups", translated: tr("Channel Groups")}, - "channel": {name: "Channel Permissions", translated: tr("Channel Permissions")}, - "client": {name: "Client Permissions", translated: tr("Client Permissions")}, - "client-channel": {name: "Client Channel Permissions", translated: tr("Client Channel Permissions")}, +export const PermissionTabName: { [T in PermissionEditorTab]: { name: string, useTranslate: () => string, renderTranslate: () => React.ReactNode } } = { + "groups-server": {name: "Server Groups", useTranslate: () => useTr("Server Groups"), renderTranslate: () => Server Groups}, + "groups-channel": {name: "Channel Groups", useTranslate: () => useTr("Channel Groups"), renderTranslate: () => Channel Groups}, + "channel": {name: "Channel Permissions", useTranslate: () => useTr("Channel Permissions"), renderTranslate: () => Channel Permissions}, + "client": {name: "Client Permissions", useTranslate: () => useTr("Client Permissions"), renderTranslate: () => Client Permissions}, + "client-channel": {name: "Client Channel Permissions", useTranslate: () => useTr("Client Channel Permissions"), renderTranslate: () => Client Channel Permissions}, }; export type GroupProperties = { @@ -244,13 +245,15 @@ const ActiveTabInfo = (props: { events: Registry }) => { const [activeTab, setActiveTab] = useState("groups-server"); props.events.reactUse("action_activate_tab", event => setActiveTab(event.tab)); - return
-
- - {PermissionTabName[activeTab].name} - + return ( +
+
-
+ ); }; const TabSelectorEntry = (props: { events: Registry, entry: PermissionEditorTab }) => { @@ -258,22 +261,26 @@ const TabSelectorEntry = (props: { events: Registry, entr props.events.reactUse("action_activate_tab", event => setActive(event.tab === props.entry)); - return
!active && props.events.fire("action_activate_tab", {tab: props.entry})}> - - {PermissionTabName[props.entry].translated} - -
; + return ( +
!active && props.events.fire("action_activate_tab", {tab: props.entry})}> + + {PermissionTabName[props.entry].renderTranslate()} + +
+ ); }; const TabSelector = (props: { events: Registry }) => { - return
- - - - - -
; + return ( +
+ + + + + +
+ ); }; export type DefaultTabValues = { groupId?: number, channelId?: number, clientDatabaseId?: number }; diff --git a/shared/js/ui/modal/permission/PermissionEditor.tsx b/shared/js/ui/modal/permission/PermissionEditor.tsx index c4667035..03bee227 100644 --- a/shared/js/ui/modal/permission/PermissionEditor.tsx +++ b/shared/js/ui/modal/permission/PermissionEditor.tsx @@ -1354,7 +1354,7 @@ export class PermissionEditor extends React.Component
- ] + ]; } componentDidMount(): void {