Browse Source

Create article editor route

master
buttercat1791 2 years ago
parent
commit
f66f072660
  1. 5271
      package-lock.json
  2. 2
      package.json
  3. 2035
      pnpm-lock.yaml
  4. 24
      src/lib/Toc.svelte
  5. 2
      src/lib/components/Article.svelte
  6. 4
      src/lib/components/ArticleHeader.svelte
  7. 5
      src/lib/components/EditorArticle.svelte
  8. 5
      src/lib/components/Toc.svelte
  9. 2
      src/routes/+page.svelte
  10. 2
      src/routes/[id]/+page.svelte
  11. 2
      src/routes/d/[tag]/+page.svelte
  12. 6
      src/routes/new/edit/+page.svelte
  13. 2774
      yarn.lock

5271
package-lock.json generated

File diff suppressed because it is too large Load Diff

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "alexandria",
"version": "0.0.4",
"version": "0.0.5",
"private": true,
"type": "module",
"scripts": {

2035
pnpm-lock.yaml

File diff suppressed because it is too large Load Diff

24
src/lib/Toc.svelte

@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
<script lang="ts">
import type { NDKEvent } from '@nostr-dev-kit/ndk';
import {nip19} from 'nostr-tools';
export let notes: NDKEvent[] = [];
// check if notes is empty
if (notes.length === 0) {
console.debug('notes is empty');
}
</script>
<div class="toc">
<h2>Table of contents</h2>
<ul>
{#each notes as note}
<li><a href="#{nip19.noteEncode(note.id)}">{note.getMatchingTags('title')[0][1]}</a></li>
{/each}
</ul>
</div>
<style>
.toc h2 {
text-align: center;
}
</style>

2
src/lib/Article.svelte → src/lib/components/Article.svelte

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
import showdown from 'showdown';
import { onMount } from 'svelte';
import { BookOutline } from 'flowbite-svelte-icons';
import { zettelKinds } from './consts';
import { zettelKinds } from '../consts';
export let index: NDKEvent | null | undefined;

4
src/lib/ArticleHeader.svelte → src/lib/components/ArticleHeader.svelte

@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
import { page } from "$app/stores";
import { neventEncode } from "$lib/utils";
import type { NDKEvent } from "@nostr-dev-kit/ndk";
import { standardRelays } from "./consts";
import { standardRelays } from "../consts";
import { Card, Button, Modal, Tooltip } from "flowbite-svelte";
import { ClipboardCheckOutline, ClipboardCleanOutline, CodeOutline, ShareNodesOutline } from "flowbite-svelte-icons";
import { ndk } from "./ndk";
import { ndk } from "../ndk";
export let event: NDKEvent;

5
src/lib/components/EditorArticle.svelte

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
<script lang='ts'>
export let html: string;
</script>

5
src/lib/components/Toc.svelte

@ -2,7 +2,10 @@ @@ -2,7 +2,10 @@
import type { NDKEvent } from '@nostr-dev-kit/ndk';
import {nip19} from 'nostr-tools';
export let notes: NDKEvent[] = [];
console.debug(notes);
// check if notes is empty
if (notes.length === 0) {
console.debug('notes is empty');
}
</script>
<div class="toc">

2
src/routes/+page.svelte

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<script lang="ts">
import ArticleHeader from "$lib/ArticleHeader.svelte";
import ArticleHeader from "$lib/components/ArticleHeader.svelte";
import { FeedType, indexKind, standardRelays } from "$lib/consts";
import { ndk } from "$lib/ndk";
import { filterValidIndexEvents } from "$lib/utils";

2
src/routes/[id]/+page.svelte

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<script lang="ts">
import Article from '$lib/Article.svelte';
import Article from '$lib/components/Article.svelte';
import type { PageData } from './$types';
export let data: PageData;

2
src/routes/d/[tag]/+page.svelte

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<script lang="ts">
import Article from '$lib/Article.svelte';
import Article from '$lib/components/Article.svelte';
import { ndk } from '$lib/ndk';
import { TextPlaceholder } from 'flowbite-svelte';
import type { PageData } from './$types';

6
src/routes/new/edit/+page.svelte

@ -15,12 +15,12 @@ @@ -15,12 +15,12 @@
};
const hidePreview = () => {
isEditing = false;
isEditing = true;
};
</script>
<main>
<form>
<main class='w-full flex justify-center'>
<form class='max-w-2xl w-full'>
<div class='flex flex-col space-y-4'>
<div>
<Label for='article-title' class='mb-2'>Article Title</Label>

2774
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save