webapp/src/components/Nav/Private.tsx

44 lines
1.4 KiB
TypeScript
Raw Normal View History

2022-09-09 11:53:35 +00:00
import type { Author } from '../../graphql/types.gen'
import Userpic from '../Author/Userpic'
2022-09-22 09:37:49 +00:00
import { Icon } from './Icon'
2022-10-03 21:31:11 +00:00
import './Private.module.scss'
2022-09-30 14:22:33 +00:00
import { useAuthStore } from '../../stores/auth'
2022-09-22 09:37:49 +00:00
import { useRouter } from '../../stores/router'
2022-09-09 11:53:35 +00:00
export default () => {
2022-09-30 14:22:33 +00:00
const { session } = useAuthStore()
2022-09-22 09:37:49 +00:00
const { getPage } = useRouter()
2022-09-09 11:53:35 +00:00
return (
2022-10-03 21:31:11 +00:00
<div class="userControl col">
<div class="userControlItem userControlItemWritePost">
2022-09-09 11:53:35 +00:00
<a href="/create">
<span class="text-label">опубликовать материал</span>
<Icon name="pencil" />
</a>
</div>
2022-10-03 21:31:11 +00:00
<div class="userControlItem userControlItemSearch">
2022-09-09 11:53:35 +00:00
<a href="/search">
<Icon name="search" />
</a>
</div>
2022-10-03 21:31:11 +00:00
<div class="userControlItem userControlItemInbox">
2022-09-09 11:53:35 +00:00
<a href="/inbox">
2022-09-22 09:37:49 +00:00
{/*FIXME: replace with route*/}
<div classList={{ entered: getPage().path === '/inbox' }}>
2022-09-09 11:53:35 +00:00
<Icon name="inbox-white" counter={session().info?.unread || 0} />
</div>
</a>
</div>
2022-10-03 21:31:11 +00:00
<div class="userControlItem">
2022-09-09 11:53:35 +00:00
<a href={`/${session().user?.slug}`}>
2022-09-22 09:37:49 +00:00
{/*FIXME: replace with route*/}
<div classList={{ entered: getPage().path === `/${session().user?.slug}` }}>
2022-09-09 11:53:35 +00:00
<Userpic user={session().user as Author} />
</div>
</a>
</div>
</div>
)
}