diff --git a/apps/cowswap-frontend/src/legacy/components/Header/URLWarning/index.tsx b/apps/cowswap-frontend/src/legacy/components/Header/URLWarning/index.tsx index f55aa91613..848ddefce4 100644 --- a/apps/cowswap-frontend/src/legacy/components/Header/URLWarning/index.tsx +++ b/apps/cowswap-frontend/src/legacy/components/Header/URLWarning/index.tsx @@ -1,5 +1,4 @@ -import { useFetchFile } from '@cowprotocol/common-hooks' -import { environmentName, hashCode, isInjectedWidget } from '@cowprotocol/common-utils' +import { hashCode, isInjectedWidget } from '@cowprotocol/common-utils' import { SupportedChainId as ChainId } from '@cowprotocol/cow-sdk' import { ClosableBanner } from '@cowprotocol/ui' import { useWalletInfo } from '@cowprotocol/wallet' @@ -11,16 +10,9 @@ import { GlobalWarning } from 'common/pure/GlobalWarning' import { markdownComponents } from '../../Markdown/components' -// Announcement content: Modify this repository to edit the announcement -const ANNOUNCEMENTS_MARKDOWN_BASE_URL = 'https://raw.githubusercontent.com/cowprotocol/cowswap-banner/main' // const BANNER_STORAGE_KEY = 'announcementBannerClosed/' -const PRODUCTION_ENVS: (typeof environmentName)[] = ['production', 'staging', 'ens'] - -function getAnnouncementUrl(chainId: number, env?: 'production' | 'barn') { - return `${ANNOUNCEMENTS_MARKDOWN_BASE_URL}${env ? `/${env}` : ''}/announcements-${chainId}.md` -} function useGetCmsAnnouncement(chainId: number): string | undefined { const critical = useCriticalAnnouncements(chainId) @@ -40,30 +32,6 @@ function useGetCmsAnnouncement(chainId: number): string | undefined { return } -// TODO: should it be kept as a fallback? -function useGetAnnouncement(chainId: number): string | undefined { - const env = PRODUCTION_ENVS.includes(environmentName) ? 'production' : 'barn' - - // Fetches global announcement - const { file, error } = useFetchFile(getAnnouncementUrl(chainId)) - // Fetches env announcement - const { file: envFile, error: envError } = useFetchFile(getAnnouncementUrl(chainId, env)) - - const announcementText = error ? undefined : file?.trim() - - if (error) { - console.error('[URLWarning] Error getting the announcement text: ', error) - } - - const envAnnouncementText = envError ? undefined : envFile?.trim() - - if (envError) { - console.error(`[URLWarning] Error getting the env ${env} announcement text: `, envError) - } - - return announcementText || envAnnouncementText -} - export function URLWarning() { const { chainId = ChainId.MAINNET } = useWalletInfo()