Remove unused imports, packages and add lang

This commit is contained in:
Daniel Kluge 2022-10-03 01:35:03 +02:00
parent c8d0d1e959
commit 85acc1bdac
8 changed files with 16 additions and 36 deletions

View File

@ -3,7 +3,7 @@ import { MutableRefObject, useState, createRef, useEffect } from "react";
import { CommandInterface } from "../../../lib/commands"; import { CommandInterface } from "../../../lib/commands";
import styles from "../../../styles/Terminal/REPL/REPLInput.module.css"; import styles from "../../../styles/Terminal/REPL/REPLInput.module.css";
import { useCommands } from "../../../lib/commands/ContextProvider"; import { useCommands } from "../../../lib/commands/ContextProvider";
import { useModalFunctions } from "../contexts/ModalFunctions"; //import { useModalFunctions } from "../contexts/ModalFunctions";
interface REPLInputParams { interface REPLInputParams {
historyCallback: CallableFunction; historyCallback: CallableFunction;
@ -20,7 +20,7 @@ const REPLInput: NextPage<REPLInputParams> = ({historyCallback, historyClear, in
const [cmdHistory, setCmdHistory] = useState<string[]>([]); const [cmdHistory, setCmdHistory] = useState<string[]>([]);
const [usrInputTmp, setUsrInputTmp] = useState<string>(""); const [usrInputTmp, setUsrInputTmp] = useState<string>("");
const {cmdContext: cmdIf, updateCallbacks} = useCommands(); const {cmdContext: cmdIf, updateCallbacks} = useCommands();
const { modalFunctions } = useModalFunctions(); //const { modalFunctions } = useModalFunctions();
updateCallbacks({ getCmdHistory: () => cmdHistory }); updateCallbacks({ getCmdHistory: () => cmdHistory });

View File

@ -3,7 +3,6 @@ import REPLInput from "./REPLInput";
import REPLHistory from "./REPLHistory"; import REPLHistory from "./REPLHistory";
import styles from "../../../styles/Terminal/REPL/REPLComplete.module.css"; import styles from "../../../styles/Terminal/REPL/REPLComplete.module.css";
import type { NextPage } from "next"; import type { NextPage } from "next";
// import { useCommands } from "../../../lib/commands/ContextProvider";
interface IREPLProps { interface IREPLProps {
inputRef: MutableRefObject<HTMLInputElement|null>; inputRef: MutableRefObject<HTMLInputElement|null>;

View File

@ -9,15 +9,15 @@ function getCommandByName(name: string): Command | undefined {
return commandList.find(cmd => cmd.name === name); return commandList.find(cmd => cmd.name === name);
} }
function illegalUse(raw: string, cmd: Command): string[] { /*function illegalUse(raw: string, cmd: Command): string[] {
return [ return [
"Syntax error!", "Syntax error!",
`Cannot parse "${raw}"`, `Cannot parse "${raw}"`,
"" ""
].concat(printSyntax(cmd)); ].concat(printSyntax(cmd));
} }*/
function checkFlags(flags: string[], cmd: Command): boolean { /*function checkFlags(flags: string[], cmd: Command): boolean {
if (!flags || flags.length === 0) return true; if (!flags || flags.length === 0) return true;
if (!cmd.flags) return false; if (!cmd.flags) return false;
@ -27,9 +27,9 @@ function checkFlags(flags: string[], cmd: Command): boolean {
if (!flagObj) return false; if (!flagObj) return false;
} }
return true; return true;
} }*/
function checkSubcmd(subcmds: string[], cmd: Command): boolean { /*function checkSubcmd(subcmds: string[], cmd: Command): boolean {
if (!subcmds || subcmds.length === 0) return true; if (!subcmds || subcmds.length === 0) return true;
if (!cmd.subcommands) return false; if (!cmd.subcommands) return false;
@ -38,7 +38,7 @@ function checkSubcmd(subcmds: string[], cmd: Command): boolean {
if (!flagObj) return false; if (!flagObj) return false;
} }
return true; return true;
} }*/
function checkFlagInclude(flagsProvided: string[], flag: Flag): boolean { function checkFlagInclude(flagsProvided: string[], flag: Flag): boolean {
if (!flag) return false; if (!flag) return false;

View File

@ -3,5 +3,9 @@ module.exports = {
reactStrictMode: true, reactStrictMode: true,
images: { images: {
domains: ["openai-labs-public-images-prod.azureedge.net"] domains: ["openai-labs-public-images-prod.azureedge.net"]
},
i18n: {
locales: ["en"],
defaultLocale: "en",
} }
}; };

17
package-lock.json generated
View File

@ -13,8 +13,7 @@
"node-fetch": "^3.2.0", "node-fetch": "^3.2.0",
"phosphor-react": "^1.3.1", "phosphor-react": "^1.3.1",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2", "react-dom": "17.0.2"
"swr": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@types/color": "^3.0.3", "@types/color": "^3.0.3",
@ -3351,14 +3350,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/swr": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/swr/-/swr-1.2.2.tgz",
"integrity": "sha512-ky0BskS/V47GpW8d6RU7CPsr6J8cr7mQD6+do5eky3bM0IyJaoi3vO8UhvrzJaObuTlGhPl2szodeB2dUd76Xw==",
"peerDependencies": {
"react": "^16.11.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/table": { "node_modules/table": {
"version": "6.8.0", "version": "6.8.0",
"resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz",
@ -5973,12 +5964,6 @@
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true "dev": true
}, },
"swr": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/swr/-/swr-1.2.2.tgz",
"integrity": "sha512-ky0BskS/V47GpW8d6RU7CPsr6J8cr7mQD6+do5eky3bM0IyJaoi3vO8UhvrzJaObuTlGhPl2szodeB2dUd76Xw==",
"requires": {}
},
"table": { "table": {
"version": "6.8.0", "version": "6.8.0",
"resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz",

View File

@ -15,8 +15,7 @@
"node-fetch": "^3.2.0", "node-fetch": "^3.2.0",
"phosphor-react": "^1.3.1", "phosphor-react": "^1.3.1",
"react": "17.0.2", "react": "17.0.2",
"react-dom": "17.0.2", "react-dom": "17.0.2"
"swr": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@types/color": "^3.0.3", "@types/color": "^3.0.3",

View File

@ -1,7 +1,6 @@
import type { AppProps } from "next/app"; import type { AppProps } from "next/app";
import Head from "next/head"; import Head from "next/head";
import "../styles/globals.css"; import "../styles/globals.css";
//import "../styles/customAsciidoc.scss";
import { CommandsProvider } from "../lib/commands/ContextProvider"; import { CommandsProvider } from "../lib/commands/ContextProvider";
import { ModalFunctionProvider } from "../components/Terminal/contexts/ModalFunctions"; import { ModalFunctionProvider } from "../components/Terminal/contexts/ModalFunctions";

View File

@ -1,19 +1,13 @@
import type { NextPage } from "next"; import type { NextPage } from "next";
import Head from "next/head"; import Head from "next/head";
import useSWR from "swr";
import type { ContentList } from "../lib/content/types"; import type { ContentList } from "../lib/content/types";
import Navigation from "../components/Blog/Navigation"; import Navigation from "../components/Blog/Navigation";
import ProjectCard from "../components/Blog/Card"; import ProjectCard from "../components/Blog/Card";
import Spinner from "../components/Spinner";
import styles from "../styles/Blog/Front.module.scss"; import styles from "../styles/Blog/Front.module.scss";
const Blog: NextPage<{ content: ContentList }> = ({content}) => { const Blog: NextPage<{ content: ContentList }> = ({content}) => {
//const { data: projectList, error } = useSWR("/content/list.json", (...args) => fetch(...args).then(res => res.json()));
const generateCards = (type: string) => { const generateCards = (type: string) => {
//if (error) return <div>Error on fetching projects.</div>; return <div className={styles.contentList}>{content.filter(p => p.type === type).map(p => <ProjectCard key={p.name} title={p.title} description={p.desc.join(" ")} />)}</div>;
//if (!projectList) return <Spinner size={200} color={"#ff0000"} />;
/*else*/ return <div className={styles.contentList}>{content.filter(p => p.type === type).map(p => <ProjectCard key={p.name} title={p.title} description={p.desc.join(" ")} />)}</div>;
}; };
return <> return <>