95 lines
5.0 KiB
Plaintext
95 lines
5.0 KiB
Plaintext
<%- include('../partials/head', { title: 'Upload Model' }) %>
|
|
<%- include('../partials/adminNav', { currentPath: '/admin/upload' }) %>
|
|
<%- include('../partials/adminTopBar') %>
|
|
|
|
<div class="lg:pl-56 pt-14 lg:pt-0 min-h-screen">
|
|
<%- include('../partials/adminBanner') %>
|
|
<div class="max-w-2xl mx-auto px-4 sm:px-8 py-6 sm:py-8">
|
|
<div class="mb-8">
|
|
<h1 class="text-xl font-semibold text-white">Upload Model</h1>
|
|
<p class="text-sm text-gray-500 mt-0.5">Supported formats: STEP, STP, STL</p>
|
|
</div>
|
|
|
|
<% if (error) { %>
|
|
<div class="mb-6 flex items-start gap-3 bg-red-500/10 border border-red-500/30 rounded-lg px-4 py-3">
|
|
<svg class="w-4 h-4 text-red-400 mt-0.5 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" />
|
|
</svg>
|
|
<p class="text-sm text-red-400"><%= error %></p>
|
|
</div>
|
|
<% } %>
|
|
|
|
<form method="POST" action="/admin/models" enctype="multipart/form-data" class="space-y-6">
|
|
|
|
<!-- Drop zone -->
|
|
<div id="drop-zone" class="border-2 border-dashed border-gray-700 hover:border-accent rounded-2xl p-12 text-center transition-colors cursor-pointer">
|
|
<svg class="w-10 h-10 text-gray-600 mx-auto mb-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5" />
|
|
</svg>
|
|
<p class="text-sm text-gray-400">Drop a <span class="text-white font-medium">.STEP, .STP, or .STL</span> file here</p>
|
|
<p class="text-xs text-gray-600 mt-1">or</p>
|
|
<label class="mt-3 inline-block cursor-pointer">
|
|
<span class="text-sm text-accent underline">Browse files</span>
|
|
<input id="model_file" name="model_file" type="file" accept=".step,.stp,.stl" required class="hidden" />
|
|
</label>
|
|
<p id="file-name" class="text-xs text-gray-400 mt-3 hidden"></p>
|
|
</div>
|
|
|
|
<!-- Metadata -->
|
|
<div class="bg-surface-900 border border-gray-800 rounded-2xl p-6 space-y-5">
|
|
<div>
|
|
<label class="block text-xs font-medium text-gray-400 mb-1.5" for="name">Display Name <span class="text-red-400">*</span></label>
|
|
<input id="name" name="name" type="text" required
|
|
class="w-full bg-surface-800 border border-gray-700 rounded-lg px-3.5 py-2.5 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-accent transition-colors"
|
|
placeholder="e.g. Main Assembly v3"
|
|
/>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-xs font-medium text-gray-400 mb-1.5" for="description">Description</label>
|
|
<textarea id="description" name="description" rows="3"
|
|
class="w-full bg-surface-800 border border-gray-700 rounded-lg px-3.5 py-2.5 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-accent transition-colors resize-none"
|
|
placeholder="Optional notes about this model…"
|
|
></textarea>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-xs font-medium text-gray-400 mb-1.5" for="category_id">Category</label>
|
|
<select id="category_id" name="category_id"
|
|
class="w-full bg-surface-800 border border-gray-700 rounded-lg px-3 py-2.5 text-sm text-gray-300 focus:outline-none focus:border-accent transition-colors">
|
|
<option value="">Uncategorized</option>
|
|
<% categories.forEach(c => { %>
|
|
<option value="<%= c.id %>"><%= c.name %></option>
|
|
<% }) %>
|
|
</select>
|
|
</div>
|
|
<div class="flex items-end pb-0.5">
|
|
<label class="flex items-center gap-2.5 cursor-pointer">
|
|
<div class="relative">
|
|
<input id="is_public" name="is_public" type="checkbox" checked class="sr-only peer" />
|
|
<div class="w-9 h-5 bg-gray-700 rounded-full peer-checked:bg-accent transition-colors"></div>
|
|
<div class="absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform peer-checked:translate-x-4"></div>
|
|
</div>
|
|
<span class="text-sm text-gray-400">Make public</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex gap-3">
|
|
<button type="submit" class="btn-accent text-white rounded-lg px-6 py-2.5 text-sm font-medium transition-all">
|
|
Upload Model
|
|
</button>
|
|
<a href="/admin" class="bg-surface-800 hover:bg-surface-700 border border-gray-700 text-gray-300 rounded-lg px-6 py-2.5 text-sm font-medium transition-colors">
|
|
Cancel
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/admin.js"></script>
|
|
</body>
|
|
</html>
|