Skip to content

Commit cca96c3

Browse files
authored
[Platform]: update footer to dissplay API version and homebox to show data iteration (#853)
1 parent fc4a46d commit cca96c3

File tree

3 files changed

+40
-9
lines changed

3 files changed

+40
-9
lines changed

apps/platform/src/pages/HomePage/Version.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Link, useAPIMetadata } from "ui";
55
interface VersionData {
66
month: number;
77
year: number;
8+
iteration: string;
89
}
910

1011
function getVersion({ month, year }: VersionData): string {
@@ -33,12 +34,14 @@ interface VersionLinkProps {
3334
year: number;
3435
version: string;
3536
link: string;
37+
iteration: string;
3638
}
3739

38-
function VersionLink({ month, year, version, link }: VersionLinkProps): JSX.Element {
40+
function VersionLink({ month, year, version, iteration, link }: VersionLinkProps): JSX.Element {
41+
const parsedIteration = iteration && iteration !== "" ? `.${iteration}` : "";
3942
return (
4043
<Link external to={link}>
41-
{month} 20{year} ({version})
44+
{month} 20{year} ({version}{parsedIteration})
4245
</Link>
4346
);
4447
}
@@ -65,13 +68,13 @@ function Version({
6568
const { month, year } = version;
6669

6770
const parsedVersion = getVersion({ month, year });
68-
const fullMonth = getFullMonth({ month, year });
71+
const fullMonth = getFullMonth({ month, year });;
6972

7073
return (
7174
<VersionContainer>
7275
<Typography variant="body2">
7376
Last update:{" "}
74-
<VersionLink link={releaseNotesURL} month={fullMonth} year={year} version={parsedVersion} />
77+
<VersionLink link={releaseNotesURL} month={fullMonth} year={year} version={parsedVersion} iteration={version.iteration} />
7578
</Typography>
7679
</VersionContainer>
7780
);

packages/ui/src/components/Footer.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { EmailLink } from "./EmailLink";
88

99
import PrivateWrapper from "./PrivateWrapper";
1010
import { useConfigContext } from "../providers/ConfigurationProvider";
11+
import { useAPIMetadata } from "../providers/APIMetadataProvider";
1112

1213
const FOOTER_BACKGROUND_COLOR = "#2e2d35";
1314

@@ -197,11 +198,13 @@ const LicenseCC0 = ({ link }: LicenseCC0Props) => {
197198
);
198199
};
199200

200-
const UIVersion = () => {
201+
const DeployedVersion = () => {
201202
const { config } = useConfigContext();
203+
const { version: { apiVersion } } = useAPIMetadata();
202204
return (
203205
<Typography color="inherit" variant="caption">
204-
<b>{config?.gitVersion}</b>
206+
<b>UI: </b>{config?.gitVersion}<br/>
207+
<b>API: </b>{apiVersion.x}.{apiVersion.y}.{apiVersion.z}
205208
</Typography>
206209
);
207210
};
@@ -224,7 +227,7 @@ const Footer = ({ externalLinks }: FooterProps) => {
224227
<Grid item container xs={12} md={10} spacing={2}>
225228
<FooterSection heading="About" links={externalLinks.about}>
226229
<LicenseCC0 link={externalLinks.license} />
227-
<UIVersion />
230+
<DeployedVersion />
228231
</FooterSection>
229232
<FooterSection heading="Help" links={externalLinks.help} social={externalLinks.social} />
230233
<FooterSection heading="Partners" links={externalLinks.partners} />

packages/ui/src/providers/APIMetadataProvider.tsx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,50 @@ const DATA_VERSION_QUERY = gql`
88
dataVersion {
99
month
1010
year
11+
iteration
12+
}
13+
apiVersion {
14+
x
15+
y
16+
z
1117
}
1218
}
1319
}
1420
`;
1521

22+
type APIVersion = {
23+
x: string;
24+
y: string;
25+
z: string;
26+
};
27+
1628
type Version = {
1729
month: string;
1830
year: string;
31+
iteration: string;
1932
loading: boolean;
2033
error: ApolloError | null;
21-
};
34+
apiVersion: APIVersion;
35+
};
2236

2337
type ContextType = {
2438
version: Version;
2539
};
2640

41+
const initialAPIVersion: APIVersion = {
42+
x: "0",
43+
y: "0",
44+
z: "0",
45+
};
46+
2747
const initialState: ContextType = {
2848
version: {
2949
loading: false,
3050
error: null,
3151
month: "0",
3252
year: "0",
53+
iteration: "0",
54+
apiVersion: initialAPIVersion,
3355
},
3456
};
3557
export const APIMetadataContext = createContext<ContextType | undefined>(undefined);
@@ -51,7 +73,8 @@ export const APIMetadataProvider = ({ children }: PropsWithChildren): JSX.Elemen
5173
}
5274
const {
5375
meta: {
54-
dataVersion: { month, year },
76+
dataVersion: { month, year, iteration },
77+
apiVersion: apiVersion,
5578
},
5679
} = data;
5780

@@ -60,6 +83,8 @@ export const APIMetadataProvider = ({ children }: PropsWithChildren): JSX.Elemen
6083
error: null,
6184
month: month,
6285
year: year,
86+
iteration: iteration,
87+
apiVersion: apiVersion,
6388
});
6489
}, [data, loading, error]);
6590

0 commit comments

Comments
 (0)