Sfoglia il codice sorgente

:construction: create

visuddhinanda 3 anni fa
parent
commit
54c6d7b650

+ 26 - 0
dashboard/src/components/api/Dict.ts

@@ -0,0 +1,26 @@
+export interface IApiResponseDictlData {
+	id: number;
+	word: string;
+	type: string;
+	grammar: string;
+	mean: string;
+	parent: string;
+	note: string;
+	factors: string;
+	confidence: number;
+	creator_id: number;
+	updated_at: string;
+}
+export interface IApiResponseDict {
+	ok: boolean;
+	message: string;
+	data: IApiResponseDictlData;
+}
+export interface IApiResponseDictList {
+	ok: boolean;
+	message: string;
+	data: {
+		rows: IApiResponseDictlData[];
+		count: number;
+	};
+}

+ 41 - 0
dashboard/src/components/studio/LangSelect.tsx

@@ -0,0 +1,41 @@
+import { ProFormSelect } from "@ant-design/pro-components";
+import { useIntl } from "react-intl";
+
+const Widget = () => {
+	const intl = useIntl();
+
+	const langOptions = [
+		{
+			value: "English",
+			label: "en-US",
+		},
+		{
+			value: "zh-Hans",
+			label: "简体中文 zh-Hans",
+		},
+		{
+			value: "zh-Hant",
+			label: "繁体中文 zh-Hant",
+		},
+	];
+	return (
+		<ProFormSelect
+			options={langOptions}
+			initialValue="zh-Hans"
+			width="sm"
+			name="lang"
+			allowClear={false}
+			label={intl.formatMessage({ id: "forms.fields.lang.label" })}
+			rules={[
+				{
+					required: true,
+					message: intl.formatMessage({
+						id: "forms.message.lang.required",
+					}),
+				},
+			]}
+		/>
+	);
+};
+
+export default Widget;

+ 39 - 0
dashboard/src/components/studio/PublicitySelect.tsx

@@ -0,0 +1,39 @@
+import { ProFormSelect } from "@ant-design/pro-components";
+import { useIntl } from "react-intl";
+
+const Widget = () => {
+	const intl = useIntl();
+
+	const options = [
+		{
+			value: 0,
+			label: intl.formatMessage({
+				id: "forms.fields.publicity.disable.label",
+			}),
+		},
+		{
+			value: 10,
+			label: intl.formatMessage({
+				id: "forms.fields.publicity.private.label",
+			}),
+		},
+		{
+			value: 30,
+			label: intl.formatMessage({
+				id: "forms.fields.publicity.public.label",
+			}),
+		},
+	];
+	return (
+		<ProFormSelect
+			options={options}
+			initialValue={10}
+			width="sm"
+			name="status"
+			allowClear={false}
+			label={intl.formatMessage({ id: "forms.fields.publicity.label" })}
+		/>
+	);
+};
+
+export default Widget;

+ 49 - 0
dashboard/src/components/studio/channel/ChannelTypeSelect.tsx

@@ -0,0 +1,49 @@
+import { ProFormSelect } from "@ant-design/pro-components";
+import { useIntl } from "react-intl";
+
+const Widget = () => {
+	const intl = useIntl();
+
+	const channelTypeOptions = [
+		{
+			value: "translation",
+			label: intl.formatMessage({ id: "channel.type.translation.title" }),
+		},
+		{
+			value: "nissaya",
+			label: intl.formatMessage({ id: "channel.type.nissaya.title" }),
+		},
+		{
+			value: "commentary",
+			label: intl.formatMessage({ id: "channel.type.commentary.title" }),
+		},
+		{
+			value: "original",
+			label: intl.formatMessage({ id: "channel.type.original.title" }),
+		},
+		{
+			value: "general",
+			label: intl.formatMessage({ id: "channel.type.general.title" }),
+		},
+	];
+	return (
+		<ProFormSelect
+			options={channelTypeOptions}
+			initialValue="translation"
+			width="xs"
+			name="type"
+			allowClear={false}
+			label={intl.formatMessage({ id: "channel.type" })}
+			rules={[
+				{
+					required: true,
+					message: intl.formatMessage({
+						id: "channel.type.message.required",
+					}),
+				},
+			]}
+		/>
+	);
+};
+
+export default Widget;