From 4615f11cfa0f02c871cd634c9168dc7b689a6b7c Mon Sep 17 00:00:00 2001 From: Emma Date: Wed, 13 Mar 2024 04:37:40 -0600 Subject: [PATCH] docker: initial container creation --- Dockerfile | 12 ++++++++++++ app/client.tsx | 14 ++++++++++++++ app/page.tsx | 11 ++++++----- hooks/types.d.ts | 7 +++++++ hooks/useObjectState.ts | 2 +- hooks/useQueryParams.ts | 10 ---------- 6 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 Dockerfile create mode 100644 app/client.tsx create mode 100644 hooks/types.d.ts delete mode 100644 hooks/useQueryParams.ts diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1f1f781 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:18.17.1-alpine + +WORKDIR /ttc + +ADD . . + +RUN npm i +RUN npm run build + +EXPOSE 3000 + +CMD [ "npm","start" ] \ No newline at end of file diff --git a/app/client.tsx b/app/client.tsx new file mode 100644 index 0000000..d25feb3 --- /dev/null +++ b/app/client.tsx @@ -0,0 +1,14 @@ +"use client"; + +import { TTCMD } from "@/components/ttcmd"; +import { FC, use } from "react"; + +export const HomeClient: FC<{ body: Promise }> = ({ body }) => { + const text = use(body); + + return ( + + ); +}; diff --git a/app/page.tsx b/app/page.tsx index 9cb8863..1a43535 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,9 +1,12 @@ +import { readMD } from "@/actions/readMD"; import { TTCMD } from "@/components/ttcmd"; import { readFile } from "fs/promises"; import { Suspense } from "react"; +import { HomeClient } from "./client"; +import { Loader } from "@/components/loader"; export default function Home() { - const body = readFile("./md/home.md", "utf-8"); + const body = readMD("./md/home.md"); return ( <>
@@ -132,10 +135,8 @@ export default function Home() {
*/ } - - + }> + ); diff --git a/hooks/types.d.ts b/hooks/types.d.ts new file mode 100644 index 0000000..010bd2c --- /dev/null +++ b/hooks/types.d.ts @@ -0,0 +1,7 @@ +export type InputBinder = { + name: string; + value: string | number; + onChange: ( + e: ChangeEvent, + ) => void; +}; diff --git a/hooks/useObjectState.ts b/hooks/useObjectState.ts index 08363cd..07ff691 100644 --- a/hooks/useObjectState.ts +++ b/hooks/useObjectState.ts @@ -1,5 +1,5 @@ import React, { ChangeEvent, useCallback, useState } from "react"; -import { InputBinder } from "../types/inputBinder"; +import { InputBinder } from "./types"; type ObjectStateHookConfig = { disallowSpaces?: boolean; diff --git a/hooks/useQueryParams.ts b/hooks/useQueryParams.ts deleted file mode 100644 index c167a48..0000000 --- a/hooks/useQueryParams.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { useEffect, useRef } from 'react' -import { QueryParams } from '../utils/queryParams' - -export const useQueryParams = (options?: {clean: boolean}) => { - const queryParams = useRef(new QueryParams(options)) - - useEffect(() => { - console.log(queryParams.current.get('test')) - }, [queryParams.current]) -} \ No newline at end of file