Messages for devices so they can be localized.

This commit is contained in:
Mike Cao 2020-09-15 20:34:30 -07:00
parent c707b49400
commit 2d9523f963
19 changed files with 111 additions and 39 deletions

View file

@ -54,13 +54,6 @@ export const DESKTOP_OS = [
export const MOBILE_OS = ['iOS', 'Android OS', 'BlackBerry OS', 'Windows Mobile', 'Amazon OS'];
export const DEVICES = {
desktop: 'Desktop',
laptop: 'Laptop',
tablet: 'Tablet',
mobile: 'Mobile',
};
export const BROWSERS = {
aol: 'AOL',
edge: 'Edge',

View file

@ -1,5 +1,5 @@
import firstBy from 'thenby';
import { BROWSERS, ISO_COUNTRIES, DEVICES } from './constants';
import { BROWSERS, ISO_COUNTRIES } from './constants';
import { removeTrailingSlash, getDomainName } from './url';
export const urlFilter = (data, { raw }) => {
@ -118,15 +118,14 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
};
export const browserFilter = data =>
data.map(({ x, y }) => ({ x: BROWSERS[x], y })).filter(({ x }) => x);
data.map(({ x, y }) => ({ x: BROWSERS[x] || x, y })).filter(({ x }) => x);
export const osFilter = data => data.filter(({ x }) => x);
export const deviceFilter = data =>
data.map(({ x, y }) => ({ x: DEVICES[x], y })).filter(({ x }) => x);
export const deviceFilter = data => data.filter(({ x }) => x);
export const countryFilter = data =>
data.map(({ x, y }) => ({ x: ISO_COUNTRIES[x], y })).filter(({ x }) => x);
data.map(({ x, y }) => ({ x: ISO_COUNTRIES[x] || x, y })).filter(({ x }) => x);
export const percentFilter = data => {
const total = data.reduce((n, { y }) => n + y, 0);