Skip to content

Commit

Permalink
code updated
Browse files Browse the repository at this point in the history
  • Loading branch information
PranabKumarSahoo committed Mar 5, 2024
1 parent 4c41f75 commit a742385
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 103 deletions.
1 change: 0 additions & 1 deletion src/Components/CustomComp/Button/Button.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

.submit-btn:hover {
background-color: grey;
/* border: 1px solid rgb(255, 255, 255); */
}

.submit-btn:active {
Expand Down
6 changes: 2 additions & 4 deletions src/Components/CustomComp/InputBox/InputBox.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
}

.input-box-title {
/* color: white;
*/
color: var(--text_color);
color: var(--text_color);
font-size: 20px;
}

Expand All @@ -32,7 +30,7 @@ color: var(--text_color);
border-radius: 0 4px 4px 0;
border: none;
outline: none;

}

.input-box-comp .input-box {
Expand Down
4 changes: 1 addition & 3 deletions src/Components/CustomComp/OutputBox/OutputBox.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
outline: none;
padding: 10px;
font-size: 20px;
/* color: white;
*/
color: var(--text_color);
color: var(--text_color);
}

@media only screen and (max-width: 600px) {
Expand Down
7 changes: 2 additions & 5 deletions src/Components/CustomComp/OutputBox/OutputBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@ export default function OutputBox({ data }) {
const textareaRef = useRef();

const handleCopyClick = () => {
// Select the text inside the textarea
textareaRef.current.select();
toast.success("Copied", { position: toast.POSITION.TOP_RIGHT,autoClose:1000 });
toast.success("Copied", { position: toast.POSITION.TOP_RIGHT, autoClose: 1000 });

// Change the style and text of the copy button
setCopyBtnCss({
position: 'absolute',
right: 0,
color: 'green', // Change color back to green on successful copy
color: 'green',
});
setCopyBtnText('✓');

document.execCommand('copy');

// Reset the style and text after two seconds
setTimeout(() => {
setCopyBtnCss({
position: 'absolute',
Expand Down
5 changes: 2 additions & 3 deletions src/Components/Sidebar/Sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ a {
.sidebar {
width: 300px;
height: 100vh;
/* background: linear-gradient(to bottom, #303154, #2e2e4c);
*/background: var(--sidebar-background);
background: var(--sidebar-background);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
position: fixed;
top: 0;
Expand Down Expand Up @@ -70,4 +69,4 @@ nav ul {
.author {
margin-bottom: 40px;
}
}
}
27 changes: 4 additions & 23 deletions src/Pages/HomePage/HomePage.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@
flex-direction: column;
align-items: center;
justify-content: center;
/* background-color: #181828; */
background-color: var(--body_background);
}

.home-page-title {
padding: 20px;
/* color: white;
*/
color: var(--home-page-title-color);
text-shadow: 1px 1px 3px red;
}

#drop-constraint {
width: 100%;
height: fit-content;
/* background-color: #181828; */
background-color: var(--body_background);
width: 100%;
display: flex;
Expand All @@ -30,16 +26,12 @@
}

.drop-const-title {
/* color: white;
*/
color: var(--home-page-title-color);
}

#row-count {
width: 100%;
height: fit-content;
/* background-color: #141421;
*/
background-color: var(--body_background);
width: 100%;
display: flex;
Expand All @@ -52,8 +44,6 @@
#select-statement {
width: 100%;
height: fit-content;
/* background-color: #141421;
*/
background-color: var(--body_background);
width: 100%;
display: flex;
Expand All @@ -66,8 +56,6 @@
#nth-highest {
width: 100%;
height: fit-content;
/* background-color: #141421;
*/
background-color: var(--body_background);
width: 100%;
display: flex;
Expand All @@ -80,8 +68,6 @@
#nth-minimum {
width: 100%;
height: fit-content;
/* background-color: #141421;
*/
background-color: var(--body_background);
width: 100%;
display: flex;
Expand All @@ -94,8 +80,6 @@
#section-6 {
width: 100%;
height: fit-content;
/* background-color: #141421;
*/
background-color: var(--body_background);
width: 100%;
display: flex;
Expand All @@ -118,30 +102,27 @@
.section-4-title,
.section-5-title,
.section-6-title {
/* color: white;
*/
color: var(--home-page-title-color);
}

/* Add this style to your HomePage.css or create a new CSS file */
.scroll-up-button {
position: fixed;
bottom: 20px;
right: 20px;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
background-color: #007bff;
padding: 12px;
background-color: tomato;
color: #fff;
border: none;
border-radius: 5px;
border-radius: 50px;
cursor: pointer;
transition: background-color 0.3s ease;
}

.scroll-up-button:hover {
background-color: #0056b3;
background-color: rgba(255, 99, 71, 0.709);
}

@media only screen and (max-width: 600px) {
Expand Down
4 changes: 1 addition & 3 deletions src/Sections/CountOfRows/CountOfRows.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
align-items: center;
justify-content: center;
gap: 30px;
/* background-color: #141421;
*/
background-color: var(--body_background);
background-color: var(--body_background);
width: 100%;
}
22 changes: 11 additions & 11 deletions src/Sections/CountOfRows/CountOfRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TextBox from '../../Components/CustomComp/TextBox/TextBox';
import Button from '../../Components/CustomComp/Button/Button';
import OutputBox from '../../Components/CustomComp/OutputBox/OutputBox';
import Warning from '../../Components/CustomComp/Warning/Warning';
import {ToastContainer,toast} from 'react-toastify';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { countOfRows } from '../../data/guideTexts';

Expand All @@ -15,8 +15,8 @@ export default function CountOfRows() {
const [specificWord, setSpecificWord] = useState('');
const [outputSql, setOutputSql] = useState(null);
const [warnMsg, setWarnMsg] = useState('');
const [showGuide, setShowGuide] = useState(false);
const [showGuide, setShowGuide] = useState(false);

const handleTextBoxChange = (value) => {
setWordsInput(value);
};
Expand All @@ -26,12 +26,12 @@ export default function CountOfRows() {

}

const notification=(val)=>{
if(val!==''){
toast.success("Submitted successfully!",{position:toast.POSITION.TOP_RIGHT,autoClose:1000});
const notification = (val) => {
if (val !== '') {
toast.success("Submitted successfully!", { position: toast.POSITION.TOP_RIGHT, autoClose: 1000 });
}
else{
toast.warning("Please enter the schema name",{position:toast.POSITION.TOP_RIGHT,autoClose:1000});
else {
toast.warning("Please enter the schema name", { position: toast.POSITION.TOP_RIGHT, autoClose: 1000 });
}
}

Expand Down Expand Up @@ -68,8 +68,8 @@ ORDER BY
};
const handleGuideButtonClick = () => {
setShowGuide(!showGuide);
setOutputSql(showGuide ? countOfRows : null); // Clear output if guide is hidden
};
setOutputSql(showGuide ? countOfRows : null);
};
return (
<div className='count-of-rows-sec'>
<TextBox textbox_placehold="Enter tables name line by line..." value={wordsInput} onChange={handleTextBoxChange} />
Expand All @@ -79,7 +79,7 @@ ORDER BY

<Button btnText='Submit' onClick={generateSql} />
<Button btnText='Guide' onClick={handleGuideButtonClick} />
<ToastContainer/>
<ToastContainer />

<OutputBox data={outputSql} />
</div>
Expand Down
4 changes: 1 addition & 3 deletions src/Sections/DropConstraintSec/DropConstraintSec.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
align-items: center;
justify-content: center;
gap: 30px;
/* background-color: #141421;
*/
background-color: var(--body_background);
background-color: var(--body_background);
width: 100%;
}
22 changes: 9 additions & 13 deletions src/Sections/DropConstraintSec/DropConstraintSec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './DropConstraintSec.css'
import TextBox from '../../Components/CustomComp/TextBox/TextBox'
import Button from '../../Components/CustomComp/Button/Button'
import OutputBox from '../../Components/CustomComp/OutputBox/OutputBox'
import {ToastContainer,toast} from 'react-toastify';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { dropConstraint } from '../../data/guideTexts'

Expand All @@ -15,12 +15,12 @@ export default function DropConstraintSec() {
setTextBoxValue(value);
};

const notification=(val)=>{
if(val>0){
toast.success("Submitted successfully!",{position:toast.POSITION.TOP_RIGHT,autoClose:1000});
const notification = (val) => {
if (val > 0) {
toast.success("Submitted successfully!", { position: toast.POSITION.TOP_RIGHT, autoClose: 1000 });
}
else{
toast.warning("Please enter key constraint",{position:toast.POSITION.TOP_RIGHT,autoClose:1000});
else {
toast.warning("Please enter key constraint", { position: toast.POSITION.TOP_RIGHT, autoClose: 1000 });
}
}

Expand All @@ -39,13 +39,9 @@ export default function DropConstraintSec() {
if (line.includes(":")) {
result = result.replace(":", " DROP CONSTRAINT ");
}

// Add a new line character after each transformed line
result += ";\n";
}
}

// Set the result to the state
setOutputData(result);
} else {
notification(0);
Expand All @@ -54,16 +50,16 @@ export default function DropConstraintSec() {
};
const handleGuideButtonClick = () => {
setShowGuide(!showGuide);
setOutputData(showGuide ? dropConstraint : null); // Clear output if guide is hidden
};
setOutputData(showGuide ? dropConstraint : null);
};
return (
<div className='drop-const-sec'>
<TextBox textbox_placehold="Enter table & constraint name line by line as per syntax mentioned below...
{table_name}: {constraint_name}" value={textBoxValue} onChange={handleTextBoxChange} />

<Button btnText='Submit' onClick={handleButtonClick} />
<Button btnText='Guide' onClick={handleGuideButtonClick} />
<ToastContainer/>
<ToastContainer />
<OutputBox data={outputData} />
</div>
)
Expand Down
6 changes: 2 additions & 4 deletions src/Sections/NthHighest/NthHighest.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
align-items: center;
justify-content: center;
gap: 30px;
/* background-color: #141421;
*/
background-color: var(--body_background);
background-color: var(--body_background);
width: 100%;
}
}
19 changes: 9 additions & 10 deletions src/Sections/NthHighest/NthHighest.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useState } from 'react';
import './NthHighest.css';
import TextBox from '../../Components/CustomComp/TextBox/TextBox';
import InputBox from '../../Components/CustomComp/InputBox/InputBox';
import Button from '../../Components/CustomComp/Button/Button';
import OutputBox from '../../Components/CustomComp/OutputBox/OutputBox';
import {ToastContainer,toast} from 'react-toastify';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { nthHighestText } from '../../data/guideTexts';

Expand All @@ -25,14 +24,14 @@ export default function NthHighest() {
const handleNthHighestChange = (value) => {
setNthHighest(value);
};
const notification=(val)=>{
if(val){
toast.success("Submitted successfully!",{position:toast.POSITION.TOP_RIGHT,autoClose:1000});
const notification = (val) => {
if (val) {
toast.success("Submitted successfully!", { position: toast.POSITION.TOP_RIGHT, autoClose: 1000 });
}
else{
toast.warning("Please enter values for all input",{position:toast.POSITION.TOP_CENTER,autoClose:1000});
else {
toast.warning("Please enter values for all input", { position: toast.POSITION.TOP_CENTER, autoClose: 1000 });
}
}
}

const generateSelectStat = () => {
if (columnName && tableName && nthHighest) {
Expand All @@ -49,7 +48,7 @@ export default function NthHighest() {
};
const handleGuideButtonClick = () => {
setShowGuide(!showGuide);
setOutputState(showGuide ? nthHighestText : null); // Clear output if guide is hidden
setOutputState(showGuide ? nthHighestText : null);
};
return (
<div className='nth-highest'>
Expand All @@ -59,7 +58,7 @@ export default function NthHighest() {

<Button btnText='Submit' onClick={generateSelectStat} />
<Button btnText='Guide' onClick={handleGuideButtonClick} />
<ToastContainer/>
<ToastContainer />
<OutputBox data={outputState} />
</div>
);
Expand Down
Loading

0 comments on commit a742385

Please sign in to comment.