Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide blocked resources #297

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classNames from 'classnames';
import { useCallback, useEffect, useRef, useState } from 'react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useDispatch } from 'react-redux';

import { t } from 'translations';
Expand All @@ -12,6 +12,8 @@ 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';
Expand All @@ -29,6 +31,8 @@ export const Header =
const enabledPages = useEnabledPages();
const navRef = useRef<HTMLDivElement>();
const logoRef = useRef<HTMLDivElement>();
const countryCode = useCookie('country')
const isRU = useMemo(() => countryCode === 'RU', [countryCode])

const onResize = useCallback(() => {
if (navRef && navRef.current && logoRef && logoRef.current) {
Expand Down Expand Up @@ -89,7 +93,13 @@ export const Header =
ref={navRef}
>
{pages
.filter(({ value }) => (defaultPages.includes(value) || enabledPages.includes(value)))
.filter(({ value }) => {
if (value === 'community' && isRU) {
return false
}

return (defaultPages.includes(value) || enabledPages.includes(value))
})
.map((({ title, value, subTitle }) => (
<MenuItem
key={value}
Expand Down
108 changes: 63 additions & 45 deletions src/components/Pages/About/About.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
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';
Expand All @@ -11,6 +14,8 @@ 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 = '[email protected]';
const github = 'https://github.com/sonic16x/interslavic';
const source = 'http://steen.free.fr/interslavic';
Expand All @@ -37,27 +42,34 @@ export const About =
<div className="about-page__author">
{t('aboutAuthorSergeyCherebedov')}:
<a target="_blank" rel="noreferrer" href="https://github.com/sonic16x">GitHub</a>
<a target="_blank" rel="noreferrer" href="https://www.linkedin.com/in/scherebedov/">LinkedIn</a>
<Link
href="https://www.facebook.com/profile.php?id=100009366550621"
target="_blank"
rel="noreferrer"
>
Facebook
</Link>
{!isRU && (
<a target="_blank" rel="noreferrer"
href="https://www.linkedin.com/in/scherebedov/">LinkedIn</a>
)}
{!isRU && (
<Link
href="https://www.facebook.com/profile.php?id=100009366550621"
target="_blank"
rel="noreferrer"
>
Facebook
</Link>
)}
<a target="_blank" rel="noreferrer" href={`email:${email}`}>{email}</a>
</div>
<h6>{t('aboutDeveloperCoauthors')}</h6>
<div className="about-page__author">
{t('aboutAuthorDenisShabalin')}:
<a target="_blank" rel="noreferrer" href="https://github.com/ru-danko">GitHub</a>
<Link
href="https://www.facebook.com/d.y.shabalin"
target="_blank"
rel="noreferrer"
>
Facebook
</Link>
{!isRU && (
<Link
href="https://www.facebook.com/d.y.shabalin"
target="_blank"
rel="noreferrer"
>
Facebook
</Link>
)}
</div>
<div className="about-page__author">
{t('aboutAuthorJaroslavSerhieiev')}:
Expand All @@ -73,22 +85,26 @@ export const About =
<hr/>
<h6>{t('aboutOurFriends')}</h6>
<div className="about-page__community-links">
<Link
title="Interslavic Facebook"
href="https://www.facebook.com/groups/interslavic"
target="_blank"
rel="noreferrer"
>
Facebook community
</Link>
<a
title="Interslavic Discord"
href="https://discord.com/invite/n3saqm27QW"
target="_blank"
rel="noreferrer"
>
Discord server
</a>
{!isRU && (
<Link
title="Interslavic Facebook"
href="https://www.facebook.com/groups/interslavic"
target="_blank"
rel="noreferrer"
>
Facebook community
</Link>
)}
{!isRU && (
<a
title="Interslavic Discord"
href="https://discord.com/invite/n3saqm27QW"
target="_blank"
rel="noreferrer"
>
Discord server
</a>
)}
<a
title="Interslavic Language Portal"
href="http://interslavic-language.org/"
Expand Down Expand Up @@ -122,20 +138,22 @@ export const About =
/>
</a>*/}

<a
href="https://discord.com/invite/n3saqm27QW"
title="Get it on Discord"
className="badge_discord"
target="_blank"
rel="noreferrer"
>
<img
alt="Get it on Discord"
width="165px"
style={{ padding: "13px 0px" }}
src="icons/discord-icon-330x102.png"
/>
</a>
{!isRU && (
<a
href="https://discord.com/invite/n3saqm27QW"
title="Get it on Discord"
className="badge_discord"
target="_blank"
rel="noreferrer"
>
<img
alt="Get it on Discord"
width="165px"
style={{ padding: "13px 0px" }}
src="icons/discord-icon-330x102.png"
/>
</a>
)}
</div>
</div>
<div className="about-page__release-date">{version}</div>
Expand Down
14 changes: 14 additions & 0 deletions src/hooks/useCookie.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useMemo } from 'react'

export function useCookie(name) {
return useMemo(() => {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);

if (parts.length === 2) {
return parts.pop().split(';').shift();
}

return ''
}, name)
}
Loading