about summary refs log tree commit diff
path: root/corp/rih
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-06-02T14·03+0300
committertazjin <tazjin@tvl.su>2023-06-06T11·43+0000
commit20a671036586088578952f4958440f246decb06e (patch)
tree3ea4bfd3ad8bc4a6ca78989cd63d49ab3efbba1a /corp/rih
parent138f1ca1b90a1b0a3d1c703246c8eb8f9ff8b31a (diff)
feat(corp/rih): activate submit button when data is complete r/6235
The completion detection is very naive for now, but baby steps etc.

Change-Id: Iec6eae77fca13f3fc0ee1225268eef04277b504a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8702
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'corp/rih')
-rw-r--r--corp/rih/src/home.html5
-rw-r--r--corp/rih/src/main.rs10
2 files changed, 14 insertions, 1 deletions
diff --git a/corp/rih/src/home.html b/corp/rih/src/home.html
index 7f1ff5f332a2..df77ee1e8820 100644
--- a/corp/rih/src/home.html
+++ b/corp/rih/src/home.html
@@ -171,7 +171,10 @@ html! {
 
           <div id="captcha-container" class="smart-captcha mb-3" style="height: 100px" />
 
-          <button type="submit" class="btn btn-primary" disabled=true>{"Submit"}</button>
+          <button type="submit" class="btn btn-primary"
+                  disabled={!(self.record.is_complete() && self.captcha_token.is_some())}>
+            {"Submit"}
+          </button>
           <p class="pt-2"><i>{"This page is still under construction! Please reach out at contact@ if you have any questions."}</i></p>
         </form>
       </div>
diff --git a/corp/rih/src/main.rs b/corp/rih/src/main.rs
index a419e2d9bfc8..02cb350d1acb 100644
--- a/corp/rih/src/main.rs
+++ b/corp/rih/src/main.rs
@@ -98,6 +98,16 @@ struct Record {
     work_background: String,
 }
 
+impl Record {
+    fn is_complete(&self) -> bool {
+        !self.name.is_empty()
+            && !self.email.is_empty()
+            && !self.citizenship.is_empty()
+            && !self.position.is_empty()
+            && !self.technologies.is_empty()
+    }
+}
+
 struct App {
     // The record being populated.
     record: Record,