settings.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. {% extends "base.html" %} {% block title %}Settings - Kinetic Sand Table{%
  2. endblock %}
  3. {% block additional_styles %}
  4. /* Dark mode styles for settings page */
  5. .dark .bg-white {
  6. background-color: #262626;
  7. }
  8. .dark .text-slate-900 {
  9. color: #e5e5e5;
  10. }
  11. .dark .text-slate-800 {
  12. color: #e5e5e5;
  13. }
  14. .dark .text-slate-700 {
  15. color: #d1d5db;
  16. }
  17. .dark .text-slate-600 {
  18. color: #9ca3af;
  19. }
  20. .dark .text-slate-500 {
  21. color: #9ca3af;
  22. }
  23. .dark .border-slate-200 {
  24. border-color: #404040;
  25. }
  26. .dark .border-slate-300 {
  27. border-color: #404040;
  28. }
  29. .dark .divide-slate-100 {
  30. border-color: #404040;
  31. }
  32. .dark .bg-slate-50 {
  33. background-color: #262626;
  34. }
  35. .dark .hover\:bg-slate-50:hover {
  36. background-color: #404040;
  37. }
  38. .dark .bg-slate-100 {
  39. background-color: #404040;
  40. }
  41. .dark .form-input {
  42. background-color: #262626;
  43. border-color: #404040;
  44. color: #e5e5e5;
  45. }
  46. .dark .form-input::placeholder {
  47. color: #9ca3af;
  48. }
  49. .dark .form-input:focus {
  50. border-color: #0c7ff2;
  51. ring-color: #0c7ff2;
  52. }
  53. .dark .form-select {
  54. background-color: #262626;
  55. border-color: #404040;
  56. color: #e5e5e5;
  57. }
  58. .dark .form-select:focus {
  59. border-color: #0c7ff2;
  60. ring-color: #0c7ff2;
  61. }
  62. .dark .focus\:ring-sky-500:focus {
  63. ring-color: #0c7ff2;
  64. }
  65. .dark .focus\:border-sky-500:focus {
  66. border-color: #0c7ff2;
  67. }
  68. .dark .hover\:text-gray-700:hover {
  69. color: #e5e5e5;
  70. }
  71. .dark .text-gray-400 {
  72. color: #9ca3af;
  73. }
  74. /* Autocomplete suggestions dark mode */
  75. .dark #clearFromInSuggestions,
  76. .dark #clearFromOutSuggestions {
  77. background-color: #262626;
  78. border-color: #404040;
  79. }
  80. .dark .suggestion-item {
  81. color: #e5e5e5;
  82. }
  83. .dark .suggestion-item:hover {
  84. background-color: #404040;
  85. }
  86. .dark .suggestion-item.selected {
  87. background-color: #0c7ff2;
  88. color: white;
  89. }
  90. /* Light mode autocomplete styles */
  91. .suggestion-item {
  92. padding: 8px 12px;
  93. cursor: pointer;
  94. color: #1f2937;
  95. transition: background-color 0.15s;
  96. }
  97. .suggestion-item:hover {
  98. background-color: #f3f4f6;
  99. }
  100. .suggestion-item.selected {
  101. background-color: #0c7ff2;
  102. color: white;
  103. }
  104. .suggestion-item mark {
  105. background-color: #fef3c7;
  106. font-weight: 600;
  107. }
  108. .dark .suggestion-item mark {
  109. background-color: #92400e;
  110. color: #fef3c7;
  111. }
  112. {% endblock %}
  113. {% block content %}
  114. <div class="layout-content-container flex flex-col w-full max-w-4xl gap-8 pt-2 pb-[75px]">
  115. <div
  116. class="flex flex-wrap justify-between items-center p-4 bg-white rounded-xl shadow-sm mt-2 sm:mt-8"
  117. >
  118. <h1
  119. class="text-slate-900 tracking-tight text-2xl sm:text-3xl font-bold leading-tight"
  120. >
  121. Settings
  122. </h1>
  123. </div>
  124. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  125. <h2
  126. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  127. >
  128. Device Connection
  129. </h2>
  130. <div class="divide-y divide-slate-100">
  131. <div
  132. class="flex items-center gap-4 px-6 py-5 hover:bg-slate-50 transition-colors"
  133. >
  134. <div
  135. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  136. >
  137. <span class="material-icons text-3xl">usb_off</span>
  138. </div>
  139. <div class="flex-1">
  140. <p class="text-slate-800 text-base font-medium leading-normal">
  141. Status
  142. </p>
  143. <p
  144. id="serialStatus"
  145. class="text-red-500 text-sm font-medium leading-normal"
  146. >
  147. Disconnected
  148. </p>
  149. </div>
  150. <button
  151. id="disconnectButton"
  152. class="text-xs font-medium text-slate-600 bg-red-100 hover:bg-red-200 text-red-700 px-3 py-1.5 rounded-md transition-colors"
  153. hidden
  154. >
  155. Disconnect
  156. </button>
  157. </div>
  158. <div id="portSelectionDiv" class="px-6 py-5 space-y-4">
  159. <label class="flex flex-col gap-1.5">
  160. <span class="text-slate-700 text-sm font-medium leading-normal"
  161. >Available Serial Ports</span
  162. >
  163. <div class="flex gap-3 items-center">
  164. <select
  165. id="portSelect"
  166. class="form-select flex-1 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 text-base font-medium leading-normal transition-colors "
  167. >
  168. <option value="">Select a port...</option>
  169. </select>
  170. <button
  171. id="connectButton"
  172. class="flex items-center justify-center gap-2 min-w-[100px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors flex-shrink-0"
  173. >
  174. <span class="material-icons text-lg">cable</span>
  175. <span class="truncate">Connect</span>
  176. </button>
  177. </div>
  178. <p class="text-xs text-slate-500 mt-2">
  179. Select a port and click 'Connect' to establish a connection.
  180. </p>
  181. </label>
  182. </div>
  183. </div>
  184. </section>
  185. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  186. <h2
  187. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  188. >
  189. Clear Pattern Configuration
  190. </h2>
  191. <div class="px-6 py-5 space-y-6">
  192. <p class="text-sm text-slate-600">
  193. Customize the clear patterns used when transitioning between patterns. These patterns are used to clear the sand before drawing a new pattern.
  194. </p>
  195. <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
  196. <div class="flex flex-col gap-1.5">
  197. <label for="customClearFromInInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Center Pattern</label>
  198. <div class="relative">
  199. <input
  200. id="customClearFromInInput"
  201. type="text"
  202. class="form-input w-full resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 pr-10 text-base font-normal leading-normal transition-colors"
  203. placeholder="Type to search patterns or leave empty for default"
  204. autocomplete="off"
  205. />
  206. <button
  207. type="button"
  208. id="clearFromInClear"
  209. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  210. aria-label="Clear selection"
  211. title="Clear selection"
  212. >
  213. <span class="material-icons text-xl">close</span>
  214. </button>
  215. <div id="clearFromInSuggestions" class="absolute z-10 w-full mt-1 bg-white border border-slate-300 rounded-lg shadow-lg max-h-60 overflow-y-auto hidden"></div>
  216. </div>
  217. <p class="text-xs text-slate-500 mt-1">
  218. Pattern to use when clearing from the center outward.
  219. </p>
  220. </div>
  221. <div class="flex flex-col gap-1.5">
  222. <label for="customClearFromOutInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Perimeter Pattern</label>
  223. <div class="relative">
  224. <input
  225. id="customClearFromOutInput"
  226. type="text"
  227. class="form-input w-full resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 pr-10 text-base font-normal leading-normal transition-colors"
  228. placeholder="Type to search patterns or leave empty for default"
  229. autocomplete="off"
  230. />
  231. <button
  232. type="button"
  233. id="clearFromOutClear"
  234. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  235. aria-label="Clear selection"
  236. title="Clear selection"
  237. >
  238. <span class="material-icons text-xl">close</span>
  239. </button>
  240. <div id="clearFromOutSuggestions" class="absolute z-10 w-full mt-1 bg-white border border-slate-300 rounded-lg shadow-lg max-h-60 overflow-y-auto hidden"></div>
  241. </div>
  242. <p class="text-xs text-slate-500 mt-1">
  243. Pattern to use when clearing from the perimeter inward.
  244. </p>
  245. </div>
  246. </div>
  247. <div class="flex justify-end">
  248. <button
  249. id="saveClearPatterns"
  250. class="flex items-center justify-center gap-2 min-w-[140px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors"
  251. >
  252. <span class="material-icons text-lg">save</span>
  253. <span class="truncate">Save Clear Patterns</span>
  254. </button>
  255. </div>
  256. </div>
  257. </section>
  258. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  259. <h2
  260. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  261. >
  262. WLED Configuration
  263. </h2>
  264. <div class="px-6 py-5 space-y-6">
  265. <label class="flex flex-col gap-1.5">
  266. <span class="text-slate-700 text-sm font-medium leading-normal"
  267. >IP Address</span
  268. >
  269. <div class="flex gap-3 items-center">
  270. <div class="relative flex-1">
  271. <input
  272. id="wledIpInput"
  273. class="form-input flex w-full min-w-0 resize-none overflow-hidden rounded-lg text-slate-900 focus:outline-0 focus:ring-2 focus:ring-sky-500 border border-slate-300 bg-white focus:border-sky-500 h-10 placeholder:text-slate-400 px-4 pr-10 text-base font-normal leading-normal transition-colors"
  274. placeholder="e.g., 192.168.1.100"
  275. value=""
  276. />
  277. <button
  278. type="button"
  279. onclick="document.getElementById('wledIpInput').value='';"
  280. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  281. aria-label="Clear WLED IP"
  282. >
  283. <span class="material-icons">close</span>
  284. </button>
  285. </div>
  286. <button
  287. id="saveWledConfig"
  288. class="flex items-center justify-center gap-2 min-w-[140px] cursor-pointer rounded-lg h-10 px-4 bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors flex-shrink-0"
  289. >
  290. <span class="material-icons text-lg">save</span>
  291. <span class="truncate">Save Configuration</span>
  292. </button>
  293. </div>
  294. <p class="text-xs text-slate-500 mt-2">
  295. Enter the IP address of your WLED controller.
  296. </p>
  297. </label>
  298. </div>
  299. </section>
  300. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  301. <h2
  302. class="text-slate-800 text-xl sm:text-2xl font-semibold leading-tight tracking-[-0.01em] px-6 py-4 border-b border-slate-200"
  303. >
  304. Software Version
  305. </h2>
  306. <div class="divide-y divide-slate-100">
  307. <div class="flex items-center gap-4 px-6 py-5">
  308. <div
  309. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  310. >
  311. <span class="material-icons text-3xl">terminal</span>
  312. </div>
  313. <div class="flex-1">
  314. <p class="text-slate-800 text-base font-medium leading-normal">
  315. Current Version
  316. </p>
  317. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  318. </div>
  319. </div>
  320. <div class="flex items-center gap-4 px-6 py-5">
  321. <div
  322. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  323. >
  324. <span class="material-icons text-3xl">system_update</span>
  325. </div>
  326. <div class="flex-1">
  327. <p class="text-slate-800 text-base font-medium leading-normal">
  328. Latest Version
  329. </p>
  330. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  331. </div>
  332. <button
  333. id="updateSoftware"
  334. class="flex items-center justify-center gap-1.5 min-w-[84px] cursor-pointer rounded-lg h-9 px-3 bg-gray-400 text-white text-xs font-medium leading-normal tracking-[0.015em] transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
  335. disabled
  336. >
  337. <span id="updateIcon" class="material-icons text-base">download</span>
  338. <span id="updateText" class="truncate">Update</span>
  339. </button>
  340. </div>
  341. </div>
  342. </section>
  343. </div>
  344. {% endblock %} {% block scripts %}
  345. <script src="/static/js/settings.js"></script>
  346. {% endblock %}