settings.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  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. /* Toggle switch styles */
  113. .switch {
  114. position: relative;
  115. display: inline-block;
  116. width: 60px;
  117. height: 34px;
  118. }
  119. .switch input {
  120. opacity: 0;
  121. width: 0;
  122. height: 0;
  123. }
  124. .slider {
  125. position: absolute;
  126. cursor: pointer;
  127. top: 0;
  128. left: 0;
  129. right: 0;
  130. bottom: 0;
  131. background-color: #ccc;
  132. transition: .4s;
  133. }
  134. .slider:before {
  135. position: absolute;
  136. content: "";
  137. height: 26px;
  138. width: 26px;
  139. left: 4px;
  140. bottom: 4px;
  141. background-color: white;
  142. transition: .4s;
  143. }
  144. input:checked + .slider {
  145. background-color: #0c7ff2;
  146. }
  147. input:focus + .slider {
  148. box-shadow: 0 0 1px #0c7ff2;
  149. }
  150. input:checked + .slider:before {
  151. transform: translateX(26px);
  152. }
  153. .slider.round {
  154. border-radius: 34px;
  155. }
  156. .slider.round:before {
  157. border-radius: 50%;
  158. }
  159. /* Dark mode for switches */
  160. .dark .slider {
  161. background-color: #404040;
  162. }
  163. .dark input:checked + .slider {
  164. background-color: #0c7ff2;
  165. }
  166. /* Spin animation for loading states */
  167. @keyframes spin {
  168. from {
  169. transform: rotate(0deg);
  170. }
  171. to {
  172. transform: rotate(360deg);
  173. }
  174. }
  175. .animate-spin {
  176. animation: spin 1s linear infinite;
  177. }
  178. /* Time slot specific styles */
  179. .time-slot-item {
  180. background-color: #f8fafc;
  181. border: 1px solid #e2e8f0;
  182. border-radius: 8px;
  183. padding: 16px;
  184. transition: all 0.15s;
  185. }
  186. .dark .time-slot-item {
  187. background-color: #1e293b;
  188. border-color: #475569;
  189. }
  190. .time-slot-item:hover {
  191. border-color: #cbd5e1;
  192. }
  193. .dark .time-slot-item:hover {
  194. border-color: #64748b;
  195. }
  196. /* Info box dark mode */
  197. .dark .bg-blue-50 {
  198. background-color: #1e3a8a;
  199. }
  200. .dark .border-blue-200 {
  201. border-color: #1e40af;
  202. }
  203. .dark .text-blue-600 {
  204. color: #60a5fa;
  205. }
  206. .dark .text-blue-800 {
  207. color: #dbeafe;
  208. }
  209. .dark .text-blue-700 {
  210. color: #bfdbfe;
  211. }
  212. {% endblock %}
  213. {% block content %}
  214. <div class="layout-content-container flex flex-col w-full max-w-4xl gap-8 pt-2 pb-[75px]">
  215. <div
  216. class="flex flex-wrap justify-between items-center p-4 bg-white rounded-xl shadow-sm mt-2 sm:mt-8"
  217. >
  218. <h1
  219. class="text-slate-900 tracking-tight text-2xl sm:text-3xl font-bold leading-tight"
  220. >
  221. Settings
  222. </h1>
  223. </div>
  224. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  225. <h2
  226. 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"
  227. >
  228. Device Connection
  229. </h2>
  230. <div class="divide-y divide-slate-100">
  231. <div
  232. class="flex items-center gap-4 px-6 py-5 hover:bg-slate-50 transition-colors"
  233. >
  234. <div
  235. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  236. >
  237. <span class="material-icons text-3xl">usb_off</span>
  238. </div>
  239. <div class="flex-1">
  240. <p class="text-slate-800 text-base font-medium leading-normal">
  241. Status
  242. </p>
  243. <p
  244. id="serialStatus"
  245. class="text-red-500 text-sm font-medium leading-normal"
  246. >
  247. Disconnected
  248. </p>
  249. </div>
  250. <button
  251. id="disconnectButton"
  252. 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"
  253. hidden
  254. >
  255. Disconnect
  256. </button>
  257. </div>
  258. <div id="portSelectionDiv" class="px-6 py-5 space-y-4">
  259. <label class="flex flex-col gap-1.5">
  260. <span class="text-slate-700 text-sm font-medium leading-normal"
  261. >Available Serial Ports</span
  262. >
  263. <div class="flex gap-3 items-center">
  264. <select
  265. id="portSelect"
  266. 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 "
  267. >
  268. <option value="">Select a port...</option>
  269. </select>
  270. <button
  271. id="connectButton"
  272. 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"
  273. >
  274. <span class="material-icons text-lg">cable</span>
  275. <span class="truncate">Connect</span>
  276. </button>
  277. </div>
  278. <p class="text-xs text-slate-500 mt-2">
  279. Select a port and click 'Connect' to establish a connection.
  280. </p>
  281. </label>
  282. </div>
  283. </div>
  284. </section>
  285. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  286. <h2
  287. 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"
  288. >
  289. Desert Compass
  290. </h2>
  291. <div class="px-6 py-5 space-y-6">
  292. <div class="flex items-center justify-between">
  293. <div class="flex-1">
  294. <h3 class="text-slate-700 text-base font-medium leading-normal flex items-center gap-2">
  295. <span class="material-icons text-slate-600">explore</span>
  296. Enable Desert Compass (Raspberry Pi Only)
  297. </h3>
  298. <p class="text-xs text-slate-500 mt-1">
  299. Use a reed switch and magnet to establish a precise angular reference point for the table's rotation.
  300. </p>
  301. </div>
  302. <label class="switch">
  303. <input type="checkbox" id="angularHomingToggle">
  304. <span class="slider round"></span>
  305. </label>
  306. </div>
  307. <!-- GPIO Pin Selection (shown when Desert Compass is enabled) -->
  308. <div id="gpioSelectionContainer" class="space-y-2" style="display: none;">
  309. <label for="gpioInput" class="text-sm font-medium text-slate-700 flex items-center gap-2">
  310. <span class="material-icons text-slate-600 text-base">settings_input_component</span>
  311. Reed Switch GPIO Pin
  312. </label>
  313. <input
  314. type="number"
  315. id="gpioInput"
  316. min="2"
  317. max="27"
  318. step="1"
  319. value="18"
  320. class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500 text-sm"
  321. placeholder="18"
  322. />
  323. <p class="text-xs text-slate-500">
  324. GPIO pin number (BCM numbering) where the reed switch is connected. Common pins: 17, 18, 22, 23, 24, 25, 27.
  325. </p>
  326. </div>
  327. <!-- Invert State Toggle (shown when Desert Compass is enabled) -->
  328. <div id="invertStateContainer" class="space-y-2" style="display: none;">
  329. <div class="flex items-center justify-between p-3 bg-slate-50 rounded-lg">
  330. <div class="flex-1">
  331. <label for="invertStateToggle" class="text-sm font-medium text-slate-700 flex items-center gap-2 cursor-pointer">
  332. <span class="material-icons text-slate-600 text-base">swap_vert</span>
  333. Invert Sensor Logic
  334. </label>
  335. <p class="text-xs text-slate-500 mt-1">
  336. Enable if your reed switch is triggered when LOW instead of HIGH (normally closed configuration).
  337. </p>
  338. </div>
  339. <label class="switch">
  340. <input type="checkbox" id="invertStateToggle">
  341. <span class="slider round"></span>
  342. </label>
  343. </div>
  344. </div>
  345. <!-- Compass Calibration (shown when Desert Compass is enabled) -->
  346. <div id="angularOffsetContainer" class="space-y-2" style="display: none;">
  347. <label for="angularOffsetInput" class="text-sm font-medium text-slate-700 flex items-center gap-2">
  348. <span class="material-icons text-slate-600 text-base">straighten</span>
  349. Compass Reference Point (degrees)
  350. </label>
  351. <input
  352. type="number"
  353. id="angularOffsetInput"
  354. min="0"
  355. max="360"
  356. step="0.1"
  357. value="0"
  358. class="w-full px-3 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-sky-500 focus:border-sky-500 text-sm"
  359. placeholder="0.0"
  360. />
  361. <p class="text-xs text-slate-500">
  362. Set the angle (in degrees) where your magnet/sensor is physically mounted. 0° = East, increases clockwise (90° = South, 180° = West, 270° = North).
  363. </p>
  364. </div>
  365. <div id="angularHomingInfo" class="text-xs text-slate-600 bg-blue-50 border border-blue-200 rounded-lg p-3" style="display: none;">
  366. <div class="flex items-start gap-2">
  367. <span class="material-icons text-blue-600 text-base">info</span>
  368. <div>
  369. <p class="font-medium text-blue-800">How Desert Compass Works:</p>
  370. <ul class="mt-1 space-y-1 text-blue-700">
  371. <li>• After radial calibration, the arm moves to the table's edge</li>
  372. <li>• The table rotates until the magnet triggers the reed switch</li>
  373. <li>• This position becomes the angular reference point based on your compass setting</li>
  374. <li>• Requires Raspberry Pi with reed switch connected to selected GPIO pin</li>
  375. <li>• Standard wiring: Reed switch to 3.3V (triggered = HIGH)</li>
  376. <li>• Inverted wiring: Reed switch to ground (triggered = LOW)</li>
  377. <li>• Uses BCM GPIO numbering (not physical pin numbers)</li>
  378. </ul>
  379. </div>
  380. </div>
  381. </div>
  382. <div class="flex justify-end">
  383. <button
  384. id="saveHomingConfig"
  385. 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"
  386. >
  387. <span class="material-icons text-lg">save</span>
  388. <span class="truncate">Save Compass Config</span>
  389. </button>
  390. </div>
  391. </div>
  392. </section>
  393. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  394. <h2
  395. 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"
  396. >
  397. Application Settings
  398. </h2>
  399. <div class="px-6 py-5 space-y-6">
  400. <label class="flex flex-col gap-1.5">
  401. <span class="text-slate-700 text-sm font-medium leading-normal"
  402. >Application Name</span
  403. >
  404. <div class="flex gap-3 items-center">
  405. <div class="relative flex-1">
  406. <input
  407. id="appNameInput"
  408. 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"
  409. placeholder="e.g., Dune Weaver"
  410. value="Dune Weaver"
  411. />
  412. <button
  413. type="button"
  414. onclick="document.getElementById('appNameInput').value='Dune Weaver';"
  415. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  416. aria-label="Reset to default"
  417. title="Reset to default"
  418. >
  419. <span class="material-icons">restart_alt</span>
  420. </button>
  421. </div>
  422. <button
  423. id="saveAppName"
  424. 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"
  425. >
  426. <span class="material-icons text-lg">save</span>
  427. <span class="truncate">Save Name</span>
  428. </button>
  429. </div>
  430. <p class="text-xs text-slate-500 mt-2">
  431. This name will appear in the browser tab and at the top of every page.
  432. </p>
  433. </label>
  434. </div>
  435. </section>
  436. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  437. <h2
  438. 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"
  439. >
  440. Pattern Clearing
  441. </h2>
  442. <div class="px-6 py-5 space-y-6">
  443. <p class="text-sm text-slate-600">
  444. Customize the clearing behavior used when transitioning between patterns. Set custom patterns and speed to control how sand is distributed.
  445. </p>
  446. <!-- Clearing Speed Section -->
  447. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  448. <h3 class="text-slate-800 text-base font-semibold">Clearing Speed</h3>
  449. <p class="text-sm text-slate-600">
  450. Set a custom speed for clearing patterns. Leave empty to use the default pattern speed. This allows clearing patterns to run at a different speed than regular patterns.
  451. </p>
  452. <div class="flex flex-col gap-1.5">
  453. <label for="clearPatternSpeedInput" class="text-slate-700 text-sm font-medium leading-normal">
  454. Speed (steps per minute)
  455. </label>
  456. <div class="flex gap-3 items-center">
  457. <input
  458. id="clearPatternSpeedInput"
  459. type="number"
  460. min="50"
  461. max="2000"
  462. step="50"
  463. 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"
  464. placeholder="Default (use pattern speed)"
  465. value=""
  466. />
  467. <button
  468. id="saveClearSpeed"
  469. 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"
  470. >
  471. <span class="material-icons text-lg">save</span>
  472. <span class="truncate">Save Speed</span>
  473. </button>
  474. </div>
  475. <div id="effectiveClearSpeed" class="text-xs text-slate-500 mt-1"></div>
  476. </div>
  477. </div>
  478. <!-- Custom Patterns Section -->
  479. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  480. <h3 class="text-slate-800 text-base font-semibold">Custom Clear Patterns</h3>
  481. <p class="text-sm text-slate-600">
  482. Choose specific patterns to use when clearing. Leave empty to use the default clearing behavior.
  483. </p>
  484. <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
  485. <div class="flex flex-col gap-1.5">
  486. <label for="customClearFromInInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Center Pattern</label>
  487. <div class="relative">
  488. <input
  489. id="customClearFromInInput"
  490. type="text"
  491. 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"
  492. placeholder="Type to search patterns or leave empty for default"
  493. autocomplete="off"
  494. />
  495. <button
  496. type="button"
  497. id="clearFromInClear"
  498. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  499. aria-label="Clear selection"
  500. title="Clear selection"
  501. >
  502. <span class="material-icons text-xl">close</span>
  503. </button>
  504. <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>
  505. </div>
  506. <p class="text-xs text-slate-500 mt-1">
  507. Pattern to use when clearing from the center outward.
  508. </p>
  509. </div>
  510. <div class="flex flex-col gap-1.5">
  511. <label for="customClearFromOutInput" class="text-slate-700 text-sm font-medium leading-normal">Clear From Perimeter Pattern</label>
  512. <div class="relative">
  513. <input
  514. id="customClearFromOutInput"
  515. type="text"
  516. 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"
  517. placeholder="Type to search patterns or leave empty for default"
  518. autocomplete="off"
  519. />
  520. <button
  521. type="button"
  522. id="clearFromOutClear"
  523. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 hidden"
  524. aria-label="Clear selection"
  525. title="Clear selection"
  526. >
  527. <span class="material-icons text-xl">close</span>
  528. </button>
  529. <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>
  530. </div>
  531. <p class="text-xs text-slate-500 mt-1">
  532. Pattern to use when clearing from the perimeter inward.
  533. </p>
  534. </div>
  535. </div>
  536. <div class="flex justify-end">
  537. <button
  538. id="saveClearPatterns"
  539. 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"
  540. >
  541. <span class="material-icons text-lg">save</span>
  542. <span class="truncate">Save Patterns</span>
  543. </button>
  544. </div>
  545. </div>
  546. </div>
  547. </section>
  548. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  549. <h2
  550. 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"
  551. >
  552. WLED Configuration
  553. </h2>
  554. <div class="px-6 py-5 space-y-6">
  555. <label class="flex flex-col gap-1.5">
  556. <span class="text-slate-700 text-sm font-medium leading-normal"
  557. >IP Address</span
  558. >
  559. <div class="flex gap-3 items-center">
  560. <div class="relative flex-1">
  561. <input
  562. id="wledIpInput"
  563. 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"
  564. placeholder="e.g., 192.168.1.100"
  565. value=""
  566. />
  567. <button
  568. type="button"
  569. onclick="document.getElementById('wledIpInput').value='';"
  570. class="absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700"
  571. aria-label="Clear WLED IP"
  572. >
  573. <span class="material-icons">close</span>
  574. </button>
  575. </div>
  576. <button
  577. id="saveWledConfig"
  578. 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"
  579. >
  580. <span class="material-icons text-lg">save</span>
  581. <span class="truncate">Save Configuration</span>
  582. </button>
  583. </div>
  584. <p class="text-xs text-slate-500 mt-2">
  585. Enter the IP address of your WLED controller.
  586. </p>
  587. </label>
  588. </div>
  589. </section>
  590. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  591. <h2
  592. 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"
  593. >
  594. Auto-play on Boot
  595. </h2>
  596. <div class="px-6 py-5 space-y-6">
  597. <div class="flex items-center justify-between">
  598. <div class="flex-1">
  599. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Auto-play on Boot</h3>
  600. <p class="text-xs text-slate-500 mt-1">
  601. Automatically start playing a selected playlist when the system boots up.
  602. </p>
  603. </div>
  604. <label class="switch">
  605. <input type="checkbox" id="auto_playModeToggle">
  606. <span class="slider round"></span>
  607. </label>
  608. </div>
  609. <div id="auto_playSettings" class="space-y-4" style="display: none;">
  610. <label class="flex flex-col gap-1.5">
  611. <span class="text-slate-700 text-sm font-medium leading-normal">Startup Playlist</span>
  612. <select
  613. id="auto_playPlaylistSelect"
  614. 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"
  615. >
  616. <option value="">Select a playlist...</option>
  617. </select>
  618. <p class="text-xs text-slate-500 mt-1">
  619. Choose which playlist to automatically play when the system starts.
  620. </p>
  621. </label>
  622. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  623. <label class="flex flex-col gap-1.5">
  624. <span class="text-slate-700 text-sm font-medium leading-normal">Run Mode</span>
  625. <select
  626. id="auto_playRunModeSelect"
  627. class="form-select 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"
  628. >
  629. <option value="single">Single (play once)</option>
  630. <option value="loop">Loop (repeat forever)</option>
  631. </select>
  632. <p class="text-xs text-slate-500 mt-1">
  633. How to run the playlist when it finishes.
  634. </p>
  635. </label>
  636. <label class="flex flex-col gap-1.5">
  637. <span class="text-slate-700 text-sm font-medium leading-normal">Pause Between Patterns (seconds)</span>
  638. <input
  639. id="auto_playPauseTimeInput"
  640. type="number"
  641. min="0"
  642. step="0.5"
  643. class="form-input 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"
  644. placeholder="5.0"
  645. />
  646. <p class="text-xs text-slate-500 mt-1">
  647. Time to wait between each pattern (0 or more seconds).
  648. </p>
  649. </label>
  650. </div>
  651. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  652. <label class="flex flex-col gap-1.5">
  653. <span class="text-slate-700 text-sm font-medium leading-normal">Clear Pattern</span>
  654. <select
  655. id="auto_playClearPatternSelect"
  656. class="form-select 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"
  657. >
  658. <option value="none">None</option>
  659. <option value="adaptive">Adaptive</option>
  660. <option value="clear_from_in">Clear From Center</option>
  661. <option value="clear_from_out">Clear From Perimeter</option>
  662. <option value="clear_sideway">Clear Sideway</option>
  663. <option value="random">Random</option>
  664. </select>
  665. <p class="text-xs text-slate-500 mt-1">
  666. Pattern to run before each main pattern.
  667. </p>
  668. </label>
  669. <div class="flex items-center justify-between">
  670. <div class="flex-1">
  671. <h4 class="text-slate-700 text-sm font-medium leading-normal">Shuffle Playlist</h4>
  672. <p class="text-xs text-slate-500 mt-1">
  673. Randomize the order of patterns in the playlist.
  674. </p>
  675. </div>
  676. <label class="switch">
  677. <input type="checkbox" id="auto_playShuffleToggle">
  678. <span class="slider round"></span>
  679. </label>
  680. </div>
  681. </div>
  682. </div>
  683. </div>
  684. </section>
  685. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  686. <h2
  687. 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"
  688. >
  689. Still Sands
  690. </h2>
  691. <div class="px-6 py-5 space-y-6">
  692. <div class="flex items-center justify-between">
  693. <div class="flex-1">
  694. <h3 class="text-slate-700 text-base font-medium leading-normal">Enable Still Sands</h3>
  695. <p class="text-xs text-slate-500 mt-1">
  696. Automatically bring the sands to rest during specified time periods.
  697. </p>
  698. </div>
  699. <label class="switch">
  700. <input type="checkbox" id="scheduledPauseToggle">
  701. <span class="slider round"></span>
  702. </label>
  703. </div>
  704. <div id="scheduledPauseSettings" class="space-y-4" style="display: none;">
  705. <!-- WLED Control Option -->
  706. <div class="bg-amber-50 rounded-lg p-4 border border-amber-200">
  707. <div class="flex items-center justify-between">
  708. <div class="flex-1">
  709. <h4 class="text-slate-800 text-sm font-medium flex items-center gap-2">
  710. <span class="material-icons text-amber-600 text-base">lightbulb</span>
  711. Control WLED Lights
  712. </h4>
  713. <p class="text-xs text-slate-600 mt-1">
  714. Turn off WLED lights during still periods for complete rest
  715. </p>
  716. </div>
  717. <label class="switch">
  718. <input type="checkbox" id="stillSandsWledControl">
  719. <span class="slider round"></span>
  720. </label>
  721. </div>
  722. </div>
  723. <div class="bg-slate-50 rounded-lg p-4 space-y-4">
  724. <div class="flex items-center justify-between">
  725. <h4 class="text-slate-800 text-base font-semibold">Still Periods</h4>
  726. <button
  727. id="addTimeSlotButton"
  728. class="flex items-center justify-center gap-2 cursor-pointer rounded-lg h-9 px-3 bg-sky-600 hover:bg-sky-700 text-white text-xs font-medium leading-normal tracking-[0.015em] transition-colors"
  729. >
  730. <span class="material-icons text-base">add</span>
  731. <span>Add Still Period</span>
  732. </button>
  733. </div>
  734. <p class="text-sm text-slate-600">
  735. Define time periods when the sands should rest in stillness. Patterns will resume automatically when still periods end.
  736. </p>
  737. <div id="timeSlotsContainer" class="space-y-3">
  738. <!-- Time slots will be dynamically added here -->
  739. </div>
  740. <div class="text-xs text-slate-500 bg-blue-50 border border-blue-200 rounded-lg p-3">
  741. <div class="flex items-start gap-2">
  742. <span class="material-icons text-blue-600 text-base">info</span>
  743. <div>
  744. <p class="font-medium text-blue-800">Important Notes:</p>
  745. <ul class="mt-1 space-y-1 text-blue-700">
  746. <li>• Times are based on your system's local time zone</li>
  747. <li>• Currently running patterns will pause immediately when entering a still period</li>
  748. <li>• Patterns will resume automatically when exiting a still period</li>
  749. <li>• Still periods that span midnight (e.g., 22:00 to 06:00) are supported</li>
  750. </ul>
  751. </div>
  752. </div>
  753. </div>
  754. </div>
  755. <div class="flex justify-end">
  756. <button
  757. id="savePauseSettings"
  758. 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"
  759. >
  760. <span class="material-icons text-lg">save</span>
  761. <span class="truncate">Save Still Sands</span>
  762. </button>
  763. </div>
  764. </div>
  765. </div>
  766. </section>
  767. <section class="bg-white rounded-xl shadow-sm overflow-hidden">
  768. <h2
  769. 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"
  770. >
  771. Software Version
  772. </h2>
  773. <div class="divide-y divide-slate-100">
  774. <div class="flex items-center gap-4 px-6 py-5">
  775. <div
  776. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  777. >
  778. <span class="material-icons text-3xl">terminal</span>
  779. </div>
  780. <div class="flex-1">
  781. <p class="text-slate-800 text-base font-medium leading-normal">
  782. Current Version
  783. </p>
  784. <p id="currentVersionText" class="text-slate-500 text-sm font-normal leading-normal">Loading...</p>
  785. </div>
  786. </div>
  787. <div class="flex items-center gap-4 px-6 py-5">
  788. <div
  789. class="text-slate-600 flex items-center justify-center rounded-lg bg-slate-100 shrink-0 size-12"
  790. >
  791. <span class="material-icons text-3xl">system_update</span>
  792. </div>
  793. <div class="flex-1">
  794. <p class="text-slate-800 text-base font-medium leading-normal">
  795. Latest Version
  796. </p>
  797. <p id="latestVersionText" class="text-slate-500 text-sm font-normal leading-normal">Checking...</p>
  798. </div>
  799. <button
  800. id="updateSoftware"
  801. 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"
  802. disabled
  803. >
  804. <span id="updateIcon" class="material-icons text-base">download</span>
  805. <span id="updateText" class="truncate">Update</span>
  806. </button>
  807. </div>
  808. </div>
  809. </section>
  810. </div>
  811. {% endblock %} {% block scripts %}
  812. <script src="/static/js/settings.js"></script>
  813. {% endblock %}