parent
fc318dbbb6
commit
bb02d6b364
|
@ -14,7 +14,6 @@ import { Icon } from '../../_shared/Icon'
|
||||||
import { Image } from '../../_shared/Image'
|
import { Image } from '../../_shared/Image'
|
||||||
import { InviteCoAuthorsModal } from '../../_shared/InviteCoAuthorsModal'
|
import { InviteCoAuthorsModal } from '../../_shared/InviteCoAuthorsModal'
|
||||||
import { Popover } from '../../_shared/Popover'
|
import { Popover } from '../../_shared/Popover'
|
||||||
import { ShareModal } from '../../_shared/ShareModal'
|
|
||||||
import { CoverImage } from '../../Article/CoverImage'
|
import { CoverImage } from '../../Article/CoverImage'
|
||||||
import { getShareUrl, SharePopup } from '../../Article/SharePopup'
|
import { getShareUrl, SharePopup } from '../../Article/SharePopup'
|
||||||
import { ShoutRatingControl } from '../../Article/ShoutRatingControl'
|
import { ShoutRatingControl } from '../../Article/ShoutRatingControl'
|
||||||
|
@ -52,6 +51,7 @@ export type ArticleCardProps = {
|
||||||
withAspectRatio?: boolean
|
withAspectRatio?: boolean
|
||||||
desktopCoverSize?: 'XS' | 'S' | 'M' | 'L'
|
desktopCoverSize?: 'XS' | 'S' | 'M' | 'L'
|
||||||
article: Shout
|
article: Shout
|
||||||
|
onShare?: (article: Shout) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const desktopCoverImageWidths: Record<ArticleCardProps['desktopCoverSize'], number> = {
|
const desktopCoverImageWidths: Record<ArticleCardProps['desktopCoverSize'], number> = {
|
||||||
|
@ -367,7 +367,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
<FeedArticlePopup
|
<FeedArticlePopup
|
||||||
isOwner={canEdit()}
|
isOwner={canEdit()}
|
||||||
containerCssClass={stylesHeader.control}
|
containerCssClass={stylesHeader.control}
|
||||||
onShareClick={() => showModal('share')}
|
onShareClick={() => props.onShare(props.article)}
|
||||||
onInviteClick={() => showModal('inviteCoAuthors')}
|
onInviteClick={() => showModal('inviteCoAuthors')}
|
||||||
onVisibilityChange={(isVisible) => setIsActionPopupActive(isVisible)}
|
onVisibilityChange={(isVisible) => setIsActionPopupActive(isVisible)}
|
||||||
trigger={
|
trigger={
|
||||||
|
@ -386,12 +386,6 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
<InviteCoAuthorsModal title={t('Invite experts')} />
|
<InviteCoAuthorsModal title={t('Invite experts')} />
|
||||||
<ShareModal
|
|
||||||
title={title}
|
|
||||||
description={description}
|
|
||||||
imageUrl={props.article.cover}
|
|
||||||
shareUrl={getShareUrl({ pathname: `/${props.article.slug}` })}
|
|
||||||
/>
|
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { createEffect, createMemo, createSignal, For, on, onMount, Show } from '
|
||||||
import { useLocalize } from '../../../context/localize'
|
import { useLocalize } from '../../../context/localize'
|
||||||
import { useReactions } from '../../../context/reactions'
|
import { useReactions } from '../../../context/reactions'
|
||||||
import { router, useRouter } from '../../../stores/router'
|
import { router, useRouter } from '../../../stores/router'
|
||||||
|
import { showModal } from '../../../stores/ui'
|
||||||
import { useArticlesStore, resetSortedArticles } from '../../../stores/zine/articles'
|
import { useArticlesStore, resetSortedArticles } from '../../../stores/zine/articles'
|
||||||
import { useTopAuthorsStore } from '../../../stores/zine/topAuthors'
|
import { useTopAuthorsStore } from '../../../stores/zine/topAuthors'
|
||||||
import { useTopicsStore } from '../../../stores/zine/topics'
|
import { useTopicsStore } from '../../../stores/zine/topics'
|
||||||
|
@ -17,7 +18,9 @@ import { getServerDate } from '../../../utils/getServerDate'
|
||||||
import { DropDown } from '../../_shared/DropDown'
|
import { DropDown } from '../../_shared/DropDown'
|
||||||
import { Icon } from '../../_shared/Icon'
|
import { Icon } from '../../_shared/Icon'
|
||||||
import { Loading } from '../../_shared/Loading'
|
import { Loading } from '../../_shared/Loading'
|
||||||
|
import { ShareModal } from '../../_shared/ShareModal'
|
||||||
import { CommentDate } from '../../Article/CommentDate'
|
import { CommentDate } from '../../Article/CommentDate'
|
||||||
|
import { getShareUrl } from '../../Article/SharePopup'
|
||||||
import { AuthorLink } from '../../Author/AhtorLink'
|
import { AuthorLink } from '../../Author/AhtorLink'
|
||||||
import { AuthorBadge } from '../../Author/AuthorBadge'
|
import { AuthorBadge } from '../../Author/AuthorBadge'
|
||||||
import { ArticleCard } from '../../Feed/ArticleCard'
|
import { ArticleCard } from '../../Feed/ArticleCard'
|
||||||
|
@ -203,6 +206,12 @@ export const Feed = (props: Props) => {
|
||||||
)
|
)
|
||||||
const ogTitle = t('Feed')
|
const ogTitle = t('Feed')
|
||||||
|
|
||||||
|
const [shareData, setShareData] = createSignal<Shout | undefined>()
|
||||||
|
const handleShare = (shared) => {
|
||||||
|
showModal('share')
|
||||||
|
setShareData(shared)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="wide-container feed">
|
<div class="wide-container feed">
|
||||||
<Meta name="descprition" content={description} />
|
<Meta name="descprition" content={description} />
|
||||||
|
@ -279,7 +288,12 @@ export const Feed = (props: Props) => {
|
||||||
<Show when={sortedArticles().length > 0}>
|
<Show when={sortedArticles().length > 0}>
|
||||||
<For each={sortedArticles().slice(0, 4)}>
|
<For each={sortedArticles().slice(0, 4)}>
|
||||||
{(article) => (
|
{(article) => (
|
||||||
<ArticleCard article={article} settings={{ isFeedMode: true }} desktopCoverSize="M" />
|
<ArticleCard
|
||||||
|
onShare={(shared) => handleShare(shared)}
|
||||||
|
article={article}
|
||||||
|
settings={{ isFeedMode: true }}
|
||||||
|
desktopCoverSize="M"
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
|
|
||||||
|
@ -394,6 +408,14 @@ export const Feed = (props: Props) => {
|
||||||
</Show>
|
</Show>
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
|
<Show when={shareData()}>
|
||||||
|
<ShareModal
|
||||||
|
title={shareData().title}
|
||||||
|
description={shareData().description}
|
||||||
|
imageUrl={shareData().cover}
|
||||||
|
shareUrl={getShareUrl({ pathname: `/${shareData().slug}` })}
|
||||||
|
/>
|
||||||
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ type Props = {
|
||||||
export const ShareLinks = (props: Props) => {
|
export const ShareLinks = (props: Props) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
const [isLinkCopied, setIsLinkCopied] = createSignal(false)
|
const [isLinkCopied, setIsLinkCopied] = createSignal(false)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
actions: { showSnackbar },
|
actions: { showSnackbar },
|
||||||
} = useSnackbar()
|
} = useSnackbar()
|
||||||
|
|
|
@ -11,7 +11,6 @@ type Props = {
|
||||||
}
|
}
|
||||||
export const ShareModal = (props: Props) => {
|
export const ShareModal = (props: Props) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal name="share" variant="medium" allowClose={true}>
|
<Modal name="share" variant="medium" allowClose={true}>
|
||||||
<h2>{t('Share publication')}</h2>
|
<h2>{t('Share publication')}</h2>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user