Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [IOCOM-868] Update SEND message header and content to the new design system #5431

Merged
merged 24 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7cced1c
add title, date and content
adelloste Jan 24, 2024
239d8d3
add tests
adelloste Jan 24, 2024
cd149ef
change text color
adelloste Jan 24, 2024
bcfcb8e
Update message timestamp and color
adelloste Jan 24, 2024
d430980
Merge branch 'master' into IOCOM-868-message-header
adelloste Jan 24, 2024
c8af535
update snap
adelloste Jan 24, 2024
aea34c5
fix test
adelloste Jan 24, 2024
aa5e92d
Merge branch 'master' into IOCOM-868-message-header
adelloste Jan 25, 2024
a78fdb1
Merge branch 'master' into IOCOM-868-message-header
adelloste Jan 25, 2024
710337a
Merge branch 'master' into IOCOM-868-message-header
Vangaorth Jan 26, 2024
64786f2
Merge branch 'master' into IOCOM-868-message-header
Vangaorth Jan 26, 2024
2bbc936
update header mode and options in PnStackNavigator and MessageDetails…
adelloste Jan 26, 2024
f3d4d40
Merge branch 'master' into IOCOM-868-message-header
adelloste Jan 26, 2024
1bee02a
Remove unused type
adelloste Jan 26, 2024
983145b
replace InfoScreenComponent
adelloste Jan 26, 2024
8eb6bb8
update import for ScrollView
adelloste Jan 26, 2024
868be80
add snap
adelloste Jan 26, 2024
3efbf44
add snap
adelloste Jan 26, 2024
c1099cb
add snap
adelloste Jan 26, 2024
51f31dc
Merge branch 'master' into IOCOM-868-message-header
adelloste Jan 26, 2024
186b15e
refactor goBack function
adelloste Jan 29, 2024
48773e3
update tests
adelloste Jan 29, 2024
c2eb487
Merge branch 'master' into IOCOM-868-message-header
adelloste Jan 29, 2024
75db4cf
Merge branch 'master' into IOCOM-868-message-header
Vangaorth Jan 29, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Divider, H3, LabelSmall, VSpacer } from "@pagopa/io-app-design-system";
import React, { PropsWithChildren } from "react";
import { StyleSheet, View } from "react-native";
import { localeDateFormat } from "../../../../utils/locale";
import I18n from "../../../../i18n";
import { ServicePublic } from "../../../../../definitions/backend/ServicePublic";

export type MessageDetailHeaderProps = PropsWithChildren<{
createdAt: Date;
subject: string;
sender?: string;
service?: ServicePublic;
}>;

const styles = StyleSheet.create({
header: {
paddingHorizontal: 24
}
});

const MessageHeaderContent = ({
subject,
createdAt
}: MessageDetailHeaderProps) => (
<>
<H3 testID="message-header-subject">{subject}</H3>
<VSpacer size={8} />
<LabelSmall fontSize="regular" color="grey-700">
{localeDateFormat(
createdAt,
I18n.t("global.dateFormats.fullFormatShortMonthLiteralWithTime")
)}
</LabelSmall>
</>
);

