Delete assets/js/dashboard/stats/modals/google-keywords.tsx with huggingface_hub
Browse files
assets/js/dashboard/stats/modals/google-keywords.tsx
DELETED
|
@@ -1,86 +0,0 @@
|
|
| 1 |
-
import React, { useMemo, useState } from 'react'
|
| 2 |
-
|
| 3 |
-
import Modal from './modal'
|
| 4 |
-
import {
|
| 5 |
-
numberShortFormatter,
|
| 6 |
-
percentageFormatter
|
| 7 |
-
} from '../../util/number-formatter'
|
| 8 |
-
import { ColumnConfiguration } from '../breakdowns'
|
| 9 |
-
import { BreakdownTable } from './breakdown-table'
|
| 10 |
-
import {
|
| 11 |
-
SearchTermsResultItem,
|
| 12 |
-
useDetailedGoogleSearchTermsQuery
|
| 13 |
-
} from '../sources/fetch-search-terms'
|
| 14 |
-
|
| 15 |
-
const metricColumns = [
|
| 16 |
-
{
|
| 17 |
-
key: 'visitors',
|
| 18 |
-
label: 'Visitors',
|
| 19 |
-
formatter: numberShortFormatter,
|
| 20 |
-
width: 'w-28'
|
| 21 |
-
},
|
| 22 |
-
{
|
| 23 |
-
key: 'impressions',
|
| 24 |
-
label: 'Impressions',
|
| 25 |
-
formatter: numberShortFormatter,
|
| 26 |
-
width: 'w-28'
|
| 27 |
-
},
|
| 28 |
-
{ key: 'ctr', label: 'CTR', formatter: percentageFormatter, width: 'w-24' },
|
| 29 |
-
{
|
| 30 |
-
key: 'position',
|
| 31 |
-
label: 'Position',
|
| 32 |
-
formatter: numberShortFormatter,
|
| 33 |
-
width: 'w-24'
|
| 34 |
-
}
|
| 35 |
-
]
|
| 36 |
-
|
| 37 |
-
function GoogleKeywordsModal() {
|
| 38 |
-
const [search, setSearch] = useState('')
|
| 39 |
-
|
| 40 |
-
const apiState = useDetailedGoogleSearchTermsQuery({ search })
|
| 41 |
-
|
| 42 |
-
const columns: ColumnConfiguration<SearchTermsResultItem>[] = useMemo(
|
| 43 |
-
() => [
|
| 44 |
-
{
|
| 45 |
-
key: 'name',
|
| 46 |
-
renderLabel: () => 'Search term',
|
| 47 |
-
renderCell: (item) => item.name,
|
| 48 |
-
width: 'w-48 max-w-48 md:w-56 md:max-w-56',
|
| 49 |
-
align: 'left'
|
| 50 |
-
},
|
| 51 |
-
|
| 52 |
-
...metricColumns.map((m): ColumnConfiguration<SearchTermsResultItem> => {
|
| 53 |
-
const metric = m.key as keyof SearchTermsResultItem
|
| 54 |
-
|
| 55 |
-
return {
|
| 56 |
-
key: metric,
|
| 57 |
-
renderLabel: () => m.label,
|
| 58 |
-
renderCell: (item) => item[metric],
|
| 59 |
-
width: m.width,
|
| 60 |
-
align: 'right'
|
| 61 |
-
}
|
| 62 |
-
})
|
| 63 |
-
],
|
| 64 |
-
[]
|
| 65 |
-
)
|
| 66 |
-
|
| 67 |
-
const tableData = apiState.data
|
| 68 |
-
? { pages: apiState.data.pages.map((p) => p.results) }
|
| 69 |
-
: undefined
|
| 70 |
-
|
| 71 |
-
return (
|
| 72 |
-
<Modal>
|
| 73 |
-
<BreakdownTable<SearchTermsResultItem>
|
| 74 |
-
title="Google search terms"
|
| 75 |
-
onSearch={setSearch}
|
| 76 |
-
{...apiState}
|
| 77 |
-
error={apiState.error}
|
| 78 |
-
data={tableData}
|
| 79 |
-
columns={columns}
|
| 80 |
-
getRowKey={(row: SearchTermsResultItem) => row.name}
|
| 81 |
-
/>
|
| 82 |
-
</Modal>
|
| 83 |
-
)
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
-
export default GoogleKeywordsModal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|