diff options
author | kartofen <mladenovnasko0@gmail.com> | 2022-08-29 19:01:20 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2022-08-29 19:01:20 +0300 |
commit | 8e4163e3f08e29f38fe87c59d8cfb91e0fa98063 (patch) | |
tree | 2b117f4bafa0a4d10252eef95ca868a247a081a1 /src/pages | |
parent | 9d952483f250a97cbeab4061fa1c4e68341b330f (diff) |
everything works
Diffstat (limited to 'src/pages')
-rw-r--r-- | src/pages/board/[board].astro | 22 | ||||
-rw-r--r-- | src/pages/board/[board]/[tid].astro | 28 | ||||
-rw-r--r-- | src/pages/create/[board].astro | 5 | ||||
-rw-r--r-- | src/pages/create/[board]/[tid].astro | 27 | ||||
-rw-r--r-- | src/pages/create/comment.ts | 17 | ||||
-rw-r--r-- | src/pages/create/thread.ts | 5 |
6 files changed, 81 insertions, 23 deletions
diff --git a/src/pages/board/[board].astro b/src/pages/board/[board].astro index a529d3c..eaea03e 100644 --- a/src/pages/board/[board].astro +++ b/src/pages/board/[board].astro @@ -1,8 +1,9 @@ --- -import Default from '../../layouts/Default.astro'; -import Thread from '../../components/Thread.svelte' import '../../styles/thread.css' -import '../../styles/blackbox.css?' +import '../../styles/blackbox.css' + +import ThreadLayout from '../../layouts/ThreadLayout.astro'; +import Thread from '../../components/Thread.astro' import type Thread from '../../models/Thread'; import { api } from '../../lib/api.ts'; @@ -18,8 +19,11 @@ for(let thread of threads) await processThreadIn(board, thread); --- -<Default> - <h1><a href="/boards"> {board} </a></h1> +<ThreadLayout> + <h1 style="text-align:center"> + <a href=`/boards`>{board}</a> + </h1> + <div class="blackbox"> <button style="left: 50%; position: relative; transform: translate(-50%, 0);" onclick=`window.location='/create/${board}'`>Create Thread</button> </div> @@ -27,10 +31,4 @@ for(let thread of threads) {threads.map((thread) => ( <Thread thread={thread} board={board} /> ))} -</Default> - -<style is:inline> - :root { - --wdt: 600px; - } -</style> +</ThreadLayout> diff --git a/src/pages/board/[board]/[tid].astro b/src/pages/board/[board]/[tid].astro index 4aa34ef..e9b345a 100644 --- a/src/pages/board/[board]/[tid].astro +++ b/src/pages/board/[board]/[tid].astro @@ -1,14 +1,16 @@ --- -import Default from '../../../layouts/Default.astro'; -import Thread from '../../../components/Thread.svelte' -import '../../../styles/thread.css' -import type Thread from '../../../models/Thread'; +import '../../../styles/thread.css'; +import '../../../styles/blackbox.css'; + +import ThreadLayout from '../../../layouts/ThreadLayout.astro'; +import Thread from '../../../components/Thread.astro' +import type Thread from '../../../models/Thread';; import { api } from '../../../lib/api'; import { processThreadIn } from '../../../lib/thread'; -const { board } = Astro.params; -const data = await api('get', `thread/${board}/${Astro.params.tid}`); +const { board, tid } = Astro.params; +const data = await api('get', `thread/${board}/${tid}`); if(data.status === 404) return Astro.redirect('/404'); @@ -16,6 +18,16 @@ const thread: Thread = await data.json(); await processThreadIn(board, thread, true); --- -<Default> +<ThreadLayout> + <h1 style="text-align:center"> + <a href=`/board/${board}`>{board}</a> + </h1> + + <div class="blackbox"> + <button style="left: 50%; position: relative; transform: translate(-50%, 0);" onclick=`window.open('/create/${board}/${tid}','popUpWindow','height=500,width=600')`> + Create Comment + </button> + </div> + <Thread thread={thread} board={board} comments=true /> -</Default>
\ No newline at end of file +</ThreadLayout>
\ No newline at end of file diff --git a/src/pages/create/[board].astro b/src/pages/create/[board].astro index 9c2308f..152277c 100644 --- a/src/pages/create/[board].astro +++ b/src/pages/create/[board].astro @@ -1,4 +1,6 @@ --- +import '../../styles/blackbox.css'; + import Default from '../../layouts/Default.astro'; import Form from '../../components/Form.astro'; @@ -8,7 +10,7 @@ const { board } = Astro.params; <Default> <h1>{board}</h1> - <Form board={board} tid="niggers"> + <Form board={board} tid=""> <form id="form" method="post" action="/create/thread" onsubmit="document.getElementById('submit-button').disabled = true"> <textarea name="ThreadName" placeholder="Thread Name" style="height: 1.5rem; width: 350px;"></textarea> <br> <textarea name="ThreadText" placeholder="Thread Contents" style="height: 150px; width: 350px;"></textarea> @@ -21,5 +23,6 @@ const { board } = Astro.params; <style> :root { --wdt: 360px; + --ml: 0px; } </style> diff --git a/src/pages/create/[board]/[tid].astro b/src/pages/create/[board]/[tid].astro new file mode 100644 index 0000000..ccc95ca --- /dev/null +++ b/src/pages/create/[board]/[tid].astro @@ -0,0 +1,27 @@ +--- +import '../../../styles/blackbox.css'; + +import Default from '../../../layouts/Default.astro'; +import Form from '../../../components/Form.astro'; + +const { board, tid } = Astro.params; +--- + +<Default> + <h1>Comment</h1> + + <Form board={board} tid={tid}> + <form id="form" method="post" action="/create/comment" onsubmit="document.getElementById('submit-button').disabled = true"> + <textarea name="CommentText" placeholder="Comment Contents" style="height: 150px; width: 350px;"></textarea> + <br> <input id="submit-button" type="submit" value="Create Thread" /> + <input id="image" type="file" accept=".png,.jpg,.gif,.bmp,.mp4" /> + </form> + </Form> +</Default> + +<style> + :root { + --wdt: 360px; + --ml: 0px; + } +</style> diff --git a/src/pages/create/comment.ts b/src/pages/create/comment.ts new file mode 100644 index 0000000..f8d4c82 --- /dev/null +++ b/src/pages/create/comment.ts @@ -0,0 +1,17 @@ +import { api } from '../../lib/api'; +import { processCommentOut } from '../../lib/thread'; +import Comment from '../../models/Thread'; + +export async function post({ request }) { + const form = await request.formData(); + + let c: Comment = await processCommentOut(form); + + console.log(c); + + await api('post', `comment/${form.get('board')}/${form.get('tid')}`, JSON.stringify(c)); + + return new Response('close', { + status: 200 + }); +} diff --git a/src/pages/create/thread.ts b/src/pages/create/thread.ts index 0a0b7d1..b3a02be 100644 --- a/src/pages/create/thread.ts +++ b/src/pages/create/thread.ts @@ -1,13 +1,14 @@ import { api } from '../../lib/api'; import { processThreadOut } from '../../lib/thread'; +import Thread from '../../models/Thread'; export async function post({ request }) { const form = await request.formData(); - console.log(form); - let t: Thread = await processThreadOut(form); + console.log(t); + await api('post', `thread/${form.get('board')}`, JSON.stringify(t)); return new Response(t.id, { |