ソースを参照

Merge pull request #1629 from visuddhinanda/agile

改为相对链接 #1627
visuddhinanda 2 年 前
コミット
a36b1b9072

+ 0 - 1
dashboard/src/components/course/UploadTexture.tsx

@@ -56,7 +56,6 @@ const UploadTextureWidget = () => {
       listType="picture-card"
       className="avatar-uploader"
       showUploadList={false}
-      action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
       beforeUpload={beforeUpload}
       onChange={handleChange}
     >

+ 0 - 3
dashboard/src/components/general/Feedback.tsx

@@ -1,7 +1,4 @@
-import { useIntl } from "react-intl";
-
 const FeedbackWidget = () => {
-  const intl = useIntl();
   return (
     <>
       {process.env.REACT_APP_QUESTIONNAIRE_LINK ? (

+ 1 - 1
dashboard/src/components/general/Video.tsx

@@ -29,7 +29,7 @@ export const VideoWidget = ({ src, type }: IWidget) => {
         controls: true,
         responsive: true,
         fluid: true,
-        poster: "https://vjs.zencdn.net/v/oceans.png",
+        poster: "",
         sources: [
           {
             src: src ? src : "",

+ 16 - 10
dashboard/src/components/library/HeadBar.tsx

@@ -60,7 +60,7 @@ export const mainMenuItems: MenuProps["items"] = [
   {
     label: (
       <a
-        href="https://assets-hk.wikipali.org/help/zh-Hans/"
+        href={`${process.env.REACT_APP_ASSETS_SERVER}/help/zh-Hans/`}
         target="_blank"
         rel="noreferrer"
       >
@@ -73,7 +73,7 @@ export const mainMenuItems: MenuProps["items"] = [
   {
     label: (
       <a
-        href="https://assets-hk.wikipali.org/pali-handbook/zh-Hans/"
+        href={`${process.env.REACT_APP_ASSETS_SERVER}/pali-handbook/zh-Hans/`}
         target="_blank"
         rel="noreferrer"
       >
@@ -84,31 +84,37 @@ export const mainMenuItems: MenuProps["items"] = [
   },
   {
     label: (
-      <Link
-        to="https://www-hk.wikipali.org/app/calendar/index.html"
+      <a
+        href={`${window.location.origin}/app/calendar/index.html`}
         target={"_blank"}
+        rel="noreferrer"
       >
         <FormattedMessage id="columns.library.calendar.title" />
-      </Link>
+      </a>
     ),
     key: "calendar",
   },
   {
     label: (
-      <Link
-        to="https://www-hk.wikipali.org/app/tools/unicode.html"
+      <a
+        href={`${window.location.origin}/app/tools/unicode.html`}
         target={"_blank"}
+        rel="noreferrer"
       >
         <FormattedMessage id="columns.library.convertor.title" />
-      </Link>
+      </a>
     ),
     key: "convertor",
   },
   {
     label: (
-      <Link to="https://www-hk.wikipali.org/app/statistics/" target={"_blank"}>
+      <a
+        href={`${window.location.origin}/app/statistics/`}
+        target={"_blank"}
+        rel="noreferrer"
+      >
         <FormattedMessage id="columns.library.statistics.title" />
-      </Link>
+      </a>
     ),
     key: "statistics",
   },

+ 0 - 91
dashboard/src/components/studio/SelectUser.txt

@@ -1,91 +0,0 @@
-/*
-import { Select, Spin } from "antd";
-import type { SelectProps } from "antd/es/select";
-import debounce from "lodash/debounce";
-import React, { useMemo, useRef, useState } from "react";
-
-export interface DebounceSelectProps<ValueType = any>
-	extends Omit<SelectProps<ValueType | ValueType[]>, "options" | "children"> {
-	fetchOptions: (search: string) => Promise<ValueType[]>;
-	debounceTimeout?: number;
-}
-
-function DebounceSelect<ValueType extends { key?: string; label: React.ReactNode; value: string | number } = any>({
-	fetchOptions,
-	debounceTimeout = 800,
-	...props
-}: DebounceSelectProps<ValueType>) {
-	const [fetching, setFetching] = useState(false);
-	const [options, setOptions] = useState<ValueType[]>([]);
-	const fetchRef = useRef(0);
-
-	const debounceFetcher = useMemo(() => {
-		const loadOptions = (value: string) => {
-			fetchRef.current += 1;
-			const fetchId = fetchRef.current;
-			setOptions([]);
-			setFetching(true);
-
-			fetchOptions(value).then((newOptions) => {
-				if (fetchId !== fetchRef.current) {
-					// for fetch callback order
-					return;
-				}
-
-				setOptions(newOptions);
-				setFetching(false);
-			});
-		};
-
-		return debounce(loadOptions, debounceTimeout);
-	}, [fetchOptions, debounceTimeout]);
-
-	return (
-		<Select
-			labelInValue
-			filterOption={false}
-			onSearch={debounceFetcher}
-			notFoundContent={fetching ? <Spin size="small" /> : null}
-			{...props}
-			options={options}
-		/>
-	);
-}
-
-// Usage of DebounceSelect
-interface UserValue {
-	label: string;
-	value: string;
-}
-
-async function fetchUserList(username: string): Promise<UserValue[]> {
-	console.log("fetching user", username);
-
-	return fetch("https://randomuser.me/api/?results=5")
-		.then((response) => response.json())
-		.then((body) =>
-			body.results.map((user: { name: { first: string; last: string }; login: { username: string } }) => ({
-				label: `${user.name.first} ${user.name.last}`,
-				value: user.login.username,
-			}))
-		);
-}
-
-const Widget = () => {
-	const [value, setValue] = useState<UserValue[]>([]);
-
-	return (
-		<DebounceSelect
-			mode="multiple"
-			value={value}
-			placeholder="Select users"
-			fetchOptions={fetchUserList}
-			onChange={(newValue) => {
-				setValue(newValue as UserValue[]);
-			}}
-			style={{ width: "100%" }}
-		/>
-	);
-};
-
-export default Widget;

+ 0 - 9
dashboard/src/pages/library/download/Download.tsx

@@ -64,15 +64,6 @@ const ChapterNewWidget = () => {
       <Card title={"App下载"} style={{ margin: 10, borderRadius: 8 }}>
         <Paragraph>
           {"点链接打开网站下载安卓App安装包"}
-          <Button type="link" size="large" icon={<GithubOutlined />}>
-            <a
-              href="https://github.com/gohugoio/hugo/releases"
-              target="_blank"
-              rel="noreferrer"
-            >
-              Github下载
-            </a>
-          </Button>
           <Button type="link" size="large">
             <a href={giteeRelease} target="_blank" rel="noreferrer">
               Gitee下载

+ 0 - 5
dashboard/src/pages/nut/index.tsx

@@ -36,11 +36,6 @@ const Widget = () => {
   return (
     <div>
       <HeadBar />
-      <div
-        dangerouslySetInnerHTML={{
-          __html: marked.parse("- [Google](https://www.google.com)"),
-        }}
-      ></div>
       <div>Home Page</div>
 
       <InnerDrawer />

+ 6 - 1
dashboard/src/utils.ts

@@ -2,7 +2,12 @@ import { SortOrder } from "antd/lib/table/interface";
 import lodash from "lodash";
 
 export function fullUrl(url: string): string {
-  return window.location.origin + process.env.PUBLIC_URL + url;
+  if (process.env.PUBLIC_URL.includes("http")) {
+    //for CDN
+    return process.env.PUBLIC_URL + url;
+  } else {
+    return window.location.origin + process.env.PUBLIC_URL + url;
+  }
 }
 
 export function PaliToEn(pali: string): string {