Skip to content

Commit c83efba

Browse files
committed
Merge branch 'dev' into liveCodeRender
front end changes from dark mode :wq
2 parents e77ac62 + 3fb7b72 commit c83efba

File tree

9 files changed

+35
-13
lines changed

9 files changed

+35
-13
lines changed

app/src/components/login/SignIn.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const SignIn: React.FC<LoginInt & RouteComponentProps> = props => {
6767
const [invalidPass, setInvalidPass] = useState(false);
6868

6969
useEffect(() => {
70-
const githubCookie = setInterval(() => {
70+
const githubCookie = setTimeout(() => {
7171
window.api?.setCookie();
7272
window.api?.getCookie(cookie => {
7373
// if a cookie exists, set localstorage item with cookie data, clear interval, go back to '/' route to load app

app/src/components/main/Canvas.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import renderChildren from '../../helperFunctions/renderChildren';
88
// Caret start
99
import Arrow from './Arrow';
1010

11-
function Canvas() {
11+
function Canvas(props): JSX.Element {
1212
const [state, dispatch] = useContext(StateContext);
1313
// Caret start
1414
Arrow.deleteLines();
@@ -72,12 +72,23 @@ function Canvas() {
7272
border: '1px solid #FBFBF2',
7373
borderStyle: isOver ? 'dotted' : 'solid',
7474
};
75+
76+
const darkCanvasStyle = {
77+
width: '100%',
78+
minHeight: '100%',
79+
backgroundColor: isOver ? '#4d4d4d' : '#21262c',
80+
border: '1px solid #FBFBF2',
81+
borderStyle: isOver ? 'dotted' : 'solid',
82+
};
7583
// Combine the default styles of the canvas with the custom styles set by the user for that component
7684
// The render children function renders all direct children of a given component
7785
// Direct children are draggable/clickable
86+
87+
// const canvasStyle = combineStyles(defaultCanvasStyle, currentComponent.style);
7888
const canvasStyle = combineStyles(defaultCanvasStyle, currentComponent.style);
89+
const darkCombinedCanvasStyle = combineStyles(darkCanvasStyle, currentComponent.style);
7990
return (
80-
<div ref={drop} style={canvasStyle} onClick={onClickHandler}>
91+
<div ref={drop} style={props.isThemeLight ? canvasStyle : darkCombinedCanvasStyle} onClick={onClickHandler}>
8192
{renderChildren(currentComponent.children)}
8293
</div>
8394
);

app/src/components/main/CanvasContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import Canvas from './Canvas';
33

44
// The CanvasContainer sets the boundaries on the width/height of the canvas
5-
function CanvasContainer() {
5+
function CanvasContainer(props): JSX.Element {
66
const canvasContainerStyle = {
77
width: '100%',
88
backgroundColor: 'lightgrey',
@@ -12,7 +12,7 @@ function CanvasContainer() {
1212
return (
1313
<div style={canvasContainerStyle}>
1414

15-
<Canvas />
15+
<Canvas isThemeLight={props.isThemeLight}/>
1616
</div>
1717
);
1818
}

app/src/components/main/DirectChildHTML.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { combineStyles } from '../../helperFunctions/combineStyles';
1010
import globalDefaultStyle from '../../public/styles/globalDefaultStyles';
1111
import Annotation from './Annotation'
1212

13+
import { styleContext } from '../../containers/AppContainer';
14+
1315
function DirectChildHTML({
1416
childId,
1517
name,
@@ -19,6 +21,7 @@ function DirectChildHTML({
1921
annotations,
2022
}: ChildElement) {
2123
const [state, dispatch] = useContext(StateContext);
24+
const { isThemeLight } = useContext(styleContext);
2225

2326
// find the HTML element corresponding with this instance of an HTML element
2427
// find the current component to render on the canvas
@@ -59,15 +62,17 @@ function DirectChildHTML({
5962
: '1px solid grey'
6063
};
6164

65+
6266
const combinedStyle = combineStyles(
6367
combineStyles(combineStyles(globalDefaultStyle, HTMLType.style), style),
6468
interactiveStyle
6569
);
6670

6771
return (
6872
<div onClick={onClickHandler} style={combinedStyle} ref={drag} id={`canv${childId}`}>
69-
<strong>{HTMLType.placeHolderShort}</strong>
70-
{` (${childId})`}
73+
<strong style={ {color: isThemeLight ? 'black' : 'white'} }>{HTMLType.placeHolderShort}</strong>
74+
{/* {` (${childId})`} */}
75+
<span style={ {color: isThemeLight ? 'black' : 'white'} }>{` ( ${childId} )`}</span>
7176
<Annotation
7277
id={childId}
7378
name={name}

app/src/components/main/DirectChildHTMLNestable.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import componentNest from '../../helperFunctions/componentNestValidation'
1212
import AddRoute from './AddRoute';
1313
import AddLink from './AddLink';
1414

15+
import { styleContext } from '../../containers/AppContainer';
16+
1517
function DirectChildHTMLNestable({
1618
childId,
1719
type,
@@ -23,6 +25,7 @@ function DirectChildHTMLNestable({
2325
attributes
2426
}: ChildElement) {
2527
const [state, dispatch] = useContext(StateContext);
28+
const { isThemeLight } = useContext(styleContext);
2629
const ref = useRef(null);
2730

2831
// takes a snapshot of state to be used in UNDO and REDO cases. snapShotFunc is also invoked in Canvas.tsx
@@ -145,8 +148,9 @@ function DirectChildHTMLNestable({
145148

146149
return (
147150
<div onClick={onClickHandler} style={combinedStyle} ref={ref} id={`canv${childId}`}>
148-
<strong>{HTMLType.placeHolderShort}</strong>
149-
{` ( ${childId} )`}
151+
<strong style={ {color: isThemeLight ? 'black' : 'white'} }>{HTMLType.placeHolderShort}</strong>
152+
{/* {` ( ${childId} )`} */}
153+
<span style={ {color: isThemeLight ? 'black' : 'white'} }>{` ( ${childId} )`}</span>
150154
<strong style={{ color: "#0099E6" }}>{attributes && attributes.compLink ? ` ${attributes.compLink}` : ''}</strong>
151155
{routeButton}
152156
<Annotation

app/src/containers/AppContainer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import RightContainer from './CustomizationPanel';
77
import { theme1, theme2 } from '../public/styles/theme';
88
export const styleContext = createContext({
99
style: null,
10-
setStyle: null
10+
setStyle: null,
11+
isThemeLight: null
1112
});
1213
// setting light and dark themes (navbar and background); linked to theme.ts
1314
const lightTheme = theme1;
@@ -20,7 +21,7 @@ const AppContainer = () => {
2021
return (
2122
// Mui theme provider provides themed styling to all MUI components in app
2223
<MuiThemeProvider theme={isThemeLight ? lightTheme : darkTheme}>
23-
<styleContext.Provider value={{ style, setStyle }}>
24+
<styleContext.Provider value={{ style, setStyle, isThemeLight }}>
2425
<div>
2526
<NavBar setTheme={setTheme} isThemeLight={isThemeLight}/>
2627
</div>

app/src/containers/MainContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const MainContainer = (props): JSX.Element => {
99
return (
1010
<div className="main-container" style={style} >
1111
<div className="main">
12-
<CanvasContainer />
12+
<CanvasContainer isThemeLight={props.isThemeLight}/>
1313
<DemoRender />
1414
</div>
1515
<BottomPanel isThemeLight={props.isThemeLight}/>

app/src/context/HTMLTypes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ const HTMLTypes: HTMLType[] = [
224224
tag: 'Link',
225225
name: 'LinkHref',
226226
style: {},
227-
placeHolderShort: 'LinkHref',
227+
placeHolderShort: 'Link',
228228
placeHolderLong: '',
229229
icon: ListIcon,
230230
framework: 'nextjs',

server/controllers/userController.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ userController.createUser = (req, res, next) => {
3030
let email, username, password;
3131
// use this condition for Oauth login
3232
if (res.locals.signUpType === 'oauth') {
33+
console.log('line 33 of create user')
3334
email = res.locals.githubEmail;
3435
username = email;
3536
password = randomPassword();

0 commit comments

Comments
 (0)