@@ -7,6 +7,7 @@ import { ReferencedBy } from "./ReferencedBy";
77import { CrossGameRefs } from "./CrossGameRefs" ;
88import { KindIcon } from "../KindIcon" ;
99import { DeclarationsContext , declarationKey } from "./DeclarationsContext" ;
10+ import { getGame } from "../../games" ;
1011import {
1112 matchesWords ,
1213 matchesMetadataKeys ,
@@ -105,6 +106,38 @@ export const ModuleBadge: React.FC<{ module: string }> = ({ module }) => {
105106 ) ;
106107} ;
107108
109+ const GitHubIcon = styled . a `
110+ display: inline-flex;
111+ align-items: center;
112+ color: var(--text-dim);
113+ margin-left: 4px;
114+
115+ &:hover {
116+ color: var(--highlight);
117+ }
118+ ` ;
119+
120+ export const GitHubFileLink : React . FC < { module : string ; name : string } > = ( { module, name } ) => {
121+ const { game } = useContext ( DeclarationsContext ) ;
122+ const gameData = getGame ( game ) ;
123+ if ( ! gameData ) return null ;
124+ const fileName = name . replace ( / : / g, "_" ) ;
125+ const url = `https://github.com/${ gameData . repo } /blob/master/DumpSource2/schemas/${ module } /${ fileName } .h` ;
126+ return (
127+ < GitHubIcon href = { url } target = "_blank" rel = "noopener noreferrer" title = "View on GitHub" >
128+ < svg
129+ xmlns = "http://www.w3.org/2000/svg"
130+ viewBox = "0 0 16 16"
131+ width = "16"
132+ height = "16"
133+ fill = "currentColor"
134+ >
135+ < path d = "M6.766 11.695C4.703 11.437 3.25 9.904 3.25 7.92c0-.806.281-1.677.75-2.258-.203-.532-.172-1.662.062-2.129.626-.081 1.469.258 1.969.726.594-.194 1.219-.291 1.985-.291.765 0 1.39.097 1.953.274.484-.451 1.343-.79 1.969-.709.218.435.25 1.564.046 2.113.5.613.766 1.436.766 2.274 0 1.984-1.453 3.485-3.547 3.759.531.355.891 1.129.891 2.016v1.678c0 .484.39.758.859.564C13.781 14.824 16 11.905 16 8.291 16 3.726 12.406 0 7.984 0 3.562 0 0 3.726 0 8.291c0 3.581 2.203 6.55 5.172 7.663A.595.595 0 0 0 6 15.389v-1.291c-.219.097-.5.162-.75.162-1.031 0-1.641-.581-2.078-1.662-.172-.435-.36-.693-.719-.742-.187-.016-.25-.097-.25-.193 0-.194.313-.339.625-.339.453 0 .844.29 1.25.887.313.468.641.678 1.031.678.391 0 .641-.146 1-.516.266-.275.469-.517.657-.678Z" > </ path >
136+ </ svg >
137+ </ GitHubIcon >
138+ ) ;
139+ } ;
140+
108141export const SchemaClassView : React . FC < {
109142 declaration : api . SchemaClass ;
110143} > = ( { declaration } ) => {
@@ -161,6 +194,7 @@ export const SchemaClassView: React.FC<{
161194 { declaration . name }
162195 </ DeclarationNameLink >
163196 < ModuleBadge module = { declaration . module } />
197+ < GitHubFileLink module = { declaration . module } name = { declaration . name } />
164198 </ CommonGroupSignature >
165199 </ DeclarationHeader >
166200 { ( ! collapseNonMatching ||
0 commit comments