Skip to content

Commit

Permalink
added constants for media related to search usage
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil97 committed Oct 26, 2023
1 parent afcaca8 commit 7bb949a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
3 changes: 3 additions & 0 deletions src/common/constants/searchParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export const TYPE_WORD = 'word'
export const TYPE_ENTRY = 'word,phrase,song,story'
export const TYPE_DICTIONARY = 'word,phrase'
export const TYPE_MEDIA = 'audio,image,video'
export const TYPE_AUDIO = 'audio'
export const TYPE_IMAGE = 'image'
export const TYPE_VIDEO = 'video'

/* Param Keys Frontend ONLY */
export const CHAR = 'char'
12 changes: 6 additions & 6 deletions src/common/dataHooks/useSearchLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import PropTypes from 'prop-types'
import useIntersectionObserver from 'common/hooks/useIntersectionObserver'
import api from 'services/api'
import {
AUDIO,
IMAGE,
VIDEO,
SEARCH,
TYPE_PHRASE,
TYPE_SONG,
TYPE_STORY,
TYPE_WORD,
TYPE_AUDIO,
TYPE_IMAGE,
TYPE_VIDEO,
} from 'common/constants'
import {
storySummaryAdaptor,
Expand Down Expand Up @@ -71,9 +71,9 @@ function useSearchLoader({ searchParams }) {
...storySummaryAdaptor({ item: result?.entry }),
...baseObject,
}
case AUDIO:
case IMAGE:
case VIDEO:
case TYPE_AUDIO:
case TYPE_IMAGE:
case TYPE_VIDEO:
return {
...mediaAdaptor({ type: result?.type, data: result?.entry }),
...baseObject,
Expand Down
12 changes: 6 additions & 6 deletions src/common/utils/stringHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
TYPE_STORY,
TYPE_SONG,
TYPE_MEDIA,
AUDIO,
IMAGE,
VIDEO,
TYPE_AUDIO,
TYPE_IMAGE,
TYPE_VIDEO,
UUID_REGEX,
} from 'common/constants'

Expand Down Expand Up @@ -247,23 +247,23 @@ export const getPresentationPropertiesForType = (type) => {
slug: 'search',
color: 'primary',
}
case AUDIO:
case TYPE_AUDIO:
return {
uppercase: 'AUDIO',
singular: 'audio',
plural: 'audio',
slug: 'audio',
color: 'primary',
}
case IMAGE:
case TYPE_IMAGE:
return {
uppercase: 'IMAGE',
singular: 'image',
plural: 'images',
slug: 'image',
color: 'primary',
}
case VIDEO:
case TYPE_VIDEO:
return {
uppercase: 'VIDEO',
singular: 'video',
Expand Down
14 changes: 10 additions & 4 deletions src/components/DashboardMedia/DashboardMediaData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,39 @@ import { useSearchParams } from 'react-router-dom'

// FPCC
import { useSiteStore } from 'context/SiteContext'
import {
TYPE_AUDIO,
TYPE_IMAGE,
TYPE_VIDEO,
TYPES,
} from 'common/constants/searchParams'

function DashboardMediaData() {
const { site } = useSiteStore()
const [searchParams] = useSearchParams()

const docType = searchParams.get('types') || null
const docType = searchParams.get(`${TYPES}`) || null

const tileContent = [
{
icon: 'Microphone',
name: 'Audio',
description: 'Manage your audio files',
href: 'browser?types=audio',
href: `browser?${TYPES}=${TYPE_AUDIO}`,
iconColor: 'songText',
},
{
icon: 'Images',
name: 'Images',
description: 'Manage your images',
href: 'browser?types=image',
href: `browser?${TYPES}=${TYPE_IMAGE}`,
iconColor: 'wordText',
},
{
icon: 'Video',
name: 'Videos',
description: 'Manage your videos',
href: 'browser?types=video',
href: `browser?${TYPES}=${TYPE_VIDEO}`,
iconColor: 'storyText',
},
]
Expand Down

0 comments on commit 7bb949a

Please sign in to comment.