Skip to content

Commit 2c96753

Browse files
committed
-Footer fix
1 parent 7861097 commit 2c96753

File tree

2 files changed

+22
-44
lines changed

2 files changed

+22
-44
lines changed

components/Footer.tsx

+22-24
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const Footer: React.FC = () => {
1313
let shiftPressed = false;
1414

1515
const handleKeyDown = (e: KeyboardEvent) => {
16+
// Detect if Ctrl or Shift are pressed
1617
if (e.key === 'Control') {
1718
ctrlPressed = true;
1819
}
@@ -22,42 +23,47 @@ const Footer: React.FC = () => {
2223
};
2324

2425
const handleKeyUp = (e: KeyboardEvent) => {
26+
// When both Ctrl and Shift are released, start listening for "admin"
2527
if (ctrlPressed && shiftPressed) {
26-
setListeningForAdmin(true);
27-
setInputSequence('');
28+
setListeningForAdmin(true); // Set flag to start listening for "admin"
29+
setInputSequence(''); // Reset input sequence
2830
ctrlPressed = false;
2931
shiftPressed = false;
3032

33+
// Set a timer to stop listening if no input in 5 seconds
3134
if (timer) clearTimeout(timer);
3235
setTimer(
3336
setTimeout(() => {
34-
setListeningForAdmin(false);
35-
setInputSequence('');
37+
setListeningForAdmin(false); // Stop listening after 5 seconds
38+
setInputSequence(''); // Reset sequence
3639
}, 5000)
3740
);
3841
}
3942
};
4043

4144
const handleKeyPress = (e: KeyboardEvent) => {
45+
// Only proceed if we're in the input mode
4246
if (listeningForAdmin) {
4347
const newSequence = inputSequence + e.key.toLowerCase();
4448

49+
// Check if the input sequence matches "admin"
4550
if (newSequence === 'admin') {
4651
setShowLink(true);
47-
setInputSequence('');
48-
setListeningForAdmin(false);
52+
setInputSequence(''); // Reset sequence after success
53+
setListeningForAdmin(false); // Stop listening
4954

55+
// Set a timer to hide the link after 5 seconds
5056
if (timer) clearTimeout(timer);
5157
setTimer(
5258
setTimeout(() => {
53-
setShowLink(false);
59+
setShowLink(false); // Hide the link after 5 seconds
5460
}, 5000)
5561
);
5662
} else if ('admin'.startsWith(newSequence)) {
57-
setInputSequence(newSequence);
63+
setInputSequence(newSequence); // Update sequence
5864
} else {
59-
setInputSequence('');
60-
setListeningForAdmin(false);
65+
setInputSequence(''); // Reset sequence on wrong input
66+
setListeningForAdmin(false); // Stop listening if incorrect
6167
}
6268
}
6369
};
@@ -70,7 +76,7 @@ const Footer: React.FC = () => {
7076
window.removeEventListener('keydown', handleKeyDown);
7177
window.removeEventListener('keyup', handleKeyUp);
7278
window.removeEventListener('keypress', handleKeyPress);
73-
if (timer) clearTimeout(timer);
79+
if (timer) clearTimeout(timer); // Clean up timeout on unmount
7480
};
7581
}, [inputSequence, listeningForAdmin, timer]);
7682

@@ -84,7 +90,7 @@ const Footer: React.FC = () => {
8490
};
8591

8692
return (
87-
<footer className="footer">
93+
<footer>
8894
<div className="footer-content">
8995
<p>© 2024 ProBooker</p>
9096
{showLink && (
@@ -95,21 +101,13 @@ const Footer: React.FC = () => {
95101
</div>
96102
<AdminLoginModal show={showModal} onClose={closeModal} />
97103
<style jsx>{`
98-
.footer {
99-
width: 100%;
100-
position: absolute;
101-
bottom: 0;
102-
background: #f8f9fa;
103-
border-top: 1px solid #e9ecef;
104-
padding: 20px;
105-
text-align: center;
106-
}
107104
.footer-content {
108105
display: flex;
109106
justify-content: space-between;
110107
align-items: center;
111-
max-width: 1200px;
112-
margin: 0 auto;
108+
padding: 20px;
109+
background: #f8f9fa;
110+
border-top: 1px solid #e9ecef;
113111
}
114112
a {
115113
color: #0070f3;
@@ -124,4 +122,4 @@ const Footer: React.FC = () => {
124122
);
125123
};
126124

127-
export default Footer;
125+
export default Footer;

styles/globals.css

-20
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ main {
8181
background-repeat: no-repeat;
8282
}
8383

84-
.provider-background-login{
85-
background-image: url('/assets/turqoXL.jpg');
86-
background-size: cover;
87-
background-position: right;
88-
background-repeat: no-repeat;
89-
}
90-
9184
/* Main content background */
9285
.content-background {
9386
position: relative;
@@ -134,16 +127,3 @@ main {
134127
.h-84{
135128
height: 21rem;
136129
}
137-
/*
138-
.content-background {
139-
@apply bg-white bg-opacity-10;
140-
}
141-
*/
142-
143-
/* Sticky footer style */
144-
footer {
145-
@apply bg-gray-800 text-white py-4 mt-8;
146-
text-align: center;
147-
position: relative;
148-
width: 100%;
149-
}

0 commit comments

Comments
 (0)