webapp/src/components/Nav/ProfilePopup.tsx

53 lines
1.4 KiB
TypeScript
Raw Normal View History

2022-11-14 10:02:08 +00:00
import { useSession } from '../../context/session'
import type { PopupProps } from '../_shared/Popup'
import { Popup } from '../_shared/Popup'
2022-11-20 21:25:59 +00:00
import styles from '../_shared/Popup/Popup.module.scss'
2022-11-25 11:03:51 +00:00
import { getPagePath } from '@nanostores/router'
import { router } from '../../stores/router'
2022-10-26 19:22:22 +00:00
type ProfilePopupProps = Omit<PopupProps, 'children'>
export const ProfilePopup = (props: ProfilePopupProps) => {
const {
2022-11-25 11:03:51 +00:00
userSlug,
actions: { signOut }
2022-11-14 10:02:08 +00:00
} = useSession()
2022-10-26 19:22:22 +00:00
return (
<Popup {...props} horizontalAnchor="right">
2022-11-25 11:03:51 +00:00
{/*TODO: l10n*/}
2022-10-26 19:22:22 +00:00
<ul class="nodash">
<li>
2022-11-25 11:03:51 +00:00
<a href={getPagePath(router, 'author', { slug: userSlug() })}>Профиль</a>
2022-10-26 19:22:22 +00:00
</li>
<li>
<a href="#">Черновики</a>
</li>
<li>
<a href="#">Подписки</a>
</li>
<li>
<a href="#">Комментарии</a>
</li>
<li>
<a href="#">Закладки</a>
</li>
<li>
2022-11-25 11:03:51 +00:00
<a href={getPagePath(router, 'profileSettings')}>Настройки</a>
2022-10-26 19:22:22 +00:00
</li>
2022-11-02 21:55:29 +00:00
<li class={styles.topBorderItem}>
<a
href="#"
onClick={(event) => {
event.preventDefault()
signOut()
}}
>
Выйти из&nbsp;аккаунта
</a>
2022-10-26 19:22:22 +00:00
</li>
</ul>
</Popup>
)
}