Added intl block

This commit is contained in:
z0ccc 2021-09-28 12:41:13 -04:00
parent 82b5a1c06e
commit 9cf516f87b
3 changed files with 29 additions and 23 deletions

View file

@ -32,7 +32,7 @@ const Blocks = () => {
{/* <FingerprintBlock /> */}
<NavigatorBlock workerData={workerData} />
<UserAgentBlock workerAgent={workerData.userAgent} />
{/* <IntlBlock /> */}
<IntlBlock workerData={workerData} />
</div>
<div className="centerBlockInner">
<LocationBlock

View file

@ -1,30 +1,12 @@
/* eslint-disable no-unused-vars */
import { useState, useEffect } from 'react';
import Block from './Block';
import Table from './Table';
import { getIntl } from './main';
import { ReactComponent as CheckCircle } from '../images/checkCircle.svg';
import getIntl from '../utils/intl';
const DateBlock = () => (
const IntlBlock = ({ workerData }) => (
<Block>
<h1>Intl</h1>
<Table type="navigator" data={getIntl()} />
{/* <div className="tableWrap">
<table>
{Object.entries(Intl.DateTimeFormat().resolvedOptions()).map((item) => (
<tbody key={item[0]}>
<tr>
<td>{item[0]}</td>
<td>{item[1]}</td>
<td>
<CheckCircle className="circleButton" />
</td>
</tr>
</tbody>
))}
</table>
</div> */}
<Table data={getIntl(workerData)} />
<p>
<b>Explanation:</b> JavaScript can be used to find information about your
hardware. This information can be used to create a fingerprint.
@ -32,4 +14,4 @@ const DateBlock = () => (
</Block>
);
export default DateBlock;
export default IntlBlock;

View file

@ -0,0 +1,24 @@
import { checkWebWorker } from './common';
const getLocale = (locale) => ({
key: 'Locale',
value: Intl.DateTimeFormat().resolvedOptions().locale,
issues: [
checkWebWorker(Intl.DateTimeFormat().resolvedOptions().locale, locale),
],
});
const getTimezone = (timeZone) => ({
key: 'Timezone',
value: Intl.DateTimeFormat().resolvedOptions().timeZone,
issues: [
checkWebWorker(Intl.DateTimeFormat().resolvedOptions().timeZone, timeZone),
],
});
const getIntl = (workerData) => [
getLocale(workerData.locale),
getTimezone(workerData.timeZone),
];
export default getIntl;