Skip to content
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
2 changes: 1 addition & 1 deletion src/components/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Box: FC<CookiesBoxProps> = ({ setIsSeen }) => {
>
<Image
src="/keepsimple_/assets/cookies/close.svg"
alt=""
alt="Close cookie notice"
width={26}
height={26}
className={styles.closeIcon}
Expand Down
5 changes: 4 additions & 1 deletion src/components/SeoGenerator/SeoGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ const SeoGenerator: FC<SeoGeneratorProps> = ({
return clean;
}

// A lone "/" here yields .../ru/ or .../hy/, which 308-redirects to the
// slashless form and makes the canonical point at a redirect.
const canonicalPath = cleanURL(alternateLink).replace(/^\/(?=$|[?#])/, '');
const originalUrl =
process.env.NEXT_PUBLIC_DOMAIN + localePath + cleanURL(alternateLink);
process.env.NEXT_PUBLIC_DOMAIN + localePath + canonicalPath;
const favIcon = `${process.env.NEXT_PUBLIC_DOMAIN}${favIconPath}`;
const schema = generateSchema(
title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const EnvironmentSubSection: FC<EnvironmentSubSectionProps> = ({
})}
>
<div className={styles.titleAndIcon}>
<Image src={iconUrl} alt={''} width={24} height={24} unoptimized />
<Image src={iconUrl} alt={name} width={24} height={24} unoptimized />
<span className={styles.title}> {name}</span>
</div>
<hr className={styles.hr} />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Custom404: FC<Custom404Props> = ({ intl, locale }) => {
return (
<Fragment>
<Head>
<meta name="robots" content={'index, follow'} />
<meta name="robots" content={'noindex, follow'} />
<title>Keepsimple | Error Page</title>
<link rel="shortcut icon" href={'/keepsimple_/assets/favicon.svg'} />
<meta name="description" content={'404 page - page not found'} />
Expand Down
5 changes: 2 additions & 3 deletions src/uxcore/components/NewUpdateModal/NewUpdateModal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import Button from '@uxcore/components/Button';
import Modal from '@uxcore/components/Modal';
import Image from 'next/image';
import Link from 'next/link';
import { FC } from 'react';
import ReactMarkdown from 'react-markdown';

import Button from '@uxcore/components/Button';
import Modal from '@uxcore/components/Modal';

import type { NewUpdateModalProps } from './NewUpdateModal.types';

import styles from './NewUpdateModal.module.scss';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface NewUpdateData {
'Close button text'?: string;
'Frontend modal visibility'?: boolean;
'Appears after x seconds'?: number;
updatedAt?: string;
}

export interface NewUpdateModalProps {
Expand Down
18 changes: 17 additions & 1 deletion src/uxcore/components/NewUpdateModal/NewUpdateModalContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { FC, useEffect, useState } from 'react';
import NewUpdateModal from './NewUpdateModal';
import type { NewUpdateData } from './NewUpdateModal.types';

const DISMISSED_KEY = 'uxcoreNewUpdateDismissed';

const NewUpdateModalContainer: FC = () => {
const router = useRouter();
const [data, setData] = useState<NewUpdateData | null>(null);
Expand All @@ -22,6 +24,11 @@ const NewUpdateModalContainer: FC = () => {

if (cancelled || !res || !res['Frontend modal visibility']) return;

// Dismissal is keyed to the CMS updatedAt: closing hides this update
// for the rest of the session, but a newly published one shows again.
if (sessionStorage.getItem(DISMISSED_KEY) === (res.updatedAt ?? 'seen'))
return;

setData(res);

const delaySeconds = Number(res['Appears after x seconds']) || 0;
Expand All @@ -42,9 +49,18 @@ const NewUpdateModalContainer: FC = () => {
};
}, [router.locale]);

const handleClose = () => {
setOpen(false);
try {
sessionStorage.setItem(DISMISSED_KEY, data?.updatedAt ?? 'seen');
} catch {
// Storage can be unavailable (private mode); closing still works.
}
};

if (!open || !data) return null;

return <NewUpdateModal data={data} onClose={() => setOpen(false)} />;
return <NewUpdateModal data={data} onClose={handleClose} />;
};

export default NewUpdateModalContainer;
5 changes: 4 additions & 1 deletion src/uxcore/components/SeoGenerator/SeoGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,11 @@ const SeoGenerator: FC<SeoGeneratorProps> = ({
return clean;
}

// A lone "/" here yields .../ru/ or .../hy/, which 308-redirects to the
// slashless form and makes the canonical point at a redirect.
const canonicalPath = cleanURL(alternateLink).replace(/^\/(?=$|[?#])/, '');
const originalUrl =
process.env.NEXT_PUBLIC_DOMAIN + localePath + cleanURL(alternateLink);
process.env.NEXT_PUBLIC_DOMAIN + localePath + canonicalPath;
const metaDescription = isBiasHrView
? hrDescriptionRandom[0]
: stripHTML(description);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const BiasPanel = forwardRef<HTMLDivElement, BiasPanelProps>(
<div className={styles.Header}>
<FlagImage
countryCode={country.id}
countryName={country.name}
size={40}
className={styles.HeaderFlag}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const CountryList: FC<CountryListProps> = ({
[styles.CardSelected]: isSelected,
})}
>
<FlagImage countryCode={c.id} size={18} />
<FlagImage countryCode={c.id} countryName={c.name} size={18} />
<span className={styles.CardName}>{c.name}</span>
<span className={styles.CardConfidence}>
{Math.round(c.confidence * 100)}%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@ const CountryMap: FC<CountryMapProps> = ({
}}
>
<div className={styles.TooltipHead}>
<FlagImage countryCode={hoveredData.id} size={16} />
<FlagImage
countryCode={hoveredData.id}
countryName={hoveredData.name}
size={16}
/>
<span className={styles.TooltipName}>{hoveredData.name}</span>
</div>
<div className={styles.TooltipMeta}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styles from './FlagImage.module.scss';

interface FlagImageProps {
countryCode: string;
countryName?: string;
size?: number;
className?: string;
}
Expand All @@ -20,6 +21,7 @@ const codeToEmoji = (code: string): string => {

const FlagImage: FC<FlagImageProps> = ({
countryCode,
countryName,
size = 20,
className = '',
}) => {
Expand Down Expand Up @@ -58,7 +60,7 @@ const FlagImage: FC<FlagImageProps> = ({
srcSet={`https://flagcdn.com/w${cdnW2x}/${code}.png 2x`}
width={w}
height={size}
alt=""
alt={`Flag of ${countryName || countryCode.toUpperCase()}`}
className={cn(styles.Flag, className)}
style={{ width: w, height: size }}
loading="lazy"
Expand Down
Loading