Skip to content

Commit 48d6ee6

Browse files
committed
more fixes
1 parent 468558e commit 48d6ee6

9 files changed

Lines changed: 192 additions & 107 deletions

File tree

web/src/components/Docs/ContentList.tsx

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useContext } from "react";
2+
import { useNavigate } from "react-router-dom";
23
import styled from "styled-components";
34
import { ContentWrapper, ListItem, TextMessage } from "~components/layout/Content";
45
import { LazyList, ScrollableList } from "~components/Lists";
@@ -7,6 +8,76 @@ import { SchemaClassView } from "./SchemaClass";
78
import { SchemaEnumView } from "./SchemaEnum";
89
import { Declaration } from "~components/Docs/api";
910
import { DeclarationsContext } from "~components/Docs/DeclarationsContext";
11+
import { GAMES } from "~games";
12+
13+
const InfoBlock = styled.div`
14+
max-width: 560px;
15+
margin: 24px auto 0;
16+
padding: 16px 20px;
17+
background: ${(props) => props.theme.group};
18+
border: 1px solid ${(props) => props.theme.groupBorder};
19+
border-radius: 10px;
20+
color: ${(props) => props.theme.textDim};
21+
font-size: 16px;
22+
line-height: 1.6;
23+
24+
p {
25+
margin: 0;
26+
}
27+
28+
p + p {
29+
margin-top: 8px;
30+
}
31+
`;
32+
33+
const GameChip = styled.span`
34+
display: inline-flex;
35+
align-items: center;
36+
gap: 4px;
37+
padding: 2px 8px;
38+
border-radius: 6px;
39+
background: ${(props) => props.theme.groupMembers};
40+
border: 1px solid ${(props) => props.theme.groupBorder};
41+
color: ${(props) => props.theme.text};
42+
cursor: pointer;
43+
vertical-align: middle;
44+
transition: border-color 0.1s;
45+
46+
&:hover {
47+
border-color: ${(props) => props.theme.highlight};
48+
}
49+
50+
svg {
51+
width: 18px;
52+
height: 18px;
53+
border-radius: 4px;
54+
}
55+
`;
56+
57+
function GameList() {
58+
const navigate = useNavigate();
59+
return (
60+
<>
61+
{GAMES.map((g, i) => (
62+
<React.Fragment key={g.id}>
63+
{i > 0 && " "}
64+
<GameChip onClick={() => navigate(`/${g.id}`)}>
65+
{g.icon} {g.name}
66+
</GameChip>
67+
</React.Fragment>
68+
))}
69+
</>
70+
);
71+
}
72+
73+
const InfoLink = styled.a`
74+
color: ${(props) => props.theme.highlight};
75+
text-decoration: none;
76+
77+
&:hover {
78+
text-decoration: underline;
79+
}
80+
`;
1081

