Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions change.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
npm run build
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a shebang to specify the shell environment.

+ #!/bin/bash
  npm run build
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
npm run build
#!/bin/bash
npm run build
Tools
Shellcheck

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. (SC2148)

npm run start-dev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure consistency by adding a shebang here as well.

+ #!/bin/bash
  npm run start-dev
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
npm run start-dev
#!/bin/bash
npm run start-dev

60 changes: 30 additions & 30 deletions frontend/src/components/Dashboard/discord.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import React from 'react';
import DiscordLogo from '../../assets/discord_logo.png';
import React from "react";
import DiscordLogo from "../../assets/discord_logo.png";

const DiscordButton = () => {
const discordUrl = 'https://discord.gg/2nN2VqwNaK';
const discordUrl = "https://discord.gg/2nN2VqwNaK";

const handleDiscordButtonClick = () => {
window.location.href = discordUrl;
};
const handleDiscordButtonClick = () => {
window.location.href = discordUrl;
};

return (
<button
style={{
backgroundColor: 'white',
color: 'white',
padding: '10px 20px',
borderRadius: '5px',
border: 'none',
cursor: 'pointer',
}}
onClick={handleDiscordButtonClick}
>
<img
src={DiscordLogo}
alt="Discord Logo"
style={{
marginRight: '5px',
width: '95px',
height: '28px',
}}
/>
</button>
);
return (
<button
style={{
backgroundColor: "white",
color: "white",
padding: "10px 20px",
borderRadius: "5px",
border: "none",
cursor: "pointer",
maxHeight: "48px",
}}
onClick={handleDiscordButtonClick}>
Comment on lines +12 to +22
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an explicit type attribute to the button to prevent unintended form submissions.

  <button
+   type="button"
    style={{
      backgroundColor: "white",
      color: "white",
      padding: "10px 20px",
      borderRadius: "5px",
      border: "none",
      cursor: "pointer",
      maxHeight: "48px",
    }}
    onClick={handleDiscordButtonClick}>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button
style={{
backgroundColor: "white",
color: "white",
padding: "10px 20px",
borderRadius: "5px",
border: "none",
cursor: "pointer",
maxHeight: "48px",
}}
onClick={handleDiscordButtonClick}>
<button
type="button"
style={{
backgroundColor: "white",
color: "white",
padding: "10px 20px",
borderRadius: "5px",
border: "none",
cursor: "pointer",
maxHeight: "48px",
}}
onClick={handleDiscordButtonClick}>
Tools
Biome

[error] 12-22: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

<img
src={DiscordLogo}
alt="Discord Logo"
style={{
marginRight: "5px",
width: "75px",
height: "20px",
}}
/>
</button>
);
};

export default DiscordButton;
export default DiscordButton;
182 changes: 89 additions & 93 deletions frontend/src/components/Dashboard/index.js
Original file line number Diff line number Diff line change
@@ -1,101 +1,97 @@
import React, { useState } from 'react';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import CssBaseline from '@material-ui/core/CssBaseline';
import useScrollTrigger from '@material-ui/core/useScrollTrigger';
import Container from '@material-ui/core/Container';
import { IconButton, Paper } from '@material-ui/core';
import { createTheme, ThemeProvider } from '@material-ui/core/styles';
import { dashConstants } from '../../config/constants';
import { LightTheme, DarkTheme } from '../../util/themes/GlobalThemes';
import { getAppBarStyles } from '../../util/styles/componentStyles';
import MoonIcon from '../../assets/moon.svg';
import LightIcon from '../../assets/sun.svg';
import Home from '../Pages/Home';
import DiscordButton from './discord';
import React, {useState} from "react";
import AppBar from "@material-ui/core/AppBar";
import Toolbar from "@material-ui/core/Toolbar";
import Typography from "@material-ui/core/Typography";
import CssBaseline from "@material-ui/core/CssBaseline";
import useScrollTrigger from "@material-ui/core/useScrollTrigger";
import Container from "@material-ui/core/Container";
import {Box, IconButton, Paper} from "@material-ui/core";
import {createTheme, ThemeProvider} from "@material-ui/core/styles";
import {dashConstants} from "../../config/constants";
import {LightTheme, DarkTheme} from "../../util/themes/GlobalThemes";
import {getAppBarStyles} from "../../util/styles/componentStyles";
import MoonIcon from "../../assets/moon.svg";
import LightIcon from "../../assets/sun.svg";
import Home from "../Pages/Home";
import DiscordButton from "./discord";

