Skip to content

Commit

Permalink
Merge pull request #3973 from tloncorp/po/tlon-2756-move-channel-add-…
Browse files Browse the repository at this point in the history
…button-to-header

move the 'add' button in notebook/gallery to header
  • Loading branch information
patosullivan authored Oct 1, 2024
2 parents 4eeba6d + 59fd83b commit c674414
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
13 changes: 13 additions & 0 deletions packages/ui/src/components/Channel/ChannelHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export function ChannelHeader({
goBack,
goToSearch,
showSpinner,
showAddButton = false,
onPressAddButton,
showSearchButton = true,
showMenuButton = false,
}: {
Expand All @@ -25,6 +27,8 @@ export function ChannelHeader({
goBack?: () => void;
goToSearch?: () => void;
showSpinner?: boolean;
showAddButton?: boolean;
onPressAddButton?: () => void;
showSearchButton?: boolean;
showMenuButton?: boolean;
post?: db.Post;
Expand Down Expand Up @@ -56,6 +60,15 @@ export function ChannelHeader({
<Icon type="Search" />
</Button>
)}
{showAddButton && (
<Button
backgroundColor="unset"
borderColor="transparent"
onPress={onPressAddButton}
>
<Icon type="Add" />
</Button>
)}
{showMenuButton && (
<Button
backgroundColor="unset"
Expand Down
36 changes: 8 additions & 28 deletions packages/ui/src/components/Channel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ export function Channel({
showBigInput ? bigInputGoBack() : goBack()
}
showSearchButton={isChatChannel}
showAddButton={
!isChatChannel && canWrite && !showBigInput
}
onPressAddButton={() =>
channel.type === 'gallery'
? setShowAddGalleryPost(true)
: setShowBigInput(true)
}
goToSearch={goToSearch}
showSpinner={isLoadingPosts}
showMenuButton={true}
Expand Down Expand Up @@ -395,34 +403,6 @@ export function Channel({
showAttachmentButton={channel.type !== 'gallery'}
/>
)}
{!isChatChannel && canWrite && !showBigInput && (
<View
position="absolute"
bottom={bottom}
flex={1}
width="100%"
alignItems="center"
>
{channel.type === 'gallery' &&
(showAddGalleryPost ||
isUploadingGalleryImage) ? null : (
<FloatingActionButton
onPress={() =>
channel.type === 'gallery'
? setShowAddGalleryPost(true)
: setShowBigInput(true)
}
icon={
<Icon
type="Add"
size={'$s'}
marginRight={'$s'}
/>
}
/>
)}
</View>
)}
{!negotiationMatch && isChatChannel && canWrite && (
<NegotionMismatchNotice />
)}
Expand Down

0 comments on commit c674414

Please sign in to comment.