Skip to content

Commit

Permalink
update ui, yt feature
Browse files Browse the repository at this point in the history
  • Loading branch information
qridwan committed Mar 7, 2023
1 parent 5a166d5 commit 7cfe74f
Show file tree
Hide file tree
Showing 18 changed files with 260 additions and 80 deletions.
Empty file removed .github/workflows/gcp.yml
Empty file.
62 changes: 62 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"ioredis": "^4.28.5",
"pg": "^8.8.0",
"pm2": "^5.2.2",
"rc-slider": "^10.1.1",
"react": "^17.0.2",
"react-colorful": "^5.6.1",
"react-dom": "^17.0.2",
Expand Down
35 changes: 34 additions & 1 deletion server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,12 @@ app.get('/youtube-trending', async (req, res) => {
}
});
app.post('/createRoom', async (req, res) => {
const roomData = req.body;

const genName = () => '/' + makeName(config.SHARD);
let name = genName();
console.log('createRoom: ', name);
const newRoom = new Room(io, name);
const newRoom = new Room(io, name, JSON.stringify(roomData));
if (postgres) {
const now = new Date();
const roomObj: any = {
Expand All @@ -290,6 +292,7 @@ app.post('/createRoom', async (req, res) => {
redisCount('createRoomError');
}
}

const decoded = await validateUserToken(req.body?.uid, req.body?.token);
newRoom.creator = decoded?.email;
const preload = (req.body?.video || '').slice(0, 20000);
Expand All @@ -302,6 +305,36 @@ app.post('/createRoom', async (req, res) => {
rooms.set(name, newRoom);
res.json({ name: name.slice(1) });
});
// app.post('/createRoom', async (req, res) => {
// const genName = () => '/' + makeName(config.SHARD);
// let name = genName();
// console.log('createRoom: ', name);
// const newRoom = new Room(io, name);
// if (postgres) {
// const now = new Date();
// const roomObj: any = {
// roomId: newRoom.roomId,
// lastUpdateTime: now,
// creationTime: now,
// };
// try {
// await insertObject(postgres, 'room', roomObj);
// } catch (e) {
// redisCount('createRoomError');
// }
// }
// const decoded = await validateUserToken(req.body?.uid, req.body?.token);
// newRoom.creator = decoded?.email;
// const preload = (req.body?.video || '').slice(0, 20000);
// if (preload) {
// redisCount('createRoomPreload');
// newRoom.video = preload;
// newRoom.paused = true;
// await newRoom.saveRoom();
// }
// rooms.set(name, newRoom);
// res.json({ name: name.slice(1) });
// });

app.post('/manageSub', async (req, res) => {
const decoded = await validateUserToken(req.body?.uid, req.body?.token);
Expand Down
Binary file added src/assets/placeholder/placeholder-image.webp
Binary file not shown.
3 changes: 3 additions & 0 deletions src/assets/upload/copied.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions src/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
DropdownProps,
Grid,
Icon,
Input,
Loader,
Message,
Popup,
Expand Down Expand Up @@ -1608,7 +1607,7 @@ export default class App extends React.Component<AppProps, AppState> {
// );
return (
<React.Fragment>
{!this.state.isAutoPlayable && (
{/* {!this.state.isAutoPlayable && (
<Modal inverted basic open>
<div style={{ display: 'flex', justifyContent: 'center' }}>
<Button
Expand All @@ -1627,7 +1626,7 @@ export default class App extends React.Component<AppProps, AppState> {
</Button>
</div>
</Modal>
)}
)} */}
{this.state.isUploadPress && (
<UploadFile toggleIsUploadPress={this.toggleIsUploadPress} />
// <Modal inverted basic open>
Expand Down
10 changes: 8 additions & 2 deletions src/components/ComboBox/ComboBox.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
width: 100vw;
position: absolute;
top: 18px;
max-height: 65vh;
max-height: 80vh;
overflow: auto;
z-index: 900;
}
Expand All @@ -18,7 +18,13 @@
.PlaylistDropdown {
background-color: #1f1f1f !important;
color: #f4f4f4 !important;
width: 150px;
width: 180px;

display: flex !important;
align-items: center !important;
}
.PlaylistDropdown > .text {
font-size: 1.3wv !important;
}
.PlaylistMenu {
background: black !important;
Expand Down
8 changes: 6 additions & 2 deletions src/components/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export class ComboBox extends React.Component<ComboBoxProps> {
style={{ flexGrow: 1 }}
fluid
focus
size="massive"
disabled={this.props.disabled}
onChange={this.doSearch}
onFocus={(e: any) => {
Expand Down Expand Up @@ -242,7 +243,10 @@ export class ComboBox extends React.Component<ComboBoxProps> {
>
<Dropdown.Menu direction="left" className={styles.PlaylistMenu}>
{this.props.playlist.length === 0 && (
<Dropdown.Item disabled style={{ color: 'white' }}>
<Dropdown.Item
disabled
style={{ color: 'white', fontSize: '1.2vw' }}
>
There are no items in the playlist.
</Dropdown.Item>
)}
Expand Down Expand Up @@ -281,7 +285,7 @@ export class ComboBox extends React.Component<ComboBoxProps> {
<Button
icon
labelPosition="right"
size="tiny"
size="big"
className={styles.UploadButton}
onClick={() => toggleIsUploadPress()}
>
Expand Down
58 changes: 37 additions & 21 deletions src/components/Controls/Controls.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import { Icon, Progress, Label, Popup } from 'semantic-ui-react';
import { Slider } from 'react-semantic-ui-range';
// import { Slider } from 'react-semantic-ui-range';
import { formatTimestamp } from '../../utils';
import styles from './Controls.module.css';
import Slider from 'rc-slider';
interface ControlsProps {
duration: number;
togglePlay: Function;
Expand Down Expand Up @@ -84,15 +85,15 @@ export class Controls extends React.Component<ControlsProps> {
}}
>
<Icon
size="big"
size="huge"
onClick={() => onSeek(null, currentTime - 10)}
className={styles.Btn}
name="angle double left"
// style={{ transform: 'rotate(180deg)' }}
title="Backward 10 seconds"
/>
<Icon
size="big"
size="huge"
onClick={() => {
togglePlay();
}}
Expand All @@ -101,7 +102,7 @@ export class Controls extends React.Component<ControlsProps> {
name={paused ? 'play circle outline' : 'pause circle outline'}
/>
<Icon
size="big"
size="huge"
onClick={() => onSeek(null, currentTime + 10)}
className={styles.Btn}
name="angle double right"
Expand All @@ -119,7 +120,7 @@ export class Controls extends React.Component<ControlsProps> {
}
trigger={
<Icon
size="large"
size="huge"
onClick={jumpToLeader}
disabled={!isBehind}
className={`${styles.Btn} control action ${
Expand All @@ -139,14 +140,14 @@ export class Controls extends React.Component<ControlsProps> {
title="Theater Mode"
/> */}
<Icon
size="big"
size="huge"
onClick={() => fullScreen(true)}
className="control action"
name="expand"
title="Fullscreen"
/>
<Icon
size="big"
size="huge"
onClick={() => {
showSubtitle();
}}
Expand All @@ -157,29 +158,44 @@ export class Controls extends React.Component<ControlsProps> {
title="Captions"
/>
<Icon
size="big"
size="huge"
onClick={() => {
toggleMute();
}}
className="control action"
name={muted ? 'volume off' : 'volume up'}
title="Mute"
/>
<div style={{ width: '120px', marginRight: '0px' }}>
<div style={{ width: '150px', marginRight: '0px' }}>
<Slider
value={volume}
color={'blue'}
railStyle={{ height: 15 }}
trackStyle={{ height: 15 }}
handleStyle={{
height: 32,
width: 32,
marginLeft: -14,
marginTop: -9,
}}
min={0}
max={1}
step={0.01}
disabled={muted}
settings={{
min: 0,
max: 1,
step: 0.01,
onChange: (value: number) => {
if (value !== this.props.volume && !isNaN(value)) {
this.props.setVolume(value);
}
},
onChange={(value: any) => {
if (value !== this.props.volume && !isNaN(value)) {
this.props.setVolume(value);
}
}}
// settings={{
// min: 0,
// max: 1,
// step: 0.01,
// onChange: (value: number) => {
// if (value !== this.props.volume && !isNaN(value)) {
// this.props.setVolume(value);
// }
// },
// }}
/>
</div>
</div>
Expand All @@ -190,7 +206,7 @@ export class Controls extends React.Component<ControlsProps> {
{/* ====================== Progress ====================== */}
<div className="control">{formatTimestamp(currentTime)}</div>
<Progress
size="tiny"
size="small"
color="blue"
onClick={
duration < Infinity && !this.props.disabled ? onSeek : undefined
Expand Down Expand Up @@ -227,7 +243,7 @@ export class Controls extends React.Component<ControlsProps> {
</div>
)}
</Progress>
<div className="control">{formatTimestamp(duration)}</div>
<div className={`control `}>{formatTimestamp(duration)}</div>
{/* ====================== Progress END ====================== */}
</div>
</>
Expand Down
6 changes: 4 additions & 2 deletions src/components/EmptyTheatre/EmptyTheatre.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
}
.content p {
text-align: center;
font-size: 15px;
font-size: 1.8vw;
margin: 4px;
line-height: 1.1rem;
color: #fff9f9b5;
}
.btncontainer {
margin: 20px 0px;
}
Loading

0 comments on commit 7cfe74f

Please sign in to comment.