This commit is contained in:
Eric Bailey
2024-10-23 12:35:04 -05:00
parent 7a14f82b03
commit fa9c020047
4 changed files with 38 additions and 6 deletions
+4
View File
@@ -46,6 +46,7 @@ export type FeedSourceFeedInfo = {
name: string
params: Record<string, string>
}
did: string
cid: string
avatar: string | undefined
displayName: string
@@ -65,6 +66,7 @@ export type FeedSourceListInfo = {
name: string
params: Record<string, string>
}
did: unknown
cid: string
avatar: string | undefined
displayName: string
@@ -99,6 +101,7 @@ export function hydrateFeedGenerator(
type: 'feed',
uri: view.uri,
feedDescriptor: `feedgen|${view.uri}`,
did: view.did,
cid: view.cid,
route: {
href,
@@ -136,6 +139,7 @@ export function hydrateList(view: AppBskyGraphDefs.ListView): FeedSourceInfo {
name: route[0],
params: route[1],
},
did: view.did,
cid: view.cid,
avatar: view.avatar,
description: new RichText({
+11 -5
View File
@@ -141,8 +141,10 @@ export const ComposePost = ({
imageUris: initImageUris,
videoUri: initVideoUri,
cancelRef,
initFeeds,
}: Props & {
cancelRef?: React.RefObject<CancelRef>
initFeeds?: string[]
}) => {
const {currentAccount} = useSession()
const agent = useAgent()
@@ -175,7 +177,7 @@ export const ComposePost = ({
initText,
initMention,
initOutlineTags: [],
initFeeds: [],
initFeeds: initFeeds || [],
},
createComposerState,
)
@@ -537,6 +539,7 @@ export const ComposePost = ({
const [showOutlineTags, setShowOutlineTags] = useState(false)
const outlineTagsVisible = showOutlineTags || draft.tags.length > 0
const [showFeeds, setShowFeeds] = useState(false)
const feedsAreVisible = showFeeds || draft.feeds.length > 0
const {
scrollHandler,
@@ -793,7 +796,7 @@ export const ComposePost = ({
</View>
)}
{showFeeds && (
{feedsAreVisible && (
<View style={[a.px_lg]}>
<Divider />
<View style={[a.flex_row, a.gap_xs, a.pt_sm, a.pb_md]}>
@@ -806,7 +809,10 @@ export const ComposePost = ({
<FeedsIcon size="md" />
</View>
<View style={[a.flex_1]}>
<FeedsSelector onChangeFeeds={onChangeFeeds} />
<FeedsSelector
initialFeeds={draft.feeds}
onChangeFeeds={onChangeFeeds}
/>
</View>
</View>
</View>
@@ -863,9 +869,9 @@ export const ComposePost = ({
</Button>
)}
{!showFeeds && (
{!feedsAreVisible && (
<Button
label={_(msg`Add tags`)}
label={_(msg`Add feeds to submit to`)}
size="small"
variant="solid"
color="secondary"
+22 -1
View File
@@ -51,10 +51,11 @@ import {Text} from '#/view/com/util/text/Text'
import * as Toast from '#/view/com/util/Toast'
import {CenteredView} from '#/view/com/util/Views'
import {atoms as a, useTheme} from '#/alf'
import {Button as NewButton, ButtonText} from '#/components/Button'
import {Button as NewButton, ButtonIcon, ButtonText} from '#/components/Button'
import {useRichText} from '#/components/hooks/useRichText'
import {ArrowOutOfBox_Stroke2_Corner0_Rounded as Share} from '#/components/icons/ArrowOutOfBox'
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
import {EditBig_Stroke2_Corner0_Rounded as EditBig} from '#/components/icons/EditBig'
import {
Heart2_Filled_Stroke2_Corner0_Rounded as HeartFilled,
Heart2_Stroke2_Corner0_Rounded as HeartOutline,
@@ -266,6 +267,9 @@ export function ProfileFeedScreenInner({
},
[feedSectionRef],
)
const isFeedSubmittable =
feedInfo.creatorDid === currentAccount?.did &&
feedInfo.did === 'did:web:feeed.club'
const renderHeader = useCallback(() => {
return (
@@ -283,6 +287,21 @@ export function ProfileFeedScreenInner({
}
avatarType="algo">
<View style={[a.flex_row, a.align_center, a.gap_sm]}>
{isFeedSubmittable && (
<NewButton
size="small"
variant="solid"
color="primary"
shape="round"
label={_(msg`Add post to feed`)}
onPress={() =>
openComposer({
initFeeds: [feedInfo.uri],
})
}>
<ButtonIcon icon={EditBig} />
</NewButton>
)}
{feedInfo && hasSession && (
<NewButton
testID={isPinned ? 'unpinBtn' : 'pinBtn'}
@@ -391,6 +410,8 @@ export function ProfileFeedScreenInner({
onPressShare,
t,
isPending,
isFeedSubmittable,
openComposer,
])
return (
+1
View File
@@ -100,6 +100,7 @@ function Inner({state}: {state: ComposerOpts}) {
openEmojiPicker={onOpenPicker}
text={state.text}
imageUris={state.imageUris}
initFeeds={state.initFeeds}
/>
</View>
<EmojiPicker state={pickerState} close={onClosePicker} />