mirror of
https://github.com/hexastack/hexabot
synced 2025-01-22 18:45:57 +00:00
fix: i18n custom blocks settings
This commit is contained in:
parent
fa491584ac
commit
123f9bf1a9
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import { Prop, Schema, SchemaFactory, ModelDefinition } from '@nestjs/mongoose';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsArray, IsIn } from 'class-validator';
|
||||
|
||||
import { BaseSchema } from '@/utils/generics/base-schema';
|
||||
@ -45,6 +46,13 @@ export class Setting extends BaseSchema {
|
||||
@Prop({ type: JSON, default: {} })
|
||||
config?: Record<string, any>;
|
||||
|
||||
@Prop({
|
||||
type: String,
|
||||
default: '',
|
||||
})
|
||||
@Transform(({ obj }) => obj.help || undefined)
|
||||
help?: string;
|
||||
|
||||
@Prop({
|
||||
type: Number,
|
||||
default: 0,
|
||||
|
@ -36,9 +36,11 @@ const SettingInput: React.FC<RenderSettingInputProps> = ({
|
||||
}) => {
|
||||
const { t } = useTranslate();
|
||||
const nestedLabel = setting.label as TNestedTranslation<"label">;
|
||||
const nestedHelp = setting.label as TNestedTranslation<"help">;
|
||||
const label = t("label", nestedLabel);
|
||||
const helperText = t("help", nestedHelp);
|
||||
const nestedHelp = setting.help as TNestedTranslation<"help">;
|
||||
const label = t("label", nestedLabel, { defaultValue: nestedLabel });
|
||||
const helperText = nestedHelp
|
||||
? t("help", nestedHelp, { defaultValue: nestedHelp })
|
||||
: "";
|
||||
|
||||
switch (setting.type) {
|
||||
case "text":
|
||||
|
@ -93,6 +93,7 @@ export interface ISettingAttributes {
|
||||
config?: Record<string, any>;
|
||||
weight?: number;
|
||||
title?: string;
|
||||
help?: string;
|
||||
}
|
||||
|
||||
export interface ISettingStub extends IBaseSchema, ISettingAttributes {}
|
||||
|
Loading…
Reference in New Issue
Block a user