Skip to content
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

settings modal #81

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion package-lock.json

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

26 changes: 26 additions & 0 deletions src/Components/NameChanger/NameChanger.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React, { useContext } from "react";
import TextInput from "../TextInput/TextInput";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { NameChangerContext } from "../../Contexts";

import './NameChanger.scss'

function NameChanger({inputProps, icon}) {
const { setWillBeRenamed, changeName } = useContext(NameChangerContext);

return (
<div className="row">
<div className="col-10">
<TextInput
{...inputProps}
valueSetter={setWillBeRenamed}
/>
</div>
<div className="col-2 icon">
<FontAwesomeIcon icon={icon} onClick={changeName} />
</div>
</div>
);
}

export default NameChanger;
6 changes: 6 additions & 0 deletions src/Components/NameChanger/NameChanger.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "../../styles/variables.scss";

.icon{
padding: 10px 0;
cursor: pointer;
}
4 changes: 2 additions & 2 deletions src/Components/SendMessageInput/SendMessageInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { React, useContext } from "react";
import TextInput from "../TextInput/TextInput";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faPaperPlane } from '@fortawesome/free-solid-svg-icons'
import { Context } from "../../Contexts/SendMessageInputContext";
import { SendMessageInputContext } from "../../Contexts";

import './SendMessageInput.scss'

