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'
|
2024-05-06 22:01:20 +00:00
|
|
|
import { Icon } from '../_shared/Icon'
|
2024-05-06 22:13:16 +00:00
|
|
|
import { Popup } from '../_shared/Popup'
|
2023-11-14 15:10:00 +00:00
|
|
|
|
2024-05-06 22:13:16 +00:00
|
|
|
import { clsx } from 'clsx'
|
2023-11-14 15:10:00 +00:00
|
|
|
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) => {
|
2024-02-04 17:40:15 +00:00
|
|
|
const { author, signOut } = useSession()
|
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>
|
2024-05-06 22:01:20 +00:00
|
|
|
<a class={styles.action} href={getPagePath(router, 'author', { slug: author().slug })}>
|
2024-05-06 22:13:16 +00:00
|
|
|
<Icon name="profile" class={styles.icon} />
|
2024-05-06 22:01:20 +00:00
|
|
|
{t('Profile')}
|
|
|
|
</a>
|
2022-10-26 19:22:22 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2024-05-06 22:01:20 +00:00
|
|
|
<a class={styles.action} href={getPagePath(router, 'drafts')}>
|
2024-05-06 22:13:16 +00:00
|
|
|
<Icon name="pencil-outline" class={styles.icon} />
|
2024-05-06 22:01:20 +00:00
|
|
|
{t('Drafts')}
|
|
|
|
</a>
|
2022-10-26 19:22:22 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2024-05-06 22:13:16 +00:00
|
|
|
<a
|
|
|
|
class={styles.action}
|
|
|
|
href={`${getPagePath(router, 'author', { slug: author().slug })}?m=following`}
|
|
|
|
>
|
|
|
|
<Icon name="feed-all" class={styles.icon} />
|
2023-05-18 13:18:07 +00:00
|
|
|
{t('Subscriptions')}
|
|
|
|
</a>
|
2022-10-26 19:22:22 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2024-05-06 22:13:16 +00:00
|
|
|
<a
|
|
|
|
class={styles.action}
|
|
|
|
href={`${getPagePath(router, 'authorComments', { slug: author().slug })}`}
|
|
|
|
>
|
|
|
|
<Icon name="comment" class={styles.icon} />
|
2024-05-06 22:01:20 +00:00
|
|
|
{t('Comments')}
|
|
|
|
</a>
|
2022-10-26 19:22:22 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2024-05-06 22:01:20 +00:00
|
|
|
<a class={styles.action} href="#">
|
2024-05-06 22:13:16 +00:00
|
|
|
<Icon name="bookmark" class={styles.icon} />
|
2024-05-06 22:01:20 +00:00
|
|
|
{t('Bookmarks')}
|
|
|
|
</a>
|
2022-10-26 19:22:22 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2024-05-06 22:01:20 +00:00
|
|
|
<a class={styles.action} href={getPagePath(router, 'profileSettings')}>
|
2024-05-06 22:13:16 +00:00
|
|
|
<Icon name="settings" class={styles.icon} />
|
2024-05-06 22:01:20 +00:00
|
|
|
{t('Settings')}
|
|
|
|
</a>
|
2022-10-26 19:22:22 +00:00
|
|
|
</li>
|
2022-11-02 21:55:29 +00:00
|
|
|
<li class={styles.topBorderItem}>
|
2024-05-06 22:01:20 +00:00
|
|
|
<span class={clsx(styles.action, 'link')} onClick={() => signOut()}>
|
2024-05-06 22:13:16 +00:00
|
|
|
<Icon name="logout" class={styles.icon} />
|
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>
|
|
|
|
)
|
|
|
|
}
|