From a23d476da47dcba0b29c5cc109fdec11d78aa620 Mon Sep 17 00:00:00 2001 From: bniwredyc Date: Fri, 21 Apr 2023 17:10:23 +0200 Subject: [PATCH] WIP --- src/components/Article/FullArticle.tsx | 2 +- src/pages/drafts.page.route.ts | 4 +++ src/pages/drafts.page.tsx | 35 ++++++++++++++++++++++++++ src/stores/router.ts | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/pages/drafts.page.route.ts create mode 100644 src/pages/drafts.page.tsx diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx index 0b258005..1dc9ec90 100644 --- a/src/components/Article/FullArticle.tsx +++ b/src/components/Article/FullArticle.tsx @@ -1,7 +1,7 @@ import { capitalize, formatDate } from '../../utils' import { Icon } from '../_shared/Icon' import { AuthorCard } from '../Author/Card' -import { createMemo, createSignal, For, Match, onMount, Show, Switch } from 'solid-js' +import { createEffect, createMemo, createSignal, For, Match, onMount, Show, Switch } from 'solid-js' import type { Author, Shout } from '../../graphql/types.gen' import MD from './MD' import { SharePopup } from './SharePopup' diff --git a/src/pages/drafts.page.route.ts b/src/pages/drafts.page.route.ts new file mode 100644 index 00000000..bb4d2892 --- /dev/null +++ b/src/pages/drafts.page.route.ts @@ -0,0 +1,4 @@ +import { ROUTES } from '../stores/router' +import { getServerRoute } from '../utils/getServerRoute' + +export default getServerRoute(ROUTES.drafts) diff --git a/src/pages/drafts.page.tsx b/src/pages/drafts.page.tsx new file mode 100644 index 00000000..9a48f80a --- /dev/null +++ b/src/pages/drafts.page.tsx @@ -0,0 +1,35 @@ +import { createMemo, createSignal, For, lazy, onMount, Show, Suspense } from 'solid-js' +import { PageLayout } from '../components/_shared/PageLayout' +import { useSession } from '../context/session' +import { Shout } from '../graphql/types.gen' +import { useRouter } from '../stores/router' +import { apiClient } from '../utils/apiClient' + +export const DraftsPage = () => { + const { isAuthenticated, isSessionLoaded, user } = useSession() + + const [drafts, setDrafts] = createSignal([]) + + onMount(async () => { + const loadedDrafts = await apiClient.getShouts({ + filters: { + author: user().slug, + visibility: 'owner' + }, + limit: 9999 + }) + setDrafts(loadedDrafts) + }) + + return ( + + + + {(draft) =>
{draft.title}
}
+
+
+
+ ) +} + +export const Page = DraftsPage diff --git a/src/stores/router.ts b/src/stores/router.ts index 9d6494db..ac965090 100644 --- a/src/stores/router.ts +++ b/src/stores/router.ts @@ -11,6 +11,7 @@ export const ROUTES = { create: '/create', edit: '/edit/:shoutSlug', editSettings: '/edit/:shoutSlug/settings', + drafts: '/drafts', topics: '/topics', topic: '/topic/:slug', authors: '/authors',