function SendMessageInput () {
const { setText, click, press } = useContext(Context);
const { setText, click, press } = useContext(SendMessageInputContext);
let input = null

const refSetter = (ref) => {
Expand Down
29 changes: 29 additions & 0 deletions src/Components/SettingsModal/Room/RoomContainer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react'
import Setting from '../Setting/Setting'
import { faPen } from '@fortawesome/free-solid-svg-icons'

import './RoomContainer.scss';

const props = {
inputProps: {
placeholder: "Cental Perk"
},
icon: faPen,
}

const components = {
nameChanger: "nameChanger",
// permission: PermissionManager,
};

function RoomContainer() {
return (
<div className="user-container">
<Setting settingType={components.nameChanger} title="Room Name"
info="Name of the room." {...props}
/>
</div>
)
}

export default RoomContainer;
Empty file.
35 changes: 35 additions & 0 deletions src/Components/SettingsModal/Setting/Setting.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from "react";
import NameChanger from "../../NameChanger/NameChanger";

import './Setting.scss'
const components = {
nameChanger: NameChanger,
// permission: PermissionManager,
// deleteRoomButton: deleteRoomButton,
};

function Setting({ settingType, title, info, ...props }) {
const SpecificSetting = components[settingType];
return (
<div className='setting'>
<div className='title'><h5>{title}</h5></div>
<div className='container-body'>
<div className='info'>
<p>{info}</p>
</div>
<div className='setting'>
<SpecificSetting {...props}/>
</div>
</div>
</div>
);
}

Setting.defaultProps = {
settingType: components.nameChanger,
title: "Setting",
info: "This is setting",
props: {}
}

export default Setting;
Empty file.
43 changes: 43 additions & 0 deletions src/Components/SettingsModal/SettingsModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React, { useState } from 'react'
import Room from './Room/RoomContainer';
import User from './User/UserContainer';
import { RENAMES } from '../../Constants';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faXmarkCircle, faGears, faHome, faUser } from '@fortawesome/free-solid-svg-icons'

import './SettingsModal.scss';

function SettingsModal({ closeModal, selected }) {
const [selectedContent, setSelectedContent] = useState(RENAMES.ROOM);
return (
<div className="modal-background">
<div className="modal-container">
<div className='close-button'>
<FontAwesomeIcon icon={faXmarkCircle} onClick={() => closeModal(false)} />
</div>
<div className='row'>
<div className='col-md-2'>
<div className="room-user-container">
<div className='settings'><FontAwesomeIcon icon={faGears} /></div>
<div className={selectedContent === RENAMES.ROOM ? 'selected' : 'not-selected'}><FontAwesomeIcon icon={faHome} onClick={() => {
setSelectedContent(RENAMES.ROOM);
selected(RENAMES.ROOM);
}} /></div>
<div className={selectedContent === RENAMES.USER ? 'selected' : 'not-selected'}><FontAwesomeIcon icon={faUser} onClick={() => {
setSelectedContent(RENAMES.USER);
selected(RENAMES.USER);
}} /></div>
</div>
</div>
<div className='col-md-10'>
{
selectedContent === RENAMES.ROOM ? <Room /> : <User />
}
</div>
</div>
</div>
</div>
)
}

export default SettingsModal;
65 changes: 65 additions & 0 deletions src/Components/SettingsModal/SettingsModal.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@import "../../styles/variables.scss";

.modal-background {
width: 100vw;
height: 100vh;
backdrop-filter: blur(3px);
position: fixed;
display: flex;
justify-content: center;
align-items: center;
z-index: 1;

.modal-container {
width: 500px;
height: 500px;
border-radius: 12px;
background-color: $blacksea;
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
display: flex;
flex-direction: column;
padding: 25px;

.close-button {
display: flex;
justify-content: flex-end;
cursor: pointer;
}

.room-user-container {
div {
margin: 0 0 10px 0;
padding: 0 0 10px 20px;
}

.selected {
border-left: 3px solid $beyza;
}

.not-selected {
cursor: pointer;
}
}
}
}

/* width */
::-webkit-scrollbar {
width: 10px;
}

/* Track */
::-webkit-scrollbar-track {
background: $alihan;
}

/* Handle */
::-webkit-scrollbar-thumb {
background: $navy;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: $light-navy;
}

30 changes: 30 additions & 0 deletions src/Components/SettingsModal/User/UserContainer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import Setting from '../Setting/Setting'
import { faPen } from '@fortawesome/free-solid-svg-icons'

import './UserContainer.scss';


const props = {
inputProps: {
placeholder: "Regina Phalange"
},
icon: faPen,
}

const components = {
nameChanger: "nameChanger",
// permission: PermissionManager,
};

function UserContainer() {
return (
<div className="user-container">
<Setting settingType={components.nameChanger} title="Username"
info="Your user name will be visible in the viewers list and the chat." {...props}
/>
</div>
)
}

export default UserContainer;
11 changes: 11 additions & 0 deletions src/Components/SettingsModal/User/UserContainer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@import "../../../styles/variables.scss";

.user-container {
margin: 0 10px 0 0;

.container-body {
background-color: $alihan;
padding: 20px;
border-radius: 5px;
}
}
7 changes: 7 additions & 0 deletions src/Constants/Renames.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const RENAMES = {
ROOM: 'room',
USER: 'user',
}

export default RENAMES;

2 changes: 2 additions & 0 deletions src/Constants/SocketEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const SOCKET_EVENTS = {
VIDEO_DURATION_CHANGED: 'video-duration-changed',
SKIP_VIDEO: 'skip-video',
VIDEO_SKIPPED: 'video-skipped',
CHANGE_NAME: 'change-name',
NAME_CHANGED: 'name-changed',
};

export default SOCKET_EVENTS;
2 changes: 2 additions & 0 deletions src/Constants/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import SOCKET_EVENTS from './SocketEvents';
import PLAYLIST_STATUS from './PlaylistStatus';
import VIDEO_STATUS from './VideoStatus';
import RENAMES from './Renames';

export {
SOCKET_EVENTS,
PLAYLIST_STATUS,
VIDEO_STATUS,
RENAMES,
};
5 changes: 5 additions & 0 deletions src/Contexts/NameChangerContext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createContext } from "react";

const NameChangerContext = createContext();

export default NameChangerContext;
4 changes: 3 additions & 1 deletion src/Contexts/SendMessageInputContext.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { createContext } from "react";

export const Context = createContext();
const SendMessageInputContext = createContext();

export default SendMessageInputContext;
7 changes: 7 additions & 0 deletions src/Contexts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import NameChangerContext from './NameChangerContext';
import SendMessageInputContext from './SendMessageInputContext';

export {
NameChangerContext,
SendMessageInputContext,
};
Loading