2022-11-14 10:02:08 +00:00
|
|
|
import type { PopupProps } from '../_shared/Popup'
|
2023-11-14 15:10:00 +00:00
|
|
|
|
2023-04-03 12:55:00 +00:00
|
|
|
import { getPagePath } from '@nanostores/router'
|
2023-11-14 15:10:00 +00:00
|
|
|
|
2023-02-17 09:21:02 +00:00
|
|
|
import { useLocalize } from '../../context/localize'
|
2023-11-14 15:10:00 +00:00
|
|
|
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) => {
|
2022-11-13 19:35:57 +00:00
|
|
|
const {
|
2023-12-13 23:56:44 +00:00
|
|
|
author,
|
2023-11-14 15:10:00 +00:00
|
|
|
actions: { signOut },
|
2022-11-14 10:02:08 +00:00
|
|
|
} = useSession()
|
2022-10-26 19:22:22 +00:00
|
|
|
|
2023-03-03 18:26:26 +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`}>
|
2023-05-18 13:18:07 +00:00
|
|
|
{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}>
|
2023-09-29 12:48:58 +00:00
|
|
|
<span class="link" onClick={() => signOut()}>
|
2023-02-17 09:21:02 +00:00
|
|
|
{t('Logout')}
|
2023-09-29 12:48:58 +00:00
|
|
|
</span>
|
2022-10-26 19:22:22 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</Popup>
|
|
|
|
)
|
|
|
|
}
|