const ElevationScroll = (props) => {
const { children, window } = props;
// Note that you normally won't need to set the window ref as useScrollTrigger
// will default to window.
// This is only being set here because the demo is in an iframe.
const trigger = useScrollTrigger({
disableHysteresis: true,
threshold: 0,
target: window ? window() : undefined,
});
const {children, window} = props;
// Note that you normally won't need to set the window ref as useScrollTrigger
// will default to window.
// This is only being set here because the demo is in an iframe.
const trigger = useScrollTrigger({
disableHysteresis: true,
threshold: 0,
target: window ? window() : undefined,
});

return React.cloneElement(children, {
elevation: trigger ? 4 : 0,
});
}
return React.cloneElement(children, {
elevation: trigger ? 4 : 0,
});
};

const Dashboard = (props) => {
const [isDark, setIsDark] = useState(false);
const theme = isDark
? createTheme(DarkTheme)
: createTheme(LightTheme);
const classes = getAppBarStyles();
const [isDark, setIsDark] = useState(false);
const theme = isDark ? createTheme(DarkTheme) : createTheme(LightTheme);
const classes = getAppBarStyles();

function handleThemeChange() {
setIsDark(!isDark);
}
return (
<React.Fragment>
<ThemeProvider theme={theme}>
<Paper>
<CssBaseline />
<ElevationScroll {...props}>
<AppBar>
<Toolbar className={classes.root}>
<Typography
variant='h6'
className={classes.title}
>
{dashConstants.APP_NAME}
</Typography>
<DiscordButton />
<IconButton>
<a
href='https://www.producthunt.com/posts/dynamic-github-profile-readme-quotes?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-dynamic-github-profile-readme-quotes'
target='_blank'
rel='noreferrer'
>
<img
src='https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=276934&theme=light'
alt='Dynamic GitHub Profile Readme Quotes - Everlasting Poetic Touch to GitHub Profiles for everyone | Product Hunt'
style={{
width: ' 250px',
height: '54px',
}}
width='250'
height='54'
/>
</a>
</IconButton>
<IconButton
className={classes.themeIcon}
onClick={handleThemeChange}
>
{
<img
alt='Theme Icon'
src={isDark ? LightIcon : MoonIcon}
/>
}
</IconButton>
</Toolbar>
</AppBar>
</ElevationScroll>
<Toolbar />
<Container style={{ backgroundColor: 'white' }}>
<Home />
</Container>
</Paper>
</ThemeProvider>
</React.Fragment>
);
}
function handleThemeChange() {
setIsDark(!isDark);
}
return (
<React.Fragment>
<ThemeProvider theme={theme}>
<Paper>
<CssBaseline />
<ElevationScroll {...props}>
<AppBar>
<Toolbar className={classes.navBar}>
<Typography variant="h6" className={classes.title}>
{dashConstants.APP_NAME}
</Typography>
<Box className={classes.linkButtons}>
<DiscordButton />
<IconButton>
<a
href="https://www.producthunt.com/posts/dynamic-github-profile-readme-quotes?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-dynamic-github-profile-readme-quotes"
target="_blank"
rel="noreferrer">
<img
src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=276934&theme=light"
alt="Dynamic GitHub Profile Readme Quotes - Everlasting Poetic Touch to GitHub Profiles for everyone | Product Hunt"
style={{
width: {
xs: "200px",
sm: "250px",
},
height: "48px",
}}
/>
</a>
</IconButton>
<IconButton
className={classes.themeIcon}
onClick={handleThemeChange}>
{
<img
alt="Theme Icon"
src={isDark ? LightIcon : MoonIcon}
/>
}
</IconButton>
</Box>
</Toolbar>
</AppBar>
</ElevationScroll>
<Toolbar />
<Container style={{backgroundColor: "white"}}>
<Home />
</Container>
</Paper>
</ThemeProvider>
</React.Fragment>
);
};

export default Dashboard;
4 changes: 2 additions & 2 deletions frontend/src/config/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const dashConstants = {
APP_NAME : 'Github Dynamic Quotes for Readme'
};
APP_NAME: "Github Dynamic Quotes for Readme",
};
35 changes: 23 additions & 12 deletions frontend/src/util/styles/componentStyles.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import { makeStyles } from '@material-ui/core';
import {makeStyles} from "@material-ui/core";

export const getAppBarStyles = makeStyles((theme) => ({
title: {
flexGrow: 1,
},
themeIcon: {
backgroundColor: 'transparent !important',
height: '38px',
width: '38px',
boxShadow: '0px 0px 0.5px 0.5px #6e7681',
},
productHuntBtn: {
flexGrow: 1,
title: {
flexGrow: 1,
},
themeIcon: {
backgroundColor: "transparent !important",
height: "38px",
width: "38px",
boxShadow: "0px 0px 0.5px 0.5px #6e7681",
},
productHuntBtn: {
flexGrow: 1,
},
navBar: {
display: "flex",
flexWrap: "wrap",
},
linkButtons: {
display: {
xs: "none",
sm: "flex",
},
alignItems: "center",
},
}));