Skip to content

Commit

Permalink
YOU STREAM 0.34.0
Browse files Browse the repository at this point in the history
Add WatchVideoContents.tsx
Add WatchVideoContents.styles.ts
Update App.tsx
Update App.context.tsx
Update ShortsVideoItem.tsx
Update RegularVideoItem.tsx
  • Loading branch information
DavidGomezToca committed Apr 18, 2024
1 parent eda0294 commit 985c2c0
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

- **STACK :**

- **YOU STREAM** : `0.33.0`
- **YOU STREAM** : `0.34.0`
- **REACT** : `18.2.0`
- **PEXELS** : `1.4.0`
- **REACT ICONS** : `5.0.1`
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "you-stream",
"version": "0.33.0",
"version": "0.34.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
Expand Down
Binary file modified resources/img/Thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { useAppContext } from "./context/App.context";
import Header from "./components/header/Header";
import ToolTips from "./utils/ToolTips";
import Body from "./components/body/Body";
import { Route, Routes } from "react-router-dom";
import WatchVideoContents from "./components/watchVideoContents/WatchVideoContents";

function App() {
const { theme } = useAppContext();
Expand All @@ -16,7 +18,10 @@ function App() {
<ToolTips />
<AppContainer>
<Header />
<Body />
<Routes>
<Route path="/" element={<Body />} />
<Route path="/:id" element={<WatchVideoContents />} />
</Routes>
</AppContainer>
</ThemeProvider>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const Header = () => {
</Icon>
<LogoSection to="/">
<FaYoutube color="#FF0000" size={30} />
<Text className="logo">YouStream v0.33.0</Text>
<Text className="logo">YouStream v0.34.0</Text>
</LogoSection>
</LeftSection>
<SearchSection>
Expand Down
3 changes: 2 additions & 1 deletion src/components/regularVideoItem/RegularVideoItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ interface IRegularVideoItemProps {

const RegularVideoItem = ({ video }: IRegularVideoItemProps) => {
const [playTrailer, setPlayTrailer] = useState(false);
const { isMenuSmall } = useAppContext();
const { isMenuSmall, setVideoToWatch } = useAppContext();
const TITLE_LENGTH = 50;

return (
<StyledRegularVideoItem
onMouseOver={() => setPlayTrailer(true)}
onMouseOut={() => setPlayTrailer(false)}
onClick={() => setVideoToWatch(video.id)}
>
<RegularVideoThumbnail $isMenuSmall={isMenuSmall}>
{playTrailer ? (
Expand Down
3 changes: 2 additions & 1 deletion src/components/shortsVideoItem/ShortsVideoItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ interface IShortsVideoItemProps {

const ShortsVideoItem = ({ video }: IShortsVideoItemProps) => {
const [playTrailer, setPlayTrailer] = useState(false);
const { isMenuSmall } = useAppContext();
const { isMenuSmall, setVideoToWatch } = useAppContext();
const TITLE_LENGTH = 50;

return (
<StyledShortsVideoItem
onMouseOver={() => setPlayTrailer(true)}
onMouseOut={() => setPlayTrailer(false)}
onClick={() => setVideoToWatch(video.id)}
>
<StyledShortsVideoThumbnail $isMenuSmall={isMenuSmall}>
{playTrailer ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import styled from "styled-components";

export const StyledWatchVideoContents = styled.div`
background-color: blue;
`;
15 changes: 15 additions & 0 deletions src/components/watchVideoContents/WatchVideoContents.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";
import { Text } from "../../utils/Text.styles";
import { StyledWatchVideoContents } from "./WatchVideoContents.styles";

const WatchVideoContents = () => {
return (
<div>
<StyledWatchVideoContents>
<Text>WatchVideoContents</Text>
</StyledWatchVideoContents>
</div>
);
};

export default WatchVideoContents;
14 changes: 14 additions & 0 deletions src/context/App.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { ITranslations, LANGUAGE } from "../utils/translations";
import { Video, Videos, createClient } from "pexels";
import { PEXELES_API_KEY } from "../utils/pexels";
import { useNavigate } from "react-router-dom";

interface IAppContextValue {
theme: "light" | "dark";
Expand All @@ -26,6 +27,8 @@ interface IAppContextValue {
setActiveCategory: Dispatch<SetStateAction<string>>;
videos: Video[];
isFetchingVideos: boolean;
videoToWatch: number;
setVideoToWatch: Dispatch<SetStateAction<number>>;
}

const AppContext = createContext<IAppContextValue | null>(null);
Expand Down Expand Up @@ -53,6 +56,15 @@ export const AppContextProvider = ({ children }: IAppContextProviderProps) => {
const [activeCategory, setActiveCategory] = useState("All");
const [videos, setVideos] = useState<Video[]>([]);
const [isFetchingVideos, setIsFetchingVideos] = useState(false);
const [videoToWatch, setVideoToWatch] = useState<number>(0);

let navigate = useNavigate();

useEffect(() => {
if (videoToWatch !== 0) {
navigate(`/${videoToWatch}`);
}
}, [videoToWatch]);

useEffect(() => {
fetchVideos(activeCategory);
Expand Down Expand Up @@ -100,6 +112,8 @@ export const AppContextProvider = ({ children }: IAppContextProviderProps) => {
setActiveCategory,
videos,
isFetchingVideos,
videoToWatch,
setVideoToWatch,
};

return <AppContext.Provider value={value}>{children}</AppContext.Provider>;
Expand Down

0 comments on commit 985c2c0

Please sign in to comment.