Skip to content

Commit fff119c

Browse files
committed
fix 37
1 parent a1a65b7 commit fff119c

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

css/styles.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ main {
5454
flex-direction: column;
5555
height: 100%;
5656
position: relative;
57-
padding-top: 35px; /* Add space at top for status message */
57+
padding-top: 35px; /* Restore original padding */
5858
padding-bottom: 5px; /* Reduced bottom padding */
5959
}
6060

@@ -250,7 +250,7 @@ main {
250250
align-items: center;
251251
justify-content: center;
252252
position: absolute;
253-
top: 5px; /* Position at top to avoid overlapping with content */
253+
top: 5px; /* Restore original position */
254254
left: 5px;
255255
right: 5px;
256256
border: 2px solid;

js/mood-palette.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,14 @@ window.onPluginMessage = function(data) {
537537
const parsedData = JSON.parse(data.data);
538538
console.log('Parsed data:', parsedData);
539539

540+
// Handle email address response
541+
if (parsedData.email) {
542+
console.log('Received user email from LLM:', parsedData.email);
543+
showStatus('EMAIL ADDRESS RECEIVED. SENDING PALETTE...', 'info');
544+
sendPaletteToEmail(parsedData.email);
545+
return;
546+
}
547+
540548
// Handle color analysis response
541549
if (parsedData.colors && Array.isArray(parsedData.colors)) {
542550
console.log('Received colors from LLM:', parsedData.colors);
@@ -691,3 +699,44 @@ function sendColorsToLLM(colors) {
691699
showStatus('LLM COMMUNICATION FAILED', 'error');
692700
}
693701
}
702+
703+
// Function to send the palette image to a specific email address
704+
function sendPaletteToEmail(emailAddress) {
705+
console.log('Sending palette to email:', emailAddress);
706+
707+
// Generate the palette image
708+
generatePaletteImage().then(imageDataUrl => {
709+
showStatus('PALETTE IMAGE GENERATED. SENDING...', 'info');
710+
711+
// In a real implementation, we would either:
712+
// 1. Upload the image to a hosting service and send the URL
713+
// 2. Send the image data directly if the email service supports it
714+
// 3. Ask the LLM to generate an email with the image attached
715+
716+
if (typeof PluginMessageHandler !== 'undefined') {
717+
// Ask the LLM to send an email with the palette image
718+
const payload = {
719+
message: `Please send an email to ${emailAddress} with the attached color palette image. The palette colors are: ${currentPalette.join(', ')}. Include a creative description of the palette.`,
720+
useLLM: true,
721+
wantsR1Response: true,
722+
imageData: imageDataUrl // Send the image data directly
723+
};
724+
725+
PluginMessageHandler.postMessage(JSON.stringify(payload));
726+
showStatus('SENDING EMAIL VIA LLM...', 'info');
727+
} else {
728+
// Simulate email sending in browser
729+
setTimeout(() => {
730+
showStatus('PALETTE SENT TO YOUR EMAIL!', 'success');
731+
732+
// Reset after success
733+
setTimeout(() => {
734+
resetApp();
735+
}, 2000);
736+
}, 1500);
737+
}
738+
}).catch(error => {
739+
console.error('Error generating palette image:', error);
740+
showStatus('FAILED TO GENERATE PALETTE IMAGE', 'error');
741+
});
742+
}

0 commit comments

Comments
 (0)