diff --git a/.changeset/stupid-pens-occur.md b/.changeset/stupid-pens-occur.md
new file mode 100644
index 0000000000..5ddac159a1
--- /dev/null
+++ b/.changeset/stupid-pens-occur.md
@@ -0,0 +1,7 @@
+---
+'@backstage/core-app-api': patch
+'@backstage/core-components': patch
+'@backstage/plugin-config-schema': patch
+---
+
+Removed the `HomepageTimer` and its related config as it has been replaced by the `HeaderWorldClock` in the Home plugin and was deprecated over a year ago
diff --git a/app-config.yaml b/app-config.yaml
index 57349d213a..977b07612f 100644
--- a/app-config.yaml
+++ b/app-config.yaml
@@ -420,16 +420,6 @@ costInsights:
kind: 'PINTS_OF_ICE_CREAM'
unit: 'ice cream pint'
rate: 5.5
-homepage:
- clocks:
- - label: UTC
- timezone: UTC
- - label: NYC
- timezone: 'America/New_York'
- - label: STO
- timezone: 'Europe/Stockholm'
- - label: TYO
- timezone: 'Asia/Tokyo'
pagerduty:
eventsBaseUrl: 'https://events.pagerduty.com/v2'
jenkins:
diff --git a/packages/core-app-api/config.d.ts b/packages/core-app-api/config.d.ts
index d88c818d11..77778ef4f3 100644
--- a/packages/core-app-api/config.d.ts
+++ b/packages/core-app-api/config.d.ts
@@ -89,15 +89,6 @@ export interface Config {
name?: string;
};
- homepage?: {
- clocks?: Array<{
- /** @visibility frontend */
- label: string;
- /** @visibility frontend */
- timezone: string;
- }>;
- };
-
/**
* Configuration that provides information on available configured authentication providers.
*/
diff --git a/packages/core-components/api-report.md b/packages/core-components/api-report.md
index 9587a32ab5..fc3ab4e5fc 100644
--- a/packages/core-components/api-report.md
+++ b/packages/core-components/api-report.md
@@ -495,9 +495,6 @@ export type HeaderTabsClassKey =
// @public (undocumented)
export function HelpIcon(props: IconComponentProps): JSX.Element;
-// @public @deprecated
-export function HomepageTimer(_props: {}): JSX.Element | null;
-
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
//
// @public
diff --git a/packages/core-components/src/layout/HomepageTimer/HomepageTimer.test.tsx b/packages/core-components/src/layout/HomepageTimer/HomepageTimer.test.tsx
deleted file mode 100644
index 9a7a8ac47d..0000000000
--- a/packages/core-components/src/layout/HomepageTimer/HomepageTimer.test.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2021 The Backstage Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- renderWithEffects,
- TestApiProvider,
- withLogCollector,
-} from '@backstage/test-utils';
-import { HomepageTimer } from './HomepageTimer';
-import React from 'react';
-import { lightTheme } from '@backstage/theme';
-import { ThemeProvider } from '@material-ui/core/styles';
-import { ConfigReader } from '@backstage/core-app-api';
-import { ConfigApi, configApiRef } from '@backstage/core-plugin-api';
-
-it('changes default timezone to GMT', async () => {
- const configApi: ConfigApi = new ConfigReader({
- homepage: {
- clocks: [
- {
- label: 'New York',
- timezone: 'America/New_Pork',
- },
- ],
- },
- context: 'test',
- });
-
- const { warn } = await withLogCollector(async () => {
- const rendered = await renderWithEffects(
-
-
-
-
- ,
- );
-
- expect(rendered.getByText('GMT')).toBeInTheDocument();
- });
- expect(warn).toEqual([
- 'The timezone America/New_Pork is invalid. Defaulting to GMT',
- ]);
-});
diff --git a/packages/core-components/src/layout/HomepageTimer/HomepageTimer.tsx b/packages/core-components/src/layout/HomepageTimer/HomepageTimer.tsx
deleted file mode 100644
index 71e764987b..0000000000
--- a/packages/core-components/src/layout/HomepageTimer/HomepageTimer.tsx
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2020 The Backstage Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import React from 'react';
-import { HeaderLabel } from '../HeaderLabel';
-import { ConfigApi, useApi, configApiRef } from '@backstage/core-plugin-api';
-
-const timeFormat: Intl.DateTimeFormatOptions = {
- hour: '2-digit',
- minute: '2-digit',
-};
-
-type TimeObj = {
- time: string;
- label: string;
-};
-
-function getTimes(configApi: ConfigApi) {
- const d = new Date();
- const lang = window.navigator.language;
-
- const clocks: TimeObj[] = [];
-
- if (!configApi.has('homepage.clocks')) {
- return clocks;
- }
-
- const clockConfigs = configApi.getConfigArray('homepage.clocks');
-
- for (const clock of clockConfigs) {
- if (clock.has('label') && clock.has('timezone')) {
- let label = clock.getString('label');
-
- const options: Intl.DateTimeFormatOptions = {
- timeZone: clock.getString('timezone'),
- ...timeFormat,
- };
-
- try {
- new Date().toLocaleString(lang, options);
- } catch (e) {
- // eslint-disable-next-line no-console
- console.warn(
- `The timezone ${options.timeZone} is invalid. Defaulting to GMT`,
- );
- options.timeZone = 'GMT';
- label = 'GMT';
- }
-
- const time = d.toLocaleTimeString(lang, options);
- clocks.push({ time, label });
- }
- }
- return clocks;
-}
-
-/**
- * Please use the HeaderWorldClock in the home plugin
- *
- * @public
- * @deprecated in favor of the HeaderWorldClock which is found in the to home plugin
- */
-export function HomepageTimer(_props: {}) {
- const configApi = useApi(configApiRef);
-
- const defaultTimes: TimeObj[] = [];
- const [clocks, setTimes] = React.useState(defaultTimes);
-
- React.useEffect(() => {
- setTimes(getTimes(configApi));
-
- const intervalId = setInterval(() => {
- setTimes(getTimes(configApi));
- }, 1000);
-
- return () => {
- clearInterval(intervalId);
- };
- }, [configApi]);
-
- if (clocks.length !== 0) {
- return (
- <>
- {clocks.map(clock => (
-
- ))}
- >
- );
- }
- return null;
-}
diff --git a/packages/core-components/src/layout/HomepageTimer/index.ts b/packages/core-components/src/layout/HomepageTimer/index.ts
deleted file mode 100644
index bc004fc757..0000000000
--- a/packages/core-components/src/layout/HomepageTimer/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright 2020 The Backstage Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { HomepageTimer } from './HomepageTimer';
diff --git a/packages/core-components/src/layout/index.ts b/packages/core-components/src/layout/index.ts
index 4b594f0e94..a024cfbbc4 100644
--- a/packages/core-components/src/layout/index.ts
+++ b/packages/core-components/src/layout/index.ts
@@ -23,7 +23,6 @@ export * from './Header';
export * from './HeaderActionMenu';
export * from './HeaderLabel';
export * from './HeaderTabs';
-export * from './HomepageTimer';
export * from './InfoCard';
export * from './ItemCard';
export * from './Page';
diff --git a/plugins/config-schema/dev/example-schema.json b/plugins/config-schema/dev/example-schema.json
index 86f05d500d..bb90595340 100644
--- a/plugins/config-schema/dev/example-schema.json
+++ b/plugins/config-schema/dev/example-schema.json
@@ -499,28 +499,6 @@
}
}
},
- "homepage": {
- "type": "object",
- "properties": {
- "clocks": {
- "type": "array",
- "items": {
- "type": "object",
- "required": ["label", "timezone"],
- "properties": {
- "label": {
- "visibility": "frontend",
- "type": "string"
- },
- "timezone": {
- "visibility": "frontend",
- "type": "string"
- }
- }
- }
- }
- }
- },
"integrations": {
"description": "Configuration for integrations towards various external repository provider systems",
"type": "object",