diff --git a/frontend/components/views/QuickStartView.tsx b/frontend/components/views/QuickStartView.tsx
index a0fb7c2c..f1da4fb7 100644
--- a/frontend/components/views/QuickStartView.tsx
+++ b/frontend/components/views/QuickStartView.tsx
@@ -10,11 +10,12 @@ import React, { useState } from 'react';
import styled from 'styled-components';
import logo from '../../../assets/logo/seeqr_dock.png';
import '../../lib/style.css';
+import { greyPrimary } from '../../style-variables';
interface QuickStartViewProps {
show: boolean;
}
-
+// welcome page container w/o sidebar
const PageContainer = styled.a`
display: flex;
flex-direction: column;
@@ -23,12 +24,19 @@ const PageContainer = styled.a`
height: auto;
width: auto;
`;
-
+// each stepper component
const StyledStepper = styled(Stepper)`
- margin: 60px 0px 20px 0px;
- background: transparent;
+ margin: 60px 10px 20px 0px;
`;
-
+// stepButton with all elements inside
+const StyledStepButton = styled(StepButton)`
+ padding-top: 25px;
+ & :hover {
+ background-color: ${greyPrimary};
+ transition: 200ms ease-in-out;
+ }
+`;
+// Text label for each stepper
const StyledStepLabel = styled(StepLabel)`
width: 10vw;
& .MuiStepLabel-label {
@@ -36,48 +44,53 @@ const StyledStepLabel = styled(StepLabel)`
}
`;
+// text instructions div
const StyledTypographyInstructions = styled.div`
font-size: clamp(1rem, 2.2vw, 1.2rem);
text-align: center;
- width: 40vw;
+ width: 50vw;
`;
-
+// title: "welcome to SeeQR"
const StyledTypographyTitle = styled(Typography)`
font-size: clamp(2rem, 35vw, 3rem);
`;
-
+// container div for btn back & btn complete
const NavButtons = styled.div`
- margin: 15px auto;
+ width: 80%;
+ display: flex;
+ flex-direction: row;
+ justify-content: space-around;
+ margin-bottom: 15px;
`;
-
+// container for the text instructions and navBtn
const StepContent = styled.div`
+ min-height: 30vw;
display: flex;
flex-direction: column;
- justify-content: center;
+ justify-content: space-between;
align-items: center;
+ margin-top: 20px;
`;
-
+// step list ul
const StepList = styled.ul`
text-align: left;
font-size: 0.9em;
list-style: circle;
-
& li {
margin-top: 7px;
}
`;
-function getSteps() {
- return [
- 'Set Up Servers and Permissions',
- 'Import/ Export a Database',
- 'Create New Queries',
- 'Saving/Loading Queries',
- 'Compare Queries',
- ];
-}
-
-function getStepContent(step: number) {
+// array to hold all the steps
+const steps: string[] = [
+ 'Set Up Servers and Permissions',
+ 'Import/ Export a Database',
+ 'Create New Queries',
+ 'Saving/Loading Queries',
+ 'Compare Queries',
+];
+// func to help get step instructions and render it
+function getStepContent(step: number): JSX.Element | string {
switch (step) {
case 0:
return (
@@ -90,15 +103,16 @@ function getStepContent(step: number) {
Run server(s) in the background
Ensure that PATH is enabled
- MySQL username defaults to 'root' and postgres username defaults to 'postgres'
-
+ MySQL username defaults to "root" and postgres username
+ defaults to "postgres"
- MySQL and postgres password will be your password to log into mySQL and postgres database
+ MySQL and postgres password will be your password to log into
+ mySQL and postgres database
- Ports for PostgresSQL and MySQL are defaulted to ‘5432’ and
- ‘3306’, respectively
+ Ports for PostgresSQL and MySQL are defaulted to "5432"
+ and "3306", respectively
Enable full permissions for database manipulation
@@ -150,7 +164,8 @@ function getStepContent(step: number) {
query
- Use the previous queries dropdown to view and select previously inputted queries
+ Use the previous queries dropdown to view and select previously
+ inputted queries
Select "RUN QUERY" button to execute
@@ -209,79 +224,53 @@ function getStepContent(step: number) {
function QuickStartView({ show }: QuickStartViewProps) {
if (!show) return null;
const [activeStep, setActiveStep] = useState(0);
- const [completed, setCompleted] = useState(new Set());
- const [skipped, setSkipped] = useState(new Set());
- const steps = getSteps();
-
- const totalSteps = () => getSteps().length;
-
- const isStepOptional = (step: number) => step === null;
+ const [completed, setCompleted] = useState<{ [k: number]: boolean }>({});
- const handleSkip = () => {
- if (!isStepOptional(activeStep)) {
- // You probably want to guard against something like this
- // it should never occur unless someone's actively trying to break something.
- throw new Error("You can't skip a step that isn't optional.");
- }
+ const totalSteps = () => steps.length;
- setActiveStep((prevActiveStep) => prevActiveStep + 1);
- setSkipped((prevSkipped) => {
- const newSkipped = new Set(prevSkipped.values());
- newSkipped.add(activeStep);
- return newSkipped;
- });
- };
-
- const skippedSteps = () => skipped.size;
+ // count completed steps number
+ const completedSteps = (): number => Object.keys(completed).length;
- const completedSteps = () => completed.size;
+ // check if it is the last step
+ const isLastStep = (): boolean => activeStep === totalSteps() - 1;
- const allStepsCompleted = () =>
- completedSteps() === totalSteps() - skippedSteps();
-
- const isLastStep = () => activeStep === totalSteps() - 1;
+ // check if all steps are completed
+ const allStepsCompleted = (): boolean => completedSteps() === totalSteps();
+ // func to handle next btn
const handleNext = () => {
const newActiveStep =
isLastStep() && !allStepsCompleted()
? // It's the last step, but not all steps have been completed
// find the first step that has been completed
- steps.findIndex((step, i) => !completed.has(i))
+ steps.findIndex((step, i) => !(i in completed))
: activeStep + 1;
-
setActiveStep(newActiveStep);
};
+ // func to handle back btn
const handleBack = () => {
setActiveStep((prevActiveStep) => prevActiveStep - 1);
};
+ // func to set activeStep
const handleStep = (step: number) => () => {
setActiveStep(step);
};
-
+ // func to handle each complete step btn
const handleComplete = () => {
- const newCompleted = new Set(completed);
- newCompleted.add(activeStep);
+ const newCompleted = completed;
+ newCompleted[activeStep] = true;
setCompleted(newCompleted);
-
- if (completed.size !== totalSteps() - skippedSteps()) {
- handleNext();
- }
+ handleNext();
};
-
+ // handle reset btn after all steps completed
const handleReset = () => {
setActiveStep(0);
- setCompleted(new Set());
- setSkipped(new Set());
+ setCompleted({});
};
- const isStepSkipped = (step: number) => skipped.has(step);
-
- function isStepComplete(step: number) {
- return completed.has(step);
- }
-
+ // render components
return (
@@ -289,71 +278,69 @@ function QuickStartView({ show }: QuickStartViewProps) {
- {steps.map((label, index) => {
- const stepProps: { completed?: boolean } = {};
- const buttonProps: { optional?: React.ReactNode } = {};
- if (isStepOptional(index)) {
- buttonProps.optional = (
- Optional
- );
- }
- if (isStepSkipped(index)) {
- stepProps.completed = false;
- }
- return (
-
-
- {label}
-
-
- );
- })}
+ {steps.map((label, index) => (
+
+
+ {label}
+
+
+ ))}
{allStepsCompleted() ? (
-
+
All steps completed - you're ready to use SeeQr!
-
+