export const MessageDetailHeader = ({
children,
...rest
}: MessageDetailHeaderProps) => (
<View style={styles.header}>
{children}
<MessageHeaderContent {...rest} />
<VSpacer size={8} />
<Divider />
{/* TODO: Add MessageHeaderService */}
</View>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, { ComponentProps } from "react";
import { render } from "@testing-library/react-native";
import { MessageDetailHeader } from "../MessageDetailHeader";
import { ServicePublic } from "../../../../../../definitions/backend/ServicePublic";

const service = {
service_id: "serviceId",
service_name: "health",
organization_name: "Organization foo",
department_name: "Department one",
organization_fiscal_code: "OFSAAAAAA"
} as ServicePublic;

const defaultProps: ComponentProps<typeof MessageDetailHeader> = {
subject: "Subject",
createdAt: new Date("2021-10-18T16:00:30.541Z")
};

describe("MessageDetailHeader component", () => {
it("should match the snapshot with default props", () => {
const component = render(<MessageDetailHeader {...defaultProps} />);
expect(component.toJSON()).toMatchSnapshot();
});

it("should match the snapshot with all props", () => {
const component = render(
<MessageDetailHeader
{...defaultProps}
sender="Sender"
service={service}
/>
);
expect(component.toJSON()).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`MessageDetailHeader component should match the snapshot with all props 1`] = `
<View
style={
Object {
"paddingHorizontal": 24,
}
}
>
<Text
allowFontScaling={false}
color="bluegreyDark"
defaultColor="bluegreyDark"
defaultWeight="SemiBold"
font="TitilliumWeb"
fontStyle={
Object {
"fontSize": 24,
"lineHeight": 34,
}
}
style={
Array [
Object {
"fontSize": 24,
"lineHeight": 34,
},
Object {
"color": "#17324D",
"fontFamily": "Titillium Web",
"fontStyle": "normal",
"fontWeight": "600",
},
]
}
testID="message-header-subject"
weight="SemiBold"
>
Subject
</Text>
<View
style={
Object {
"height": 8,
}
}
/>
<Text
allowFontScaling={false}
color="grey-700"
defaultColor="blue"
defaultWeight="Bold"
font="TitilliumWeb"
fontSize="regular"
fontStyle={
Object {
"fontSize": 14,
"lineHeight": 21,
}
}
style={
Array [
Object {
"fontSize": 14,
"lineHeight": 21,
},
Object {
"color": "#555C70",
"fontFamily": "Titillium Web",
"fontStyle": "normal",
"fontWeight": "700",
},
]
}
weight="Bold"
>
18 Oct 2021, 16:00
</Text>
<View
style={
Object {
"height": 8,
}
}
/>
<View
style={
Object {
"backgroundColor": "#D2D6E3",
"height": 0.5,
}
}
/>
</View>
`;

exports[`MessageDetailHeader component should match the snapshot with default props 1`] = `
<View
style={
Object {
"paddingHorizontal": 24,
}
}
>
<Text
allowFontScaling={false}
color="bluegreyDark"
defaultColor="bluegreyDark"
defaultWeight="SemiBold"
font="TitilliumWeb"
fontStyle={
Object {
"fontSize": 24,
"lineHeight": 34,
}
}
style={
Array [
Object {
"fontSize": 24,
"lineHeight": 34,
},
Object {
"color": "#17324D",
"fontFamily": "Titillium Web",
"fontStyle": "normal",
"fontWeight": "600",
},
]
}
testID="message-header-subject"
weight="SemiBold"
>
Subject
</Text>
<View
style={
Object {
"height": 8,
}
}
/>
<Text
allowFontScaling={false}
color="grey-700"
defaultColor="blue"
defaultWeight="Bold"
font="TitilliumWeb"
fontSize="regular"
fontStyle={
Object {
"fontSize": 14,
"lineHeight": 21,
}
}
style={
Array [
Object {
"fontSize": 14,
"lineHeight": 21,
},
Object {
"color": "#555C70",
"fontFamily": "Titillium Web",
"fontStyle": "normal",
"fontWeight": "700",
},
]
}
weight="Bold"
>
18 Oct 2021, 16:00
</Text>
<View
style={
Object {
"height": 8,
}
}
/>
<View
style={
Object {
"backgroundColor": "#D2D6E3",
"height": 0.5,
}
}
/>
</View>
`;
46 changes: 46 additions & 0 deletions ts/features/pn/__mocks__/message.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { ThirdPartyMessageWithContent } from "../../../../definitions/backend/ThirdPartyMessageWithContent";
import { message_1 } from "../../messages/__mocks__/message";
import { ATTACHMENT_CATEGORY } from "../../messages/types/attachmentCategory";

export const thirdPartyMessage: ThirdPartyMessageWithContent = {
...message_1,
created_at: new Date("2020-01-01T00:00:00.000Z"),
third_party_message: {
details: {
abstract: "######## abstract ########",
attachments: [
{
messageId: message_1.id,
id: "1",
displayName: "A First Attachment",
contentType: "application/pdf",
category: ATTACHMENT_CATEGORY.DOCUMENT,
resourceUrl: { href: "/resource/attachment1.pdf" }
},
{
messageId: message_1.id,
id: "2",
displayName: "A Second Attachment",
contentType: "application/pdf",
category: ATTACHMENT_CATEGORY.DOCUMENT,
resourceUrl: { href: "/resource/attachment2.pdf" }
}
],
iun: "731143-7-0317-8200-0",
subject: "######## subject ########",
recipients: [
{
recipientType: "-",
taxId: "AAABBB00A00A000A",
denomination: "AaAaAa BbBbBb",
payment: {
noticeCode: "026773337463073118",
creditorTaxId: "00000000009"
}
}
],
notificationStatusHistory: [],
senderDenomination: "Sender denomination"
}
}
};
Loading
Loading