Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ts/features/pn/components/MessageBottomMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const styles = StyleSheet.create({

export type MessageBottomMenuProps = {
history: NotificationStatusHistory;
isAARMessage: boolean;
isCancelled?: boolean;
iun: string;
messageId: string;
Expand Down Expand Up @@ -133,6 +134,7 @@ const generateMessageSectionData = (
export const MessageBottomMenu = ({
history,
isCancelled,
isAARMessage,
iun,
messageId,
paidNoticeCodes,
Expand Down Expand Up @@ -162,7 +164,7 @@ export const MessageBottomMenu = ({
{ backgroundColor: IOColors[theme["appBackground-secondary"]] }
]}
>
<TimelineListItem history={history} />
<TimelineListItem hideFooter={isAARMessage} history={history} />
{(serviceMetadata?.email || serviceMetadata?.phone) && (
<ContactsListItem
email={serviceMetadata.email}
Expand Down
1 change: 1 addition & 0 deletions ts/features/pn/components/MessageDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const MessageDetails = ({
</ContentWrapper>
<MessageBottomMenu
history={message.notificationStatusHistory}
isAARMessage={isAARMessage}
isCancelled={message.isCancelled}
iun={message.iun}
messageId={messageId}
Expand Down
21 changes: 17 additions & 4 deletions ts/features/pn/components/TimelineListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ import { pnFrontendUrlSelector } from "../../../store/reducers/backendStatus/rem
import { Timeline, TimelineItemProps } from "./Timeline";

const topBottomSheetMargin = 122;
const timelineBottomMargin = 292;
const baseFooterHeightWithAlert = 181;
const timelineBottomMarginWithAlert = 288;
const timelineBottomMarginWithoutAlert = 128;
const timelineItemHeight = 70;

export type TimelineListItemProps = {
hideFooter: boolean;
history: NotificationStatusHistory;
};

Expand All @@ -41,8 +44,16 @@ const generateTimelineData = (
status: notificationStatusToTimelineStatus(historyItem.status)
}));

export const TimelineListItem = ({ history }: TimelineListItemProps) => {
const [footerHeight, setFooterHeight] = useState<number>(181);
export const TimelineListItem = ({
hideFooter,
history
}: TimelineListItemProps) => {
const baseFooterHeight = hideFooter ? 0 : baseFooterHeightWithAlert;
const [footerHeight, setFooterHeight] = useState<number>(baseFooterHeight);

const timelineBottomMargin = hideFooter
? timelineBottomMarginWithoutAlert
: timelineBottomMarginWithAlert;
const windowHeight = Dimensions.get("window").height;
const snapPoint = Math.min(
windowHeight - topBottomSheetMargin,
Expand All @@ -53,7 +64,7 @@ export const TimelineListItem = ({ history }: TimelineListItemProps) => {
const { bottomSheet, present } = useIOBottomSheetModal({
component: <Timeline data={timelineData} footerHeight={footerHeight} />,
title: I18n.t("features.pn.details.timeline.menuTitle"),
footer: (
footer: !hideFooter ? (
<View
onLayout={layoutChangeEvent =>
setFooterHeight(layoutChangeEvent.nativeEvent.layout.height)
Expand All @@ -76,6 +87,8 @@ export const TimelineListItem = ({ history }: TimelineListItemProps) => {
}}
/>
</View>
) : (
<View />
),
snapPoint: [snapPoint]
});
Expand Down
4 changes: 3 additions & 1 deletion ts/features/pn/components/__mocks__/MessageBottomMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MessageBottomMenuProps } from "../MessageBottomMenu";

export const MessageBottomMenu = ({
history,
isAARMessage,
isCancelled,
iun,
messageId,
Expand All @@ -26,7 +27,8 @@ export const MessageBottomMenu = ({
<View>{`${pieceOfHistory.status}`}</View>
</View>
))}
{isCancelled && <View>{isCancelled}</View>}
{isAARMessage && <View>{`${isAARMessage}`}</View>}
{isCancelled && <View>{`${isCancelled}`}</View>}
<View>{iun}</View>
<View>{messageId}</View>
{paidNoticeCodes &&
Expand Down
6 changes: 5 additions & 1 deletion ts/features/pn/components/__mocks__/TimelineListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { View } from "react-native";
import { TimelineListItemProps } from "../TimelineListItem";

export const TimelineListItem = ({ history }: TimelineListItemProps) => (
export const TimelineListItem = ({
hideFooter,
history
}: TimelineListItemProps) => (
<>
{history.map((pieceOfHistory, index) => (
<View key={`poh_${index}`}>
Expand All @@ -17,5 +20,6 @@ export const TimelineListItem = ({ history }: TimelineListItemProps) => (
<View>{pieceOfHistory.status}</View>
</View>
))}
<View>{`${hideFooter}`}</View>
</>
);
Loading
Loading