From a7cc473f530dc99fae9e6a61f74638efc17ec766 Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Fri, 30 Sep 2022 19:38:25 +0200 Subject: [PATCH] Finish move from index to terminal --- components/Terminal/ProjectModal.tsx | 5 +++-- components/Terminal/REPL/REPLHistory.tsx | 2 +- components/Terminal/REPL/REPLInput.tsx | 2 +- components/Terminal/REPL/index.tsx | 4 ++-- components/Terminal/contexts/ModalFunctions.tsx | 2 +- lib/commands/definitions.ts | 2 +- pages/_app.tsx | 2 +- pages/index.tsx | 10 ++++++++-- pages/terminal.tsx | 2 +- styles/{ => Terminal}/ProjectModal.module.css | 0 styles/{ => Terminal}/REPL/REPLComplete.module.css | 0 styles/{ => Terminal}/REPL/REPLHistory.module.css | 0 styles/{ => Terminal}/REPL/REPLInput.module.css | 0 styles/{ => Terminal}/Random.module.scss | 0 .../{Home.module.css => Terminal/Terminal.module.css} | 2 ++ styles/{ => Terminal}/asciidocBootSlate.css | 0 .../customAsciidoc.module.scss} | 0 styles/globals.css | 2 -- 18 files changed, 21 insertions(+), 14 deletions(-) rename styles/{ => Terminal}/ProjectModal.module.css (100%) rename styles/{ => Terminal}/REPL/REPLComplete.module.css (100%) rename styles/{ => Terminal}/REPL/REPLHistory.module.css (100%) rename styles/{ => Terminal}/REPL/REPLInput.module.css (100%) rename styles/{ => Terminal}/Random.module.scss (100%) rename styles/{Home.module.css => Terminal/Terminal.module.css} (96%) rename styles/{ => Terminal}/asciidocBootSlate.css (100%) rename styles/{customAsciidoc.scss => Terminal/customAsciidoc.module.scss} (100%) diff --git a/components/Terminal/ProjectModal.tsx b/components/Terminal/ProjectModal.tsx index d6e3c51..42a1ba6 100644 --- a/components/Terminal/ProjectModal.tsx +++ b/components/Terminal/ProjectModal.tsx @@ -1,7 +1,8 @@ import type { NextPage } from "next"; import { useEffect, useRef, useState, isValidElement, useCallback } from "react"; import { useRouter } from "next/router"; -import styles from "../../styles/ProjectModal.module.css"; +import styles from "../../styles/Terminal/ProjectModal.module.css"; +import asciidocStyles from "../../styles/Terminal/customAsciidoc.module.scss"; import type { Project, Diary } from "../../lib/content/types"; import { useCommands } from "../../lib/commands/ContextProvider"; import { generateContent, projectEmpty } from "../../lib/content/generate"; @@ -108,7 +109,7 @@ const ProjectModal: NextPage = () => {
event.stopPropagation()}> {nextPageSelector} -
+
{nextPageSelector} diff --git a/components/Terminal/REPL/REPLHistory.tsx b/components/Terminal/REPL/REPLHistory.tsx index a559d61..a599197 100644 --- a/components/Terminal/REPL/REPLHistory.tsx +++ b/components/Terminal/REPL/REPLHistory.tsx @@ -1,7 +1,7 @@ import { NextPage } from "next"; import Link from "next/link"; import type { BaseSyntheticEvent, MutableRefObject } from "react"; -import styles from "../../../styles/REPL/REPLHistory.module.css"; +import styles from "../../../styles/Terminal/REPL/REPLHistory.module.css"; interface REPLHistoryParams { history: string[]; diff --git a/components/Terminal/REPL/REPLInput.tsx b/components/Terminal/REPL/REPLInput.tsx index e0865a0..8667830 100644 --- a/components/Terminal/REPL/REPLInput.tsx +++ b/components/Terminal/REPL/REPLInput.tsx @@ -1,7 +1,7 @@ import type { NextPage } from "next"; import { MutableRefObject, useState, createRef, useEffect } from "react"; import { CommandInterface } from "../../../lib/commands"; -import styles from "../../../styles/REPL/REPLInput.module.css"; +import styles from "../../../styles/Terminal/REPL/REPLInput.module.css"; import { useCommands } from "../../../lib/commands/ContextProvider"; import { useModalFunctions } from "../contexts/ModalFunctions"; diff --git a/components/Terminal/REPL/index.tsx b/components/Terminal/REPL/index.tsx index 0516c22..cb62ebd 100644 --- a/components/Terminal/REPL/index.tsx +++ b/components/Terminal/REPL/index.tsx @@ -1,9 +1,9 @@ import { MutableRefObject, useEffect, useRef, useState } from "react"; import REPLInput from "./REPLInput"; import REPLHistory from "./REPLHistory"; -import styles from "../../../styles/REPL/REPLComplete.module.css"; +import styles from "../../../styles/Terminal/REPL/REPLComplete.module.css"; import type { NextPage } from "next"; -import { useCommands } from "../../../lib/commands/ContextProvider"; +// import { useCommands } from "../../../lib/commands/ContextProvider"; interface IREPLProps { inputRef: MutableRefObject; diff --git a/components/Terminal/contexts/ModalFunctions.tsx b/components/Terminal/contexts/ModalFunctions.tsx index bddcbb0..54cdbdd 100644 --- a/components/Terminal/contexts/ModalFunctions.tsx +++ b/components/Terminal/contexts/ModalFunctions.tsx @@ -1,6 +1,6 @@ import { createContext, useContext } from "react"; import type { PropsWithChildren } from "react"; -import type { Project, Diary } from "../../lib/content/types"; +import type { Project, Diary } from "../../../lib/content/types"; interface ModalFunctions { setVisible?: CallableFunction; diff --git a/lib/commands/definitions.ts b/lib/commands/definitions.ts index 3c32698..10eb1d7 100644 --- a/lib/commands/definitions.ts +++ b/lib/commands/definitions.ts @@ -3,7 +3,7 @@ import type { Command, Flag } from "./types"; import Color from "color"; import { getColors, setColors } from "../colors"; import Rainbow from "../colors"; -import styles from "../../styles/Random.module.scss"; +import styles from "../../styles/Terminal/Random.module.scss"; function getCommandByName(name: string): Command | undefined { return commandList.find(cmd => cmd.name === name); diff --git a/pages/_app.tsx b/pages/_app.tsx index 5788baf..cf09ab4 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,7 +1,7 @@ import type { AppProps } from "next/app"; import Head from "next/head"; import "../styles/globals.css"; -import "../styles/customAsciidoc.scss"; +//import "../styles/customAsciidoc.scss"; import { CommandsProvider } from "../lib/commands/ContextProvider"; import { ModalFunctionProvider } from "../components/Terminal/contexts/ModalFunctions"; diff --git a/pages/index.tsx b/pages/index.tsx index ecb969b..8beb67c 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -9,6 +9,12 @@ import Spinner from "../components/Spinner"; const Blog: NextPage<{}> = () => { const { data: projectList, error } = useSWR("/content/list.json", (...args) => fetch(...args).then(res => res.json())); + const generateCards = (type: string) => { + if (error) return
Error on fetching projects.
; + if (!projectList) return ; + else return
{(projectList as ContentList).filter(p => p.type === type).map(p => )}
; + }; + return <> c0ntroller.de @@ -18,11 +24,11 @@ const Blog: NextPage<{}> = () => {

Miaumiau Lorem ipsum

Projects

{ - projectList ? (projectList as ContentList).filter(p => p.type === "project").map(p => ) : + generateCards("project") }

Diaries

{ - projectList ? (projectList as ContentList).filter(p => p.type === "diary").map(p => ) : + generateCards("diary") } ; diff --git a/pages/terminal.tsx b/pages/terminal.tsx index dd62295..d6f10b9 100644 --- a/pages/terminal.tsx +++ b/pages/terminal.tsx @@ -6,7 +6,7 @@ import { useCommands } from "../lib/commands/ContextProvider"; import { useModalFunctions } from "../components/Terminal/contexts/ModalFunctions"; import ProjectModal from "../components/Terminal/ProjectModal"; import REPL from "../components/Terminal/REPL"; -import styles from "../styles/Home.module.css"; +import styles from "../styles/Terminal/Terminal.module.css"; import type { ContentList } from "../lib/content/types"; import { useRouter } from "next/router"; import Rainbow from "../lib/colors"; diff --git a/styles/ProjectModal.module.css b/styles/Terminal/ProjectModal.module.css similarity index 100% rename from styles/ProjectModal.module.css rename to styles/Terminal/ProjectModal.module.css diff --git a/styles/REPL/REPLComplete.module.css b/styles/Terminal/REPL/REPLComplete.module.css similarity index 100% rename from styles/REPL/REPLComplete.module.css rename to styles/Terminal/REPL/REPLComplete.module.css diff --git a/styles/REPL/REPLHistory.module.css b/styles/Terminal/REPL/REPLHistory.module.css similarity index 100% rename from styles/REPL/REPLHistory.module.css rename to styles/Terminal/REPL/REPLHistory.module.css diff --git a/styles/REPL/REPLInput.module.css b/styles/Terminal/REPL/REPLInput.module.css similarity index 100% rename from styles/REPL/REPLInput.module.css rename to styles/Terminal/REPL/REPLInput.module.css diff --git a/styles/Random.module.scss b/styles/Terminal/Random.module.scss similarity index 100% rename from styles/Random.module.scss rename to styles/Terminal/Random.module.scss diff --git a/styles/Home.module.css b/styles/Terminal/Terminal.module.css similarity index 96% rename from styles/Home.module.css rename to styles/Terminal/Terminal.module.css index e83e428..1bbb40c 100644 --- a/styles/Home.module.css +++ b/styles/Terminal/Terminal.module.css @@ -4,6 +4,8 @@ height: 100vh; margin: 0; padding: 2px 10px 10px 10px; + color: var(--repl-color); + background: #000; } .header { diff --git a/styles/asciidocBootSlate.css b/styles/Terminal/asciidocBootSlate.css similarity index 100% rename from styles/asciidocBootSlate.css rename to styles/Terminal/asciidocBootSlate.css diff --git a/styles/customAsciidoc.scss b/styles/Terminal/customAsciidoc.module.scss similarity index 100% rename from styles/customAsciidoc.scss rename to styles/Terminal/customAsciidoc.module.scss diff --git a/styles/globals.css b/styles/globals.css index 09e9bc6..431bc96 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -16,6 +16,4 @@ body { margin: 0; padding: 0; - color: var(--repl-color); - background: #000; }