Skip to content
Merged
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
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# GlobalClicker
[Click here to play](https://gc.galvindev.me.uk)
[Click here to play](https://gc.galvindev.me.uk)
![Website](https://img.shields.io/website?url=https%3A%2F%2Fgc.galvindev.me.uk&style=for-the-badge&label=Website) ![API](https://img.shields.io/website?url=https%3A%2F%2Fapi-gc.galvindev.me.uk&style=for-the-badge&label=API)
![Website Version](https://img.shields.io/badge/Website%20Version%3A-1.0%20(Upcoming%201)-blue?style=for-the-badge) <!-- ![API Version](https://img.shields.io/badge/API%20Version%3A-Version-blue?style=for-the-badge) -->


# API Endpoints
There are currently only two supported endpoints, however more are to be developed:
Expand All @@ -12,6 +15,21 @@ There are currently only two supported endpoints, however more are to be develop
# Changelog
Note: Backend code isn't available, however changes are documented

### Version 1.0 (Upcoming)
#### Backend
* No issues fixed, but there will be changes made

#### Frontend
* Button hover colour is now blue, rather than staying green. However it will remain green when you're not hovering
* Added pointer when hovering on button
* Can no longer select text
* Renamed odometer.css
* Made small text more readable on smaller devices
* `index.html`: root is now main rather than div
* Added accessability
* Added light mode
* Restructured folders

<details>
<summary>Beta</summary>

Expand Down
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logoNew192.png" />
<link rel="manifest" href="%PUBLIC_URL%/site.webmanifest" />
<link rel="stylesheet" href="%PUBLIC_URL%/odometer-theme-default.css">
<link rel="stylesheet" href="%PUBLIC_URL%/odometer.css">
<title>Global Clicker</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<main id="root"></div>
</body>
</html>
File renamed without changes.
111 changes: 61 additions & 50 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,73 @@
import logo from './logo.svg';
import settingsIcon from './svg/settings.svg'
import statsIcon from './svg/stats.svg'

import './App.scss';
import Odometer from 'react-odometerjs'
import { useEffect, useState } from 'react';

function App() {
const [value, setValue] = useState()
useEffect(() => {
let rows;
console.log("Script running!")
const interval = setInterval(() => {
fetch('https://api-gc.galvindev.me.uk/clicks', {method: 'GET'})
.then(function(response) {
if(response.ok) return response.json();
throw new Error('Request failed.');
})
.then(function(data) {
rows = data[0].row_count
})
.catch(function(error) {
console.log(error);
});

setValue(rows)
}, 2000)
return () => clearInterval(interval)
}, [])
const [value, setValue] = useState()
useEffect(() => {
let rows;
console.log("Script running!")
const interval = setInterval(() => {
fetch('https://api-gc.galvindev.me.uk/clicks', {method: 'GET'})
.then(function(response) {
if(response.ok) return response.json();
throw new Error('Request failed.');
})
.then(function(data) {
rows = data[0].row_count
})
.catch(function(error) {
console.log(error);
});
setValue(rows)
}, 2000)
return () => clearInterval(interval)
}, [])

function sendReq() {
fetch('https://api-gc.galvindev.me.uk/clicked')
.then(function(response) {
if(response.ok) return response.json
throw new Error('Request failed.')
})
.catch(function(error) {
console.error(error)
})
}
function sendReq() {
fetch('https://api-gc.galvindev.me.uk/clicked')
.then(function(response) {
if(response.ok) return response.json
throw new Error('Request failed.')
})
.catch(function(error) {
console.error(error)
})
}

// Needed for outlinks
const Anchor = props => {
return (
<a href='https://github.com/galvinpython/globalclicker'>{props.children}</a>
)
}
// Needed for outlinks
const Anchor = props => {
return (
<a href='https://github.com/galvinpython/globalclicker'>{props.children}</a>
)
}

return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>Global Clicker By: <code>GalvinPython</code></p>
<div className='Odometer'>
<Odometer value={value} format='(,ddd),dd' style={{ fontWeight: "bold", whiteSpace: "nowrap", overflow: "hidden" }} title='Clicks / Count'/>
</div>
<button onClick={sendReq}>+1 Click</button>
<small title='This is a beta version to test everything works. Compiled on 26th July 2023'>Version 0.3-20230726 (BETA) | <Anchor>View Source</Anchor></small>
</header>
</div>
);
return (
<div className="App">
<header className="App-header dark">
<div class="App-settings">
<div class="App-icons">
<img src={settingsIcon} alt="logo" />
</div>
<div class="App-icons">
<img src={statsIcon} alt="logo" />
</div>
</div>
<img src={logo} className="App-logo" alt="logo" />
<p>Global Clicker By <b>GalvinPython</b></p>
<div className='Odometer'>
<Odometer value={value} format='(,ddd),dd' style={{ fontWeight: "bold", whiteSpace: "nowrap", overflow: "hidden" }} title='Clicks / Count'/>
</div>
<button onClick={sendReq} type='button'>+1 Click</button>
<code title='Upcoming version of GlobalClicker. Updated on 6th August 2023'>1.0 (Upcoming 2) | <Anchor>View Source</Anchor></code>
{/* <small title='GlobalClicker is now in stable release! Click the "view source" button to see more information. Compiled on x August 2023'>Version 1.0| <Anchor>View Source</Anchor></small> */}
</header>
</div>
);
}

export default App;
51 changes: 41 additions & 10 deletions src/App.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Variables
$background-color_1: black;
$background-color_2: rgb(181, 252, 94);
$background-color_3: rgb(97, 218, 251);
$background-color_4: white;
$background-color_5: #222;

$color_1: white;
$color_2: #61dafb;
Expand All @@ -12,7 +15,7 @@ $font-family_2: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospa
// Main Content
.App {
text-align: center;
cursor: url(cursor.svg), auto;
cursor: url(svg/cursor.svg), auto;
}
.App-logo {
height: 20vmin;
Expand All @@ -27,6 +30,17 @@ $font-family_2: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospa
justify-content: center;
font-size: calc(10px + 2vmin);
color: $color_1;
a {
color: $color_1;
}

&.light {
background-color: $background-color_4;
color: $color_3;
a {
color: $color_3;
}
}
}
.App-link {
color: $color_2;
Expand All @@ -46,35 +60,52 @@ button {
font-size: 1em;
transition-duration: 0.5s;
font-weight: bolder;
cursor: url(svg/cursor.svg), auto;
&:hover {
background-color: $background-color_3;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(255,255,255,0.19);
cursor: pointer;
transition-duration: 0.5s;
cursor: url(pointer.svg), auto;
}
}

small {
font-size: 1vh;
position: fixed;
bottom: 0;
}

body {
margin: 0;
font-family: $font-family_1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
user-select: none;
}

code {
font-family: $font-family_2;
font-size: 1.2vh;
position: fixed;
bottom: 0;
}

.odometer {
min-width: 90vw;
font-size: 10vw;
}

a {
color: white;
.App-settings {
position: absolute;
top: 0;
right: 10px;
}
.App-icons {
background-color: $background-color_5;
border-radius: 50%;
width: 5vw;
height: 5vw;
margin-top: 10px;
cursor: not-allowed !important; // TODO: Remove once functionality has been implemented
> img {
text-align: center;
vertical-align: center;
width: 3vw;
margin-top: 1vw;
pointer-events: none;
}
}
1 change: 1 addition & 0 deletions src/pointer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
1 change: 1 addition & 0 deletions src/svg/settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/svg/stats.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.