diff --git a/src/pages/about/manifest.page.tsx b/src/pages/about/manifest.page.tsx
index 7599bdce..0c205e64 100644
--- a/src/pages/about/manifest.page.tsx
+++ b/src/pages/about/manifest.page.tsx
@@ -4,7 +4,7 @@ import { Feedback } from '../../components/Discours/Feedback'
import { Modal } from '../../components/Nav/Modal'
import Opener from '../../components/Nav/Modal/Opener'
import { StaticPage } from '../../components/Views/StaticPage'
-import { Subscribe } from '../../components/_shared/Subscribe'
+import { Newsletter } from '../../components/_shared/Newsletter'
import { useLocalize } from '../../context/localize'
import { getImageUrl } from '../../utils/getImageUrl'
@@ -24,7 +24,7 @@ export const ManifestPage = () => {
-
+
diff --git a/src/pages/author.page.tsx b/src/pages/author.page.tsx
index e23f92d3..c2568540 100644
--- a/src/pages/author.page.tsx
+++ b/src/pages/author.page.tsx
@@ -1,6 +1,6 @@
import type { PageProps } from './types'
-import { Show, createEffect, createMemo, createSignal, on, onCleanup, onMount } from 'solid-js'
+import { Show, createEffect, createMemo, createSignal, on, onCleanup } from 'solid-js'
import { AuthorView, PRERENDERED_ARTICLES_COUNT } from '../components/Views/Author'
import { Loading } from '../components/_shared/Loading'
@@ -20,38 +20,19 @@ export const AuthorPage = (props: PageProps) => {
Boolean(props.authorShouts) && Boolean(props.author) && props.author.slug === slug(),
)
- const preload = () => {
- return Promise.all([
- loadShouts({
- filters: { author: slug(), featured: false },
- limit: PRERENDERED_ARTICLES_COUNT,
- }),
- loadAuthor({ slug: slug() }),
- ])
- }
-
- onMount(async () => {
- if (isLoaded()) {
- return
- }
-
- resetSortedArticles()
- await preload()
-
- setIsLoaded(true)
- })
-
createEffect(
- on(
- () => slug(),
- async () => {
+ on(slug, async (s) => {
+ if (s) {
setIsLoaded(false)
resetSortedArticles()
- await preload()
+ await loadShouts({
+ filters: { author: s, featured: false },
+ limit: PRERENDERED_ARTICLES_COUNT,
+ })
+ await loadAuthor({ slug: s })
setIsLoaded(true)
- },
- { defer: true },
- ),
+ }
+ }),
)
onCleanup(() => resetSortedArticles())
diff --git a/src/pages/create.page.tsx b/src/pages/create.page.tsx
index e5b7e8a1..c6acd6c0 100644
--- a/src/pages/create.page.tsx
+++ b/src/pages/create.page.tsx
@@ -17,9 +17,10 @@ import styles from '../styles/Create.module.scss'
const handleCreate = async (layout: LayoutType) => {
const shout = await apiClient.createArticle({ article: { layout: layout } })
- redirectPage(router, 'edit', {
- shoutId: shout?.id.toString(),
- })
+ shout?.id &&
+ redirectPage(router, 'edit', {
+ shoutId: shout?.id.toString(),
+ })
}
export const CreatePage = () => {
diff --git a/src/pages/edit.page.tsx b/src/pages/edit.page.tsx
index aaa08eee..3b5e4f84 100644
--- a/src/pages/edit.page.tsx
+++ b/src/pages/edit.page.tsx
@@ -7,7 +7,7 @@ import { useLocalize } from '../context/localize'
import { useSession } from '../context/session'
import { apiClient } from '../graphql/client/core'
import { Shout } from '../graphql/schema/core.gen'
-import { router, useRouter } from '../stores/router'
+import { router } from '../stores/router'
import { redirectPage } from '@nanostores/router'
import { useSnackbar } from '../context/snackbar'
@@ -33,7 +33,6 @@ const getContentTypeTitle = (layout: LayoutType) => {
export const EditPage = () => {
const { t } = useLocalize()
const { session } = useSession()
- const { page } = useRouter()
const snackbar = useSnackbar()
const fail = async (error: string) => {
@@ -48,18 +47,21 @@ export const EditPage = () => {
createEffect(
on(
- () => page(),
+ () => window?.location.pathname,
(p) => {
- if (p?.path) {
- console.debug(p?.path)
- const shoutId = p?.path.split('/').pop()
- const shoutIdFromUrl = Number.parseInt(shoutId ?? '0', 10)
- console.debug(`editing shout ${shoutIdFromUrl}`)
- if (shoutIdFromUrl) {
- setShoutId(shoutIdFromUrl)
+ if (p) {
+ console.debug(p)
+ const shoutId = p.split('/').pop()
+ if (shoutId) {
+ const shoutIdFromUrl = Number.parseInt(shoutId ?? '0', 10)
+ console.debug(`editing shout ${shoutIdFromUrl}`)
+ if (shoutIdFromUrl) {
+ setShoutId(shoutIdFromUrl)
+ }
}
}
},
+ { defer: true },
),
)
diff --git a/src/pages/expo/expo.page.tsx b/src/pages/expo/expo.page.tsx
index 1a1a2235..a3d3ff09 100644
--- a/src/pages/expo/expo.page.tsx
+++ b/src/pages/expo/expo.page.tsx
@@ -12,10 +12,9 @@ import { LayoutType } from '../types'
export const ExpoPage = (props: PageProps) => {
const { t } = useLocalize()
const { page } = useRouter()
- const getLayout = createMemo(() => page().params['layout'] as LayoutType)
-
- const getTitle = () => {
- switch (getLayout()) {
+ const layout = createMemo(() => page().params['layout'] as LayoutType)
+ const title = createMemo(() => {
+ switch (layout()) {
case 'audio': {
return t('Audio')
}
@@ -32,22 +31,14 @@ export const ExpoPage = (props: PageProps) => {
return t('Art')
}
}
- }
+ })
- createEffect(
- on(
- () => getLayout(),
- () => {
- document.title = getTitle()
- },
- { defer: true },
- ),
- )
+ createEffect(on(title, (t) => (document.title = t), { defer: true }))
return (
-
+
-
+
)
}
diff --git a/src/pages/feed.page.tsx b/src/pages/feed.page.tsx
index 869d22da..ac0e4c45 100644
--- a/src/pages/feed.page.tsx
+++ b/src/pages/feed.page.tsx
@@ -1,6 +1,5 @@
-import { Match, Switch, createEffect, on, onCleanup } from 'solid-js'
+import { createEffect, on, onCleanup } from 'solid-js'
-import { AuthGuard } from '../components/AuthGuard'
import { Feed } from '../components/Views/Feed'
import { PageLayout } from '../components/_shared/PageLayout'
import { useLocalize } from '../context/localize'
@@ -25,34 +24,14 @@ const handleMyFeedLoadShouts = (options: LoadShoutsOptions) => {
export const FeedPage = () => {
const { t } = useLocalize()
-
- onCleanup(() => resetSortedArticles())
-
const { page } = useRouter()
-
- createEffect(
- on(
- () => page().route,
- () => {
- resetSortedArticles()
- },
- { defer: true },
- ),
- )
+ createEffect(on(page, (_) => resetSortedArticles(), { defer: true }))
+ onCleanup(() => resetSortedArticles())
return (
- }>
-
-
-
-
-
-
-
-
-
+
)
diff --git a/src/pages/profile/profileSecurity.page.tsx b/src/pages/profile/profileSecurity.page.tsx
index b19f139e..6f50221b 100644
--- a/src/pages/profile/profileSecurity.page.tsx
+++ b/src/pages/profile/profileSecurity.page.tsx
@@ -44,10 +44,10 @@ export const ProfileSecurityPage = () => {
createEffect(
on(
() => session()?.user?.email,
- () => {
+ (email) => {
setFormData((prevData) => ({
...prevData,
- ['email']: session()?.user?.email,
+ email,
}))
},
),
diff --git a/src/pages/topic.page.tsx b/src/pages/topic.page.tsx
index 4fa3fb49..498b064a 100644
--- a/src/pages/topic.page.tsx
+++ b/src/pages/topic.page.tsx
@@ -37,24 +37,22 @@ export const TopicPage = (props: PageProps) => {
})
createEffect(
- on(
- () => slug(),
- async () => {
+ on(slug, async (s) => {
+ if (s) {
setIsLoaded(false)
resetSortedArticles()
await preload()
setIsLoaded(true)
- },
- { defer: true },
- ),
+ }
+ }),
)
- onCleanup(() => resetSortedArticles())
+ onCleanup(resetSortedArticles)
const usePrerenderedData = props.topic?.slug === slug()
return (
-
+
}>
=> {
const formData = new FormData()
diff --git a/tests/basic-routes.spec.ts b/tests/basic-routes.spec.ts
index 3b581ef5..b904fbef 100644
--- a/tests/basic-routes.spec.ts
+++ b/tests/basic-routes.spec.ts
@@ -1,15 +1,15 @@
import { expect, test } from '@playwright/test'
-const baseHost = process.env.BASE_URL
+const baseHost = process.env.BASE_HOST || 'https://localhost:3000'
const pagesTitles = {
'/': /Дискурс/,
- '/feed': /Дискурс/,
- '/create': /Дискурс/,
- '/about/donate': /Дискурс/,
- '/authors': /Дискурс/,
- '/topics': /Дискурс/,
- '/inbox': /Дискурс/,
+ '/feed': /Лента/,
+ '/create': /Выберите тип публикации/,
+ '/about/help': /Поддержите Дискурс/,
+ '/authors': /Авторы/,
+ '/topics': /Темы и сюжеты/,
+ '/inbox': /Входящие/,
}
Object.keys(pagesTitles).forEach((res: string) => {
diff --git a/tests/basic-routes.test.js b/tests/basic-routes.test.js
index 589b5ae0..a3ffcf78 100644
--- a/tests/basic-routes.test.js
+++ b/tests/basic-routes.test.js
@@ -5,13 +5,13 @@ import { chromium } from 'playwright'
// Define the URLs to visit
const pagesToVisit = [
- 'http://localhost:3000/',
- 'http://localhost:3000/feed',
- 'http://localhost:3000/create',
- 'http://localhost:3000/about/donate',
- 'http://localhost:3000/authors',
- 'http://localhost:3000/topics',
- 'http://localhost:3000/inbox',
+ 'https://localhost:3000/',
+ 'https://localhost:3000/feed',
+ 'https://localhost:3000/create',
+ 'https://localhost:3000/about/donate',
+ 'https://localhost:3000/authors',
+ 'https://localhost:3000/topics',
+ 'https://localhost:3000/inbox',
]
// Loop through the pages and visit each one
diff --git a/vite.config.ts b/vite.config.ts
index f50a5bab..e0660837 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -14,8 +14,9 @@ const cssModuleHMR = () => {
const { modules } = context
modules.forEach((module) => {
- if (module.id.includes('.module.scss')) {
+ if (module.id.includes('.scss') || module.id.includes('.css')) {
module.isSelfAccepting = true
+ // module.accept()
}
})
},