Import a 3D Model and automatically assign and export animations
TypeScript
Do not allow double clicking submit survey. Switch UI to thank you message when done.
Scott Petrovicb005fc2110d8
diff --git a/src/dialog.css b/src/dialog.cssindex 33e7694..fa9d3b7 100644--- a/src/dialog.css+++ b/src/dialog.css@@ -200,6 +200,17 @@/* ── Download Success Dialog ── */+.survey-content {+ display: flex;+ flex-direction: column;+ gap: 1rem;+}++.survey-thank-you {+ font-style: italic;+ text-align: center;+}+.download-success-dialog-overlay {position: fixed;top: 0;@@ -329,6 +340,7 @@ font-size: 2rem;max-height: 50px;resize: none;margin-bottom: 1rem;+ color: var(--text-primary);}.download-success-feedback-textarea::placeholder {diff --git a/src/lib/components/download-success/DownloadSuccessDialog.ts b/src/lib/components/download-success/DownloadSuccessDialog.tsindex 7a575d6..efed60e 100644--- a/src/lib/components/download-success/DownloadSuccessDialog.ts+++ b/src/lib/components/download-success/DownloadSuccessDialog.ts@@ -3,7 +3,6 @@ import { StarRating } from './StarRating'export class DownloadSuccessDialog {private dialog_element: HTMLDivElement | null = nullprivate star_rating: StarRating | null = null- private current_rating: number | null = nullprivate readonly content_html = `@@ -19,9 +18,11 @@ export class DownloadSuccessDialog {<div class="download-success-section"><h3>Share Your Feedback</h3>- <div class="star-rating-container"></div>- <textarea class="download-success-feedback-textarea" placeholder="Add optionalal feedback. (500 character max)" rows="4" maxlength="500"></textarea>- <button id="survey-submission-button">Submit</button>+ <div class="survey-content">+ <div class="star-rating-container"></div>+ <textarea id="download-success-feedback" name="download-success-feedback" class="download-success-feedback-textarea" placeholder="Add optionalal feedback. (500 character max)" rows="4" maxlength="500"></textarea>+ <button id="survey-submission-button">Submit</button>+ </div></div><div class="download-success-section">@@ -51,10 +52,8 @@ export class DownloadSuccessDialog {// Initialize star ratingconst rating_container = this.dialog_element.querySelector('.star-rating-container')if (rating_container) {- this.star_rating = new StarRating((rating) => {- this.current_rating = rating- console.log('User rated:', rating)- })+ this.star_rating = new StarRating()+rating_container.innerHTML = this.star_rating.getHTML()this.star_rating.attachEventListeners(rating_container as HTMLElement)}@@ -64,16 +63,15 @@ export class DownloadSuccessDialog {submit_button?.addEventListener('click', async () => {const feedback_textarea = this.dialog_element?.querySelector('.download-success-feedback-textarea') as HTMLTextAreaElementconst feedback_text = feedback_textarea?.value?.trim() || ''+ const current_rating = this.star_rating?.getRating() ?? 3+ const survey_content = this.dialog_element?.querySelector('.survey-content') as HTMLDivElement | null- // Worker requires each submitted item to include a non-empty answer.- if (this.current_rating === null) {- console.error('Survey submission blocked: rating is required before submitting')- return- }+ submit_button.setAttribute('disabled', 'true')+ // Worker requires each submitted item to include a non-empty answer.// Build payload with required rating and optional feedback.const survey_data: Array<{ question: string, answer: string | number }> = [- { question: 'Rating', answer: this.current_rating }+ { question: 'Rating', answer: current_rating }]if (feedback_text.length > 0) {@@ -91,11 +89,19 @@ export class DownloadSuccessDialog {})if (!res.ok) {console.error('Survey submission failed:', res.statusText)+ submit_button.removeAttribute('disabled')} else {console.log('Survey submitted successfully')+ if (survey_content) {+ survey_content.innerHTML = `+ <p class="survey-thank-you">+ Thanks for the feedback. These results will help determine what bugs need fixing, or what features to improve in the future.+ </p>`+ }}} catch (error) {console.error('Error submitting survey:', error)+ submit_button.removeAttribute('disabled')}})