Skip to content

Finish new present OBS system #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 89 additions & 3 deletions bun.lock

Large diffs are not rendered by default.

46 changes: 27 additions & 19 deletions components/live/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import Head from 'next/head';
import styled from 'styled-components';
import { Slide } from '../screen';
import { Title } from '../screen/text';
import Schedule from './schedule';
import NowPlaying from '../now-playing';
import Social from './social';
import Video from './video';
import React from "react";
import PropTypes from "prop-types";
import Head from "next/head";
import styled from "styled-components";
import { Slide } from "../screen";
import { Title } from "../screen/text";
import Schedule from "./schedule";
import NowPlaying from "../now-playing";
import Social from "./social";
import OBS from "./obs";

const leftWidth = 30;

Expand All @@ -31,7 +31,11 @@ const ScheduleBox = styled.div`
top: 0;
bottom: 0;
width: 4vw;
background-image: linear-gradient(to right, rgba(255, 104, 107, 0), rgba(255, 104, 107, 1));
background-image: linear-gradient(
to right,
rgba(255, 104, 107, 0),
rgba(255, 104, 107, 1)
);
}

&:after {
Expand All @@ -42,7 +46,10 @@ const ScheduleBox = styled.div`
bottom: 0;
left: 0;
right: 0;
background-image: linear-gradient(rgba(255, 104, 107, 0), rgba(255, 104, 107, 1));
background-image: linear-gradient(
rgba(255, 104, 107, 0),
rgba(255, 104, 107, 1)
);
}
`;

Expand Down Expand Up @@ -73,29 +80,30 @@ export default class Live extends React.Component {
static propTypes = {
event: PropTypes.object.isRequired,
config: PropTypes.object.isRequired,
}
};

componentDidMount() {
this.forceUpdate();
}

render() {
const { event, config } = this.props;
if (typeof window === 'undefined') return null;
if (typeof window === "undefined") return null;

return (
<Slide padding="0">
<Head>
<link rel="stylesheet" href="https://f1.codeday.org/fonts/gosha-sans/all.css" />
<link
rel="stylesheet"
href="https://f1.codeday.org/fonts/gosha-sans/all.css"
/>
</Head>
<ScheduleBox>
<Schedule event={event} config={config} />
</ScheduleBox>
<RadioBox>
{config.radio && <NowPlaying align="left" />}
</RadioBox>
<RadioBox>{config.radio && <NowPlaying align="left" />}</RadioBox>
<SocialBox>
<Video purpose="intro"/>
<OBS/>
</SocialBox>
</Slide>
);
Expand Down
91 changes: 91 additions & 0 deletions components/live/obs/fallbackslide.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React, { useEffect } from 'react';
import dynamic from 'next/dynamic';
import Text from '@codeday/topo/Atom/Text';
import Box from '@codeday/topo/Atom/Box';
import Image from 'next/image';

const ReactTypingEffect = dynamic(
() => import('react-typing-effect'),
{ ssr: false },
);

const hellos = [
'Pershendetje shoku im!',
'Բարեւ իմ ընկեր!',
'Salam dostum!',
'Kaixo lagun!',
'Вітаю мой сябар!',
'Zdravo prijatelju!',
'Здравей приятелю!',
'Hola amic meu!',
'Kumusta akong higala!',
'Moni mnzanga!',
'朋友你好!',
'Salutu o amicu!',
'Zdravo prijatelju!',
'Ahoj příteli!',
'Hej min ven!',
'Hallo mijn vriend!',
'Hello my friend!',
'Tere mu sõber!',
'Kumusta Kaibigan ko!',
'Hei ystäväni!',
'Bonjour, mon ami!',
'Hallo myn freon!',
'Hola meu amigo!',
'Hallo, mein Freund!',
'Γεια σου φίλε μου!',
'Bonjou zanmi mwen!',
'Sannu abokina!',
'Aloha e kuʻu hoaaloha!',
'Szia barátom!',
'Halló, vinur minn!',
'Ndewo, enyi m!',
'Ndewo, enyi m!',
'Dia duit a chara!',
'Ciao amico!',
'こんにちは、友よ!',
'Halo kancaku!',
'Сәлеметсіз бе менің досым!',
'Mwaramutse nshuti yanjye!',
'Silav hevalê min!',
'Salve amice!',
'Sveiks mans draugs!',
'Labas mano drauge!',
'Hallo mäi Frënd!',
'Здраво пријателе!',
'Ahoy Mateys!',
'سلام دوست من!',
'Привет мой друг!',
'안녕 내 친구!',
'สวัสดีเพื่อนของฉัน!',
'Merhaba arkadaşım!',
'Xin chào bạn của tôi!',
'Olá meu amigo!',
'مرحبا صديقي!',
'שלום חבר שלי!',
'नमस्ते मेरे दोस्त!',
];

export default function FallbackSlide({ onComplete }) {
useEffect(() => {
const interval = setInterval(onComplete, 5000);
return () => clearInterval(interval);
}, [onComplete]);

return (
<Box p={8} style={{ backgroundColor: '#ff686b', color: '#fff', position: 'relative', height: '60vh' }}>
<Box position="absolute" top="calc(50% - 6em)" left={0} right={0} textAlign="center">
<Image src="/logo.png" alt="CodeDay" width={266} height={52.6} />
<Text as="div" fontSize="xl">
<ReactTypingEffect
speed={50}
eraseSpeed={50}
typingDelay={100}
text={hellos.sort(() => Math.random() > 0.5 ? 1 : -1)}
/>
</Text>
</Box>
</Box>
)
}
12 changes: 12 additions & 0 deletions components/live/obs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React, { useState, useEffect } from "react";
import Video from "./video";
import FallbackSlide from "./fallbackslide";

const INTERVAL = 5 * 60 * 1000;
export default function OBS() {
return (
<>
<Video fallback={<FallbackSlide />} purpose="live" />
</>
);
}
2 changes: 1 addition & 1 deletion components/live/video.js → components/live/obs/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ export default function Video(purpose) {
</div>
</>
);
}
}
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"apollo-cache-inmemory": "^1.6.3",
"apollo-client": "^2.6.4",
"apollo-link-prismic": "^1.0.4",
"confetti-react": "^2.6.0",
"dotenv": "^8.1.0",
"framer-motion": "^12.0.6",
"graphql": "^14.5.8",
"graphql-tag": "^2.10.1",
"luxon": "^2.1.1",
Expand All @@ -28,10 +30,14 @@
"random-seed": "^0.3.0",
"react": "^18.2.0",
"react-addons-css-transition-group": "^15.6.2",
"react-canvas-confetti": "^2.0.7",
"react-confetti": "^6.2.2",
"react-dom": "^18.2.0",
"react-player": "^2.16.0",
"react-sound": "^1.2.0",
"react-typing-effect": "^2.0.5",
"react-typist-n10": "^2.0.4",
"react-use": "^17.6.0",
"react-youtube": "^7.9.0",
"styled-components": "^4.4.0",
"superagent": "^5.1.0"
Expand Down
Binary file added public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.