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 /> */} {/* <FingerprintBlock /> */}
<NavigatorBlock workerData={workerData} /> <NavigatorBlock workerData={workerData} />
<UserAgentBlock workerAgent={workerData.userAgent} /> <UserAgentBlock workerAgent={workerData.userAgent} />
{/* <IntlBlock /> */} <IntlBlock workerData={workerData} />
</div> </div>
<div className="centerBlockInner"> <div className="centerBlockInner">
<LocationBlock <LocationBlock

View file

@ -1,30 +1,12 @@
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
import { useState, useEffect } from 'react';
import Block from './Block'; import Block from './Block';
import Table from './Table'; import Table from './Table';
import { getIntl } from './main'; import getIntl from '../utils/intl';
import { ReactComponent as CheckCircle } from '../images/checkCircle.svg';
const DateBlock = () => ( const IntlBlock = ({ workerData }) => (
<Block> <Block>
<h1>Intl</h1> <h1>Intl</h1>
<Table type="navigator" data={getIntl()} /> <Table data={getIntl(workerData)} />
{/* <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> */}
<p> <p>
<b>Explanation:</b> JavaScript can be used to find information about your <b>Explanation:</b> JavaScript can be used to find information about your
hardware. This information can be used to create a fingerprint. hardware. This information can be used to create a fingerprint.
@ -32,4 +14,4 @@ const DateBlock = () => (
</Block> </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;