1182
const OffsetsNote = styled.div`
1283
font-size: 14px;
@@ -48,7 +119,14 @@ export function ContentList() {
48119
) : isSearching ? (
49120
<TextMessage>No results found</TextMessage>
50121
) : (
51-
<TextMessage>Choose a class or enum from the sidebar, or use search...</TextMessage>
122+
<>
123+
<TextMessage>Choose a class or enum from the sidebar, or use search...</TextMessage>
124+
<InfoBlock>
125+
<p>Source 2 includes a schema system that describes the engine's classes, fields, and enumerations along with their types, offsets, and metadata. These schemas comprehensively map engine internals, making them useful for modding and reverse engineering.</p>
126+
<p>Currently tracking: <GameList /></p>
127+
<p>The schemas displayed here are generated by <InfoLink href="https://github.com/ValveResourceFormat/DumpSource2">DumpSource2</InfoLink> and automatically updated by <InfoLink href="https://github.com/SteamTracking/GameTracking">GameTracking</InfoLink>. The code for this site is on <InfoLink href="https://github.com/ValveResourceFormat/SchemaExplorer">GitHub</InfoLink>.</p>
128+
</InfoBlock>
129+
</>
52130
)}
53131
{data.length > 0 && <OffsetsNote>Offsets are from Windows build xxx</OffsetsNote>}
54132
</ContentWrapper>

web/src/components/ElementLink.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

web/src/components/layout/Content.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import styled from "styled-components";
22

33
export const ContentWrapper = styled.main`
4-
grid-column: 2;
5-
grid-row: 2;
4+
flex: 1;
65
padding: 0 0 0 24px;
76
min-width: 0;
7+
overflow-y: auto;
88
99
@media (max-width: 768px) {
1010
grid-column: 1;

web/src/components/layout/NavBar.tsx

Lines changed: 40 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,28 @@
11
import React from "react";
22
import styled from "styled-components";
3-
import { NavLink, useNavigate, useLocation } from "react-router-dom";
3+
import { useNavigate, useLocation } from "react-router-dom";
44
import { AppContext } from "~components/AppContext";
5-
import { SearchBox, SearchInput } from "~components/Search";
6-
import { SidebarFilterContext } from "~components/layout/SidebarFilterContext";
5+
import { SearchBox } from "~components/Search";
76
import { GAMES, GameId, getGame } from "~games";
87

9-
export const NavBar = ({ baseUrl, game }: { baseUrl?: string; game?: GameId }) => {
8+
export const NavBar = ({ baseUrl }: { baseUrl?: string }) => {
109
if (!baseUrl) {
1110
return (
1211
<NavBarSimple>
13-
<HomeBrandLink to="/cs2">Source 2 Schemas</HomeBrandLink>
1412
<NavBarThemeSwitcher />
1513
</NavBarSimple>
1614
);
1715
}
1816

19-
return <NavBarWithSearch baseUrl={baseUrl} game={game} />;
20-
};
21-
22-
function NavBarWithSearch({ baseUrl, game }: { baseUrl: string; game?: GameId }) {
23-
const { filter, setFilter } = React.useContext(SidebarFilterContext);
24-
2517
return (
26-
<>
27-
<NavBarSidebarCell>
28-
<SidebarSearchInput
29-
placeholder="Filter sidebar..."
30-
value={filter}
31-
onChange={(e) => setFilter(e.target.value)}
32-
/>
33-
</NavBarSidebarCell>
34-
<NavBarContentCell>
35-
<NavBarSearchBox baseUrl={baseUrl} placeholder="Search... (module: or offset: to filter)" />
36-
{game && <GameSwitcher currentGame={game} />}
37-
<HomeBrandLink to="/cs2">Source 2 Schemas</HomeBrandLink>
38-
<NavBarThemeSwitcher />
39-
</NavBarContentCell>
40-
</>
18+
<NavBarContentCell>
19+
<NavBarSearchBox baseUrl={baseUrl} placeholder="Search... (module: or offset: to filter)" />
20+
<NavBarThemeSwitcher />
21+
</NavBarContentCell>
4122
);
42-
}
23+
};
4324

44-
function GameSwitcher({ currentGame }: { currentGame: GameId }) {
25+
export function GameSwitcher({ currentGame }: { currentGame: GameId }) {
4526
const [open, setOpen] = React.useState(false);
4627
const ref = React.useRef<HTMLDivElement>(null);
4728
const navigate = useNavigate();
@@ -71,10 +52,10 @@ function GameSwitcher({ currentGame }: { currentGame: GameId }) {
7152
return (
7253
<SwitcherWrapper ref={ref}>
7354
<SwitcherToggle onClick={() => setOpen(!open)} title={currentGameInfo?.name}>
74-
<SwitcherIcon>{currentGameInfo?.icon}</SwitcherIcon>
7555
<SwitcherChevron viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
7656
<path d="m6 9 6 6 6-6" />
7757
</SwitcherChevron>
58+
<SwitcherIcon>{currentGameInfo?.icon}</SwitcherIcon>
7859
</SwitcherToggle>
7960
{open && (
8061
<SwitcherDropdown>
@@ -120,8 +101,8 @@ const SwitcherIcon = styled.span`
120101
121102
svg {
122103
display: block;
123-
width: 37px;
124-
height: 37px;
104+
width: 28px;
105+
height: 28px;
125106
}
126107
`;
127108

@@ -132,13 +113,13 @@ const SwitcherChevron = styled.svg`
132113
const SwitcherDropdown = styled.div`
133114
position: absolute;
134115
top: 100%;
135-
left: 0;
116+
right: 0;
136117
margin-top: 4px;
137118
background: ${(props) => props.theme.group};
138119
border: 1px solid ${(props) => props.theme.groupBorder};
139120
border-radius: 8px;
140121
box-shadow: ${(props) => props.theme.groupShadow};
141-
z-index: 100;
122+
z-index: 200;
142123
overflow: hidden;
143124
min-width: 200px;
144125
`;
@@ -161,44 +142,21 @@ const SwitcherOption = styled.button<{ $active: boolean }>`
161142
}
162143
`;
163144

164-
const NavBarCell = styled.div`
165-
grid-row: 1;
145+
const NavBarContentCell = styled.div`
166146
display: flex;
167147
align-items: center;
168-
`;
169-
170-
const NavBarSidebarCell = styled(NavBarCell)`
171-
grid-column: 1;
172-
padding: 10px 14px;
173-
background-color: ${(props) => props.theme.sidebar};
174-
position: sticky;
175-
top: 0;
176-
z-index: 10;
177-
178-
@media (max-width: 768px) {
179-
display: none;
180-
}
181-
`;
182-
183-
const NavBarContentCell = styled(NavBarCell)`
184-
grid-column: 2;
185148
gap: 14px;
186149
padding: 10px 14px 10px 24px;
187150
min-width: 0;
151+
flex-shrink: 0;
188152
background-color: ${(props) => props.theme.background};
189-
position: sticky;
190-
top: 0;
191-
z-index: 10;
192153
193154
@media (max-width: 768px) {
194155
grid-column: 1;
195156
padding: 10px 14px;
196157
}
197158
`;
198159

199-
const SidebarSearchInput = styled(SearchInput)`
200-
background: ${(props) => props.theme.background};
201-
`;
202160

203161
const NavBarSearchBox = styled(SearchBox)`
204162
flex: 1;
@@ -216,21 +174,6 @@ const NavBarSimple = styled.nav`
216174
background-color: ${(props) => props.theme.background};
217175
`;
218176

219-
const HomeBrandLink = styled(NavLink)`
220-
font-weight: 600;
221-
font-size: 16px;
222-
letter-spacing: -0.01em;
223-
text-decoration: none;
224-
color: ${(props) => props.theme.textDim};
225-
white-space: nowrap;
226-
flex-shrink: 0;
227-
transition: color 0.15s;
228-
229-
&:hover {
230-
color: ${(props) => props.theme.text};
231-
}
232-
`;
233-
234177
const ToggleTrack = styled.label<{ $active: boolean }>`
235178
display: flex;
236179
align-items: center;
@@ -276,6 +219,30 @@ const ToggleLabelRight = styled(ToggleLabel)`
276219
right: 5px;
277220
`;
278221

222+
export function S2VLogo() {
223+
return (
224+
<svg viewBox="0 0 160 160" width="28" height="28">
225+
<circle cx="75.25" cy="72.75" r="64.58" fill="#242a40" />
226+
<path
227+
fill="#458fff"
228+
d="M143.69 21.16q0 1.04-.12 2.04s-4.59 27.94-7.58 45.96c-.5 3.03-1.46 9.4-1.66 10.01v.02a7.06 7.06 0 0 1-9.48 4.27 6.8 6.8 0 0 1-4.18-6.39v-.08c0-.38.21-3.16.22-4.18a48 48 0 0 0-.25-4.82 44 44 0 0 0-1.58-8.09 45.7 45.7 0 0 0-38.68-32.5 47 47 0 0 0-5.07-.29c-.84 0-4.1.21-4.19.19a7 7 0 0 1-1.68-13.74c.46-.14 6.66-1.18 9.68-1.72 18.25-3.24 44.55-7.88 44.55-7.88a17.3 17.3 0 0 1 11.74 2.35 17.4 17.4 0 0 1 8.29 14.83Z"
229+
/>
230+
<path
231+
fill="#385283"
232+
d="M132.81 87.2q-.22.88-.46 1.75a58 58 0 0 1-3.85 9.98c-.68 1.27-2.45 4.5-3.65 6.42a60 60 0 0 1-10.27 11.84s6.76 18.06 7.05 19.22q.5 1.94.5 4.05a16.6 16.6 0 0 1-16.66 16.61 16.6 16.6 0 0 1-13.92-7.56c-.37-.55-10.13-17.74-10.13-17.74q-4.34.46-8.84.26c-29.95-1.32-54.48-25.23-56.5-55.13a59.2 59.2 0 0 1 20.11-48.78 56 56 0 0 1 8.23-6.05 58 58 0 0 1 16.79-6.97 11.42 11.42 0 0 0 2.33 13.52c-4.7 1.15-12.04 3.47-18.94 10.35-9.78 9.76-16.33 23.06-14.72 38.42 2.35 22.4 20.95 40.03 43.46 40.95l.43.01a45.5 45.5 0 0 0 39.4-20.18c1.43-2.08 4.97-8.87 6.06-13.09l.08-.33a11.4 11.4 0 0 0 13.53 2.45Z"
233+
/>
234+
<path
235+
fill="#edf3fc"
236+
d="M95.73 68.92q5.22 2.91 7.4 9.5a20 20 0 0 1 .33 11.94 23 23 0 0 1-6.4 10.5 29 29 0 0 1-11.44 6.71A28 28 0 0 1 72 108.65a24 24 0 0 1-11.36-5.05c-2.46-2-4.34-4.73-5.5-6.92a8 8 0 0 1-.79-1.99 7.5 7.5 0 0 1 4.93-8.87 7.3 7.3 0 0 1 7.31 1.74l.11.12c.46.47 1.38 1.88 1.46 2.02a12.4 12.4 0 0 0 5.41 4.72q3.49 1.63 7.91.21c4.42-1.42 5.04-2.47 6.5-4.66a8 8 0 0 0 .91-7.22q-.9-2.77-3.51-3.34c-1.74-.38-10.38-.46-10.94-.46-.45 0-8.67.03-11.77-.26A25 25 0 0 1 52.6 75.3q-5.1-2.91-7.08-9.41a19 19 0 0 1-.02-11.59 23 23 0 0 1 6.41-10.04q4.63-4.35 11.11-6.41c6.48-2.06 8.91-1.83 13.17-1.14a24 24 0 0 1 11.11 4.67 22 22 0 0 1 5.51 6.58 9 9 0 0 1 .82 1.92 7.16 7.16 0 0 1-4.77 8.65c-2.63.84-5.4.11-7.28-1.67l-.11-.12a18 18 0 0 1-1.46-1.96q-1.92-3-5.34-4.54-3.41-1.53-7.74-.16c-4.33 1.37-4.94 2.4-6.39 4.52a7.7 7.7 0 0 0-.98 7.02q.86 2.7 3.42 3.27c1.71.37 10.28.44 10.84.43.45 0 8.64-.05 11.74.23q4.96.45 10.17 3.36Z"
237+
/>
238+
<path
239+
fill="#242a40"
240+
d="M137.85 33.08c.21.71.26 1.89-.03 2.48a2.3 2.3 0 0 1-1.44 1.23l-14.56 4.05c-4.59.83-6.59-2.59-5.54-5.66s9.05-15.2 9.55-15.77 1.03-1.54.78-2.4a3.8 3.8 0 0 0-2.08-2.54 4.6 4.6 0 0 0-3.33-.2 4.2 4.2 0 0 0-2.64 1.98 6 6 0 0 0-.72 3.12c0 .07.02.84-.02 1.14l-.01.07a3.1 3.1 0 0 1-2.11 2.47c-1.56.45-3.22-.55-3.79-2.25l-.07-.21a11.23 11.23 0 0 1 .16-4.72 10.72 10.72 0 0 1 7.53-7.41q2.76-.8 5.43-.22 2.69.57 4.71 2.38a10 10 0 0 1 2.86 4.59c.62 2.04.64 4.09-.05 5.7s-8.63 12.3-8.45 12.91l10.66-2.94c.79-.23 1.62 0 2.24.55a4 4 0 0 1 .93 1.62Z"
241+
/>
242+
</svg>
243+
);
244+
}
245+
279246
function NavBarThemeSwitcher() {
280247
const appContext = React.useContext(AppContext);
281248

web/src/components/layout/Sidebar.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import styled from "styled-components";
44
import { IconKind, KindIcon } from "~components/KindIcon";
55
import { Declaration } from "~components/Docs/api";
66
import { DeclarationsContext } from "~components/Docs/DeclarationsContext";
7-
import { NAVBAR_HEIGHT } from "./constants";
87

98
const SidebarLink = styled(NavLink)`
109
display: flex;
@@ -93,15 +92,13 @@ export const SidebarGroupHeader = styled.div<{ $collapsed: boolean }>`
9392

9493
export const SidebarWrapper = styled.div`
9594
grid-column: 1;
96-
grid-row: 2;
95+
grid-row: 1;
96+
display: flex;
97+
flex-direction: column;
9798
overflow: hidden;
9899
min-width: 0;
99100
padding: 6px 8px 4px 10px;
100101
background-color: ${(props) => props.theme.sidebar};
101-
position: sticky;
102-
top: ${NAVBAR_HEIGHT}px;
103-
height: calc(100dvh - ${NAVBAR_HEIGHT}px);
104-
align-self: start;
105102
106103
@media (max-width: 768px) {
107104
display: none;

web/src/components/layout/constants.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

web/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const AppWrapper = styled.div`
1111
display: flex;
1212
flex-flow: column;
1313
height: 100%;
14-
max-width: 1600px;
14+
max-width: 1440px;
1515
margin: 0 auto;
1616
background-color: ${(props) => props.theme.background};
1717
color: ${(props) => props.theme.text};

0 commit comments

Comments
 (0)