Skip to content

Commit e6b3609

Browse files
Merge pull request #169 from CaretCS/main
Final Merge from CaretDevelopment ReacType Caret Edition It was great working with ya'll!! Team Caret
2 parents 18302b9 + b736e6d commit e6b3609

File tree

124 files changed

+3087
-1052
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+3087
-1052
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["plugin:react/recommended", "airbnb-base"],
2+
"extends": ["plugin:react/recommended", "plugin:@typescript-eslint/recommended", "airbnb-base"],
33
"parserOptions": {
44
"ecmaFeatures": {
55
"jsx": true

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/team-reactype/ReacType/pulls)
77
![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)
8-
![Version 6.0](https://img.shields.io/badge/Release-6.0-lightgrey.svg)
8+
![Version 7.0.0](https://img.shields.io/badge/Release-7.0.0-lightgrey.svg)
99

10-
**ReacType** is a visual prototyping tool for developers employing **React** component architecture alongside the comprehensive type-checking of **TypeScript**.
10+
**ReacType** is a rapid prototyping tool for developers employing **React** component architecture alongside the comprehensive type-checking of **TypeScript**.
1111
In other words, **you can draw prototypes and export React / TypeScript code!**
1212

13-
**ReacType** allows users to _visualize_ their application architecture dynamically, employing a _drag-and-drop canvas display_ and a _real-time component code preview_. Users can create components and drag _instances_ of these components, as well as HTML elements, onto the canvas. This architecture can then be _exported_ as TypeScript application files to be used as a starter template for any repository.
13+
**ReacType** allows users to _visualize_ their application architecture dynamically, employing a _drag-and-drop canvas display_ , a _real-time demo render_ , a _real-time component code preview_. Users can create components and drag _instances_ of these components, as well as HTML elements, onto the canvas. This architecture can then be _exported_ as TypeScript application files to be used as a starter template for any repository.
1414

1515
Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windows](https://github.com/team-reactype/ReacType/releases/), [Linux](https://github.com/team-reactype/ReacType/releases/).
1616

@@ -48,6 +48,13 @@ Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windo
4848

4949
### Features
5050

51+
52+
- **Live Render Demo**: Live render demo in React using Electron's sandbox environment. Updates in realtime to reflect canvas structure and customization options.
53+
- **Annotations**: Provide design notes directly on the canvas and have these persist while sharing designs with other engineers.
54+
- **CSS Editor**: Copy and paste custom css styles and classes into the editor and save to use personal or company designs in an instant.
55+
- **State & Props Creator**: Create custom state hooks with real-time updates in the code preview.
56+
- **Application Style Update**: Complete redesign of the entire application for enhanced user experience to maintain a single view application
57+
5158
- **Dashboard**: Click the 'Dashboard' button to view the Public Dashboard and User Dashboard.
5259
- **Like**: Like other people's templates by clicking on the thumbs up icon.
5360
- **Comment**: Comment on other templates by typing in the input field and clicking the comment icon.

app/electron/main.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async function createWindow() {
7272
// icon: path.join(__dirname, '../src/public/icons/png/256x256.png'),
7373
webPreferences: {
7474
zoomFactor: 0.7,
75-
// enable devtools when in development mode
75+
// enable devtools when in development mode
7676
devTools: isDev,
7777
// crucial security feature - blocks rendering process from having access to node modules
7878
nodeIntegration: false,
@@ -131,7 +131,7 @@ async function createWindow() {
131131
});
132132
}
133133

134-
// Emitted when the window is closed.
134+
// Emitted when the window is closed.
135135
win.on('closed', () => {
136136
// Dereference the window object, usually you would store windows
137137
// in an array if your app supports multi windows, this is the time
@@ -223,6 +223,7 @@ app.on('web-contents-created', (event, contents) => {
223223
const parsedUrl = new URL(navigationUrl);
224224
const validOrigins = [
225225
selfHost,
226+
'https://reactype-caret.herokuapp.com',
226227
'http://localhost:5000',
227228
'https://reactype.herokuapp.com',
228229
'https://github.com',
@@ -246,6 +247,7 @@ app.on('web-contents-created', (event, contents) => {
246247
const parsedUrl = new URL(navigationUrl);
247248
const validOrigins = [
248249
selfHost,
250+
'https://reactype-caret.herokuapp.com',
249251
'http://localhost:5000',
250252
'https://reactype.herokuapp.com',
251253
'https://github.com',
@@ -288,6 +290,7 @@ app.on('web-contents-created', (event, contents) => {
288290
const parsedUrl = new URL(navigationUrl);
289291
const validOrigins = [
290292
selfHost,
293+
'https://reactype-caret.herokuapp.com',
291294
'http://localhost:5000',
292295
'https://reactype.herokuapp.com',
293296
'https://nextjs.org',
@@ -351,7 +354,7 @@ ipcMain.on('choose_app_dir', (event) => {
351354
});
352355

353356
// define serverURL for cookie and auth purposes based on environment
354-
let serverUrl = 'https://reactype.herokuapp.com';
357+
let serverUrl = 'https://reactype-caret.herokuapp.com';
355358
if (isDev) {
356359
serverUrl = 'http://localhost:5000';
357360
}

app/src/Dashboard/ProjectContainer.tsx

Lines changed: 118 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
1-
import React, { useState, useContext, useEffect, createContext } from 'react';
2-
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
1+
import React, {
2+
useState, useContext, useEffect, createContext,
3+
} from 'react';
4+
import {
5+
createMuiTheme, MuiThemeProvider, makeStyles, Theme, useTheme,
6+
} from '@material-ui/core/styles';
37
import { useQuery } from '@apollo/client';
8+
9+
import AppBar from '@material-ui/core/AppBar';
10+
import Tabs from '@material-ui/core/Tabs';
11+
import Tab from '@material-ui/core/Tab';
12+
13+
import Box from '@material-ui/core/Box';
414
import { GET_PROJECTS } from './gqlStrings';
515
import Project from './Project';
616
import NavBarDash from './NavbarDash';
7-
import AppContainer from '../containers/AppContainer';
17+
818
import { theme1, theme2 } from '../public/styles/theme';
919
// Implement Apollo Client useQuery hook to retrieve data from the server through graphQL. This includes 2 steps:
1020
// 1) Impliment Apollo Provider in the top component in ./src/index.js, this allows children components access to the queried data
1121
// 2) useQuery hook will update the data stored in Apollo Client's cache and automatically trigger child components rendering
1222

1323
export const styleContext = createContext({
1424
style: null,
15-
setStyle: null
25+
setStyle: null,
1626
});
1727

1828
// setting light and dark themes (navbar and background); linked to theme.ts
1929
const lightTheme = theme1;
2030
const darkTheme = theme2; // dark mode color in theme.ts not reached
2131

2232

23-
const arrToComponent = (arr) => {
24-
return arr.map((proj, index) => <Project
33+
const arrToComponent = arr => arr.map((proj, index) => <Project
2534
key= {index}
2635
name = {proj.name}
2736
likes = {proj.likes}
@@ -32,22 +41,81 @@ const arrToComponent = (arr) => {
3241
id = {proj.id}
3342
comments = {proj.comments}
3443
/>);
44+
45+
// Start Pulled from materialUI to create a tab panel
46+
const a11yProps = (index: any) => ({
47+
id: `vertical-tab-${index}`,
48+
'aria-controls': `vertical-tabpanel-${index}`,
49+
});
50+
51+
interface LinkTabProps {
52+
label?: string;
53+
href?: string;
54+
}
55+
56+
const LinkTab = (props: LinkTabProps) => (
57+
<Tab
58+
onClick={(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
59+
event.preventDefault();
60+
}}
61+
{...props}
62+
/>
63+
);
64+
65+
const TabPanelItem = (props: TabPanelProps): JSX.Element => {
66+
const theme = useTheme();
67+
const {
68+
children, index, value, ...other
69+
} = props;
70+
return (
71+
<div
72+
role="tabpanel"
73+
hidden={value !== index}
74+
id={`vertical-tabpanel-${index}`}
75+
aria-labelledby={`vertical-tab-${index}`}
76+
{...other}
77+
>
78+
{value === index && (
79+
<Box p={3}>
80+
{children}
81+
</Box>
82+
)}
83+
</div>
84+
);
3585
};
3686

87+
const useStyles = makeStyles((theme) => ({
88+
root: {
89+
flexGrow: 1,
90+
backgroundColor: theme.palette.background.paper,
91+
display: 'flex',
92+
// height: 224,
93+
},
94+
tabs: {
95+
borderRight: `1px solid ${theme.palette.divider}`,
96+
},
97+
}));
98+
// End of prefab code to generate a tab panel
99+
100+
const ProjectContainer = (): JSX.Element => {
101+
const classes = useStyles();
102+
const [value, setValue] = useState(0);
103+
104+
const handleChange = (event: React.ChangeEvent<{}>, newValue: number) => {
105+
setValue(newValue);
106+
};
37107

38-
const ProjectContainer = () => {
108+
// old code from project container
39109
const myVar = {};
40110
// Need this for the individual user dasboard, for now, dashboard shows all projects from all users
41111
const userSSID = window.localStorage.getItem('ssid') || 'unavailable';
42112
const username = window.localStorage.getItem('username') || 'unavailable';
43-
113+
44114
const [isThemeLight, setTheme] = useState(true);
45115

46116
const initialStyle = useContext(styleContext);
47117
const [style, setStyle] = useState(initialStyle);
48118

49-
// --------------------------Sorting Buttons------------------------------------//
50-
51119
// hook for sorting menu
52120
const [selectedOption, setSelectedOption] = useState('RATING');
53121

@@ -68,55 +136,72 @@ const ProjectContainer = () => {
68136
const sortedRatings = projects.sort((a, b) => b.username - a.username);
69137
return sortedRatings;
70138
};
71-
// ===================================================================================== //
72-
73139
// function for selecting drop down sorting menu
74140
const optionClicked = (value) => {
75141
setSelectedOption(value);
76142
};
77-
// ===================================================================================== //
78-
79-
80143
// useQuery hook abstracts fetch request
81144
const { loading, error, data } = useQuery(GET_PROJECTS, { pollInterval: 2000, variables: myVar });
82145
if (loading) return <p>Loading...</p>;
83146
if (error) return <p>Error :{error}</p>;
84-
85147
// based on resolver(getAllProject) for this query, the data is stored in the data object with the key 'getAllProjects'
86148
const projects = data.getAllProjects;
87-
88149
// create array to hold the data recieved in the public dashboard the will be conditionally rendered
89-
let sortedProjects = projects.filter(proj => proj.published);
90-
const userProjects = projects.filter(proj => proj.username === username);
150+
let sortedProjects = projects.filter(proj => {
151+
return proj.published;
152+
});
153+
const userProjects = projects.filter((proj) => {
154+
return proj.username === username;
155+
});
91156

92157
// checking which sorting method was selected from drop down menu and invoking correct sorting function
93158
if (selectedOption === 'DATE') sortedProjects = sortByDate(sortedProjects);
94159
else if (selectedOption === 'USER') sortedProjects = sortByUser(sortedProjects);
95160
else if (selectedOption === 'RATING') sortedProjects = sortByRating(sortedProjects);
96-
161+
97162

98163
// create array to hold the components Project of loggin-in users
99164
// generate an array of Project components based on queried data
100165
const userDisplay = arrToComponent(userProjects);
101-
102166
// create an array of components Project that will be conditionally rendered
103167
const sortedDisplay = arrToComponent(sortedProjects);
168+
// old code from Project Container
104169

105170
return (
106-
<MuiThemeProvider theme={isThemeLight ? lightTheme : darkTheme}>
107-
<div className = "dashboardContainer">
108-
<NavBarDash setTheme={setTheme} styles={[style, setStyle]} isThemeLight={isThemeLight} optionClicked={optionClicked}/>
109-
<h1> Public Dashboard </h1>
110-
<div className = "projectContainer">
111-
{sortedDisplay}
112-
</div>
113-
<hr></hr>
114-
<h1> User Dashboard </h1>
115-
<div className = "projectContainer">
116-
{userDisplay}
171+
<div className={classes.root}>
172+
<MuiThemeProvider theme={isThemeLight ? lightTheme : darkTheme}>
173+
<div className= {'dashboardContainer'}>
174+
<NavBarDash setTheme={setTheme} styles={[style, setStyle]} isThemeLight={isThemeLight} optionClicked={optionClicked}/>
175+
<div className={'userDashboard'}>
176+
{/* <AppBar position="static"> */}
177+
<Tabs
178+
variant="scrollable"
179+
orientation="vertical"
180+
value={value}
181+
onChange={handleChange}
182+
aria-label="Vertical tabs example"
183+
className={classes.tabs}
184+
>
185+
<LinkTab label="Shared Dashboard" {...a11yProps(0)} />
186+
<LinkTab label="Private Dashboard" {...a11yProps(1)} />
187+
</Tabs>
188+
{/* </AppBar> */}
189+
<TabPanelItem className= {'projectPanel'} value={value} index={0}>
190+
<h1> Shared Dashboard </h1>
191+
<div className="projectContainer">
192+
{sortedDisplay}
193+
</div>
194+
</TabPanelItem>
195+
<TabPanelItem className= {'projectPanel'} value={value} index={1}>
196+
<h1> Private Dashboard </h1>
197+
<div className="projectContainer">
198+
{userDisplay}
199+
</div>
200+
</TabPanelItem>
117201
</div>
202+
</div>
203+
</MuiThemeProvider>
118204
</div>
119-
</MuiThemeProvider>
120205
);
121206
};
122207

app/src/Dashboard/styles.css

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@
1414

1515
.dashboardContainer {
1616
height: 100%;
17+
width: 100%
18+
}
19+
20+
.userDashboard {
21+
display: flex;
22+
flex-direction: row;
23+
}
24+
25+
.projectPanel {
26+
width: 100%;
1727
}
1828

1929
.projectContainer{
2030
display: flex;
2131
flex-direction: column-reverse;
2232
flex-flow: row wrap;
23-
height: 600px;
33+
flex-grow: 1;
2434
overflow-y: scroll;
2535
}
2636

@@ -66,7 +76,7 @@
6676
}
6777

6878
.header {
69-
background-color: #186BB4;
79+
background-color: #0099E6;
7080
color: rgba(255, 255, 255, 0.897);
7181
width: 100%;
7282
position: relative;

0 commit comments

Comments
 (0)