Skip to content

Commit

Permalink
Resolved translations and removed old useReports hook
Browse files Browse the repository at this point in the history
  • Loading branch information
devan-huapaya committed Aug 26, 2021
1 parent 206ad39 commit 0736827
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion packages/api/migrations/20210818223159-tag_collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { Db } from 'mongodb'
import { DbTag, DbOrganization } from '../src/db/types'
import { DbOrganization } from '../src/db/types'

// DO NOT CHANGE THE NEXT LINE module.exports is needed for migrate-mongo to funciton properly
module.exports = {
Expand Down
86 changes: 43 additions & 43 deletions packages/webapp/src/components/lists/RequestTagsList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import EditTagForm from '~components/forms/EditTagForm'
import UserCardRow from '~components/ui/UserCardRow'
import { Col, Row } from 'react-bootstrap'
//import { Parser, FieldInfo } from 'json2csv'
import { useReports } from '~hooks/api/useReports'
// import { useReports } from '~hooks/api/useReports'
import { useTranslation } from '~hooks/useTranslation'

interface RequestTagsListProps extends ComponentProps {
Expand All @@ -34,7 +34,7 @@ const RequestTagsList = memo(function RequestTagsList({
}: RequestTagsListProps): JSX.Element {
const { t, c } = useTranslation('requestTags')
const org = useRecoilValue(organizationState)
const { data: engagementExportData } = useReports()
// const { data: engagementExportData } = useReports()

const { isMD } = useWindowSize()
const [filteredList, setFilteredList] = useState<Tag[]>(org?.tags || [])
Expand Down Expand Up @@ -97,7 +97,7 @@ const RequestTagsList = memo(function RequestTagsList({
},
{
key: 'category',
name: t('requestTag.list.columns.category'),
name: t('requestTagListColumns.category'),
className: 'col-md-1',
onRenderColumnItem: function onRenderColumnItem(tag: Tag) {
const group = tag?.category ?? 'OTHER'
Expand Down Expand Up @@ -185,48 +185,48 @@ const RequestTagsList = memo(function RequestTagsList({
}
]

const downloadFile = () => {
// const csvFields: FieldInfo<Tag>[] = [
// {
// label: 'Tag Name',
// value: (row: Tag) => row.label
// },
// {
// label: 'Description',
// value: (row: Tag) => row.description
// },
// {
// label: 'Total uses',
// value: (row: Tag) => (row?.usageCount?.actions || 0) + (row?.usageCount?.engagement || 0)
// },
// {
// label: '# of Actions',
// value: (row: Tag) => row?.usageCount?.actions || 0
// },
// {
// label: '# of Engagements',
// value: (row: Tag) => row?.usageCount?.engagement || 0
// }
// ]
// const downloadFile = () => {
// // const csvFields: FieldInfo<Tag>[] = [
// // {
// // label: 'Tag Name',
// // value: (row: Tag) => row.label
// // },
// // {
// // label: 'Description',
// // value: (row: Tag) => row.description
// // },
// // {
// // label: 'Total uses',
// // value: (row: Tag) => (row?.usageCount?.actions || 0) + (row?.usageCount?.engagement || 0)
// // },
// // {
// // label: '# of Actions',
// // value: (row: Tag) => row?.usageCount?.actions || 0
// // },
// // {
// // label: '# of Engagements',
// // value: (row: Tag) => row?.usageCount?.engagement || 0
// // }
// // ]

// const csvParser = new Parser({ fields: csvFields })
// const csv = csvParser.parse(org.tags)
// const csvData = new Blob([csv], { type: 'text/csv' })
// const csvURL = URL.createObjectURL(csvData)
// window.open(csvURL)
// // const csvParser = new Parser({ fields: csvFields })
// // const csv = csvParser.parse(org.tags)
// // const csvData = new Blob([csv], { type: 'text/csv' })
// // const csvURL = URL.createObjectURL(csvData)
// // window.open(csvURL)

const filename = 'engagements.json'
const contentType = 'application/json;charset=utf-8;'
// const filename = 'engagements.json'
// const contentType = 'application/json;charset=utf-8;'

const a = document.createElement('a')
a.download = filename
a.href = 'data:' + contentType + ',' + encodeURIComponent(JSON.stringify(engagementExportData))
a.target = '_blank'
// const a = document.createElement('a')
// a.download = filename
// a.href = 'data:' + contentType + ',' + encodeURIComponent(JSON.stringify(engagementExportData))
// a.target = '_blank'

document.body.appendChild(a)
a.click()
document.body.removeChild(a)
}
// document.body.appendChild(a)
// a.click()
// document.body.removeChild(a)
// }

return (
<ClientOnly>
Expand All @@ -241,8 +241,8 @@ const RequestTagsList = memo(function RequestTagsList({
addButtonName={t('requestTagAddButton')}
onSearchValueChange={(value) => searchList(value)}
onListAddButtonClick={() => openNewTagPanel()}
exportButtonName={t('requestTagExportButton')}
onExportDataButtonClick={() => downloadFile()}
// exportButtonName={st('requestTagExportButton')}
// onExportDataButtonClick={() => downloadFile()}
/>
) : (
<PaginatedList
Expand Down
18 changes: 9 additions & 9 deletions packages/webapp/src/locales/en-US/requestTags.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"page.title": "Tags",
"_page.title.comment": "Page title displayed in the browser tab",
"requestTags.title": "Tags",
"_requestTags.title.comment": "List header title for the list of tags",
"requestTag.list.columns": {
"pageTitle": "Tags",
"_pageTitle.comment": "Page title displayed in the browser tab",
"requestTagsTitle": "Tags",
"_requestTagsTitle.comment": "List header title for the list of tags",
"requestTagListColumns": {
"tag": "Tag",
"_tag.comment": "Tag column header label of the list",
"description": "Description",
Expand Down Expand Up @@ -44,10 +44,10 @@
"addTag": {
"tagInfo": "Tag info",
"_tagInfo.comment": "Tag info field label",
"tag.placeholder": "Tag name",
"_tag.placeholder.comment": "Placeholder for Tag name",
"description.placeholder": "Tag description",
"_description.placeholder.comment": "Placeholder for Tag description",
"tagPlaceholder": "Tag name",
"_tagPlaceholder.comment": "Placeholder for Tag name",
"descriptionPlaceholder": "Tag description",
"_descriptionPlaceholder.comment": "Placeholder for Tag description",
"categoryPlaceholder": "Tag category",
"_categoryPlaceholder.comment": "Placeholder used when selecting tag category, tag category is stored in common.json",
"buttons": {
Expand Down

0 comments on commit 0736827

Please sign in to comment.