linking-fix
This commit is contained in:
parent
8cce8d897e
commit
c79b0451cb
|
@ -1,7 +1,6 @@
|
||||||
|
import { A, useLocation, useParams } from '@solidjs/router'
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
import { For, Show, createSignal } from 'solid-js'
|
import { For, Show, createSignal } from 'solid-js'
|
||||||
|
|
||||||
import { A, useMatch } from '@solidjs/router'
|
|
||||||
import { Icon } from '~/components/_shared/Icon'
|
import { Icon } from '~/components/_shared/Icon'
|
||||||
import { useFeed } from '~/context/feed'
|
import { useFeed } from '~/context/feed'
|
||||||
import { useFollowing } from '~/context/following'
|
import { useFollowing } from '~/context/following'
|
||||||
|
@ -15,10 +14,8 @@ export const Sidebar = () => {
|
||||||
const { follows } = useFollowing()
|
const { follows } = useFollowing()
|
||||||
const { feedByTopic, feedByAuthor, seen } = useFeed()
|
const { feedByTopic, feedByAuthor, seen } = useFeed()
|
||||||
const [isSubscriptionsVisible, setSubscriptionsVisible] = createSignal(true)
|
const [isSubscriptionsVisible, setSubscriptionsVisible] = createSignal(true)
|
||||||
const matchFeed = useMatch(() => '/feed')
|
const loc = useLocation()
|
||||||
const matchFeedMy = useMatch(() => '/feed/followed')
|
const params = useParams()
|
||||||
const matchFeedCollabs = useMatch(() => '/feed/coauthored')
|
|
||||||
const matchFeedDiscussions = useMatch(() => '/feed/discussed')
|
|
||||||
const checkTopicIsSeen = (topicSlug: string) => {
|
const checkTopicIsSeen = (topicSlug: string) => {
|
||||||
return feedByTopic()[topicSlug]?.every((article) => Boolean(seen()[article.slug]))
|
return feedByTopic()[topicSlug]?.every((article) => Boolean(seen()[article.slug]))
|
||||||
}
|
}
|
||||||
|
@ -32,9 +29,9 @@ export const Sidebar = () => {
|
||||||
<ul class={styles.feedFilters}>
|
<ul class={styles.feedFilters}>
|
||||||
<li>
|
<li>
|
||||||
<A
|
<A
|
||||||
href={'feed'}
|
href={'/feed'}
|
||||||
class={clsx({
|
class={clsx({
|
||||||
[styles.selected]: matchFeed()
|
[styles.selected]: !loc.pathname.includes('feed/my')
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<span class={styles.sidebarItemName}>
|
<span class={styles.sidebarItemName}>
|
||||||
|
@ -45,9 +42,9 @@ export const Sidebar = () => {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<A
|
<A
|
||||||
href={'/feed/followed'}
|
href={'/feed/my/followed'}
|
||||||
class={clsx({
|
class={clsx({
|
||||||
[styles.selected]: matchFeedMy()
|
[styles.selected]: !params.mode || params.mode === 'followed'
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<span class={styles.sidebarItemName}>
|
<span class={styles.sidebarItemName}>
|
||||||
|
@ -58,9 +55,9 @@ export const Sidebar = () => {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<A
|
<A
|
||||||
href={'/feed/coauthored'}
|
href={'/feed/my/coauthored'}
|
||||||
class={clsx({
|
class={clsx({
|
||||||
[styles.selected]: matchFeedCollabs()
|
[styles.selected]: params.mode === 'coauthored'
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<span class={styles.sidebarItemName}>
|
<span class={styles.sidebarItemName}>
|
||||||
|
@ -71,9 +68,9 @@ export const Sidebar = () => {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href={'/feed/discussed'}
|
href={'/feed/my/discussed'}
|
||||||
class={clsx({
|
class={clsx({
|
||||||
[styles.selected]: matchFeedDiscussions()
|
[styles.selected]: params.mode === 'discussed'
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<span class={styles.sidebarItemName}>
|
<span class={styles.sidebarItemName}>
|
||||||
|
|
|
@ -477,7 +477,7 @@ export const Header = (props: Props) => {
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<A href={'/feed/followed'}>
|
<A href={'/feed/my/followed'}>
|
||||||
<span class={styles.subnavigationItemName}>
|
<span class={styles.subnavigationItemName}>
|
||||||
<Icon name="feed-my" class={styles.icon} />
|
<Icon name="feed-my" class={styles.icon} />
|
||||||
{t('My feed')}
|
{t('My feed')}
|
||||||
|
@ -485,7 +485,7 @@ export const Header = (props: Props) => {
|
||||||
</A>
|
</A>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<A href={'/feed/coauthored'}>
|
<A href={'/feed/my/coauthored'}>
|
||||||
<span class={styles.subnavigationItemName}>
|
<span class={styles.subnavigationItemName}>
|
||||||
<Icon name="feed-collaborate" class={styles.icon} />
|
<Icon name="feed-collaborate" class={styles.icon} />
|
||||||
{t('Participation')}
|
{t('Participation')}
|
||||||
|
@ -493,7 +493,7 @@ export const Header = (props: Props) => {
|
||||||
</A>
|
</A>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<A href={'/feed/discussed'}>
|
<A href={'/feed/my/discussed'}>
|
||||||
<span class={styles.subnavigationItemName}>
|
<span class={styles.subnavigationItemName}>
|
||||||
<Icon name="feed-discussion" class={styles.icon} />
|
<Icon name="feed-discussion" class={styles.icon} />
|
||||||
{t('Discussions')}
|
{t('Discussions')}
|
||||||
|
|
|
@ -35,7 +35,7 @@ export type PeriodType = 'week' | 'month' | 'year'
|
||||||
|
|
||||||
export type FeedProps = {
|
export type FeedProps = {
|
||||||
shouts: Shout[]
|
shouts: Shout[]
|
||||||
mode?: 'followed' | 'discussed' | 'coauthored' | 'unrated'
|
mode?: 'followed' | 'discussed' | 'coauthored' | 'unrated' | 'all'
|
||||||
order?: '' | 'likes' | 'hot'
|
order?: '' | 'likes' | 'hot'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,8 +143,8 @@ export const FeedView = (props: FeedProps) => {
|
||||||
</Show>
|
</Show>
|
||||||
<DropDown
|
<DropDown
|
||||||
popupProps={{ horizontalAnchor: 'right' }}
|
popupProps={{ horizontalAnchor: 'right' }}
|
||||||
options={asOptions(['followed', 'unrated', 'discussed', 'coauthored'])}
|
options={asOptions(['all', 'featured', 'followed', 'unrated', 'discussed', 'coauthored'])}
|
||||||
currentOption={asOption(loc.pathname.split('/').pop() || '')}
|
currentOption={asOption(props.mode || '')}
|
||||||
triggerCssClass={styles.periodSwitcher}
|
triggerCssClass={styles.periodSwitcher}
|
||||||
onChange={(mode: Option) => navigate(`/feed/${mode.value}`)}
|
onChange={(mode: Option) => navigate(`/feed/${mode.value}`)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -256,6 +256,7 @@
|
||||||
"Language": "Язык",
|
"Language": "Язык",
|
||||||
"Last rev.": "Посл. изм.",
|
"Last rev.": "Посл. изм.",
|
||||||
"Let's log in": "Давайте авторизуемся",
|
"Let's log in": "Давайте авторизуемся",
|
||||||
|
"Liked": "Популярное",
|
||||||
"Link copied": "Ссылка скопирована",
|
"Link copied": "Ссылка скопирована",
|
||||||
"Link copied to clipboard": "Ссылка скопирована в буфер обмена",
|
"Link copied to clipboard": "Ссылка скопирована в буфер обмена",
|
||||||
"Link sent, check your email": "Ссылка отправлена, проверьте почту",
|
"Link sent, check your email": "Ссылка отправлена, проверьте почту",
|
||||||
|
|
|
@ -114,7 +114,7 @@ export default (props: RouteSectionProps<{ shouts: Shout[]; topics: Topic[] }>)
|
||||||
<ReactionsProvider>
|
<ReactionsProvider>
|
||||||
<Feed
|
<Feed
|
||||||
shouts={feed() || []}
|
shouts={feed() || []}
|
||||||
mode={(mode() || 'followed') as FeedProps['mode']}
|
mode={(mode() || 'all') as FeedProps['mode']}
|
||||||
order={order() as FeedProps['order']}
|
order={order() as FeedProps['order']}
|
||||||
/>
|
/>
|
||||||
</ReactionsProvider>
|
</ReactionsProvider>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user