Skip to content

Commit

Permalink
add xterm
Browse files Browse the repository at this point in the history
  • Loading branch information
mio-19 committed Sep 19, 2024
1 parent 4b2cd98 commit 4bd27b2
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Replace basePath in Next.js config
run: |
sed -i 's|basePath: "/",|basePath: "/chester",|' next.config.mjs
sed -i 's|basePath: "",|basePath: "/chester",|' next.config.mjs
working-directory: ./site

- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ lazy val site = crossProject(JSPlatform).withoutSuffixFor(JSPlatform)
)
.jsSettings(
libraryDependencies += "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1",
libraryDependencies += "me.shadaj" %%% "slinky-core" % "0.7.4",
)

lazy val lsp = crossProject(JVMPlatform).withoutSuffixFor(JVMPlatform)
Expand Down
55 changes: 18 additions & 37 deletions site/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,33 @@
'use client';

import { useEffect, useRef } from "react";
import Image from "next/image";
import { XTerm } from "@pablo-lion/xterm-react";

export default function Home() {
const xtermRef = useRef(null);

useEffect(() => {
if (xtermRef.current) {
xtermRef.current.terminal.writeln("Welcome to Chester REPL");
xtermRef.current.terminal.writeln("Type your Chester code below:");
}
}, []);

return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<main className="flex flex-col gap-8 row-start-2 items-center sm:items-start">
<Image
className="dark:invert"
src="https://nextjs.org/icons/next.svg"
alt="Next.js logo"
src="/chester-logo.svg"
alt="Chester logo"
width={180}
height={38}
priority
/>
<ol className="list-inside list-decimal text-sm text-center sm:text-left font-[family-name:var(--font-geist-mono)]">
<li className="mb-2">
Get started by editing{" "}
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
app/page.tsx
</code>
.
</li>
<li>Save and see your changes instantly.</li>
</ol>

<div className="flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="https://nextjs.org/icons/vercel.svg"
alt="Vercel logomark"
width={20}
height={20}
/>
Deploy now
</a>
<a
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Read our docs
</a>
<h1 className="text-2xl font-bold">Chester: A Programming Language</h1>
<div className="w-full h-96 bg-black rounded">
<XTerm ref={xtermRef} />
</div>
</main>
<footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center">
Expand Down
2 changes: 1 addition & 1 deletion site/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const nextConfig = {
*
* @see https://nextjs.org/docs/app/api-reference/next-config-js/basePath
*/
basePath: "/",
basePath: "",

/**
* Disable server-based image optimization. Next.js does not support
Expand Down
21 changes: 21 additions & 0 deletions site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
"lint": "next lint"
},
"dependencies": {
"@pablo-lion/xterm-react": "^1.1.2",
"@xterm/xterm": "^5.5.0",
"next": "14.2.12",
"react": "^18",
"react-dom": "^18",
"next": "14.2.12"
"react-dom": "^18"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.12",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"eslint": "^8",
"eslint-config-next": "14.2.12"
"typescript": "^5"
}
}
1 change: 1 addition & 0 deletions site/src/main/scala/chester/site/App.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package chester.site

0 comments on commit 4bd27b2

Please sign in to comment.