From 6a1a59d72caf7e2361ccf05cefbb84f528926358 Mon Sep 17 00:00:00 2001 From: Sergey Cherebedov Date: Fri, 1 Nov 2024 20:50:02 +0700 Subject: [PATCH] Fix hide blocked resources (#299) --- package-lock.json | 4 +-- package.json | 2 +- src/components/Header/Header.tsx | 8 ++---- src/components/Link/Link.tsx | 43 +++++++--------------------- src/components/Pages/About/About.tsx | 17 ++++------- src/custom.d.ts | 1 + src/hooks/useCookie.ts | 14 --------- 7 files changed, 23 insertions(+), 66 deletions(-) delete mode 100644 src/hooks/useCookie.ts diff --git a/package-lock.json b/package-lock.json index 9f1957347..028352945 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "interslavic", - "version": "1.20.4", + "version": "1.21.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "interslavic", - "version": "1.20.4", + "version": "1.21.0", "license": "MIT", "dependencies": { "@ag-grid-community/client-side-row-model": "25.2.0", diff --git a/package.json b/package.json index 9d24f4f6b..a9d941445 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interslavic", - "version": "1.20.4", + "version": "1.21.0", "license": "MIT", "description": "Interslavic Dictionary", "author": "Sergey Cherebedov", diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 7ab8ccf5e..558393178 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; import { useDispatch } from 'react-redux'; import { t } from 'translations'; @@ -12,8 +12,6 @@ import { useInterfaceLang } from 'hooks/useInterfaceLang'; import { usePage } from 'hooks/usePage'; import { defaultPages, pages } from 'routing'; -import { useCookie } from "../../hooks/useCookie"; - import './Header.scss'; import LogoIcon from './images/logo-icon.svg'; @@ -31,8 +29,6 @@ export const Header = const enabledPages = useEnabledPages(); const navRef = useRef(); const logoRef = useRef(); - const countryCode = useCookie('country') - const isRU = useMemo(() => countryCode === 'RU', [countryCode]) const onResize = useCallback(() => { if (navRef && navRef.current && logoRef && logoRef.current) { @@ -94,7 +90,7 @@ export const Header = > {pages .filter(({ value }) => { - if (value === 'community' && isRU) { + if (value === 'community' && IS_COM) { return false } diff --git a/src/components/Link/Link.tsx b/src/components/Link/Link.tsx index 9b69e1a77..691e624cf 100644 --- a/src/components/Link/Link.tsx +++ b/src/components/Link/Link.tsx @@ -1,5 +1,4 @@ import classNames from 'classnames'; -import { useEffect, useState } from 'react'; import './Link.scss'; @@ -23,36 +22,16 @@ export const Link = ( }: ILinkProps, ) => { const clsName = classNames(['link', className]); - const [isAvailable, setAvailable] = useState(false); - useEffect(() => { - try { - fetch(href, { - mode: 'no-cors', - cache: 'no-cache', - }).then((res) => { - if (res) { - setAvailable(true); - } - }); - } catch (err) { - - } - }, [href, setAvailable]); - - if (isAvailable) { - return ( - - {children} - - ); - } - - return null; + return ( + + {children} + + ); }; diff --git a/src/components/Pages/About/About.tsx b/src/components/Pages/About/About.tsx index ba87cdf29..0f92021b8 100644 --- a/src/components/Pages/About/About.tsx +++ b/src/components/Pages/About/About.tsx @@ -1,10 +1,7 @@ -import { useMemo } from "react"; - import { tablesData } from 'consts'; import { t } from 'translations'; -import { useCookie } from "hooks/useCookie"; import { getTablePublicUrl } from 'utils/getTablePublicUrl'; import { Link } from 'components/Link'; @@ -14,8 +11,6 @@ import './About.scss'; export const About = () => { const worksheetUrl = getTablePublicUrl(tablesData[0].spreadsheetId, tablesData[0].sheetId); - const countryCode = useCookie('country') - const isRU = useMemo(() => countryCode === 'RU', [countryCode]) const email = 'cherebedov.sergey@gmail.com'; const github = 'https://github.com/sonic16x/interslavic'; const source = 'http://steen.free.fr/interslavic'; @@ -42,11 +37,11 @@ export const About =
{t('aboutAuthorSergeyCherebedov')}: GitHub - {!isRU && ( + {IS_COM && ( LinkedIn )} - {!isRU && ( + {IS_COM && ( {t('aboutAuthorDenisShabalin')}: GitHub - {!isRU && ( + {IS_COM && (
{t('aboutOurFriends')}
- {!isRU && ( + {IS_COM && ( )} - {!isRU && ( + {IS_COM && ( */} - {!isRU && ( + {IS_COM && ( { - const value = `; ${document.cookie}`; - const parts = value.split(`; ${name}=`); - - if (parts.length === 2) { - return parts.pop().split(';').shift(); - } - - return '' - }, name) -}