()
const [abc, setAbc] = createSignal([])
- const { getSortedTopics: topicslist } = useTopicsStore({ topics: props.topics })
+ const { getSortedTopics: topicslist } = useTopicsStore({ topics: props.topics || [] })
const auth = useStore(session)
const subscribed = (s) => Boolean(auth()?.info?.topics && auth()?.info?.topics?.includes(s || ''))
const params = useStore(paramstore)
@@ -34,8 +34,6 @@ export const AllTopicsPage = (props: { topics?: Topic[] }) => {
}
}, [topicslist(), params()])
- // onMount(() => setBy(''))
-
return (
<>
diff --git a/src/components/Views/ArticlePage.tsx b/src/components/Views/ArticlePage.tsx
index 2e8ac84e..6874b3d6 100644
--- a/src/components/Views/ArticlePage.tsx
+++ b/src/components/Views/ArticlePage.tsx
@@ -5,9 +5,10 @@ import { t } from '../../utils/intl'
import type { Reaction, Shout } from '../../graphql/types.gen'
import { useCurrentArticleStore } from '../../stores/zine/currentArticle'
import { loadArticleReactions, useReactionsStore } from '../../stores/zine/reactions'
-import { slug } from '../../stores/router'
+import { slug as slugstore } from '../../stores/router'
import '../../styles/Article.scss'
+import { useStore } from '@nanostores/solid'
interface ArticlePageProps {
article: Shout
@@ -21,7 +22,7 @@ export const ArticlePage = (props: ArticlePageProps) => {
const { getCurrentArticle } = useCurrentArticleStore({ currentArticle: props.article })
const [getCommentsPage] = createSignal(1)
const [getIsCommentsLoading, setIsCommentsLoading] = createSignal(false)
-
+ const slug = useStore(slugstore)
const reactionslist = useReactionsStore(props.reactions)
createEffect(async () => {
diff --git a/src/components/Views/Home.tsx b/src/components/Views/Home.tsx
index 742163bf..500c1a32 100644
--- a/src/components/Views/Home.tsx
+++ b/src/components/Views/Home.tsx
@@ -1,4 +1,4 @@
-import { createEffect, createMemo, createSignal, onMount, Show, Suspense } from 'solid-js'
+import { createMemo, createSignal, Show, Suspense } from 'solid-js'
import Banner from '../Discours/Banner'
import NavTopics from '../Nav/Topics'
import Row5 from '../Feed/Row5'
diff --git a/src/graphql/publicGraphQLClient.ts b/src/graphql/publicGraphQLClient.ts
index 75dc9a08..8dd30a7b 100644
--- a/src/graphql/publicGraphQLClient.ts
+++ b/src/graphql/publicGraphQLClient.ts
@@ -4,8 +4,8 @@ import { devtoolsExchange } from '@urql/devtools'
// FIXME actual value
const isDev = true
-export const baseUrl = 'https://newapi.discours.io'
-// export const baseUrl = 'http://localhost:8000'
+// export const baseUrl = 'https://newapi.discours.io'
+export const baseUrl = 'http://localhost:8000'
const exchanges: Exchange[] = [dedupExchange, fetchExchange]
diff --git a/src/pages/api/package.json b/src/pages/api/package.json
new file mode 100644
index 00000000..c181c1ab
--- /dev/null
+++ b/src/pages/api/package.json
@@ -0,0 +1,6 @@
+{
+ "dependencies": {
+ "@aws-sdk/client-s3": "^3.159.0",
+ "mailgun.js": "^8.0.0"
+ }
+}
diff --git a/src/stores/router.ts b/src/stores/router.ts
index 982f1b46..2743dde3 100644
--- a/src/stores/router.ts
+++ b/src/stores/router.ts
@@ -1,6 +1,6 @@
import { createRouter, createSearchParams } from '@nanostores/router'
-import { onMount } from 'nanostores'
-import { createEffect, createMemo, createSignal } from 'solid-js'
+import { atom, onMount } from 'nanostores'
+import { createEffect } from 'solid-js'
import { isServer } from 'solid-js/web'
// Types for :params in route templates
@@ -19,6 +19,8 @@ interface Routes {
topic: 'slug'
}
+export const resource = atom('')
+export const slug = atom('')
export const params = createSearchParams()
export const router = createRouter(
{
@@ -42,21 +44,16 @@ export const router = createRouter(
}
)
-const [resource, setResource] = createSignal('')
-const slug = createMemo(() => {
- const s = resource().split('/').pop()
- return (Boolean(s) && router.routes.filter((x) => x[0] === s).length === 0 && s) || ''
-})
-
-const _route = (ev) => {
- const href: string = ev.target.href
- console.log('[router] faster link', href)
- ev.stopPropoganation()
- ev.preventDefault()
- router.open(href)
-}
-
-const route = (ev) => {
+// suppresses reload
+export const route = (ev) => {
+ // eslint-disable-next-line unicorn/consistent-function-scoping
+ const _route = (ev) => {
+ const href: string = ev.target.href
+ console.log('[router] faster link', href)
+ ev.stopPropoganation()
+ ev.preventDefault()
+ router.open(href)
+ }
if (typeof ev === 'function') {
return _route
} else if (!isServer && ev?.target && ev.target.href) {
@@ -70,7 +67,11 @@ if (!isServer) {
}
onMount(router, () => {
- router.listen((r) => setResource(r.path))
+ router.listen((r) => {
+ resource.set(r.path)
+ const last = resource.get().split('/').pop()
+ if (Boolean(last) && router.routes.filter((x) => x[0] === last).length === 0) {
+ slug.set(last || '')
+ }
+ })
})
-
-export { slug, route, resource }