|
|
|
|
@ -5,7 +5,7 @@ import ListReport from '../reports/list'
|
|
|
|
|
import * as api from '../../api'
|
|
|
|
|
import * as url from '../../util/url'
|
|
|
|
|
|
|
|
|
|
function Browsers({query, site}) {
|
|
|
|
|
function Browsers({ query, site }) {
|
|
|
|
|
function fetchData() {
|
|
|
|
|
return api.get(url.apiPath(site, '/browsers'), query)
|
|
|
|
|
}
|
|
|
|
|
@ -13,29 +13,32 @@ function Browsers({query, site}) {
|
|
|
|
|
return (
|
|
|
|
|
<ListReport
|
|
|
|
|
fetchData={fetchData}
|
|
|
|
|
filter={{browser: 'name'}}
|
|
|
|
|
filter={{ browser: 'name' }}
|
|
|
|
|
keyLabel="Browser"
|
|
|
|
|
query={query}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function BrowserVersions({query, site}) {
|
|
|
|
|
function BrowserVersions({ query, site }) {
|
|
|
|
|
function fetchData() {
|
|
|
|
|
return api.get(url.apiPath(site, '/browser-versions'), query)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const browserName = query.filters.browser === '(not set)' ? 'Browser' : query.filters.browser
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<ListReport
|
|
|
|
|
fetchData={fetchData}
|
|
|
|
|
filter={{browser_version: 'name'}}
|
|
|
|
|
keyLabel={query.filters.browser + ' version'}
|
|
|
|
|
filter={{ browser_version: 'name' }}
|
|
|
|
|
keyLabel={browserName + ' version'}
|
|
|
|
|
query={query}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function OperatingSystems({query, site}) {
|
|
|
|
|
function OperatingSystems({ query, site }) {
|
|
|
|
|
function fetchData() {
|
|
|
|
|
return api.get(url.apiPath(site, '/operating-systems'), query)
|
|
|
|
|
}
|
|
|
|
|
@ -43,29 +46,32 @@ function OperatingSystems({query, site}) {
|
|
|
|
|
return (
|
|
|
|
|
<ListReport
|
|
|
|
|
fetchData={fetchData}
|
|
|
|
|
filter={{os: 'name'}}
|
|
|
|
|
filter={{ os: 'name' }}
|
|
|
|
|
keyLabel="Operating system"
|
|
|
|
|
query={query}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function OperatingSystemVersions({query, site}) {
|
|
|
|
|
function OperatingSystemVersions({ query, site }) {
|
|
|
|
|
function fetchData() {
|
|
|
|
|
return api.get(url.apiPath(site, '/operating-system-versions'), query)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const osName = query.filters.os === '(not set)' ? 'Operating System' : query.filters.os
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<ListReport
|
|
|
|
|
fetchData={fetchData}
|
|
|
|
|
filter={{os_version: 'name'}}
|
|
|
|
|
keyLabel={query.filters.os + ' version'}
|
|
|
|
|
filter={{ os_version: 'name' }}
|
|
|
|
|
keyLabel={osName + ' version'}
|
|
|
|
|
query={query}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ScreenSizes({query, site}) {
|
|
|
|
|
function ScreenSizes({ query, site }) {
|
|
|
|
|
function fetchData() {
|
|
|
|
|
return api.get(url.apiPath(site, '/screen-sizes'), query)
|
|
|
|
|
}
|
|
|
|
|
@ -81,7 +87,7 @@ function ScreenSizes({query, site}) {
|
|
|
|
|
return (
|
|
|
|
|
<ListReport
|
|
|
|
|
fetchData={fetchData}
|
|
|
|
|
filter={{screen: 'name'}}
|
|
|
|
|
filter={{ screen: 'name' }}
|
|
|
|
|
keyLabel="Screen size"
|
|
|
|
|
query={query}
|
|
|
|
|
renderIcon={renderIcon}
|
|
|
|
|
@ -100,38 +106,39 @@ const EXPLANATION = {
|
|
|
|
|
function iconFor(screenSize) {
|
|
|
|
|
if (screenSize === 'Mobile') {
|
|
|
|
|
return (
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="-mt-px feather"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"/><line x1="12" y1="18" x2="12" y2="18"/></svg>
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="-mt-px feather"><rect x="5" y="2" width="14" height="20" rx="2" ry="2" /><line x1="12" y1="18" x2="12" y2="18" /></svg>
|
|
|
|
|
)
|
|
|
|
|
} else if (screenSize === 'Tablet') {
|
|
|
|
|
return (
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="-mt-px feather"><rect x="4" y="2" width="16" height="20" rx="2" ry="2" transform="rotate(180 12 12)"/><line x1="12" y1="18" x2="12" y2="18"/></svg>
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="-mt-px feather"><rect x="4" y="2" width="16" height="20" rx="2" ry="2" transform="rotate(180 12 12)" /><line x1="12" y1="18" x2="12" y2="18" /></svg>
|
|
|
|
|
)
|
|
|
|
|
} else if (screenSize === 'Laptop') {
|
|
|
|
|
return (
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="-mt-px feather"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="2" y1="20" x2="22" y2="20"/></svg>
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="-mt-px feather"><rect x="2" y="3" width="20" height="14" rx="2" ry="2" /><line x1="2" y1="20" x2="22" y2="20" /></svg>
|
|
|
|
|
)
|
|
|
|
|
} else if (screenSize === 'Desktop') {
|
|
|
|
|
return (
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="-mt-px feather"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="-mt-px feather"><rect x="2" y="3" width="20" height="14" rx="2" ry="2" /><line x1="8" y1="21" x2="16" y2="21" /><line x1="12" y1="17" x2="12" y2="21" /></svg>
|
|
|
|
|
)
|
|
|
|
|
} else if (screenSize === '(not set)') {
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default class Devices extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props)
|
|
|
|
|
this.tabKey = `deviceTab__${ props.site.domain}`
|
|
|
|
|
this.tabKey = `deviceTab__${props.site.domain}`
|
|
|
|
|
const storedTab = storage.getItem(this.tabKey)
|
|
|
|
|
this.state = {
|
|
|
|
|
mode: storedTab || 'size'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setMode(mode) {
|
|
|
|
|
return () => {
|
|
|
|
|
storage.setItem(this.tabKey, mode)
|
|
|
|
|
this.setState({mode})
|
|
|
|
|
this.setState({ mode })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -189,12 +196,12 @@ export default class Devices extends React.Component {
|
|
|
|
|
<div className="flex justify-between w-full">
|
|
|
|
|
<h3 className="font-bold dark:text-gray-100">Devices</h3>
|
|
|
|
|
<div className="flex text-xs font-medium text-gray-500 dark:text-gray-400 space-x-2">
|
|
|
|
|
{ this.renderPill('Size', 'size') }
|
|
|
|
|
{ this.renderPill('Browser', 'browser') }
|
|
|
|
|
{ this.renderPill('OS', 'os') }
|
|
|
|
|
{this.renderPill('Size', 'size')}
|
|
|
|
|
{this.renderPill('Browser', 'browser')}
|
|
|
|
|
{this.renderPill('OS', 'os')}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{ this.renderContent() }
|
|
|
|
|
{this.renderContent()}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
|