Skip to content

Commit c35669e

Browse files
committed
Merge branch 'master' into #4-Edit-full-text-plus-replace-only-trainer
2 parents 907a379 + b736516 commit c35669e

12 files changed

Lines changed: 925 additions & 9 deletions

File tree

‎front/config/webpack/base.js‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const HtmlWebpackPlugin = require('html-webpack-plugin');
22
const merge = require('webpack-merge');
33
const helpers = require('./helpers');
4+
const CopyPlugin = require('copy-webpack-plugin');
45

56
module.exports = merge(
67
{},
@@ -45,8 +46,14 @@ module.exports = merge(
4546
plugins: [
4647
new HtmlWebpackPlugin({
4748
favicon: 'assets/favicon.ico',
48-
filename: 'index.html',
49-
template: 'index.html',
49+
template: 'app.html',
50+
filename: 'app.html',
51+
}),
52+
new CopyPlugin({
53+
patterns: [
54+
{ from: '../static/index.html', to: 'index.html' },
55+
{ from: '../static/styles.css', to: 'styles.css' },
56+
],
5057
}),
5158
],
5259
}

‎front/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@typescript-eslint/parser": "^2.9.0",
5858
"babel-loader": "^8.0.6",
5959
"babel-plugin-emotion": "^10.0.23",
60+
"copy-webpack-plugin": "^6.2.1",
6061
"css-loader": "^3.2.0",
6162
"dotenv-webpack": "^1.7.0",
6263
"eslint": "^6.7.1",
File renamed without changes.

‎front/src/common/global-window.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export const getHostBaseUrl = () => window.location.origin;
1+
export const getHostBaseUrl = () =>
2+
`${window.location.origin}${window.location.pathname}`;

‎front/src/pods/trainer/components/new-text.component.tsx‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ interface Props {
1111
export const NewTextComponent: React.FC<Props> = props => {
1212
const { handleAppendTrainerText } = props;
1313
const [trainerText, setTrainerText] = React.useState<string>('');
14-
const { newTextContainer, labelTextarea, editTextArea, sendBtn } = classes;
14+
const {
15+
newTextContainer,
16+
labelTextarea,
17+
editTextArea,
18+
sendBtn,
19+
sendBtnDisabled,
20+
} = classes;
1521

1622
const trainerTextRef = React.useRef<string>(trainerText);
1723

@@ -51,9 +57,10 @@ export const NewTextComponent: React.FC<Props> = props => {
5157
<Button
5258
variant="contained"
5359
color="primary"
54-
className={sendBtn}
55-
onClick={() => handleAppendTrainerTextInternal()}
56-
disabled={!trainerText}
60+
className={trainerText ? sendBtn : sendBtnDisabled}
61+
onClick={() => trainerText && handleAppendTrainerTextInternal()}
62+
aria-disabled={!trainerText}
63+
disableRipple={!trainerText}
5764
>
5865
Send
5966
</Button>

‎front/src/pods/trainer/components/new-text.styles.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,22 @@ export const editTextArea = css`
3030
export const sendBtn = css`
3131
width: 100%;
3232
`;
33+
34+
export const sendBtnDisabled = css`
35+
color: ${palette.grey[700]};
36+
background-color: ${palette.grey[300]};
37+
cursor: default;
38+
width: 100%;
39+
opacity: 0.5;
40+
box-shadow: none;
41+
&:hover {
42+
color: ${palette.grey[700]};
43+
background-color: ${palette.grey[300]};
44+
box-shadow: none;
45+
}
46+
&:active {
47+
color: ${palette.grey[700]};
48+
background-color: ${palette.grey[300]};
49+
box-shadow: none;
50+
}
51+
`;

‎front/src/pods/trainer/trainer.container.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export const TrainerContainer = () => {
4848
};
4949

5050
React.useEffect(() => {
51-
setCurrentTrainerUrl(`${getHostBaseUrl()}/#${routes.trainer(room, token)}`);
52-
setCurrentStudentUrl(`${getHostBaseUrl()}/#${routes.student(room)}`);
51+
setCurrentTrainerUrl(`${getHostBaseUrl()}#${routes.trainer(room, token)}`);
52+
setCurrentStudentUrl(`${getHostBaseUrl()}#${routes.student(room)}`);
5353
handleConnection();
5454
}, []);
5555

‎front/src/scenes/create-session.scene.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ import React from 'react';
22
import { CreateSessionContainer } from 'pods/create-session';
33

44
export const CreateSessionScene: React.FC = () => {
5+
React.useEffect(() => {
6+
document.title = `Create New Session - Code Paster`;
7+
}, []);
8+
59
return <CreateSessionContainer />;
610
};

‎front/src/scenes/student.scene.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ import * as React from 'react';
22
import { PlayerContainer } from 'pods/student';
33

44
export const StudentScene = () => {
5+
React.useEffect(() => {
6+
document.title = `Student - Code Paster`;
7+
}, []);
8+
59
return <PlayerContainer />;
610
};

‎front/src/scenes/trainer.scene.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@ import { CreateSessionContainer } from 'pods/create-session';
33
import { TrainerContainer } from 'pods/trainer';
44

55
export const TrainerScene: React.FC = () => {
6+
React.useEffect(() => {
7+
document.title = `Trainer - Code Paster`;
8+
}, []);
9+
610
return <TrainerContainer />;
711
};

0 commit comments

Comments
 (0)