File size: 12,327 Bytes
4fee2f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Neurodivergent Translator</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: {
                            50: '#f0f9ff',
                            100: '#e0f2fe',
                            200: '#bae6fd',
                            300: '#7dd3fc',
                            400: '#38bdf8',
                            500: '#0ea5e9',
                            600: '#0284c7',
                            700: '#0369a1',
                            800: '#075985',
                            900: '#0c4a6e',
                        },
                        secondary: {
                            50: '#f5f3ff',
                            100: '#ede9fe',
                            200: '#ddd6fe',
                            300: '#c4b5fd',
                            400: '#a78bfa',
                            500: '#8b5cf6',
                            600: '#7c3aed',
                            700: '#6d28d9',
                            800: '#5b21b6',
                            900: '#4c1d95',
                        }
                    }
                }
            }
        }
    </script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
        
        body {
            font-family: 'Inter', sans-serif;
            background-color: #f8fafc;
        }
        
        .input-box {
            transition: all 0.2s ease;
            min-height: 120px;
        }
        
        .input-box:focus {
            border-color: #7dd3fc;
            box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.3);
        }
        
        .output-bubble {
            position: relative;
            background-color: #f0f9ff;
            border-radius: 18px;
        }
        
        .output-bubble:after {
            content: '';
            position: absolute;
            left: 0;
            top: -10px;
            width: 0;
            height: 0;
            border: 10px solid transparent;
            border-right-color: #f0f9ff;
            border-left: 0;
            margin-left: 20px;
        }
        
        .btn-primary {
            transition: all 0.2s ease;
        }
        
        .btn-primary:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        
        .btn-primary:active {
            transform: translateY(0);
        }
        
        .feedback-textarea {
            min-height: 80px;
            transition: all 0.2s ease;
        }
        
        .feedback-textarea:focus {
            border-color: #c4b5fd;
            box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.3);
        }
        
        @media (max-width: 640px) {
            .container-padding {
                padding-left: 1rem;
                padding-right: 1rem;
            }
        }
    </style>
