design.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. {% extends "base.html" %}
  2. {% block title %}Design - Kinetic Sand Table{% endblock %}
  3. {% block additional_styles %}
  4. .design-canvas {
  5. background-color: #f8fafc;
  6. background-image: linear-gradient(#e2e8f0 1px, transparent 1px),
  7. linear-gradient(90deg, #e2e8f0 1px, transparent 1px);
  8. background-size: 20px 20px;
  9. }
  10. .design-canvas.drawing {
  11. cursor: crosshair;
  12. }
  13. .design-canvas.moving {
  14. cursor: grab;
  15. }
  16. .design-canvas.moving:active {
  17. cursor: grabbing;
  18. }
  19. {% endblock %}
  20. {% block content %}
  21. <div class="layout-content-container flex flex-col w-full max-w-7xl gap-8">
  22. <div class="flex flex-wrap justify-between items-center gap-4 p-4 bg-white rounded-xl shadow-sm">
  23. <h1 class="text-slate-900 tracking-tight text-2xl sm:text-3xl font-bold leading-tight">
  24. Design
  25. </h1>
  26. <div class="flex items-center gap-3">
  27. <button
  28. id="undoButton"
  29. class="flex items-center justify-center rounded-lg h-10 px-4 bg-slate-100 hover:bg-slate-200 text-slate-700 transition-colors"
  30. disabled
  31. >
  32. <span class="material-icons text-xl">undo</span>
  33. </button>
  34. <button
  35. id="redoButton"
  36. class="flex items-center justify-center rounded-lg h-10 px-4 bg-slate-100 hover:bg-slate-200 text-slate-700 transition-colors"
  37. disabled
  38. >
  39. <span class="material-icons text-xl">redo</span>
  40. </button>
  41. <button
  42. id="clearButton"
  43. class="flex items-center justify-center rounded-lg h-10 px-4 bg-slate-100 hover:bg-slate-200 text-slate-700 transition-colors"
  44. >
  45. <span class="material-icons text-xl">delete</span>
  46. </button>
  47. </div>
  48. </div>
  49. <div class="flex flex-col lg:flex-row gap-8">
  50. <div class="flex-1">
  51. <div class="bg-white rounded-xl shadow-sm overflow-hidden">
  52. <div class="p-4 border-b border-slate-200">
  53. <div class="flex items-center justify-between">
  54. <h2 class="text-slate-800 text-xl font-semibold leading-tight tracking-[-0.01em]">
  55. Canvas
  56. </h2>
  57. <div class="flex items-center gap-2">
  58. <button
  59. id="zoomOutButton"
  60. class="flex items-center justify-center rounded-lg h-9 px-3 bg-slate-100 hover:bg-slate-200 text-slate-700 transition-colors"
  61. >
  62. <span class="material-icons text-xl">remove</span>
  63. </button>
  64. <span id="zoomLevel" class="text-slate-700 text-sm font-medium">100%</span>
  65. <button
  66. id="zoomInButton"
  67. class="flex items-center justify-center rounded-lg h-9 px-3 bg-slate-100 hover:bg-slate-200 text-slate-700 transition-colors"
  68. >
  69. <span class="material-icons text-xl">add</span>
  70. </button>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="p-4">
  75. <div class="relative aspect-square w-full overflow-hidden rounded-lg border border-slate-200">
  76. <canvas
  77. id="designCanvas"
  78. class="design-canvas absolute inset-0 size-full"
  79. width="1000"
  80. height="1000"
  81. ></canvas>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="w-full lg:w-80">
  87. <div class="bg-white rounded-xl shadow-sm overflow-hidden">
  88. <div class="p-4 border-b border-slate-200">
  89. <h2 class="text-slate-800 text-xl font-semibold leading-tight tracking-[-0.01em]">
  90. Tools
  91. </h2>
  92. </div>
  93. <div class="p-4 space-y-4">
  94. <div class="space-y-2">
  95. <label class="text-slate-700 text-sm font-medium leading-normal">Mode</label>
  96. <div class="grid grid-cols-2 gap-2">
  97. <label class="group relative flex cursor-pointer items-center justify-center rounded-lg border border-slate-300 p-2 text-center text-sm font-medium text-slate-700 transition-all hover:border-sky-500 has-[:checked]:border-sky-500 has-[:checked]:bg-sky-500 has-[:checked]:text-white has-[:checked]:ring-2 has-[:checked]:ring-sky-500 has-[:checked]:ring-offset-2">
  98. Draw
  99. <input checked class="peer sr-only" name="mode" type="radio" value="draw" />
  100. </label>
  101. <label class="group relative flex cursor-pointer items-center justify-center rounded-lg border border-slate-300 p-2 text-center text-sm font-medium text-slate-700 transition-all hover:border-sky-500 has-[:checked]:border-sky-500 has-[:checked]:bg-sky-500 has-[:checked]:text-white has-[:checked]:ring-2 has-[:checked]:ring-sky-500 has-[:checked]:ring-offset-2">
  102. Move
  103. <input class="peer sr-only" name="mode" type="radio" value="move" />
  104. </label>
  105. </div>
  106. </div>
  107. <div class="space-y-2">
  108. <label class="text-slate-700 text-sm font-medium leading-normal">Brush Size</label>
  109. <input
  110. id="brushSizeInput"
  111. class="form-range w-full h-2 bg-slate-200 rounded-lg appearance-none cursor-pointer"
  112. type="range"
  113. min="1"
  114. max="50"
  115. value="5"
  116. />
  117. <div class="flex justify-between text-xs text-slate-500">
  118. <span>1px</span>
  119. <span>50px</span>
  120. </div>
  121. </div>
  122. <div class="space-y-2">
  123. <label class="text-slate-700 text-sm font-medium leading-normal">Color</label>
  124. <div class="grid grid-cols-4 gap-2">
  125. <button
  126. class="size-8 rounded-full bg-black border-2 border-slate-300 hover:border-slate-400 transition-colors"
  127. data-color="#000000"
  128. ></button>
  129. <button
  130. class="size-8 rounded-full bg-white border-2 border-slate-300 hover:border-slate-400 transition-colors"
  131. data-color="#ffffff"
  132. ></button>
  133. <button
  134. class="size-8 rounded-full bg-red-500 border-2 border-slate-300 hover:border-slate-400 transition-colors"
  135. data-color="#ef4444"
  136. ></button>
  137. <button
  138. class="size-8 rounded-full bg-blue-500 border-2 border-slate-300 hover:border-slate-400 transition-colors"
  139. data-color="#3b82f6"
  140. ></button>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <div class="mt-8 bg-white rounded-xl shadow-sm overflow-hidden">
  146. <div class="p-4 border-b border-slate-200">
  147. <h2 class="text-slate-800 text-xl font-semibold leading-tight tracking-[-0.01em]">
  148. Actions
  149. </h2>
  150. </div>
  151. <div class="p-4 space-y-4">
  152. <button
  153. id="saveButton"
  154. class="flex w-full items-center justify-center gap-2 rounded-lg bg-sky-600 hover:bg-sky-700 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors h-10 px-4"
  155. >
  156. <span class="material-icons text-lg">save</span>
  157. <span class="truncate">Save Design</span>
  158. </button>
  159. <button
  160. id="playButton"
  161. class="flex w-full items-center justify-center gap-2 rounded-lg bg-emerald-500 hover:bg-emerald-600 text-white text-sm font-medium leading-normal tracking-[0.015em] transition-colors h-10 px-4"
  162. >
  163. <span class="material-icons text-lg">play_arrow</span>
  164. <span class="truncate">Play Design</span>
  165. </button>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. {% endblock %}
  172. {% block scripts %}
  173. <script src="/static/js/design.js"></script>
  174. {% endblock %}