55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
66 < title > Grappling Game Viewer</ title >
77 < link rel ="stylesheet " href ="assets/css/style.css ">
8+ < link rel ="stylesheet " href ="assets/css/feedback.css ">
89 < link rel ="stylesheet " href ="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css ">
910 < script src ="https://cdn.jsdelivr.net/npm/marked/marked.min.js "> </ script >
1011</ head >
@@ -25,12 +26,41 @@ <h1>Grappling Games</h1>
2526 < h2 id ="file-title "> Loading...</ h2 >
2627 < div id ="markdown-content "> </ div >
2728 </ div >
29+
30+ < div id ="feedback-section " class ="feedback-section ">
31+ < h3 > Provide Feedback</ h3 >
32+ < button id ="show-feedback-form " class ="feedback-button "> Leave Feedback</ button >
33+ < div id ="feedback-form-container " style ="display: none; ">
34+ < form id ="feedback-form ">
35+ < div class ="form-group ">
36+ < label for ="feedback-type "> Type of Feedback:</ label >
37+ < select id ="feedback-type " required >
38+ < option value =""> Select an option</ option >
39+ < option value ="suggestion "> Suggestion</ option >
40+ < option value ="improvement "> Improvement</ option >
41+ < option value ="correction "> Correction</ option >
42+ < option value ="question "> Question</ option >
43+ </ select >
44+ </ div >
45+ < div class ="form-group ">
46+ < label for ="feedback-text "> Your Feedback:</ label >
47+ < textarea id ="feedback-text " rows ="4 " required > </ textarea >
48+ </ div >
49+ < div class ="form-actions ">
50+ < button type ="submit " class ="submit-button "> Submit Feedback</ button >
51+ < button type ="button " id ="cancel-feedback " class ="cancel-button "> Cancel</ button >
52+ </ div >
53+ </ form >
54+ < div id ="feedback-message " style ="display: none; "> </ div >
55+ </ div >
56+ </ div >
2857 </ main >
2958
3059 < footer >
3160 < div class ="container ">
3261 < p > Last updated: June 19, 2025</ p >
3362 < p > < a href ="https://github.com/mennlo/grappling-games "> View on GitHub < i class ="fab fa-github "> </ i > </ a > </ p >
63+ < p > < a href ="https://github.com/mennlo/grappling-games/issues/new?title=Feedback%20on%20 " id ="feedback-link " target ="_blank "> Provide Feedback < i class ="fas fa-comment "> </ i > </ a > </ p >
3464 </ div >
3565 </ footer >
3666
@@ -53,6 +83,10 @@ <h2 id="file-title">Loading...</h2>
5383 document . getElementById ( 'file-title' ) . textContent = `${ formatName ( fileName ) } ${ contentType } ` ;
5484 document . title = `${ formatName ( fileName ) } - Grappling Games` ;
5585
86+ // Update the feedback link with the current file
87+ const feedbackLink = document . getElementById ( 'feedback-link' ) ;
88+ feedbackLink . href = `https://github.com/mennlo/grappling-games/issues/new?title=Feedback%20on%20${ formatName ( fileName ) } &body=Feedback%20for:%20${ filePath } %0A%0AYour%20feedback:%20` ;
89+
5690 // Fetch the markdown content from GitHub
5791 const baseRepoUrl = 'https://api.github.com/repos/mennlo/grappling-games/contents/' ;
5892
@@ -82,6 +116,64 @@ <h2 id="file-title">Loading...</h2>
82116 . map ( word => word . charAt ( 0 ) . toUpperCase ( ) + word . slice ( 1 ) )
83117 . join ( ' ' ) ;
84118 }
119+
120+ // Handle feedback form
121+ const showFeedbackFormButton = document . getElementById ( 'show-feedback-form' ) ;
122+ const feedbackFormContainer = document . getElementById ( 'feedback-form-container' ) ;
123+ const feedbackForm = document . getElementById ( 'feedback-form' ) ;
124+ const cancelFeedbackButton = document . getElementById ( 'cancel-feedback' ) ;
125+ const feedbackMessage = document . getElementById ( 'feedback-message' ) ;
126+
127+ showFeedbackFormButton . addEventListener ( 'click' , function ( ) {
128+ feedbackFormContainer . style . display = 'block' ;
129+ showFeedbackFormButton . style . display = 'none' ;
130+ } ) ;
131+
132+ cancelFeedbackButton . addEventListener ( 'click' , function ( ) {
133+ feedbackFormContainer . style . display = 'none' ;
134+ showFeedbackFormButton . style . display = 'block' ;
135+ feedbackForm . reset ( ) ;
136+ } ) ;
137+
138+ feedbackForm . addEventListener ( 'submit' , function ( e ) {
139+ e . preventDefault ( ) ;
140+
141+ const feedbackType = document . getElementById ( 'feedback-type' ) . value ;
142+ const feedbackText = document . getElementById ( 'feedback-text' ) . value ;
143+
144+ // Create a GitHub issue via the API
145+ createGitHubIssue ( fileName , filePath , feedbackType , feedbackText ) ;
146+ } ) ;
147+
148+ function createGitHubIssue ( fileName , filePath , feedbackType , feedbackText ) {
149+ // Normally, you would use the GitHub API here, but that requires authentication
150+ // For simplicity, we'll redirect to the new issue page with pre-filled information
151+ const issueTitle = `Feedback [${ feedbackType } ]: ${ formatName ( fileName ) } ` ;
152+ const issueBody = `Feedback for: ${ filePath } \n\nType: ${ feedbackType } \n\n${ feedbackText } ` ;
153+
154+ const encodedTitle = encodeURIComponent ( issueTitle ) ;
155+ const encodedBody = encodeURIComponent ( issueBody ) ;
156+
157+ const issueUrl = `https://github.com/mennlo/grappling-games/issues/new?title=${ encodedTitle } &body=${ encodedBody } ` ;
158+
159+ // Show success message
160+ feedbackForm . style . display = 'none' ;
161+ feedbackMessage . innerHTML = `
162+ <p>Thank you for your feedback!</p>
163+ <p>Please complete your submission on GitHub:</p>
164+ <a href="${ issueUrl } " target="_blank" class="submit-button">Continue to GitHub</a>
165+ <button type="button" id="close-feedback" class="cancel-button">Close</button>
166+ ` ;
167+ feedbackMessage . style . display = 'block' ;
168+
169+ document . getElementById ( 'close-feedback' ) . addEventListener ( 'click' , function ( ) {
170+ feedbackFormContainer . style . display = 'none' ;
171+ showFeedbackFormButton . style . display = 'block' ;
172+ feedbackForm . reset ( ) ;
173+ feedbackForm . style . display = 'block' ;
174+ feedbackMessage . style . display = 'none' ;
175+ } ) ;
176+ }
85177 } ) ;
86178 </ script >
87179</ body >
0 commit comments