</head>
<body class="min-h-screen bg-gray-50">
    <div class="max-w-2xl mx-auto container-padding py-8 px-4 sm:px-6 lg:px-8">
        <div class="text-center mb-8">
            <div class="flex items-center justify-center mb-4">
                <div class="bg-primary-100 p-3 rounded-full">
                    <i class="fas fa-brain text-primary-600 text-2xl"></i>
                </div>
            </div>
            <h1 class="text-3xl font-bold text-gray-800 mb-2">Neurodivergent Translator</h1>
            <p class="text-gray-600 max-w-md mx-auto">Bridge communication gaps with tailored message transformations</p>
        </div>
        
        <div class="bg-white rounded-xl shadow-sm p-6 mb-6">
            <div class="mb-6">
                <label for="original-message" class="block text-sm font-medium text-gray-700 mb-2">
                    Your original message
                </label>
                <textarea 
                    id="original-message" 
                    class="input-box w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-200" 
                    placeholder="Type or paste your message here..." 
                    rows="4"></textarea>
            </div>
            
            <div class="mb-6">
                <label for="transformation-type" class="block text-sm font-medium text-gray-700 mb-2">
                    Transformation Type
                </label>
                <select 
                    id="transformation-type" 
                    class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-200">
                    <option value="clarify">Clarify my intent</option>
                    <option value="decode">Decode this message</option>
                    <option value="professional">Make it sound professional</option>
                    <option value="soften">Soften tone, keep meaning</option>
                    <option value="meltdown">I'm melting down, fix it</option>
                </select>
            </div>
            
            <button 
                id="translate-btn" 
                class="btn-primary w-full bg-primary-500 hover:bg-primary-600 text-white font-medium py-3 px-4 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-200 focus:ring-offset-2">
                <i class="fas fa-language mr-2"></i> Translate
            </button>
        </div>
        
        <div id="output-section" class="hidden bg-white rounded-xl shadow-sm p-6 mb-6">
            <h2 class="text-lg font-medium text-gray-800 mb-4">Translated Message</h2>
            <div class="output-bubble p-4 mb-6">
                <p id="translated-output" class="text-gray-700"></p>
            </div>
            
            <div class="pt-4 border-t border-gray-100">
                <h3 class="text-sm font-medium text-gray-700 mb-3">How helpful was this?</h3>
                <textarea 
                    id="feedback-text" 
                    class="feedback-textarea w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-secondary-200" 
                    placeholder="Your feedback helps us improve..."></textarea>
                <button 
                    id="feedback-btn" 
                    class="mt-3 w-full bg-secondary-500 hover:bg-secondary-600 text-white font-medium py-2 px-4 rounded-lg focus:outline-none focus:ring-2 focus:ring-secondary-200 focus:ring-offset-2">
                    Submit Feedback
                </button>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const translateBtn = document.getElementById('translate-btn');
            const originalMessage = document.getElementById('original-message');
            const transformationType = document.getElementById('transformation-type');
            const outputSection = document.getElementById('output-section');
            const translatedOutput = document.getElementById('translated-output');
            const feedbackBtn = document.getElementById('feedback-btn');
            const feedbackText = document.getElementById('feedback-text');
            
            // Mock translation function
            function mockTranslate(message, type) {
                // Simulate API call delay
                return new Promise(resolve => {
                    setTimeout(() => {
                        const transformations = {
                            'clarify': `Clarified version: ${message} (I mean this sincerely and want to communicate my thoughts clearly)`,
                            'decode': `Decoded meaning: This likely means "${message}" but might be confusing due to neurodivergent communication style`,
                            'professional': `Professional version: Dear colleague, ${message}. Best regards.`,
                            'soften': `Gentler phrasing: I was wondering if perhaps ${message.toLowerCase()}? No pressure though!`,
                            'meltdown': `Emergency support message: I'm struggling right now. I need help with: ${message}. Can we talk about this when I'm calmer?`
                        };
                        resolve(transformations[type] || message);
                    }, 800);
                });
            }
            
            // Translate button click handler
            translateBtn.addEventListener('click', async function() {
                const message = originalMessage.value.trim();
                const type = transformationType.value;
                
                if (!message) {
                    alert('Please enter a message to translate');
                    return;
                }
                
                // Show loading state
                translateBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Translating...';
                translateBtn.disabled = true;
                
                // Mock API call
                try {
                    const result = await mockTranslate(message, type);
                    translatedOutput.textContent = result;
                    outputSection.classList.remove('hidden');
                    
                    // Scroll to output
                    outputSection.scrollIntoView({ behavior: 'smooth' });
                } catch (error) {
                    console.error('Translation error:', error);
                    alert('Translation failed. Please try again.');
                } finally {
                    // Reset button
                    translateBtn.innerHTML = '<i class="fas fa-language mr-2"></i> Translate';
                    translateBtn.disabled = false;
                }
            });
            
            // Feedback button click handler
            feedbackBtn.addEventListener('click', function() {
                const feedback = feedbackText.value.trim();
                
                if (!feedback) {
                    alert('Please provide some feedback');
                    return;
                }
                
                // Show loading state
                feedbackBtn.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i> Submitting...';
                feedbackBtn.disabled = true;
                
                // Mock API call
                setTimeout(() => {
                    alert('Thank you for your feedback! We appreciate your input.');
                    feedbackText.value = '';
                    feedbackBtn.innerHTML = 'Submit Feedback';
                    feedbackBtn.disabled = false;
                }, 800);
            });
            
            // Accessibility: Make textareas auto-expand
            function autoExpand(textarea) {
                textarea.style.height = 'auto';
                textarea.style.height = (textarea.scrollHeight) + 'px';
            }
            
            originalMessage.addEventListener('input', function() {
                autoExpand(this);
            });
            
            feedbackText.addEventListener('input', function() {
                autoExpand(this);
            });
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=nomadicsynth/neurodivergent-translator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>