-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(project): add SEO for screens and update translations
- Loading branch information
1 parent
59a17eb
commit de5ddc8
Showing
17 changed files
with
272 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { UseBaseQueryResult, useQuery } from 'react-query'; | ||
import type { PlaylistItem } from 'types/playlist'; | ||
|
||
import { getMediaById } from '../services/api.service'; | ||
|
||
export type UseMediaResult<TData = PlaylistItem, TError = unknown> = UseBaseQueryResult<TData, TError>; | ||
|
||
export default function useMedia (mediaId: string, enabled: boolean = true): UseMediaResult { | ||
return useQuery(['media', mediaId], () => getMediaById(mediaId), { | ||
enabled: !!mediaId && enabled, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"error_description": "Reload this page or try again later.", | ||
"error_heading": "Something went wrong", | ||
"error_subheading": "It looks like we had an issue loading this page...", | ||
"heading": "Search results", | ||
"no_results_heading": "No results found for \"{{query}}\"", | ||
"start_typing": "Type something in the search box to start searching", | ||
"suggestions": "Suggestions:", | ||
"tip_one": "Make sure all words are spelled correctly", | ||
"tip_three": "Try different search terms", | ||
"tip_two": "Make search terms more general", | ||
"title": "{{results}} result for \"{{query}}\"", | ||
"title_plural": "{{results}} results for \"{{query}}\"" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"error_description": "", | ||
"error_heading": "", | ||
"error_subheading": "", | ||
"heading": "", | ||
"no_results_heading": "", | ||
"start_typing": "", | ||
"suggestions": "", | ||
"tip_one": "", | ||
"tip_three": "", | ||
"tip_two": "", | ||
"title": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,93 @@ | ||
import React from 'react'; | ||
import { RouteComponentProps, useLocation } from 'react-router-dom'; | ||
import React, { useContext } from 'react'; | ||
import type { RouteComponentProps } from 'react-router-dom'; | ||
import { useHistory } from 'react-router'; | ||
import { Helmet } from 'react-helmet'; | ||
|
||
import Video from '../../containers/Video/Video'; | ||
import { useFavorites } from '../../stores/FavoritesStore'; | ||
import { ConfigContext } from '../../providers/ConfigProvider'; | ||
import useBlurImageUpdater from '../../hooks/useBlurImageUpdater'; | ||
import { cardUrl, videoUrl } from '../../utils/formatting'; | ||
import type { PlaylistItem } from '../../../types/playlist'; | ||
import VideoComponent from '../../components/Video/Video'; | ||
import Shelf from '../../containers/Shelf/Shelf'; | ||
import useMedia from '../../hooks/useMedia'; | ||
|
||
type MovieRouteParams = { | ||
id: string; | ||
}; | ||
|
||
const Movie = ({ | ||
match: { | ||
params: { id }, | ||
}, | ||
}: RouteComponentProps<MovieRouteParams>): JSX.Element => { | ||
const listId: string | null = new URLSearchParams(useLocation().search).get('list'); | ||
const Movie = ( | ||
{ | ||
match: { | ||
params: { id }, | ||
}, | ||
location, | ||
}: RouteComponentProps<MovieRouteParams>): JSX.Element => { | ||
const config = useContext(ConfigContext); | ||
const searchParams = new URLSearchParams(location.search); | ||
const { isLoading, error, data: item } = useMedia(id); | ||
|
||
if (!listId) return <p>No playlist id</p>; | ||
const history = useHistory(); | ||
const { hasItem, saveItem, removeItem } = useFavorites(); | ||
const play = searchParams.get('play') === '1'; | ||
const posterFading: boolean = config ? config.options.posterFading === true : false; | ||
|
||
return <Video videoType={'movie'} playlistId={listId} mediaId={id} />; | ||
const updateBlurImage = useBlurImageUpdater(null, item); | ||
const isFavorited = !!item && hasItem(item); | ||
|
||
const startPlay = () => item && history.push(videoUrl(item, searchParams.get('r'), true)); | ||
const goBack = () => item && history.push(videoUrl(item, searchParams.get('r'), false)); | ||
|
||
const onCardClick = (item: PlaylistItem) => history.push(cardUrl(item)); | ||
const onCardHover = (item: PlaylistItem) => updateBlurImage(item.image); | ||
|
||
if (isLoading) return <p>Loading...</p>; | ||
if (error) return <p>Error loading list</p>; | ||
if (!item) return <p>Can not find medium</p>; | ||
|
||
return ( | ||
<React.Fragment> | ||
<Helmet> | ||
<title>{item.title} - {config.siteName}</title> | ||
<meta name="description" content={item.description} /> | ||
<meta property="og:description" content={item.description} /> | ||
<meta property="og:title" content={`${item.title} - ${config.siteName}`} /> | ||
<meta property="og:type" content="video.other" /> | ||
{item.image && <meta property="og:image" content={item.image?.replace(/^https:/, 'http:')} />} | ||
{item.image && <meta property="og:image:secure_url" content={item.image?.replace(/^http:/, 'https:')} />} | ||
<meta property="og:image:width" content={item.image ? '720' : ''} /> | ||
<meta property="og:image:height" content={item.image ? '406' : ''} /> | ||
<meta name="twitter:title" content={`${item.title} - ${config.siteName}`} /> | ||
<meta name="twitter:description" content={item.description} /> | ||
<meta name="twitter:image" content={item.image} /> | ||
<meta property="og:video" content={window.location.href} /> | ||
<meta property="og:video:secure_url" content={window.location.href} /> | ||
<meta property="og:video:type" content="text/html" /> | ||
<meta property="og:video:width" content="1280" /> | ||
<meta property="og:video:height" content="720" /> | ||
{item.tags.split(',').map(tag => <meta property="og:video:tag" content={tag} key={tag} />)} | ||
</Helmet> | ||
<VideoComponent | ||
item={item} | ||
play={play} | ||
startPlay={startPlay} | ||
goBack={goBack} | ||
poster={posterFading ? 'fading' : 'normal'} | ||
isFavorited={isFavorited} | ||
onFavoriteButtonClick={() => isFavorited ? removeItem(item) : saveItem(item)} | ||
relatedShelf={ | ||
config.recommendationsPlaylist ? ( | ||
<Shelf | ||
playlistId={config.recommendationsPlaylist} | ||
onCardClick={onCardClick} | ||
onCardHover={onCardHover} | ||
relatedMediaId={item.mediaid} | ||
/> | ||
) : undefined | ||
} | ||
/> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export default Movie; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.