Skip to content

Commit c516a68

Browse files
committed
Update 2.0
Complete overhaul of the Website
1 parent 2327343 commit c516a68

34 files changed

+5284
-1289
lines changed

.env.local.example

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
DB_HOST=localhost
2-
DB_USER=root
3-
DB_PASSWORD=toor
4-
DB_NAME=cs2surf
1+
DB_HOST=
2+
DB_USER=
3+
DB_PASSWORD=
4+
DB_NAME=
5+
STEAM_API_KEY=API_KEY
6+
NEXT_PUBLIC_BASE_URL=YOUR_DOMAIN

.vs/ProjectSettings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"CurrentProjectSetting": null
3+
}

.vs/VSWorkspaceState.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"ExpandedNodes": [
3+
""
4+
],
5+
"PreviewInSolutionExplorer": false
6+
}

.vs/cs2-web/v17/.wsuo

14 KB
Binary file not shown.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"Version": 1,
3+
"WorkspaceRootPath": "C:\\Users\\coryb\\source\\repos\\jke-cs\\cs2-web\\",
4+
"Documents": [],
5+
"DocumentGroupContainers": [
6+
{
7+
"Orientation": 0,
8+
"VerticalTabListWidth": 256,
9+
"DocumentGroups": [
10+
{
11+
"DockedWidth": 200,
12+
"SelectedChildIndex": -1,
13+
"Children": [
14+
{
15+
"$type": "Bookmark",
16+
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
17+
},
18+
{
19+
"$type": "Bookmark",
20+
"Name": "ST:131:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
21+
},
22+
{
23+
"$type": "Bookmark",
24+
"Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}"
25+
},
26+
{
27+
"$type": "Bookmark",
28+
"Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
29+
},
30+
{
31+
"$type": "Bookmark",
32+
"Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
33+
},
34+
{
35+
"$type": "Bookmark",
36+
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
37+
},
38+
{
39+
"$type": "Bookmark",
40+
"Name": "ST:0:0:{1c64b9c2-e352-428e-a56d-0ace190b99a6}"
41+
}
42+
]
43+
}
44+
]
45+
}
46+
]
47+
}

.vs/slnx.sqlite

128 KB
Binary file not shown.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
>This website is in development use with caution.
1111
# cs2-web
1212

