webapp/src/components/Nav/ProfilePopup.tsx

54 lines
1.5 KiB
TypeScript
Raw Normal View History

2022-11-14 10:02:08 +00:00
import type { PopupProps } from '../_shared/Popup'
import { getPagePath } from '@nanostores/router'
2023-02-17 09:21:02 +00:00
import { useLocalize } from '../../context/localize'
import { useSession } from '../../context/session'
import { router } from '../../stores/router'
import { Popup } from '../_shared/Popup'
import styles from '../_shared/Popup/Popup.module.scss'
2022-10-26 19:22:22 +00:00
type ProfilePopupProps = Omit<PopupProps, 'children'>
export const ProfilePopup = (props: ProfilePopupProps) => {
const {
2023-12-13 23:56:44 +00:00
author,
actions: { signOut },
2022-11-14 10:02:08 +00:00
} = useSession()
2022-10-26 19:22:22 +00:00
const { t } = useLocalize()
2023-02-17 09:21:02 +00:00
2022-10-26 19:22:22 +00:00
return (
2022-12-17 03:27:00 +00:00
<Popup {...props} horizontalAnchor="right" variant="bordered">
2022-10-26 19:22:22 +00:00
<ul class="nodash">
<li>
2023-12-13 23:56:44 +00:00
<a href={getPagePath(router, 'author', { slug: author().slug })}>{t('Profile')}</a>
2022-10-26 19:22:22 +00:00
</li>
<li>
2023-05-05 20:05:50 +00:00
<a href={getPagePath(router, 'drafts')}>{t('Drafts')}</a>
2022-10-26 19:22:22 +00:00
</li>
<li>
2023-12-13 23:56:44 +00:00
<a href={`${getPagePath(router, 'author', { slug: author().slug })}?modal=following`}>
{t('Subscriptions')}
</a>
2022-10-26 19:22:22 +00:00
</li>
<li>
2023-12-13 23:56:44 +00:00
<a href={`${getPagePath(router, 'authorComments', { slug: author().slug })}`}>{t('Comments')}</a>
2022-10-26 19:22:22 +00:00
</li>
<li>
2023-02-17 09:21:02 +00:00
<a href="#">{t('Bookmarks')}</a>
2022-10-26 19:22:22 +00:00
</li>
<li>
2023-02-17 09:21:02 +00:00
<a href={getPagePath(router, 'profileSettings')}>{t('Settings')}</a>
2022-10-26 19:22:22 +00:00
</li>
2022-11-02 21:55:29 +00:00
<li class={styles.topBorderItem}>
<span class="link" onClick={() => signOut()}>
2023-02-17 09:21:02 +00:00
{t('Logout')}
</span>
2022-10-26 19:22:22 +00:00
</li>
</ul>
</Popup>
)
}