From b04e24e16c51789b2a22a02cc130cb5190b7d996 Mon Sep 17 00:00:00 2001 From: Maks <41080668+Maks19@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:40:37 +0300 Subject: [PATCH] add default preview (#1213) --- packages/web-app/public/index.html | 9 ++++++++- packages/web-app/src/hooks/useAddOgMetaTags.tsx | 12 ++---------- .../storefront-views/pages/StorefrontPage.tsx | 9 --------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/packages/web-app/public/index.html b/packages/web-app/public/index.html index da68598aa..a426a7cb2 100644 --- a/packages/web-app/public/index.html +++ b/packages/web-app/public/index.html @@ -13,7 +13,14 @@ - + + + + + + + + Salad diff --git a/packages/web-app/src/hooks/useAddOgMetaTags.tsx b/packages/web-app/src/hooks/useAddOgMetaTags.tsx index 1a004ce1a..b26d4cfcc 100644 --- a/packages/web-app/src/hooks/useAddOgMetaTags.tsx +++ b/packages/web-app/src/hooks/useAddOgMetaTags.tsx @@ -1,18 +1,10 @@ import { useEffect } from 'react' -const defaultOgMetaTags: Record = { - url: window.location.href, - type: 'website', - image: `${window.location.origin}/og-official-store.png`, - 'image:alt': 'Salad', -} - export const useAddOgMetaTags = (ogMetaTags: Record) => { useEffect(() => { - const combinedOgMetaTags = { ...defaultOgMetaTags, ...ogMetaTags } - Object.keys(combinedOgMetaTags).forEach((ogMetaTagPropertyName) => { + Object.keys(ogMetaTags).forEach((ogMetaTagPropertyName) => { const ogMetaTag = document.querySelector(`meta[property='og:${ogMetaTagPropertyName}']`) - const ogMetaTagContent = combinedOgMetaTags[ogMetaTagPropertyName] as string + const ogMetaTagContent = ogMetaTags[ogMetaTagPropertyName] as string if (ogMetaTag) { ogMetaTag.setAttribute('content', ogMetaTagContent) diff --git a/packages/web-app/src/modules/storefront-views/pages/StorefrontPage.tsx b/packages/web-app/src/modules/storefront-views/pages/StorefrontPage.tsx index d491d1b2e..9075cdb95 100644 --- a/packages/web-app/src/modules/storefront-views/pages/StorefrontPage.tsx +++ b/packages/web-app/src/modules/storefront-views/pages/StorefrontPage.tsx @@ -1,7 +1,6 @@ import type { WithStyles } from 'react-jss' import withStyles from 'react-jss' import { Head, Scrollbar } from '../../../components' -import { useAddOgMetaTags } from '../../../hooks/useAddOgMetaTags' import { NotificationBannerContainer } from '../../home-views/NotificationBannerContainer' import type { StorefrontCommunityChallengeProps, @@ -32,14 +31,6 @@ interface Props extends WithStyles { } const _StorefrontPage = ({ data, classes }: Props) => { - const ogMetaTags = { - title: 'Salad - Official Store', - description: - 'Salad helps you earn your way to new Steam Games, Discord Nitro, gift cards, and more from the Salad Storefront. You can even send Salad Balance to PayPal and redeem digital Visa and Mastercard that can be used worldwide!', - 'image:alt': 'Salad - Official Store', - } - useAddOgMetaTags(ogMetaTags) - return (