13+
Checkout the docs [DOCS](https://docs.cs2surf.pro)
1314

1415
A next.js Website, supporting [Sharptimer ](https://github.com/Letaryat/poor-sharptimer)
1516

@@ -54,6 +55,7 @@ rpm run start
5455

5556
```
5657

58+
5759
# TODO List
5860
- [ ] Credit system
5961
- [ ] Earn credits by playing / DU_Utlities used to measure playtime
@@ -62,7 +64,6 @@ rpm run start
6264
- [ ] Players will get VIP if they login
6365
- [ ] Add Playercount in Servercards
6466

65-
6667
## Learn More
6768

6869
To learn more about Next.js, take a look at the following resources:

app/api/PlayerStats/route.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export async function GET() {
66
user: '',
77
password: '',
88
database: '',
9+
port: 3306,
910
});
1011

1112
try {
@@ -21,4 +22,4 @@ export async function GET() {
2122
headers: { 'Content-Type': 'application/json' },
2223
});
2324
}
24-
}
25+
}

app/components/Footer.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react'
2+
3+
export default function Footer() {
4+
return (
5+
<footer className="w-full text-center py-2 bg-gray-900 text-white text-sm fixed bottom-0 left-0 z-50">
6+
<p className="animate-slide-in-once">This website was created by JKE &copy;</p>
7+
</footer>
8+
)
9+
}

app/components/Header.tsx

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
import React, { useState, useEffect } from 'react'
2+
import Image from 'next/image'
3+
import { motion, AnimatePresence } from 'framer-motion'
4+
import { FaHome, FaTrophy, FaDiscord, FaSketch, FaCog, FaPlay, FaGift, FaBook } from 'react-icons/fa'
5+
6+
interface HeaderProps {
7+
activeSection: string;
8+
setActiveSection: (section: string) => void;
9+
user: User | null;
10+
onLogin: () => void;
11+
}
12+
13+
interface User {
14+
steamName: string;
15+
avatarUrl: string;
16+
}
17+
18+
export default function Header({ activeSection, setActiveSection, user, onLogin }: HeaderProps) {
19+
const [isExpanded, setIsExpanded] = useState(false);
20+
const [isMobile, setIsMobile] = useState(false);
21+
22+
useEffect(() => {
23+
const handleResize = () => {
24+
setIsMobile(window.innerWidth < 768);
25+
};
26+
handleResize();
27+
window.addEventListener('resize', handleResize);
28+
return () => window.removeEventListener('resize', handleResize);
29+
}, []);
30+
31+
const navItems = [
32+
{ name: 'home', icon: FaPlay, label: 'Play' },
33+
{ name: 'best', icon: FaTrophy, label: 'Best' },
34+
{ name: 'skins', icon: () => <Image src="/skins2.svg" alt="Skins" width={22} height={24} />, label: 'Skins', isExternal: true, url: 'https://cs2surf.de' },
35+
{ name: 'inventory', icon: FaSketch, label: 'Inventory', isExternal: true, url: 'http://inv.cs2surf.pro:3000' },
36+
{ name: 'giveaway', icon: FaGift, label: 'Giveaway' },
37+
]
38+
39+
const secondaryItems = [
40+
{ name: 'docs', icon: FaBook, label: 'Docs', isExternal: true, url: 'https://docs.cs2surf.pro' },
41+
{ name: 'discord', icon: FaDiscord, label: 'Join Discord', isExternal: true, url: 'https://discord.gg/n4xCDWrQRB' },
42+
{ name: 'settings', icon: FaCog, label: 'Settings' },
43+
]
44+
45+
return (
46+
<motion.nav
47+
className="fixed top-0 left-0 h-screen bg-gray-900 flex flex-col items-start py-4 shadow-lg z-50 overflow-hidden"
48+
initial={false}
49+
animate={{
50+
width: isMobile
51+
? isExpanded ? '100%' : '0px'
52+
: isExpanded ? 'var(--nav-width-expanded)' : 'var(--nav-width-collapsed)'
53+
}}
54+
transition={{ duration: 0.3, ease: 'easeInOut' }}
55+
onMouseEnter={() => !isMobile && setIsExpanded(true)}
56+
onMouseLeave={() => !isMobile && setIsExpanded(false)}
57+
style={{
58+
'--nav-width-collapsed': '64px',
59+
'--nav-width-expanded': '220px',
60+
} as React.CSSProperties}
61+
>
62+
<div className="flex justify-between items-center w-full px-2 mb-6">
63+
<div className="ml-1">
64+
<Image src="/logo.png" alt="Logo" width={40} height={40} className="rounded-full" />
65+
</div>
66+
{isMobile && (
67+
<button
68+
onClick={() => setIsExpanded(!isExpanded)}
69+
className="p-2 text-white"
70+
>
71+
{isExpanded ? 'Close' : 'Menu'}
72+
</button>
73+
)}
74+
</div>
75+
<div className="flex flex-col space-y-1 w-full px-2 flex-grow overflow-y-auto">
76+
{navItems.map((item) => (
77+
<NavItem
78+
key={item.name}
79+
item={item}
80+
isActive={activeSection === item.name}
81+
isExpanded={isExpanded || isMobile}
82+
onClick={() => {
83+
handleItemClick(item, setActiveSection);
84+
isMobile && setIsExpanded(false);
85+
}}
86+
/>
87+
))}
88+
</div>
89+
<div className="mt-auto mb-4 px-2 w-full space-y-1">
90+
{secondaryItems.map((item) => (
91+
<NavItem
92+
key={item.name}
93+
item={item}
94+
isActive={activeSection === item.name}
95+
isExpanded={isExpanded || isMobile}
96+
onClick={() => {
97+
handleItemClick(item, setActiveSection);
98+
isMobile && setIsExpanded(false);
99+
}}
100+
/>
101+
))}
102+
</div>
103+
</motion.nav>
104+
)
105+
}
106+
107+
interface NavItemProps {
108+
item: {
109+
name: string;
110+
icon: React.ElementType;
111+
label: string;
112+
isExternal?: boolean;
113+
url?: string;
114+
};
115+
isActive: boolean;
116+
isExpanded: boolean;
117+
onClick: () => void;
118+
}
119+
120+
function NavItem({ item, isActive, isExpanded, onClick }: NavItemProps) {
121+
return (
122+
<motion.button
123+
className={`p-2 rounded-lg transition-colors duration-200 ease-in-out flex items-center w-full ${
124+
isActive ? 'bg-blue-600 text-white' : 'text-gray-400 hover:bg-gray-800 hover:text-white'
125+
}`}
126+
onClick={onClick}
127+
whileHover={{ scale: 1.03 }}
128+
whileTap={{ scale: 0.97 }}
129+
>
130+
<item.icon className="text-xl min-w-[20px]" />
131+
<motion.div
132+
className="ml-3 overflow-hidden"
133+
initial={false}
134+
animate={{ width: isExpanded ? 'auto' : 0 }}
135+
transition={{ duration: 0.3, ease: 'easeInOut' }}
136+
>
137+
<motion.span
138+
className="text-sm font-medium whitespace-nowrap block"
139+
initial={false}
140+
animate={{ opacity: isExpanded ? 1 : 0 }}
141+
transition={{ duration: 0.2, ease: 'easeInOut' }}
142+
>
143+
{item.label}
144+
</motion.span>
145+
</motion.div>
146+
</motion.button>
147+
)
148+
}
149+
150+
function handleItemClick(item: NavItemProps['item'], setActiveSection: (section: string) => void) {
151+
if (item.isExternal && item.url) {
152+
window.open(item.url, '_blank')
153+
} else {
154+
setActiveSection(item.name)
155+
}
156+
}

0 commit comments

Comments
 (0)