2024-07-04 07:51:15 +00:00
|
|
|
import type { PopupProps } from '~/components/_shared/Popup'
|
2023-12-29 11:07:48 +00:00
|
|
|
|
|
|
|
import { clsx } from 'clsx'
|
2024-02-04 11:25:21 +00:00
|
|
|
import { Show, createSignal } from 'solid-js'
|
2023-12-29 11:07:48 +00:00
|
|
|
|
2024-07-04 07:51:15 +00:00
|
|
|
import { Icon } from '~/components/_shared/Icon'
|
|
|
|
import { Popup } from '~/components/_shared/Popup'
|
|
|
|
import { SoonChip } from '~/components/_shared/SoonChip'
|
|
|
|
import { useLocalize } from '~/context/localize'
|
2023-12-29 11:07:48 +00:00
|
|
|
|
|
|
|
import styles from './FeedArticlePopup.module.scss'
|
|
|
|
|
2024-01-15 13:22:43 +00:00
|
|
|
type Props = {
|
2024-02-16 16:14:15 +00:00
|
|
|
canEdit: boolean
|
2024-01-05 19:31:28 +00:00
|
|
|
onInviteClick: () => void
|
|
|
|
onShareClick: () => void
|
2023-12-29 11:07:48 +00:00
|
|
|
} & Omit<PopupProps, 'children'>
|
|
|
|
|
2024-01-15 13:22:43 +00:00
|
|
|
export const FeedArticlePopup = (props: Props) => {
|
2023-12-29 11:07:48 +00:00
|
|
|
const { t } = useLocalize()
|
2024-01-15 18:41:45 +00:00
|
|
|
const [hidePopup, setHidePopup] = createSignal(false)
|
2023-12-29 11:07:48 +00:00
|
|
|
return (
|
|
|
|
<>
|
2024-01-15 13:22:43 +00:00
|
|
|
<Popup
|
|
|
|
{...props}
|
2024-01-15 18:41:45 +00:00
|
|
|
//TODO: fix hide logic
|
|
|
|
closePopup={hidePopup()}
|
2024-01-15 13:22:43 +00:00
|
|
|
horizontalAnchor={'right'}
|
|
|
|
variant="tiny"
|
|
|
|
popupCssClass={styles.feedArticlePopup}
|
|
|
|
>
|
2023-12-29 11:07:48 +00:00
|
|
|
<ul class={clsx('nodash', styles.actionList)}>
|
2024-01-05 19:31:28 +00:00
|
|
|
<li>
|
2024-01-15 13:22:43 +00:00
|
|
|
<button
|
|
|
|
class={styles.action}
|
|
|
|
onClick={() => {
|
|
|
|
props.onShareClick()
|
2024-01-15 18:41:45 +00:00
|
|
|
setHidePopup(true)
|
2024-01-15 13:22:43 +00:00
|
|
|
}}
|
|
|
|
>
|
2024-05-20 20:39:59 +00:00
|
|
|
<Icon name="share-outline" class={styles.icon} />
|
2024-05-20 20:37:56 +00:00
|
|
|
<div class={styles.title}>{t('Share')}</div>
|
2024-01-05 19:31:28 +00:00
|
|
|
</button>
|
|
|
|
</li>
|
2024-02-16 16:14:15 +00:00
|
|
|
<Show when={!props.canEdit}>
|
2023-12-29 11:07:48 +00:00
|
|
|
<li>
|
|
|
|
<button
|
|
|
|
class={styles.action}
|
|
|
|
onClick={() => {
|
|
|
|
alert('Help to edit')
|
2024-01-15 18:41:45 +00:00
|
|
|
setHidePopup(true)
|
2023-12-29 11:07:48 +00:00
|
|
|
}}
|
|
|
|
>
|
2024-05-20 20:39:59 +00:00
|
|
|
<Icon name="pencil-outline" class={styles.icon} />
|
2024-05-20 20:37:56 +00:00
|
|
|
<div class={styles.title}>{t('Help to edit')}</div>
|
2023-12-29 11:07:48 +00:00
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</Show>
|
|
|
|
<li>
|
2024-01-15 13:22:43 +00:00
|
|
|
<button
|
|
|
|
class={styles.action}
|
|
|
|
onClick={() => {
|
|
|
|
props.onInviteClick()
|
2024-01-15 18:41:45 +00:00
|
|
|
setHidePopup(false)
|
2024-01-15 13:22:43 +00:00
|
|
|
}}
|
|
|
|
>
|
2024-05-20 20:39:59 +00:00
|
|
|
<Icon name="expert" class={styles.icon} />
|
2024-05-20 20:37:56 +00:00
|
|
|
<div class={styles.title}>{t('Invite experts')}</div>
|
2023-12-29 11:07:48 +00:00
|
|
|
</button>
|
|
|
|
</li>
|
2024-02-16 16:14:15 +00:00
|
|
|
<Show when={!props.canEdit}>
|
2023-12-29 11:07:48 +00:00
|
|
|
<li>
|
2024-09-15 18:47:21 +00:00
|
|
|
<button class={clsx(styles.action, styles.soon)}>
|
2024-05-20 20:39:59 +00:00
|
|
|
<Icon name="bell-white" class={styles.icon} />
|
2024-05-20 20:37:56 +00:00
|
|
|
<div class={styles.title}>{t('Subscribe to comments')}</div>
|
2024-05-20 20:39:59 +00:00
|
|
|
<SoonChip />
|
2023-12-29 11:07:48 +00:00
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</Show>
|
|
|
|
<li>
|
2024-09-15 18:47:21 +00:00
|
|
|
<button class={clsx(styles.action, styles.soon)}>
|
2024-05-20 20:39:59 +00:00
|
|
|
<Icon name="bookmark" class={styles.icon} />
|
2024-05-20 20:37:56 +00:00
|
|
|
<div class={styles.title}>{t('Add to bookmarks')}</div>
|
|
|
|
<SoonChip />
|
2023-12-29 11:07:48 +00:00
|
|
|
</button>
|
|
|
|
</li>
|
2024-02-16 16:14:15 +00:00
|
|
|
{/*<Show when={!props.canEdit}>*/}
|
2023-12-29 11:07:48 +00:00
|
|
|
{/* <li>*/}
|
|
|
|
{/* <button*/}
|
|
|
|
{/* class={styles.action}*/}
|
2024-09-15 18:47:21 +00:00
|
|
|
{/* */}
|
2023-12-29 11:07:48 +00:00
|
|
|
{/* onClick={() => {*/}
|
2024-07-03 17:38:43 +00:00
|
|
|
{/* alert('Complain')*/}
|
2023-12-29 11:07:48 +00:00
|
|
|
{/* }}*/}
|
|
|
|
{/* >*/}
|
2024-07-03 17:38:43 +00:00
|
|
|
{/* {t('Complain')}*/}
|
2023-12-29 11:07:48 +00:00
|
|
|
{/* </button>*/}
|
|
|
|
{/* </li>*/}
|
|
|
|
{/*</Show>*/}
|
|
|
|
{/*<li>*/}
|
|
|
|
{/* <button*/}
|
|
|
|
{/* class={styles.action}*/}
|
2024-09-15 18:47:21 +00:00
|
|
|
{/* */}
|
2023-12-29 11:07:48 +00:00
|
|
|
{/* onClick={() => {*/}
|
|
|
|
{/* alert('Get notifications')*/}
|
|
|
|
{/* }}*/}
|
|
|
|
{/* >*/}
|
|
|
|
{/* {t('Get notifications')}*/}
|
|
|
|
{/* </button>*/}
|
|
|
|
{/*</li>*/}
|
|
|
|
</ul>
|
|
|
|
</Popup>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|