From ad8f9e560d7f320d1b7db5b816b17db825b86ce7 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 9 Feb 2024 20:00:21 +0000 Subject: [PATCH] Always show post dropdown button at the bottom of the post, add share button to highlighted post (#2646) * Always show post dropdown at the bottom * Rm useless view (no longer needed) * space icons evenly in big, add equal padding * add share icon * add onShare * confirmed figma noob. figured it out. * use our svg naming strat * Update icon --------- Co-authored-by: Hailey Co-authored-by: Eric Bailey --- .../arrowOutOfBox_stroke2_corner0_rounded.svg | 1 + src/components/icons/ArrowOutOfBox.tsx | 5 ++ src/view/com/post-thread/PostThreadItem.tsx | 25 +------- src/view/com/util/post-ctrls/PostCtrls.tsx | 59 ++++++++++++++----- 4 files changed, 51 insertions(+), 39 deletions(-) create mode 100644 assets/icons/arrowOutOfBox_stroke2_corner0_rounded.svg create mode 100644 src/components/icons/ArrowOutOfBox.tsx diff --git a/assets/icons/arrowOutOfBox_stroke2_corner0_rounded.svg b/assets/icons/arrowOutOfBox_stroke2_corner0_rounded.svg new file mode 100644 index 00000000..2312ccd5 --- /dev/null +++ b/assets/icons/arrowOutOfBox_stroke2_corner0_rounded.svg @@ -0,0 +1 @@ + diff --git a/src/components/icons/ArrowOutOfBox.tsx b/src/components/icons/ArrowOutOfBox.tsx new file mode 100644 index 00000000..8b395016 --- /dev/null +++ b/src/components/icons/ArrowOutOfBox.tsx @@ -0,0 +1,5 @@ +import {createSinglePathSVG} from './TEMPLATE' + +export const ArrowOutOfBox_Stroke2_Corner0_Rounded = createSinglePathSVG({ + path: 'M12.707 3.293a1 1 0 0 0-1.414 0l-4.5 4.5a1 1 0 0 0 1.414 1.414L11 6.414v8.836a1 1 0 1 0 2 0V6.414l2.793 2.793a1 1 0 1 0 1.414-1.414l-4.5-4.5ZM5 12.75a1 1 0 1 0-2 0V20a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1v-7.25a1 1 0 1 0-2 0V19H5v-6.25Z', +}) diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index d11c2781..d3ca6f35 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -23,7 +23,6 @@ import {getTranslatorLink, isPostInLanguage} from '../../../locale/helpers' import {PostMeta} from '../util/PostMeta' import {PostEmbeds} from '../util/post-embeds' import {PostCtrls} from '../util/post-ctrls/PostCtrls' -import {PostDropdownBtn} from '../util/forms/PostDropdownBtn' import {PostHider} from '../util/moderation/PostHider' import {ContentHider} from '../util/moderation/ContentHider' import {PostAlerts} from '../util/moderation/PostAlerts' @@ -43,7 +42,6 @@ import {useModerationOpts} from '#/state/queries/preferences' import {useOpenLink} from '#/state/preferences/in-app-browser' import {Shadow, usePostShadow, POST_TOMBSTONE} from '#/state/cache/post-shadow' import {ThreadPost} from '#/state/queries/post-thread' -import {useSession} from '#/state/session' import {WhoCanReply} from '../threadgate/WhoCanReply' export function PostThreadItem({ @@ -162,7 +160,6 @@ let PostThreadItemLoaded = ({ const {_} = useLingui() const langPrefs = useLanguagePrefs() const {openComposer} = useComposerControls() - const {currentAccount} = useSession() const [limitLines, setLimitLines] = React.useState( () => countLines(richText?.text) >= MAX_POST_LINES, ) @@ -188,9 +185,6 @@ let PostThreadItemLoaded = ({ return makeProfileLink(post.author, 'post', urip.rkey, 'reposted-by') }, [post.uri, post.author]) const repostsTitle = _(msg`Reposts of this post`) - const isModeratedPost = - moderation.decisions.post.cause?.type === 'label' && - moderation.decisions.post.cause.label.src !== currentAccount?.did const translatorUrl = getTranslatorLink( record?.text || '', @@ -331,23 +325,6 @@ let PostThreadItemLoaded = ({ - )} - + { + const urip = new AtUri(post.uri) + const href = makeProfileLink(post.author, 'post', urip.rkey) + const url = toShareUrl(href) + shareUrl(url) + }, [post.uri, post.author]) + return ( - + - + - {big ? undefined : ( - - + {big && ( + + + + )} + + + ) } @@ -223,6 +249,9 @@ const styles = StyleSheet.create({ flex: 1, alignItems: 'flex-start', }, + ctrlBig: { + alignItems: 'center', + }, btn: { flexDirection: 'row', alignItems: 'center',