|
|
@@ -1,5 +1,3 @@
|
|
|
-import { useIntl } from "react-intl";
|
|
|
-
|
|
|
import { ISettingItem } from "../../../reducers/setting";
|
|
|
|
|
|
export interface ISettingItemOption {
|
|
|
@@ -36,156 +34,115 @@ export const GetUserSetting = (
|
|
|
};
|
|
|
|
|
|
export const SettingFind = (key: string): ISetting | undefined => {
|
|
|
- return Settings().find((element) => element.key === key);
|
|
|
+ return defaultSetting.find((element) => element.key === key);
|
|
|
};
|
|
|
-export const Settings = (): ISetting[] => {
|
|
|
- const intl = useIntl();
|
|
|
-
|
|
|
- const defaultSetting: ISetting[] = [
|
|
|
- {
|
|
|
- /**
|
|
|
- * 是否显示巴利原文
|
|
|
- */
|
|
|
- key: "setting.display.original",
|
|
|
- label: intl.formatMessage({ id: "setting.display.original.label" }),
|
|
|
- description: intl.formatMessage({
|
|
|
- id: "setting.display.original.description",
|
|
|
- }),
|
|
|
- defaultValue: true,
|
|
|
- },
|
|
|
- {
|
|
|
- /**
|
|
|
- * 排版方向
|
|
|
- */
|
|
|
- key: "setting.layout.direction",
|
|
|
- label: intl.formatMessage({ id: "setting.layout.direction.label" }),
|
|
|
- description: intl.formatMessage({
|
|
|
- id: "setting.layout.direction.description",
|
|
|
- }),
|
|
|
- defaultValue: "column",
|
|
|
- options: [
|
|
|
- {
|
|
|
- value: "column",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.layout.direction.col.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- value: "row",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.layout.direction.row.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- ],
|
|
|
- widget: "radio-button",
|
|
|
- },
|
|
|
- {
|
|
|
- /**
|
|
|
- * 段落或者逐句对读
|
|
|
- */
|
|
|
- key: "setting.layout.paragraph",
|
|
|
- label: intl.formatMessage({ id: "setting.layout.paragraph.label" }),
|
|
|
- description: intl.formatMessage({
|
|
|
- id: "setting.layout.paragraph.description",
|
|
|
- }),
|
|
|
- defaultValue: "sentence",
|
|
|
- options: [
|
|
|
- {
|
|
|
- value: "sentence",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.layout.paragraph.sentence.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- value: "paragraph",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.layout.paragraph.paragraph.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- ],
|
|
|
- widget: "radio-button",
|
|
|
- },
|
|
|
- {
|
|
|
- /**
|
|
|
- * 第一巴利脚本
|
|
|
- */
|
|
|
- key: "setting.pali.script1",
|
|
|
- label: intl.formatMessage({ id: "setting.pali.script1.label" }),
|
|
|
- description: intl.formatMessage({
|
|
|
- id: "setting.pali.script1.description",
|
|
|
- }),
|
|
|
- defaultValue: "roman",
|
|
|
- options: [
|
|
|
- {
|
|
|
- value: "roman",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.pali.script.rome.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- value: "roman_to_my",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.pali.script.my.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- value: "roman_to_si",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.pali.script.si.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- value: "roman_to_thai",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.pali.script.thai.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- value: "roman_to_taitham",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.pali.script.tai.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- /**
|
|
|
- * 第二巴利脚本
|
|
|
- */
|
|
|
- key: "setting.pali.script2",
|
|
|
- label: intl.formatMessage({ id: "setting.pali.script2.label" }),
|
|
|
- description: intl.formatMessage({
|
|
|
- id: "setting.pali.script2.description",
|
|
|
- }),
|
|
|
- defaultValue: "none",
|
|
|
- options: [
|
|
|
- {
|
|
|
- value: "none",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.pali.script.none.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- value: "roman",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.pali.script.rome.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- value: "roman_to_my",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.pali.script.my.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- {
|
|
|
- value: "roman_to_si",
|
|
|
- label: intl.formatMessage({
|
|
|
- id: "setting.pali.script.si.label",
|
|
|
- }),
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ];
|
|
|
|
|
|
- return defaultSetting;
|
|
|
-};
|
|
|
+export const defaultSetting: ISetting[] = [
|
|
|
+ {
|
|
|
+ /**
|
|
|
+ * 是否显示巴利原文
|
|
|
+ */
|
|
|
+ key: "setting.display.original",
|
|
|
+ label: "setting.display.original.label",
|
|
|
+ description: "setting.display.original.description",
|
|
|
+ defaultValue: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ /**
|
|
|
+ * 排版方向
|
|
|
+ */
|
|
|
+ key: "setting.layout.direction",
|
|
|
+ label: "setting.layout.direction.label",
|
|
|
+ description: "setting.layout.direction.description",
|
|
|
+ defaultValue: "column",
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: "column",
|
|
|
+ label: "setting.layout.direction.col.label",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "row",
|
|
|
+ label: "setting.layout.direction.row.label",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ widget: "radio-button",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ /**
|
|
|
+ * 段落或者逐句对读
|
|
|
+ */
|
|
|
+ key: "setting.layout.paragraph",
|
|
|
+ label: "setting.layout.paragraph.label",
|
|
|
+ description: "setting.layout.paragraph.description",
|
|
|
+ defaultValue: "sentence",
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: "sentence",
|
|
|
+ label: "setting.layout.paragraph.sentence.label",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "paragraph",
|
|
|
+ label: "setting.layout.paragraph.paragraph.label",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ widget: "radio-button",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ /**
|
|
|
+ * 第一巴利脚本
|
|
|
+ */
|
|
|
+ key: "setting.pali.script.primary",
|
|
|
+ label: "setting.pali.script.primary.label",
|
|
|
+ description: "setting.pali.script.primary.description",
|
|
|
+ defaultValue: "roman",
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: "roman",
|
|
|
+ label: "setting.pali.script.rome.label",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "roman_to_my",
|
|
|
+ label: "setting.pali.script.my.label",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "roman_to_si",
|
|
|
+ label: "setting.pali.script.si.label",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "roman_to_thai",
|
|
|
+ label: "setting.pali.script.thai.label",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "roman_to_taitham",
|
|
|
+ label: "setting.pali.script.tai.label",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ /**
|
|
|
+ * 第二巴利脚本
|
|
|
+ */
|
|
|
+ key: "setting.pali.script.secondary",
|
|
|
+ label: "setting.pali.script.secondary.label",
|
|
|
+ description: "setting.pali.script.secondary.description",
|
|
|
+ defaultValue: "none",
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: "none",
|
|
|
+ label: "setting.pali.script.none.label",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "roman",
|
|
|
+ label: "setting.pali.script.rome.label",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "roman_to_my",
|
|
|
+ label: "setting.pali.script.my.label",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "roman_to_si",
|
|
|
+ label: "setting.pali.script.si.label",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+];
|