settings.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. {% extends "base.html" %} {% block title %}Settings - {{ app_name or 'Dune Weaver' }}{%
  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. Application Settings
  190. </h2>
  191. <div class="px-6 py-5 space-y-6">
  192. <label class="flex flex-col gap-1.5">
  193. <span class="text-slate-700 text-sm font-medium leading-normal"
  194. >Application Name</span
  195. >
  196. <div class="flex gap-3 items-center">
  197. <div class="relative flex-1">
  198. <input
  199. id="appNameInput"
  200. 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"
  201. placeholder="e.g., Dune Weaver"
  202. value="Dune Weaver"
  203. />
  204. <button
  205. type="button"
  206. onclick="document.getElementById('appNameInput').value='Dune Weaver';"
  207. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  208. aria-label="Reset to default"
  209. title="Reset to default"
  210. >
  211. <span class="material-icons">restart_alt</span>
  212. </button>
  213. </div>
  214. <button
  215. id="saveAppName"
  216. 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"
  217. >
  218. <span class="material-icons text-lg">save</span>
  219. <span class="truncate">Save Name</span>
  220. </button>
  221. </div>
  222. <p class="text-xs text-slate-500 mt-2">
  223. This name will appear in the browser tab and at the top of every page.
  224. </p>
  225. </label>
  226. </div>
  227. </section>
  228. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  229. <h2
  230. 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"
  231. >
  232. Pattern Clearing
  233. </h2>
  234. <div class="px-6 py-5 space-y-6">
  235. <p class="text-sm text-slate-600">
  236. Customize the clearing behavior used when transitioning between patterns. Set custom patterns and speed to control how sand is distributed.
  237. </p>
  238. <!-- Clearing Speed Section -->
  239. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  240. <h3 class="text-slate-800 text-base font-semibold">Clearing Speed</h3>
  241. <p class="text-sm text-slate-600">
  242. Set a custom speed for clearing patterns. This allows clearing patterns to run at a different speed than regular patterns.
  243. </p>
  244. <div class="flex flex-col gap-1.5">
  245. <label for="clearPatternSpeedInput" class="text-slate-700 text-sm font-medium leading-normal">
  246. Speed (steps per minute)
  247. </label>
  248. <div class="flex gap-3 items-center">
  249. <input
  250. id="clearPatternSpeedInput"
  251. type="number"
  252. min="50"
  253. max="2000"
  254. step="50"
  255. class="form-input 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-normal leading-normal transition-colors"
  256. placeholder="200"
  257. value=""
  258. />
  259. <button
  260. id="saveClearSpeed"
  261. class="flex items-center justify-center gap-2 min-w-[120px] 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"
  262. >
  263. <span class="material-icons text-lg">save</span>
  264. <span class="truncate">Save Speed</span>
  265. </button>
  266. </div>
  267. </div>
  268. </div>
  269. <!-- Custom Patterns Section -->
  270. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  271. <h3 class="text-slate-800 text-base font-semibold">Custom Clear Patterns</h3>
  272. <p class="text-sm text-slate-600">
  273. Choose specific patterns to use when clearing. Leave empty to use the default clearing behavior.
  274. </p>
  275. <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
  276. <div class="flex flex-col gap-1.5">
  277. <label for="customClearFromInInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Center Pattern</label>
  278. <div class="relative">
  279. <input
  280. id="customClearFromInInput"
  281. type="text"
  282. 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"
  283. placeholder="Type to search patterns or leave empty for default"
  284. autocomplete="off"
  285. />
  286. <button
  287. type="button"
  288. id="clearFromInClear"
  289. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  290. aria-label="Clear selection"
  291. title="Clear selection"
  292. >
  293. <span class="material-icons text-xl">close</span>
  294. </button>
  295. <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>
  296. </div>
  297. <p class="text-xs text-slate-500 mt-1">
  298. Pattern to use when clearing from the center outward.
  299. </p>
  300. </div>
  301. <div class="flex flex-col gap-1.5">
  302. <label for="customClearFromOutInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Perimeter Pattern</label>
  303. <div class="relative">
  304. <input
  305. id="customClearFromOutInput"
  306. type="text"
  307. 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"
  308. placeholder="Type to search patterns or leave empty for default"
  309. autocomplete="off"
  310. />
  311. <button
  312. type="button"
  313. id="clearFromOutClear"
  314. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  315. aria-label="Clear selection"
  316. title="Clear selection"
  317. >
  318. <span class="material-icons text-xl">close</span>
  319. </button>
  320. <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>
  321. </div>
  322. <p class="text-xs text-slate-500 mt-1">
  323. Pattern to use when clearing from the perimeter inward.
  324. </p>
  325. </div>
  326. </div>
  327. <div class="flex justify-end">
  328. <button
  329. id="saveClearPatterns"
  330. 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"
  331. >
  332. <span class="material-icons text-lg">save</span>
  333. <span class="truncate">Save Patterns</span>
  334. </button>
  335. </div>
  336. </div>
  337. </div>
  338. </section>
  339. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  340. <h2
  341. 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"
  342. >
  343. WLED Configuration
  344. </h2>
  345. <div class="px-6 py-5 space-y-6">
  346. <label class="flex flex-col gap-1.5">
  347. <span class="text-slate-700 text-sm font-medium leading-normal"
  348. >IP Address</span
  349. >
  350. <div class="flex gap-3 items-center">
  351. <div class="relative flex-1">
  352. <input
  353. id="wledIpInput"
  354. 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"
  355. placeholder="e.g., 192.168.1.100"
  356. value=""
  357. />
  358. <button
  359. type="button"
  360. onclick="document.getElementById('wledIpInput').value='';"
  361. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  362. aria-label="Clear WLED IP"
  363. >
  364. <span class="material-icons">close</span>
  365. </button>
  366. </div>
  367. <button
  368. id="saveWledConfig"
  369. 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"
  370. >
  371. <span class="material-icons text-lg">save</span>
  372. <span class="truncate">Save Configuration</span>
  373. </button>
  374. </div>
  375. <p class="text-xs text-slate-500 mt-2">
  376. Enter the IP address of your WLED controller.
  377. </p>
  378. </label>
  379. </div>
  380. </section>
  381. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  382. <h2
  383. 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"
  384. >
  385. Software Version
  386. </h2>
  387. <div class="divide-y divide-slate-100">
  388. <div class="flex items-center gap-4 px-6 py-5">
  389. <div
  390. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  391. >
  392. <span class="material-icons text-3xl">terminal</span>
  393. </div>
  394. <div class="flex-1">
  395. <p class="text-slate-800 text-base font-medium leading-normal">
  396. Current Version
  397. </p>
  398. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  399. </div>
  400. </div>
  401. <div class="flex items-center gap-4 px-6 py-5">
  402. <div
  403. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  404. >
  405. <span class="material-icons text-3xl">system_update</span>
  406. </div>
  407. <div class="flex-1">
  408. <p class="text-slate-800 text-base font-medium leading-normal">
  409. Latest Version
  410. </p>
  411. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  412. </div>
  413. <button
  414. id="updateSoftware"
  415. 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"
  416. disabled
  417. >
  418. <span id="updateIcon" class="material-icons text-base">download</span>
  419. <span id="updateText" class="truncate">Update</span>
  420. </button>
  421. </div>
  422. </div>
  423. </section>
  424. </div>
  425. {% endblock %} {% block scripts %}
  426. <script src="/static/js/settings.js"></script>
  427. {% endblock %}