Remove name field from capture flow
change
commit fb9fe6325cb7095787ee835a89b4ceb246f80a19
author Alpha Chen <alpha@kejadlen.dev>
date
parent cfcedc87
diff --git a/lib/views/capture.rb b/lib/views/capture.rb
index eebe99f..37b997e 100644
--- a/lib/views/capture.rb
+++ b/lib/views/capture.rb
@@ -10,13 +10,11 @@ module Domus
           return {
             state: 'capture',
             preview: null,
-            name: '',
             dragging: false,
 
             handleFile(file) {
               if (!file) return;
               this.preview = file.type.startsWith('image/') ? URL.createObjectURL(file) : null;
-              this.name = file.name.replace(/\\.[^.]+$/, '').replace(/[-_]/g, ' ');
               this.state = 'saved';
             },
 
@@ -37,7 +35,6 @@ module Domus
               if (this.preview) URL.revokeObjectURL(this.preview);
               this.state = 'capture';
               this.preview = null;
-              this.name = '';
               this.$refs.fileInput.value = '';
               this.$refs.cameraInput.value = '';
             }
@@ -162,20 +159,6 @@ module Domus
               end
 
               div(class: "save-form") do
-                div(class: "field") do
-                  label(class: "field-label", for: "doc-name") { plain "name" }
-                  input(
-                    type: "text",
-                    id: "doc-name",
-                    name: "name",
-                    class: "field-input",
-                    "x-model": "name",
-                    placeholder: "Document name",
-                    required: true,
-                    "x-effect": "if (state === 'saved') $nextTick(() => $el.focus())"
-                  )
-                end
-
                 div(class: "btn-row") do
                   button(type: "submit", class: "btn btn-primary") do
                     check_icon
diff --git a/lib/web.rb b/lib/web.rb
index ab8a782..a0861d6 100644
--- a/lib/web.rb
+++ b/lib/web.rb
@@ -41,9 +41,6 @@ module Domus
       upload = params["file"]
       return unless upload.is_a?(Hash) && upload[:tempfile]
 
-      name = params["name"].to_s.strip
-      name = upload[:filename].to_s.gsub(/\.[^.]+$/, "").gsub(/[-_]/, " ").strip if name.empty?
-
       ext = File.extname(upload[:filename].to_s)
       filename = "#{Time.now.strftime("%Y%m%d%H%M%S%L")}#{ext}"
       dest_dir = File.join(storage_path, "documents")
@@ -55,7 +52,6 @@ module Domus
       db[:documents].insert(
         path: File.join("documents", filename),
         kind: upload[:type].to_s,
-        name: name,
         received_at: now,
         created_at: now
       )
diff --git a/public/app.css b/public/app.css
index b4813d8..e886773 100644
--- a/public/app.css
+++ b/public/app.css
@@ -226,38 +226,6 @@ html, body {
   gap: var(--space-m);
 }
 
-.field {
-  display: flex;
-  flex-direction: column;
-  gap: var(--space-3xs);
-}
-
-.field-label {
-  font-family: var(--font-mono);
-  font-size: var(--step--2);
-  letter-spacing: 0.06em;
-  text-transform: uppercase;
-  color: var(--ink-2);
-}
-
-.field-input {
-  border: 1px solid var(--line-2);
-  border-radius: calc(var(--radius) - 3px);
-  background: var(--surface);
-  padding: var(--space-xs) var(--space-s);
-  font-family: var(--font-ui);
-  font-size: var(--step-0);
-  color: var(--ink);
-  width: 100%;
-  transition: border-color .15s ease, box-shadow .15s ease;
-  outline: none;
-}
-
-.field-input:focus {
-  border-color: var(--accent);
-  box-shadow: 0 0 0 3px var(--accent-soft);
-}
-
 .btn-row {
   display: flex;
   align-items: center;