|
110 | 110 | <div class="relative mb-8"> |
111 | 111 | <div class="w-full h-full absolute inset-0 bg-gray-900 rounded-xl translate-y-2 translate-x-2"></div> |
112 | 112 | <div class="rounded-xl relative z-20 p-8 border-[3px] border-gray-900 bg-[#E6F2FF]"> |
113 | | - <form method="post" class="flex flex-col md:flex-row gap-4"> |
| 113 | + <form method="post" class="flex flex-col md:flex-row gap-4" onsubmit="prepareFormSubmit(event)"> |
114 | 114 | <div class="relative flex-1"> |
115 | 115 | <div class="w-full h-full rounded bg-gray-900 translate-y-1 translate-x-1 absolute inset-0 z-10"></div> |
116 | 116 | <input |
|
132 | 132 | Generate Dockerfile |
133 | 133 | </button> |
134 | 134 | </div> |
| 135 | + <input type="hidden" name="additional_instructions_hidden" id="additional_instructions_hidden" value=""> |
135 | 136 | </form> |
136 | 137 |
|
137 | | - <!-- Example repositories section --> |
138 | | - <div class="mt-6"> |
139 | | - <p class="text-gray-700 mb-3 font-medium">Try these example repositories:</p> |
140 | | - <div class="flex flex-wrap gap-2"> |
141 | | - <button onclick="submitExample('https://github.com/cyclotruc/gitingest')" |
142 | | - class="px-4 py-2 bg-[#E6F2FF] hover:bg-[#5A9BF5] text-gray-900 rounded transition-colors duration-200 border-[3px] border-gray-900 relative hover:-translate-y-px hover:-translate-x-px text-sm font-medium"> |
143 | | - Gitingest |
144 | | - </button> |
145 | | - <button onclick="submitExample('https://github.com/cyclotruc/gitcontainer')" |
146 | | - class="px-4 py-2 bg-[#E6F2FF] hover:bg-[#5A9BF5] text-gray-900 rounded transition-colors duration-200 border-[3px] border-gray-900 relative hover:-translate-y-px hover:-translate-x-px text-sm font-medium"> |
147 | | - Gitcontainer |
148 | | - </button> |
| 138 | + <!-- Examples and Additional instructions row --> |
| 139 | + <div class="mt-6 flex flex-col md:flex-row md:justify-between md:items-start gap-4"> |
| 140 | + <!-- Example repositories section --> |
| 141 | + <div class="flex-1"> |
| 142 | + <p class="text-gray-700 mb-3 font-medium">Try these example repositories:</p> |
| 143 | + <div class="flex flex-wrap gap-2"> |
| 144 | + <button onclick="submitExample('https://github.com/cyclotruc/gitingest')" |
| 145 | + class="px-4 py-2 bg-[#E6F2FF] hover:bg-[#5A9BF5] text-gray-900 rounded transition-colors duration-200 border-[3px] border-gray-900 relative hover:-translate-y-px hover:-translate-x-px text-sm font-medium"> |
| 146 | + Gitingest |
| 147 | + </button> |
| 148 | + <button onclick="submitExample('https://github.com/cyclotruc/gitcontainer')" |
| 149 | + class="px-4 py-2 bg-[#E6F2FF] hover:bg-[#5A9BF5] text-gray-900 rounded transition-colors duration-200 border-[3px] border-gray-900 relative hover:-translate-y-px hover:-translate-x-px text-sm font-medium"> |
| 150 | + Gitcontainer |
| 151 | + </button> |
| 152 | + </div> |
| 153 | + </div> |
| 154 | + |
| 155 | + <!-- Additional instructions checkbox --> |
| 156 | + <div class="flex-shrink-0 self-start md:self-center"> |
| 157 | + <div class="flex items-center"> |
| 158 | + <input type="checkbox" |
| 159 | + id="show_instructions" |
| 160 | + onchange="toggleInstructions()" |
| 161 | + class="w-4 h-4 text-[#5A9BF5] bg-gray-100 border-gray-300 rounded focus:ring-[#5A9BF5] focus:ring-2"> |
| 162 | + <label for="show_instructions" class="ml-2 text-gray-700 font-medium">Additional instructions</label> |
| 163 | + </div> |
| 164 | + </div> |
| 165 | + </div> |
| 166 | + |
| 167 | + <!-- Additional instructions textarea (spans full width) --> |
| 168 | + <div id="instructions_container" class="hidden mt-4"> |
| 169 | + <div class="relative"> |
| 170 | + <div class="w-full h-full rounded bg-gray-900 translate-y-1 translate-x-1 absolute inset-0 z-10"></div> |
| 171 | + <textarea |
| 172 | + id="additional_instructions" |
| 173 | + name="additional_instructions" |
| 174 | + placeholder="e.g., Use Alpine Linux, include specific tools, optimize for production, etc." |
| 175 | + rows="3" |
| 176 | + class="border-[3px] w-full relative z-20 border-gray-900 placeholder-gray-600 text-sm font-medium focus:outline-none py-3 px-4 rounded resize-none" |
| 177 | + ></textarea> |
149 | 178 | </div> |
150 | 179 | </div> |
151 | 180 | </div> |
|
349 | 378 | // input.form.submit(); |
350 | 379 | } |
351 | 380 |
|
| 381 | + // Toggle additional instructions visibility |
| 382 | + function toggleInstructions() { |
| 383 | + const checkbox = document.getElementById('show_instructions'); |
| 384 | + const container = document.getElementById('instructions_container'); |
| 385 | + |
| 386 | + if (checkbox.checked) { |
| 387 | + container.classList.remove('hidden'); |
| 388 | + container.classList.add('block'); |
| 389 | + } else { |
| 390 | + container.classList.add('hidden'); |
| 391 | + container.classList.remove('block'); |
| 392 | + // Clear the textarea when hiding |
| 393 | + document.getElementById('additional_instructions').value = ''; |
| 394 | + } |
| 395 | + } |
| 396 | +
|
| 397 | + // Prepare form submission by copying additional instructions to hidden input |
| 398 | + function prepareFormSubmit(event) { |
| 399 | + const checkbox = document.getElementById('show_instructions'); |
| 400 | + const instructionsTextarea = document.getElementById('additional_instructions'); |
| 401 | + const hiddenInput = document.getElementById('additional_instructions_hidden'); |
| 402 | + |
| 403 | + if (checkbox.checked && instructionsTextarea.value.trim()) { |
| 404 | + hiddenInput.value = instructionsTextarea.value.trim(); |
| 405 | + } else { |
| 406 | + hiddenInput.value = ''; |
| 407 | + } |
| 408 | + |
| 409 | + // Allow form to submit normally |
| 410 | + return true; |
| 411 | + } |
| 412 | +
|
352 | 413 | // Monaco Editor setup |
353 | 414 | let dockerfileEditor = null; |
354 | 415 | let composeEditor = null; |
|
0 commit comments