Videos lang added

This commit is contained in:
Kakabay 2023-03-07 15:32:29 +05:00
parent 1f9cba7088
commit 111782763b
1 changed files with 22 additions and 19 deletions

View File

@ -1,29 +1,27 @@
// Modules
import { useEffect, useState } from "react";
import { v4 as uuiv4 } from "uuid";
import { useSelector, useDispatch } from "react-redux";
import { useEffect, useState } from 'react';
import { v4 as uuiv4 } from 'uuid';
import { useSelector, useDispatch } from 'react-redux';
// Components
import SectionTitle from "../global/SectionTitle";
import VideosItem from "./VideosItem";
import SectionTitle from '../global/SectionTitle';
import VideosItem from './VideosItem';
// Types
import { RootState } from "../../types/store.types";
import { RootState } from '../../types/store.types';
// Api
import { Api } from "../../api/Api";
import { url } from "../../url";
import { videoParams } from "../../api/params";
import { Api } from '../../api/Api';
import { url } from '../../url';
import { videoParams } from '../../api/params';
// Actions
import { setVideo } from "../../actions/setData";
import Loader from "../global/Loader";
import { setVideo } from '../../actions/setData';
import Loader from '../global/Loader';
const Videos = () => {
const data = useSelector<RootState, RootState["video"]["data"]>(
(state) => state.video.data
);
const api = new Api(url + "/pagination/posts", videoParams);
const data = useSelector<RootState, RootState['video']['data']>((state) => state.video.data);
const api = new Api(url + '/pagination/posts', videoParams);
const language = api.language;
const dispatch = useDispatch();
const [lastLanguage, setLastLanguage] = useState<typeof language>(language);
@ -38,9 +36,14 @@ const Videos = () => {
<section className="videos">
<div className="videos-inner">
<SectionTitle
title="Видео"
givenClass="videos"
linkData={{ link: "/all?type=video", title: "Посмотреть все" }}
title={language === 'EN' ? 'Videos' : language === 'RU' ? 'Видео' : 'Videolar'}
linkData={{
link: '/all',
title: `${
language === 'EN' ? 'View all' : language === 'RU' ? 'Посмотреть все' : 'Doly gör'
}`,
}}
/>
<div className="videos-items">
{data.status_code > 0 ? (
@ -49,11 +52,11 @@ const Videos = () => {
return (
<VideosItem
key={uuiv4()}
url={videosDataItem.video || ""}
url={videosDataItem.video || ''}
placeholder={
videosDataItem.featured_images[0]
? videosDataItem.featured_images[0].path
: ""
: ''
}
date={videosDataItem.published_at}
excerpt={videosDataItem.excerpt}