Selaa lähdekoodia

:art: formatting

visuddhinanda 3 vuotta sitten
vanhempi
sitoutus
abb17ecd04

+ 73 - 71
dashboard/src/components/api/Article.ts

@@ -1,103 +1,105 @@
+import { ITocPathNode } from "../corpus/TocPath";
 import type { IStudioApiResponse } from "./Auth";
 
 export interface IArticleListApiResponse {
-	article: string;
-	title: string;
-	level: string;
-	children: number;
+  article: string;
+  title: string;
+  level: string;
+  children: number;
 }
 export interface IAnthologyDataRequest {
-	title: string;
-	subtitle: string;
-	summary: string;
-	article_list: IArticleListApiResponse[];
-	lang: string;
-	status: number;
+  title: string;
+  subtitle: string;
+  summary: string;
+  article_list: IArticleListApiResponse[];
+  lang: string;
+  status: number;
 }
 export interface IAnthologyDataResponse {
-	uid: string;
-	title: string;
-	subtitle: string;
-	summary: string;
-	article_list: IArticleListApiResponse[];
-	studio: IStudioApiResponse;
-	lang: string;
-	status: number;
-	childrenNumber: number;
-	created_at: string;
-	updated_at: string;
+  uid: string;
+  title: string;
+  subtitle: string;
+  summary: string;
+  article_list: IArticleListApiResponse[];
+  studio: IStudioApiResponse;
+  lang: string;
+  status: number;
+  childrenNumber: number;
+  created_at: string;
+  updated_at: string;
 }
 export interface IAnthologyResponse {
-	ok: boolean;
-	message: string;
-	data: IAnthologyDataResponse;
+  ok: boolean;
+  message: string;
+  data: IAnthologyDataResponse;
 }
 export interface IAnthologyListResponse {
-	ok: boolean;
-	message: string;
-	data: {
-		rows: IAnthologyDataResponse[];
-		count: number;
-	};
+  ok: boolean;
+  message: string;
+  data: {
+    rows: IAnthologyDataResponse[];
+    count: number;
+  };
 }
 
 export interface IAnthologyStudioListApiResponse {
-	ok: boolean;
-	message: string;
-	data: {
-		count: number;
-		rows: IAnthologyStudioListDataApiResponse[];
-	};
+  ok: boolean;
+  message: string;
+  data: {
+    count: number;
+    rows: IAnthologyStudioListDataApiResponse[];
+  };
 }
 export interface IAnthologyStudioListDataApiResponse {
-	count: number;
-	studio: IStudioApiResponse;
+  count: number;
+  studio: IStudioApiResponse;
 }
 
 export interface IArticleDataRequest {
-	uid: string;
-	title: string;
-	subtitle: string;
-	summary: string;
-	content: string;
-	content_type: string;
-	status: number;
-	lang: string;
+  uid: string;
+  title: string;
+  subtitle: string;
+  summary: string;
+  content: string;
+  content_type: string;
+  status: number;
+  lang: string;
 }
 export interface IArticleDataResponse {
-	uid: string;
-	title: string;
-	subtitle: string;
-	summary: string;
-	content: string;
-	content_type: string;
-	status: number;
-	lang: string;
-	created_at: string;
-	updated_at: string;
+  uid: string;
+  title: string;
+  subtitle: string;
+  summary: string;
+  content: string;
+  content_type: string;
+  path?: ITocPathNode[];
+  status: number;
+  lang: string;
+  created_at: string;
+  updated_at: string;
 }
 export interface IArticleResponse {
-	ok: boolean;
-	message: string;
-	data: IArticleDataResponse;
+  ok: boolean;
+  message: string;
+  data: IArticleDataResponse;
 }
 export interface IArticleListResponse {
-	ok: boolean;
-	message: string;
-	data: {
-		rows: IArticleDataResponse[];
-		count: number;
-	};
+  ok: boolean;
+  message: string;
+  data: {
+    rows: IArticleDataResponse[];
+    count: number;
+  };
 }
 
 export interface IArticleCreateRequest {
-	title: string;
-	lang: string;
-	studio: string;
+  title: string;
+  lang: string;
+  studio: string;
 }
 
 export interface IAnthologyCreateRequest {
-	title: string;
-	lang: string;
-	studio: string;
+  title: string;
+  lang: string;
+  studio: string;
 }

+ 41 - 41
dashboard/src/components/studio/SelectLang.tsx

@@ -4,56 +4,56 @@ import { useIntl } from "react-intl";
 const { Option } = Select;
 
 const onLangChange = (value: string) => {
-	console.log(`selected ${value}`);
+  console.log(`selected ${value}`);
 };
 
 const onLangSearch = (value: string) => {
-	console.log("search:", value);
+  console.log("search:", value);
 };
 
 interface IWidgetSelectLang {
-	lang?: string;
+  lang?: string;
 }
 const Widget = (prop: IWidgetSelectLang) => {
-	const intl = useIntl();
+  const intl = useIntl();
 
-	const data = [
-		{ value: "en", lable: intl.formatMessage({ id: "languages.en-US" }) },
-		{
-			value: "zh-Hans",
-			lable: intl.formatMessage({ id: "languages.zh-Hans" }),
-		},
-		{
-			value: "zh-Hant",
-			lable: intl.formatMessage({ id: "languages.zh-Hant" }),
-		},
-		{
-			value: "zh",
-			lable: intl.formatMessage({ id: "languages.zh" }),
-		},
-	];
-	const langOptions = data.map((d, id) => (
-		<Option key={id} value={d.value}>
-			{d.lable}
-		</Option>
-	));
-	return (
-		<Select
-			showSearch
-			placeholder="Select a language"
-			optionFilterProp="children"
-			onChange={onLangChange}
-			onSearch={onLangSearch}
-			value={prop.lang ? prop.lang : ""}
-			filterOption={(input, option) =>
-				(option!.children as unknown as string)
-					.toLowerCase()
-					.includes(input.toLowerCase())
-			}
-		>
-			{langOptions}
-		</Select>
-	);
+  const data = [
+    { value: "en", label: intl.formatMessage({ id: "languages.en-US" }) },
+    {
+      value: "zh-Hans",
+      label: intl.formatMessage({ id: "languages.zh-Hans" }),
+    },
+    {
+      value: "zh-Hant",
+      label: intl.formatMessage({ id: "languages.zh-Hant" }),
+    },
+    {
+      value: "zh",
+      label: intl.formatMessage({ id: "languages.zh" }),
+    },
+  ];
+  const langOptions = data.map((d, id) => (
+    <Option key={id} value={d.value}>
+      {d.label}
+    </Option>
+  ));
+  return (
+    <Select
+      showSearch
+      placeholder="Select a language"
+      optionFilterProp="children"
+      onChange={onLangChange}
+      onSearch={onLangSearch}
+      value={prop.lang ? prop.lang : ""}
+      filterOption={(input, option) =>
+        (option!.children as unknown as string)
+          .toLowerCase()
+          .includes(input.toLowerCase())
+      }
+    >
+      {langOptions}
+    </Select>
+  );
 };
 
 export default Widget;

+ 3 - 3
dashboard/src/components/template/MdView.tsx

@@ -1,11 +1,11 @@
 import { XmlToReact } from "./utilities";
 
 interface IWidget {
-	html: string;
+  html: string;
 }
 const Widget = ({ html }: IWidget) => {
-	const jsx = XmlToReact(html);
-	return <>{jsx}</>;
+  const jsx = XmlToReact(html);
+  return <>{jsx}</>;
 };
 
 export default Widget;