Render correct OS names.

This commit is contained in:
Mike Cao 2023-12-08 22:14:55 -08:00
parent c8eb76c7af
commit e67282d7d8
2 changed files with 9 additions and 8 deletions

View File

@ -15,12 +15,7 @@ export function SettingsButton() {
<Icons.Gear /> <Icons.Gear />
</Icon> </Icon>
</Button> </Button>
<Popup <Popup className={styles.popup} position="bottom" alignment="end">
className={styles.popup}
position="bottom"
alignment="end"
onClick={e => e.stopPropagation()}
>
<Form> <Form>
<FormRow label={formatMessage(labels.timezone)}> <FormRow label={formatMessage(labels.timezone)}>
<TimezoneSetting /> <TimezoneSetting />

View File

@ -2,14 +2,20 @@ import MetricsTable from './MetricsTable';
import FilterLink from 'components/common/FilterLink'; import FilterLink from 'components/common/FilterLink';
import useMessages from 'components/hooks/useMessages'; import useMessages from 'components/hooks/useMessages';
const names = {
'Mac OS': 'macOS',
'Chrome OS': 'ChromeOS',
'Sun OS': 'SunOS',
};
export function OSTable({ websiteId, limit }: { websiteId: string; limit?: number }) { export function OSTable({ websiteId, limit }: { websiteId: string; limit?: number }) {
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
function renderLink({ x: os }) { function renderLink({ x: os }) {
return ( return (
<FilterLink id="os" value={os}> <FilterLink id="os" value={names[os] || os}>
<img <img
src={`${process.env.basePath}/images/os/${ src={`${process.env.basePath || ''}/images/os/${
os?.toLowerCase().replaceAll(/\W/g, '-') || 'unknown' os?.toLowerCase().replaceAll(/\W/g, '-') || 'unknown'
}.png`} }.png`}
alt={os} alt={os}