11import React , { useContext , useMemo } from "react" ;
22import { useParams } from "react-router" ;
3- import { Link } from "../Link" ;
43import { styled } from "@linaria/react" ;
54import { ContentWrapper , ListItem , TextMessage } from "../layout/Content" ;
65import { LazyList , ScrollableList } from "../Lists" ;
76import { useFilteredData , useParsedSearch , searchDeclarations } from "../../utils/filtering" ;
87import { DeclarationBreadcrumb } from "./Breadcrumb" ;
98import { SchemaClassView } from "./SchemaClass" ;
109import { SchemaEnumView } from "./SchemaEnum" ;
11- import { ClassTree } from "./ClassTree" ;
1210import { Declaration } from "../../data/types" ;
1311import { INTRINSIC_MODULE } from "../../data/intrinsics" ;
1412import { DeclarationsContext , declarationKey , schemaPath } from "./DeclarationsContext" ;
15- import { GAME_LIST , GameId , getGameDef } from "../../games-list" ;
16- import { SEARCH_TAGS } from "../search/SearchBox" ;
17- import { KindIcon , ICONS_URL } from "../kind-icon/KindIcon" ;
18- import { SectionLink } from "./styles" ;
19-
20- const CardBlock = styled . div `
21- max-width: 560px;
22- margin: 16px auto 0;
23- padding: 16px 20px;
24- background: var(--group);
25- border: 1px solid var(--group-border);
26- border-radius: 10px;
27- color: var(--text-dim);
28- font-size: 16px;
29- line-height: 1.6;
30- ` ;
31-
32- const InfoBlock = styled ( CardBlock ) `
33- margin-top: 24px;
34-
35- p {
36- margin: 0;
37- }
38-
39- p + p {
40- margin-top: 8px;
41- }
42- ` ;
43-
44- const GameChip = styled ( Link ) `
45- display: inline-flex;
46- align-items: center;
47- gap: 4px;
48- padding: 2px 8px;
49- border-radius: 6px;
50- background: var(--group-members);
51- border: 1px solid var(--group-border);
52- color: var(--text);
53- text-decoration: none;
54- vertical-align: middle;
55- transition: border-color 0.1s;
56-
57- &:hover {
58- border-color: var(--highlight);
59- }
60-
61- svg {
62- width: 18px;
63- height: 18px;
64- border-radius: 4px;
65- }
66- ` ;
67-
68- function GameList ( ) {
69- return (
70- < >
71- { GAME_LIST . map ( ( g , i ) => (
72- < React . Fragment key = { g . id } >
73- { i > 0 && " " }
74- < GameChip to = { schemaPath ( g . id ) } >
75- < svg width = "24" height = "24" >
76- < use href = { `${ ICONS_URL } #game-${ g . id } ` } />
77- </ svg > { " " }
78- { g . name }
79- </ GameChip >
80- </ React . Fragment >
81- ) ) }
82- </ >
83- ) ;
84- }
85-
86- const InfoLink = styled . a `
87- color: var(--highlight);
88-
89- &:hover {
90- color: var(--text);
91- }
92- ` ;
93-
94- const SearchFiltersBlock = styled ( CardBlock ) `
95- dl {
96- margin: 0;
97- }
98-
99- dt {
100- font-weight: 600;
101- color: var(--text);
102- }
103-
104- dd {
105- margin: 0 0 8px 12px;
106- }
107-
108- dd:last-child {
109- margin-bottom: 0;
110- }
111-
112- code {
113- background: var(--group-members);
114- padding: 1px 5px;
115- border-radius: 4px;
116- font-size: 15px;
117- }
118- ` ;
13+ import { GameId , getGameDef } from "../../games-list" ;
14+ import { ICONS_URL } from "../kind-icon/KindIcon" ;
15+ import { CardBlock , SectionLink } from "./styles" ;
16+ import { ClassTree } from "./ClassTree" ;
17+ import { SchemaHome } from "./SchemaHome" ;
11918
12019const ModuleChipsBlock = styled ( CardBlock ) `
20+ margin-top: 32px;
12121 display: flex;
12222 flex-wrap: wrap;
12323 gap: 5px;
@@ -172,7 +72,7 @@ function OtherGamesResults() {
17272 < OtherGameHeader >
17373 < svg width = "24" height = "24" >
17474 < use href = { `${ ICONS_URL } #game-${ gameId } ` } />
175- </ svg > { " " }
75+ </ svg >
17676 { gameInfo ?. name }
17777 </ OtherGameHeader >
17878 < DeclarationsContext . Provider value = { { ...ctx , game : gameId } } >
@@ -223,7 +123,7 @@ const renderSearchResult = (declaration: Declaration) => renderItem(declaration,
223123export function ContentList ( ) {
224124 const { declarations, metadata, error } = useContext ( DeclarationsContext ) ;
225125 const { data, isSearching } = useFilteredData ( declarations ) ;
226- const { module } = useParams ( ) ;
126+ const { game : gameParam , module } = useParams ( ) ;
227127
228128 return (
229129 < ContentWrapper >
@@ -242,47 +142,8 @@ export function ContentList() {
242142 < TextMessage > { error } </ TextMessage >
243143 ) : (
244144 < >
245- < TextMessage > Choose a class or enum from the sidebar, or use search...</ TextMessage >
246- < InfoBlock >
247- < p >
248- Source 2 includes a schema system that describes the engine's classes, fields, and
249- enumerations along with their types, offsets, and metadata. These schemas
250- comprehensively map engine internals, making them useful for modding and reverse
251- engineering.
252- </ p >
253- < p >
254- Currently tracking: < GameList />
255- </ p >
256- < p >
257- The schemas displayed here are generated by{ " " }
258- < InfoLink href = "https://github.com/ValveResourceFormat/DumpSource2" >
259- DumpSource2
260- </ InfoLink > { " " }
261- and automatically updated by{ " " }
262- < InfoLink href = "https://github.com/SteamTracking/GameTracking" > GameTracking</ InfoLink >
263- . The code for this site is on{ " " }
264- < InfoLink href = "https://github.com/ValveResourceFormat/SchemaExplorer" >
265- GitHub
266- </ InfoLink >
267- .
268- </ p >
269- </ InfoBlock >
270- < SearchFiltersBlock >
271- < dl >
272- < dt > Search by name, filters can be combined</ dt >
273- < dd > Type any text to match class, field, or enum names.</ dd >
274- { SEARCH_TAGS . map ( ( t ) => (
275- < React . Fragment key = { t . tag } >
276- < dt >
277- < KindIcon kind = { t . icon } size = "small" /> < code > { t . tag } </ code > —{ " " }
278- { t . description . toLowerCase ( ) }
279- </ dt >
280- < dd > { t . example } </ dd >
281- </ React . Fragment >
282- ) ) }
283- </ dl >
284- </ SearchFiltersBlock >
285- { module ? < ClassTree module = { module } /> : < ModuleList /> }
145+ < SchemaHome isRoot = { ! gameParam } />
146+ { module ? < ClassTree module = { module } /> : gameParam && < ModuleList /> }
286147 </ >
287148 ) }
288149 { data . length > 0 && metadata . revision > 0 && module !== INTRINSIC_MODULE && (
0 commit comments