markdown carta, layout

This commit is contained in:
Torsten Simon 2025-04-30 11:59:27 +02:00
parent c51137b59e
commit 8b0b1f2f9c
2 changed files with 18 additions and 19 deletions

View file

@ -79,25 +79,25 @@
{#if !$questionId} {#if !$questionId}
<div class="mx-auto p-4"> <div class="mx-auto p-4">
<h1 class="mb-4 text-2xl font-bold">Join a session!</h1> <h1 class="mb-4 text-2xl font-bold">An einer Ideensammlung teilnehmen</h1>
{#if $connected} {#if $connected}
<div class="join"> <div class="join">
<input type="number" class="border p-2" placeholder="Session id" bind:value={sessionId} /> <input type="number" class="border p-2" placeholder="12345678" bind:value={sessionId} />
<button class="btn btn-primary rounded" onclick={() => joinSession()}> Join </button> <button class="btn btn-primary rounded" onclick={() => joinSession()}> Teilnehmen </button>
</div> </div>
{/if} {/if}
</div> </div>
<div class="divider" /> <div class="divider" />
{/if} {/if}
<div class="mx-auto p-4"> <div class="mx-auto p-4">
<h1 class="mb-4 text-2xl font-bold">Ask a Question</h1> <h1 class="mb-4 text-2xl font-bold">Eine Ideensammlung starten</h1>
{#if $connected} {#if $connected}
{#key $questionId} {#key $questionId}
{#if $questionId === ''} {#if $questionId === ''}
<div> <div class="flex flex-col justify-center items-center">
<MarkdownEditor bind:value={$question} {carta} /> <MarkdownEditor bind:value={$question} {carta} />
<button class="btn btn-primary rounded mt-5" onclick={postQuestion}> Post Question </button> <div><button class="btn btn-primary rounded mt-5" onclick={postQuestion}> Starten </button></div>
</div> </div>
{:else} {:else}
<div class="qr-share mt-4"> <div class="qr-share mt-4">
@ -130,16 +130,12 @@
</div> </div>
<style> <style>
/* Optional styling */
:global(.carta-font-code) {
font-family: 'Monaco', monospace;
font-size: 1.1rem;
line-height: 1.1rem;
letter-spacing: normal;
}
:global(.carta-input) { :global(.carta-input) {
height: 150px !important; height: 150px !important;
} }
:global(.carta-editor) {
width: 100% !important;
}
input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button { input[type='number']::-webkit-outer-spin-button {
-webkit-appearance: none; -webkit-appearance: none;

View file

@ -15,12 +15,16 @@
sanitizer: DOMPurify.sanitize sanitizer: DOMPurify.sanitize
}); });
function submitComment() { function submitComment() {
if(!$comment) {
return;
}
const commentEvent = new NDKEvent($ndk, { const commentEvent = new NDKEvent($ndk, {
kind: 2222, kind: 2222,
content: $comment, content: $comment,
tags: [['E', data.id]] tags: [['E', data.id]]
}); });
commentEvent.publish(); commentEvent.publish();
comment.set('');
} }
let comment = writable(''); let comment = writable('');
@ -43,15 +47,14 @@
{#await $ndk.fetchEvent(data.id) then question} {#await $ndk.fetchEvent(data.id) then question}
{#if question} {#if question}
<div class="question mb-4 w-full rounded border p-4 text-xl"> <div class="question mb-4 w-full rounded border p-4 text-xl">
<h2>Question:<br /> <h2 class="text-xl font-bold">Frage / Thema:</h2>
<Markdown {carta} value={question.content} /> <Markdown {carta} value={question.content} />
</h2>
</div> </div>
<div class="mb-2 flex w-full flex-col items-center justify-center gap-2"> <div class="mb-2 flex w-full flex-col items-center justify-center gap-2">
<h1 class="text-xl">Ideensammlung</h1> <h1 class="text-xl font-bold pt-15">Meine Idee hinzufügen</h1>
<MarkdownEditor bind:value={$comment} {carta} /> <MarkdownEditor bind:value={$comment} {carta} />
<button class="btn btn-primary mb-10" onclick={() => submitComment()}>Absenden</button> <button class="btn btn-primary mb-10 mt-5" onclick={() => submitComment()}>Hinzufügen</button>
</div> </div>
{:else} {:else}
<p>Loading...</p> <p>Loading...</p>