Fix Share to X on mobile, update helper text

- Open window immediately before async fetch to preserve user gesture
- Update MIDI selection helper text per feedback

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
b1rdmania
2025-12-29 15:05:04 +00:00
parent b13923a1eb
commit 0e6a08852f
2 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -1152,7 +1152,7 @@
<div id="resultsSection" class="results-section"> <div id="resultsSection" class="results-section">
<div id="chooseHelper" class="chooser-helper" style="display:none;"> <div id="chooseHelper" class="chooser-helper" style="display:none;">
<p>Pick a source and generate. If it sounds off, try another.</p> <p>Pick a midi source. Try another if it sounds bad, some work better than others.</p>
</div> </div>
<div class="results-header"> <div class="results-header">
+11 -1
View File
@@ -758,6 +758,10 @@ class MotifApp {
const title = this.cleanSongTitle(result.title || 'a song'); const title = this.cleanSongTitle(result.title || 'a song');
// Open window immediately (must be in user gesture context for mobile)
// We'll navigate it after getting the share URL
const popup = window.open('about:blank', '_blank');
// Get share URL (try short link first) // Get share URL (try short link first)
let shareUrl: string | null = null; let shareUrl: string | null = null;
try { try {
@@ -789,7 +793,13 @@ class MotifApp {
const tweetText = `I made ${title} Game Boy version.\n\n16-Bit Midi Wario Synth by @b1rdmania`; const tweetText = `I made ${title} Game Boy version.\n\n16-Bit Midi Wario Synth by @b1rdmania`;
const twitterUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(tweetText)}&url=${encodeURIComponent(shareUrl)}`; const twitterUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(tweetText)}&url=${encodeURIComponent(shareUrl)}`;
window.open(twitterUrl, '_blank', 'width=550,height=420'); // Navigate the already-opened window
if (popup) {
popup.location.href = twitterUrl;
} else {
// Fallback if popup was blocked
window.location.href = twitterUrl;
}
} }
private setState(state: 'idle' | 'results' | 'selected' | 'generated'): void { private setState(state: 'idle' | 'results' | 'selected' | 'generated'): void {