settings.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. Application Settings
  129. </h2>
  130. <div class="px-6 py-5 space-y-6">
  131. <label class="flex flex-col gap-1.5">
  132. <span class="text-slate-700 text-sm font-medium leading-normal"
  133. >Application Name</span
  134. >
  135. <div class="flex gap-3 items-center">
  136. <div class="relative flex-1">
  137. <input
  138. id="appNameInput"
  139. 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"
  140. placeholder="e.g., Dune Weaver"
  141. value="Dune Weaver"
  142. />
  143. <button
  144. type="button"
  145. onclick="document.getElementById('appNameInput').value='Dune Weaver';"
  146. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  147. aria-label="Reset to default"
  148. title="Reset to default"
  149. >
  150. <span class="material-icons">restart_alt</span>
  151. </button>
  152. </div>
  153. <button
  154. id="saveAppName"
  155. 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"
  156. >
  157. <span class="material-icons text-lg">save</span>
  158. <span class="truncate">Save Name</span>
  159. </button>
  160. </div>
  161. <p class="text-xs text-slate-500 mt-2">
  162. This name will appear in the browser tab and at the top of every page.
  163. </p>
  164. </label>
  165. </div>
  166. </section>
  167. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  168. <h2
  169. 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"
  170. >
  171. Device Connection
  172. </h2>
  173. <div class="divide-y divide-slate-100">
  174. <div
  175. class="flex items-center gap-4 px-6 py-5 hover:bg-slate-50 transition-colors"
  176. >
  177. <div
  178. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  179. >
  180. <span class="material-icons text-3xl">usb_off</span>
  181. </div>
  182. <div class="flex-1">
  183. <p class="text-slate-800 text-base font-medium leading-normal">
  184. Status
  185. </p>
  186. <p
  187. id="serialStatus"
  188. class="text-red-500 text-sm font-medium leading-normal"
  189. >
  190. Disconnected
  191. </p>
  192. </div>
  193. <button
  194. id="disconnectButton"
  195. 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"
  196. hidden
  197. >
  198. Disconnect
  199. </button>
  200. </div>
  201. <div id="portSelectionDiv" class="px-6 py-5 space-y-4">
  202. <label class="flex flex-col gap-1.5">
  203. <span class="text-slate-700 text-sm font-medium leading-normal"
  204. >Available Serial Ports</span
  205. >
  206. <div class="flex gap-3 items-center">
  207. <select
  208. id="portSelect"
  209. 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 "
  210. >
  211. <option value="">Select a port...</option>
  212. </select>
  213. <button
  214. id="connectButton"
  215. 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"
  216. >
  217. <span class="material-icons text-lg">cable</span>
  218. <span class="truncate">Connect</span>
  219. </button>
  220. </div>
  221. <p class="text-xs text-slate-500 mt-2">
  222. Select a port and click 'Connect' to establish a connection.
  223. </p>
  224. </label>
  225. </div>
  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. Custom Clear Patterns
  233. </h2>
  234. <div class="px-6 py-5 space-y-6">
  235. <p class="text-sm text-slate-600">
  236. Customize the clear patterns used when transitioning between patterns. The idea here is for you to have some flexibility to choose clear patterns to distribute your sand evenly.
  237. </p>
  238. <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
  239. <div class="flex flex-col gap-1.5">
  240. <label for="customClearFromInInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Center Pattern</label>
  241. <div class="relative">
  242. <input
  243. id="customClearFromInInput"
  244. type="text"
  245. 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"
  246. placeholder="Type to search patterns or leave empty for default"
  247. autocomplete="off"
  248. />
  249. <button
  250. type="button"
  251. id="clearFromInClear"
  252. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  253. aria-label="Clear selection"
  254. title="Clear selection"
  255. >
  256. <span class="material-icons text-xl">close</span>
  257. </button>
  258. <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>
  259. </div>
  260. <p class="text-xs text-slate-500 mt-1">
  261. Pattern to use when clearing from the center outward.
  262. </p>
  263. </div>
  264. <div class="flex flex-col gap-1.5">
  265. <label for="customClearFromOutInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Perimeter Pattern</label>
  266. <div class="relative">
  267. <input
  268. id="customClearFromOutInput"
  269. type="text"
  270. 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"
  271. placeholder="Type to search patterns or leave empty for default"
  272. autocomplete="off"
  273. />
  274. <button
  275. type="button"
  276. id="clearFromOutClear"
  277. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  278. aria-label="Clear selection"
  279. title="Clear selection"
  280. >
  281. <span class="material-icons text-xl">close</span>
  282. </button>
  283. <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>
  284. </div>
  285. <p class="text-xs text-slate-500 mt-1">
  286. Pattern to use when clearing from the perimeter inward.
  287. </p>
  288. </div>
  289. </div>
  290. <div class="flex justify-end">
  291. <button
  292. id="saveClearPatterns"
  293. 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"
  294. >
  295. <span class="material-icons text-lg">save</span>
  296. <span class="truncate">Save Clear Patterns</span>
  297. </button>
  298. </div>
  299. </div>
  300. </section>
  301. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  302. <h2
  303. 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"
  304. >
  305. Clearing Pattern Speed
  306. </h2>
  307. <div class="px-6 py-5 space-y-6">
  308. <p class="text-sm text-slate-600">
  309. Set a custom speed for clearing patterns. This allows you to run clearing patterns at a different speed than regular patterns. If this is set, the speed will be used but won't be updated in the pattern preivew.
  310. </p>
  311. <div class="flex flex-col gap-1.5">
  312. <label for="clearPatternSpeedInput" class="text-slate-700 text-sm font-medium leading-normal">
  313. Clearing Speed (steps per minute)
  314. </label>
  315. <div class="flex gap-3 items-center">
  316. <input
  317. id="clearPatternSpeedInput"
  318. type="number"
  319. min="50"
  320. max="2000"
  321. step="50"
  322. 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"
  323. placeholder="200"
  324. value=""
  325. />
  326. <button
  327. id="saveClearSpeed"
  328. 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"
  329. >
  330. <span class="material-icons text-lg">save</span>
  331. <span class="truncate">Save Speed</span>
  332. </button>
  333. </div>
  334. </div>
  335. </div>
  336. </section>
  337. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  338. <h2
  339. 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"
  340. >
  341. WLED Configuration
  342. </h2>
  343. <div class="px-6 py-5 space-y-6">
  344. <label class="flex flex-col gap-1.5">
  345. <span class="text-slate-700 text-sm font-medium leading-normal"
  346. >IP Address</span
  347. >
  348. <div class="flex gap-3 items-center">
  349. <div class="relative flex-1">
  350. <input
  351. id="wledIpInput"
  352. 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"
  353. placeholder="e.g., 192.168.1.100"
  354. value=""
  355. />
  356. <button
  357. type="button"
  358. onclick="document.getElementById('wledIpInput').value='';"
  359. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  360. aria-label="Clear WLED IP"
  361. >
  362. <span class="material-icons">close</span>
  363. </button>
  364. </div>
  365. <button
  366. id="saveWledConfig"
  367. 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"
  368. >
  369. <span class="material-icons text-lg">save</span>
  370. <span class="truncate">Save Configuration</span>
  371. </button>
  372. </div>
  373. <p class="text-xs text-slate-500 mt-2">
  374. Enter the IP address of your WLED controller.
  375. </p>
  376. </label>
  377. </div>
  378. </section>
  379. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  380. <h2
  381. 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"
  382. >
  383. Software Version
  384. </h2>
  385. <div class="divide-y divide-slate-100">
  386. <div class="flex items-center gap-4 px-6 py-5">
  387. <div
  388. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  389. >
  390. <span class="material-icons text-3xl">terminal</span>
  391. </div>
  392. <div class="flex-1">
  393. <p class="text-slate-800 text-base font-medium leading-normal">
  394. Current Version
  395. </p>
  396. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  397. </div>
  398. </div>
  399. <div class="flex items-center gap-4 px-6 py-5">
  400. <div
  401. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  402. >
  403. <span class="material-icons text-3xl">system_update</span>
  404. </div>
  405. <div class="flex-1">
  406. <p class="text-slate-800 text-base font-medium leading-normal">
  407. Latest Version
  408. </p>
  409. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  410. </div>
  411. <button
  412. id="updateSoftware"
  413. 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"
  414. disabled
  415. >
  416. <span id="updateIcon" class="material-icons text-base">download</span>
  417. <span id="updateText" class="truncate">Update</span>
  418. </button>
  419. </div>
  420. </div>
  421. </section>
  422. </div>
  423. {% endblock %} {% block scripts %}
  424. <script src="/static/js/settings.js"></script>
  425. {% endblock %}