minor changes
This commit is contained in:
parent
6f90e4c10e
commit
47f9c10496
|
@ -52,7 +52,7 @@
|
||||||
"@graphql-codegen/urql-introspection": "^2.2.1",
|
"@graphql-codegen/urql-introspection": "^2.2.1",
|
||||||
"@graphql-tools/url-loader": "^7.17.3",
|
"@graphql-tools/url-loader": "^7.17.3",
|
||||||
"@graphql-typed-document-node/core": "^3.1.1",
|
"@graphql-typed-document-node/core": "^3.1.1",
|
||||||
"@nanostores/router": "^0.8.0",
|
"@nanostores/router": "^0.8.1",
|
||||||
"@nanostores/solid": "^0.3.2",
|
"@nanostores/solid": "^0.3.2",
|
||||||
"@popperjs/core": "^2.11.6",
|
"@popperjs/core": "^2.11.6",
|
||||||
"@solid-primitives/memo": "^1.1.3",
|
"@solid-primitives/memo": "^1.1.3",
|
||||||
|
|
|
@ -16,6 +16,8 @@ import { CommentsTree } from './CommentsTree'
|
||||||
import { useSession } from '../../context/session'
|
import { useSession } from '../../context/session'
|
||||||
import VideoPlayer from './VideoPlayer'
|
import VideoPlayer from './VideoPlayer'
|
||||||
import Slider from '../_shared/Slider'
|
import Slider from '../_shared/Slider'
|
||||||
|
import { getPagePath } from '@nanostores/router'
|
||||||
|
import { router } from '../../stores/router'
|
||||||
|
|
||||||
interface ArticleProps {
|
interface ArticleProps {
|
||||||
article: Shout
|
article: Shout
|
||||||
|
@ -59,8 +61,6 @@ export const FullArticle = (props: ArticleProps) => {
|
||||||
props.article.topics[0]
|
props.article.topics[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
const mainTopicTitle = createMemo(() => mainTopic().title.replace(' ', ' '))
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const windowHash = window.location.hash
|
const windowHash = window.location.hash
|
||||||
if (windowHash?.length > 0) {
|
if (windowHash?.length > 0) {
|
||||||
|
@ -93,7 +93,9 @@ export const FullArticle = (props: ArticleProps) => {
|
||||||
<article class="col-md-6 shift-content">
|
<article class="col-md-6 shift-content">
|
||||||
<div class={styles.shoutHeader}>
|
<div class={styles.shoutHeader}>
|
||||||
<div class={styles.shoutTopic}>
|
<div class={styles.shoutTopic}>
|
||||||
<a href={`/topic/${props.article.mainTopic}`} innerHTML={mainTopicTitle() || ''} />
|
<a href={`/topic/${props.article.mainTopic}`} class={styles.mainTopicLink}>
|
||||||
|
{mainTopic().title}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>{props.article.title}</h1>
|
<h1>{props.article.title}</h1>
|
||||||
|
@ -106,7 +108,7 @@ export const FullArticle = (props: ArticleProps) => {
|
||||||
{(a: Author, index) => (
|
{(a: Author, index) => (
|
||||||
<>
|
<>
|
||||||
<Show when={index() > 0}>, </Show>
|
<Show when={index() > 0}>, </Show>
|
||||||
<a href={`/author/${a.slug}`}>{a.name}</a>
|
<a href={getPagePath(router, 'author', { slug: a.slug })}>{a.name}</a>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
|
@ -210,7 +212,7 @@ export const FullArticle = (props: ArticleProps) => {
|
||||||
<For each={props.article.topics}>
|
<For each={props.article.topics}>
|
||||||
{(topic) => (
|
{(topic) => (
|
||||||
<div class={styles.shoutTopic}>
|
<div class={styles.shoutTopic}>
|
||||||
<a href={`/topic/${topic.slug}`}>{topic.title}</a>
|
<a href={getPagePath(router, 'topic', { slug: topic.slug })}>{topic.title}</a>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import type { AuthModalSearchParams } from './types'
|
||||||
import { hideModal, locale } from '../../../stores/ui'
|
import { hideModal, locale } from '../../../stores/ui'
|
||||||
import { useSession } from '../../../context/session'
|
import { useSession } from '../../../context/session'
|
||||||
import { signSendLink } from '../../../stores/auth'
|
import { signSendLink } from '../../../stores/auth'
|
||||||
|
import { useSnackbar } from '../../../context/snackbar'
|
||||||
|
|
||||||
type FormFields = {
|
type FormFields = {
|
||||||
email: string
|
email: string
|
||||||
|
@ -27,6 +28,10 @@ export const LoginForm = () => {
|
||||||
const [isEmailNotConfirmed, setIsEmailNotConfirmed] = createSignal(false)
|
const [isEmailNotConfirmed, setIsEmailNotConfirmed] = createSignal(false)
|
||||||
const [isLinkSent, setIsLinkSent] = createSignal(false)
|
const [isLinkSent, setIsLinkSent] = createSignal(false)
|
||||||
|
|
||||||
|
const {
|
||||||
|
actions: { showSnackbar }
|
||||||
|
} = useSnackbar()
|
||||||
|
|
||||||
const {
|
const {
|
||||||
actions: { signIn }
|
actions: { signIn }
|
||||||
} = useSession()
|
} = useSession()
|
||||||
|
@ -83,6 +88,7 @@ export const LoginForm = () => {
|
||||||
try {
|
try {
|
||||||
await signIn({ email: email(), password: password() })
|
await signIn({ email: email(), password: password() })
|
||||||
hideModal()
|
hideModal()
|
||||||
|
showSnackbar({ body: t('Welcome!') })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof ApiError) {
|
if (error instanceof ApiError) {
|
||||||
if (error.code === 'email_not_confirmed') {
|
if (error.code === 'email_not_confirmed') {
|
||||||
|
|
|
@ -3,6 +3,8 @@ import { createContext, createMemo, createResource, createSignal, onMount, useCo
|
||||||
import type { AuthResult } from '../graphql/types.gen'
|
import type { AuthResult } from '../graphql/types.gen'
|
||||||
import { apiClient } from '../utils/apiClient'
|
import { apiClient } from '../utils/apiClient'
|
||||||
import { resetToken, setToken } from '../graphql/privateGraphQLClient'
|
import { resetToken, setToken } from '../graphql/privateGraphQLClient'
|
||||||
|
import { t } from '../utils/intl'
|
||||||
|
import { useSnackbar } from './snackbar'
|
||||||
|
|
||||||
type SessionContextType = {
|
type SessionContextType = {
|
||||||
session: Resource<AuthResult>
|
session: Resource<AuthResult>
|
||||||
|
@ -26,6 +28,10 @@ export function useSession() {
|
||||||
export const SessionProvider = (props: { children: JSX.Element }) => {
|
export const SessionProvider = (props: { children: JSX.Element }) => {
|
||||||
const [isSessionLoaded, setIsSessionLoaded] = createSignal(false)
|
const [isSessionLoaded, setIsSessionLoaded] = createSignal(false)
|
||||||
|
|
||||||
|
const {
|
||||||
|
actions: { showSnackbar }
|
||||||
|
} = useSnackbar()
|
||||||
|
|
||||||
const getSession = async (): Promise<AuthResult> => {
|
const getSession = async (): Promise<AuthResult> => {
|
||||||
try {
|
try {
|
||||||
const authResult = await apiClient.getSession()
|
const authResult = await apiClient.getSession()
|
||||||
|
@ -63,7 +69,7 @@ export const SessionProvider = (props: { children: JSX.Element }) => {
|
||||||
// TODO: call backend to revoke token
|
// TODO: call backend to revoke token
|
||||||
mutate(null)
|
mutate(null)
|
||||||
resetToken()
|
resetToken()
|
||||||
console.debug('signed out')
|
showSnackbar({ body: t("You've successfully logged out") })
|
||||||
}
|
}
|
||||||
|
|
||||||
const confirmEmail = async (token: string) => {
|
const confirmEmail = async (token: string) => {
|
||||||
|
|
|
@ -229,5 +229,7 @@
|
||||||
"Subscribe to comments": "Подписаться на комментарии",
|
"Subscribe to comments": "Подписаться на комментарии",
|
||||||
"Add to bookmarks": "Добавить в закладки",
|
"Add to bookmarks": "Добавить в закладки",
|
||||||
"Get notifications": "Получать уведомления",
|
"Get notifications": "Получать уведомления",
|
||||||
"Profile successfully saved": "Профиль успешно сохранён"
|
"Profile successfully saved": "Профиль успешно сохранён",
|
||||||
|
"Welcome!": "Добро пожаловать!",
|
||||||
|
"You've successfully logged out": "Вы успешно вышли из аккаунта"
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,3 +309,7 @@ img {
|
||||||
padding: 1.1rem 1.2rem 0.9rem;
|
padding: 1.1rem 1.2rem 0.9rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mainTopicLink {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user