Skip to content

Commit

Permalink
Merge pull request #3 from oslabs-beta/kirk_jessica/merge_attempt_wit…
Browse files Browse the repository at this point in the history
…h_UI/ux_merge

Successfully merged updates from branch(UI/UX merge).
  • Loading branch information
astholden authored Feb 17, 2022
2 parents fbf9cb1 + 0c7342c commit 27322b6
Show file tree
Hide file tree
Showing 30 changed files with 113,812 additions and 58,403 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"globals": {
"NodeJS": true,
"JSX": true,
"Electron": true
},
"plugins": ["react", "prettier"],
"parser": "babel-eslint",
"parserOptions": {
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ __tests__/**/__snapshots__
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

Thumbs.db
1 change: 1 addition & 0 deletions app/components/Contact.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable jsx-a11y/label-has-associated-control */
import React, { useContext } from 'react';
import '../stylesheets/Contact.scss';
import { DashboardContext } from '../context/DashboardContext';
Expand Down
Empty file added app/components/FirstLaunch.tsx
Empty file.
50 changes: 28 additions & 22 deletions app/components/Occupied.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable jsx-a11y/label-has-associated-control */
import React, { useContext, useEffect, useState, useRef, forwardRef } from 'react';

// MATERIAL UI METHODS
Expand Down Expand Up @@ -49,8 +50,8 @@ type ClickEvent = React.MouseEvent<HTMLElement>;

const Occupied = React.memo(() => {
const { setServicesData } = useContext(ApplicationContext);
const { applications, getApplications, deleteApp, mode, getMode } = useContext(DashboardContext);
const { commsData, setCommsData, fetchCommsData } = useContext(CommsContext);
const { applications, getApplications, deleteApp, mode } = useContext(DashboardContext);
const { commsData } = useContext(CommsContext);
const [open, setOpen] = useState<boolean>(false);
const [addOpen, setAddOpen] = useState<boolean>(false);
const [addsOpen, setAddsOpen] = useState<boolean>(false);
Expand All @@ -67,7 +68,7 @@ const Occupied = React.memo(() => {
}, []);

// Ask user for deletetion confirmation
const confirmDelete = (event: ClickEvent, app: string, i: number) => {
const confirmDelete = (event: ClickEvent, application: string, i: number) => {
const message = `The application '${app}' will be permanently deleted. Continue?`;
if (confirm(message)) deleteApp(i);
};
Expand All @@ -82,8 +83,9 @@ const Occupied = React.memo(() => {
}
};

//Conditional Rendering of UI Modals for Light and Dark Mode
const useStylesDark = makeStyles<Theme, StyleProps>(theme => ({
// Conditional Rendering of UI Modals for Light and Dark Mode
// Theme, StyleProps
const useStylesDark = makeStyles<StyleProps>(theme => ({
// ALL CARDS
paper: {
display: 'flex',
Expand Down Expand Up @@ -136,7 +138,7 @@ const Occupied = React.memo(() => {
// color: '#ffffff', // dark mode
},
}));
const useStylesLight = makeStyles<Theme, StyleProps>(theme => ({
const useStylesLight = makeStyles<StyleProps>(theme => ({
// ALL CARDS
paper: {
display: 'flex',
Expand Down Expand Up @@ -190,8 +192,7 @@ const Occupied = React.memo(() => {
},
}));

let classes =
mode === 'light mode' ? useStylesLight({} as StyleProps) : useStylesDark({} as StyleProps);
const classes = mode === 'light mode' ? useStylesLight({}) : useStylesDark({}); // {} as StyleProps

// update notification count based on statuscode >= 400
const notification = commsData
Expand All @@ -216,7 +217,7 @@ const Occupied = React.memo(() => {
<input
className="form"
id="textInput"
placeholder={'Search...'}
placeholder="Search..."
onChange={e => setSearchTerm(e.target.value)}
type="text"
name="search"
Expand All @@ -233,8 +234,8 @@ const Occupied = React.memo(() => {
</span>
<DashboardIcon className="navIcon" id="dashboardIcon" />
</div>

<div className="notificationsIconArea" onClick={updateNotification}>
{/* onClick={updateNotification} */}
<div className="notificationsIconArea">
<span className="notificationsTooltip">
You have {notification ? notification.length : 0} new alerts
</span>
Expand All @@ -249,24 +250,24 @@ const Occupied = React.memo(() => {
</header>

<div className="cardContainer">
<div className="card" id={`card-add`}>
<div className="card" id="card-add">
<Button className={classes.paper} onClick={() => setAddOpen(true)}>
<AddCircleOutlineTwoToneIcon className={classes.icon} />
</Button>
</div>
{applications
.filter((db: any) => db[0].toLowerCase().includes(searchTerm.toLowerCase()))
.map((app: string[], i: number | any | string | undefined) => (
<div className="card" key={`card-${i}`} id={`card-${app[1]}`}>
.map((application: string[], i: number | any | string | undefined) => (
<div className="card" key={`card-${i}`} id={`card-${application[1]}`}>
<Card
key={`card-${i}`}
className={classes.paper}
variant="outlined"
onClick={event => handleClick(event, app[0], i)}
onClick={event => handleClick(event, application[0], i)}
>
<div className="databaseIconContainer">
<div className="databaseIconHeader">
{app[1] === 'SQL' ? (
{application[1] === 'SQL' ? (
<img className="databaseIcon" alt="SQL" />
) : (
<img className="databaseIcon" alt="MongoDB" />
Expand All @@ -278,34 +279,39 @@ const Occupied = React.memo(() => {
avatar={
<IconButton
id="iconButton"
ref={element => (delRef.current[i] = element)}
ref={element => {
delRef.current[i] = element;
}}
className={classes.iconbutton}
aria-label="Delete"
onClick={event => confirmDelete(event, app[0], i)}
onClick={event => confirmDelete(event, application[0], i)}
>
<HighlightOffIcon
className={classes.btnStyle}
id="deleteIcon"
ref={element => (delRef.current[i] = element)}
ref={element => {
delRef.current[i] = element;
}}
/>
</IconButton>
}
></CardHeader>
/>
<CardContent>
<p id="databaseName">Database Name:</p>
<Typography className={classes.fontStyles}>{app[0]}</Typography>
<Typography className={classes.fontStyles}>{application[0]}</Typography>
</CardContent>
<hr className="cardLine" />

<div className="cardFooter">
<UpdateIcon className="cardFooterIcon" />
<em>
<p id="cardFooterText">{app[3]}</p>
<p id="cardFooterText">{application[3]}</p>
</em>
</div>
</Card>
</div>
))}

<Modal open={addOpen} onClose={() => setAddOpen(false)}>
<AddModal setOpen={setAddOpen} />
</Modal>
Expand Down
76 changes: 41 additions & 35 deletions app/components/Occupied_darkmode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Occupied = React.memo(() => {
}, []);

// Ask user for deletetion confirmation
const confirmDelete = (event: ClickEvent, app: string, i: number) => {
const confirmDelete = (event: ClickEvent, application: string, i: number) => {
const message = `The application '${app}' will be permanently deleted. Continue?`;
if (confirm(message)) deleteApp(i);
};
Expand All @@ -75,7 +75,7 @@ const Occupied = React.memo(() => {
}
};

const useStyles = makeStyles<Theme, StyleProps>(theme => ({
const useStyles = makeStyles<StyleProps>(theme => ({
// ALL CARDS
paper: {
display: 'flex',
Expand Down Expand Up @@ -129,15 +129,19 @@ const Occupied = React.memo(() => {
}
}));

const classes = useStyles({} as StyleProps);
const classes = useStyles({});

return (
<div className="entireArea">
<div className="dashboardArea">
<header className="mainHeader">
<section className="header" id="leftHeader">
<span><ListIcon className="icon" id="listIcon" /></span>
<span><p id="dashboard">Dashboard</p></span>
<span>
<ListIcon className="icon" id="listIcon" />
</span>
<span>
<p id="dashboard">Dashboard</p>
</span>
</section>
<section className="header" id="rightHeader">
<form className="form">
Expand All @@ -153,7 +157,6 @@ const Occupied = React.memo(() => {
<span className="dashboardTooltip">You have {applications.length} active databases</span>
<DashboardIcon className="navIcon" id="dashboardIcon" />
</div>

<div className="notificationsIconArea">
<span className="notificationsTooltip">You have no new alerts</span>
< NotificationsIcon className="navIcon" id="notificationsIcon" />
Expand All @@ -167,54 +170,57 @@ const Occupied = React.memo(() => {
</header>

<div className="cardContainer">
<div className="card" id={`card-add`}>
<div className="card" id="card-add">
<Button className={classes.paper} onClick={() => setAddOpen(true)}>
<AddCircleOutlineTwoToneIcon className={classes.icon} />
</Button>
</div>
{applications.map((app: string[], i: number | any | string | undefined) => (
{applications.map((application: string[], i: number | any | string | undefined) => (
<div className="card" key={`card-${i}`} id={`card-${i}`}>
<Card
key={`card-${i}`}
className={classes.paper}
variant="outlined"
onClick={event => handleClick(event, app[0], i)}
>

<div className="databaseIconContainer">
<div className="databaseIconHeader">
{/** dark mode */}
<img className="databaseIcon" src="../assets/mongo-icon-green-light.png" alt="MongoDB"></img>
</div>
<div className="databaseIconContainer">
<div className="databaseIconHeader">
{/** dark mode */}
<img className="databaseIcon" src="../assets/mongo-icon-green-light.png" alt="MongoDB"></img>
</div>

<CardHeader
avatar={
<IconButton
id="iconButton"
ref={element => (delRef.current[i] = element)}
className={classes.iconbutton}
aria-label="Delete"
onClick={event => confirmDelete(event, app[0], i)}
>
<HighlightOffIcon
className={classes.btnStyle}
id="deleteIcon"
ref={element => (delRef.current[i] = element)}
/>
</IconButton>
}
>
</CardHeader>
</div>
<CardHeader
avatar={
<IconButton
id="iconButton"
ref={element => {
delRef.current[i] = element
}}
className={classes.iconbutton}
aria-label="Delete"
onClick={event => confirmDelete(event, app[0], i)}
>
<HighlightOffIcon
className={classes.btnStyle}
id="deleteIcon"
ref={element => {
delRef.current[i] = element;
}}
/>
</IconButton>
}
/>
<CardContent>
<p id="databaseName">Database Name:</p>
<Typography className={classes.fontStyles}>{app[0]}</Typography>
</CardContent>
<hr className="cardLine"/>
<hr className="cardLine" />

<div className="cardFooter">
<UpdateIcon className="cardFooterIcon"/>
<em><p id="cardFooterText">Just updated</p></em>
<em>
<p id="cardFooterText">Just updated</p>
</em>
</div>
</Card>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Settings: React.SFC = React.memo(() => {
const { changeMode } = useContext(DashboardContext);
const handleClick = (mode: string) => {
changeMode(mode);
}
};

return (
<div className="settings">
Expand Down
6 changes: 3 additions & 3 deletions app/components/Home.tsx → app/components/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const adminUser = {
};

// removed props as it was not being used
const Home = React.memo(() => {
const SignUp = React.memo(() => {
// const [open, setOpen] = useState<boolean>(false);
const [loginInfo, setLoginInfo] = React.useState<PersonProps>({
email: '',
Expand Down Expand Up @@ -59,7 +59,7 @@ const Home = React.memo(() => {
return (
<div className="home">
<p className="welcomeMessage">
Welcome Back To Chronos! Your all-in-one application monitoring tool
Welcome back to Chronos! Your all-in-one application monitoring tool
</p>

<form className="form" onSubmit={submitLogin}>
Expand Down Expand Up @@ -98,4 +98,4 @@ const Home = React.memo(() => {
);
});

export default Home;
export default SignUp;
5 changes: 3 additions & 2 deletions app/containers/Archived.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const GraphsContainer = ({ match }: IMatch) => {
useEffect(() => {
if (live) {
setIntervalID(
setInterval(function () {
setInterval(() => {
fetchCommsData();
fetchHealthData(service);
fetchDockerData(service);
Expand Down Expand Up @@ -110,7 +110,8 @@ const GraphsContainer = ({ match }: IMatch) => {
<button onClick={() => setLive(!live)}>
{live ? (
<div>
<span className="dot"></span>Live
<span className="dot" />
Live
</div>
) : (
<div>Gather Live Data</div>
Expand Down
Loading

0 comments on commit 27322b6

Please sign in to comment.