From 3730b09804ff6a7992451a2ffacb9e5f18551b37 Mon Sep 17 00:00:00 2001 From: "stan.donarise" Date: Sat, 29 Jun 2024 16:31:23 +0300 Subject: [PATCH 1/7] Update index.html --- app/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/index.html b/app/index.html index dfdb054..efcd8ed 100644 --- a/app/index.html +++ b/app/index.html @@ -6,7 +6,7 @@ - +
From b10257ab7618a04efc5b3808b285dc07fd603b24 Mon Sep 17 00:00:00 2001 From: "stan.donarise" Date: Sat, 29 Jun 2024 17:21:33 +0300 Subject: [PATCH 2/7] send user answer (post) --- app/app.view.tree | 4 ++-- app/app.view.ts | 23 +++++++++++++++++++++++ swipe/swipe.view.tree | 1 - swipe/swipe.view.ts | 2 -- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/app.view.tree b/app/app.view.tree index 167784b..faa13f4 100644 --- a/app/app.view.tree +++ b/app/app.view.tree @@ -4,7 +4,7 @@ $optimade_tmdne_app $mol_view plugins / <= Theme $mol_theme_auto auto / - <= update + <= update null rotating? false number_swiped? 0 number_prefetch? 0 @@ -66,6 +66,6 @@ $optimade_tmdne_app $mol_view loaded <= card_loaded* false why? <=> why*? \ pointer_holding? <=> card_holding? false - on_swiped <= update null + swiped_to? <=> swiped_to*? \ swipe_to_right => swipe_to_right* swipe_to_left => swipe_to_left* diff --git a/app/app.view.ts b/app/app.view.ts index 8aa640a..c3d78e7 100644 --- a/app/app.view.ts +++ b/app/app.view.ts @@ -120,6 +120,29 @@ namespace $.$$ { click_yes() { this.swipe_to_right( this.number() ) } + + @ $mol_mem_key + swiped_to( id: number, next?: string ) { + + const vote = next == 'left' ? 0 : next == 'right' ? 1 : undefined + if( vote !== undefined ) { + + this.$.$mol_wire_async( this.$.$mol_fetch ).success( 'https://crus.absolidix.com', { + method: 'post', + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify( { + id, comment: this.why( id ), vote + } ), + } ) + + this.update() + + } + + return next ?? '' + } } diff --git a/swipe/swipe.view.tree b/swipe/swipe.view.tree index b0ed24d..a0b06e9 100644 --- a/swipe/swipe.view.tree +++ b/swipe/swipe.view.tree @@ -13,7 +13,6 @@ $optimade_tmdne_swipe $mol_view swiped_to? \ swipe_to_right null swipe_to_left null - on_swiped null reset null x? 0 sub / diff --git a/swipe/swipe.view.ts b/swipe/swipe.view.ts index 4cf54ca..b79cd5d 100644 --- a/swipe/swipe.view.ts +++ b/swipe/swipe.view.ts @@ -44,14 +44,12 @@ namespace $.$$ { swipe_to_right() { this.transition( 'left 0.5s' ) this.swiped_to( 'right' ) - this.on_swiped() this.x( 300 ) } swipe_to_left() { this.transition( 'left 0.5s' ) this.swiped_to( 'left' ) - this.on_swiped() this.x( -300 ) } From beea8231c5dc9fb5c9ed697b94cc7ac4ffd7cd18 Mon Sep 17 00:00:00 2001 From: "stan.donarise" Date: Sat, 29 Jun 2024 17:23:35 +0300 Subject: [PATCH 3/7] Update swipe.view.ts --- swipe/swipe.view.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/swipe/swipe.view.ts b/swipe/swipe.view.ts index b79cd5d..5d9b94f 100644 --- a/swipe/swipe.view.ts +++ b/swipe/swipe.view.ts @@ -53,11 +53,6 @@ namespace $.$$ { this.x( -300 ) } - reset_hard() { - this.transition( '' ) - this.reset() - } - passed_left(): boolean { return this.x() < ( - this.left_threshold() ) } From ab2e0b8d20a1474603a8e0f73980e2bf1bb1bce3 Mon Sep 17 00:00:00 2001 From: "stan.donarise" Date: Sat, 29 Jun 2024 17:31:20 +0300 Subject: [PATCH 4/7] $optimade_tmdne_swipe: simplify --- swipe/swipe.view.tree | 4 +--- swipe/swipe.view.ts | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/swipe/swipe.view.tree b/swipe/swipe.view.tree index a0b06e9..432249d 100644 --- a/swipe/swipe.view.tree +++ b/swipe/swipe.view.tree @@ -8,12 +8,10 @@ $optimade_tmdne_swipe $mol_view right_threshold <= threshold 60 left_threshold <= threshold passed \ - passed_left false - passed_right false swiped_to? \ swipe_to_right null swipe_to_left null - reset null + move_to_middle null x? 0 sub / <= Float $mol_view diff --git a/swipe/swipe.view.ts b/swipe/swipe.view.ts index 5d9b94f..18e9d0f 100644 --- a/swipe/swipe.view.ts +++ b/swipe/swipe.view.ts @@ -28,14 +28,14 @@ namespace $.$$ { pointerup( next?: any ) { const speed = this.x() / ( (new $mol_time_moment).valueOf() - this.start_time! ) - if( this.passed_right() || speed > this.speed_threshold() ) this.swipe_to_right() - else if( this.passed_left() || speed < ( - this.speed_threshold() ) ) this.swipe_to_left() - else this.reset() + if( (this.passed() == 'right') || speed > this.speed_threshold() ) this.swipe_to_right() + else if( (this.passed() == 'left') || speed < ( - this.speed_threshold() ) ) this.swipe_to_left() + else this.move_to_middle() this.pointer_holding( false ) } - reset() { + move_to_middle() { this.transition( 'left 0.5s' ) this.swiped_to('') this.x( 0 ) @@ -53,17 +53,14 @@ namespace $.$$ { this.x( -300 ) } - passed_left(): boolean { - return this.x() < ( - this.left_threshold() ) - } + @ $mol_mem + passed(): string { + const x = this.x() - passed_right(): boolean { - return this.x() > this.right_threshold() - } + if( x < ( - this.left_threshold() ) ) return 'left' + if( x > this.right_threshold() ) return 'right' - passed(): string { - return this.passed_left() ? 'left' : - this.passed_right() ? 'right' : '' + return '' } } From d9dd8a8b90c95e18152af97a9ed5d7a66cc320d2 Mon Sep 17 00:00:00 2001 From: "stan.donarise" Date: Sat, 29 Jun 2024 17:36:54 +0300 Subject: [PATCH 5/7] $optimade_tmdne_app: update before post --- app/app.view.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/app.view.ts b/app/app.view.ts index c3d78e7..756251d 100644 --- a/app/app.view.ts +++ b/app/app.view.ts @@ -127,7 +127,9 @@ namespace $.$$ { const vote = next == 'left' ? 0 : next == 'right' ? 1 : undefined if( vote !== undefined ) { - this.$.$mol_wire_async( this.$.$mol_fetch ).success( 'https://crus.absolidix.com', { + this.update() + + this.$.$mol_fetch.success( 'https://crus.absolidix.com', { method: 'post', headers: { "Content-Type": "application/json", @@ -137,8 +139,6 @@ namespace $.$$ { } ), } ) - this.update() - } return next ?? '' From 2a53a8e6236a18bba3edae647a8ec99541f806ff Mon Sep 17 00:00:00 2001 From: Evgeny Blokhin Date: Sat, 29 Jun 2024 16:37:35 +0200 Subject: [PATCH 6/7] Polish styles and fix typo --- app/app.view.css.ts | 8 ++++++-- app/app.view.tree | 2 +- card/card.view.css.ts | 10 +++++----- card/card.view.tree | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/app.view.css.ts b/app/app.view.css.ts index 7655ff7..65871b8 100644 --- a/app/app.view.css.ts +++ b/app/app.view.css.ts @@ -1,5 +1,5 @@ namespace $.$$ { - + $mol_style_define( $optimade_tmdne_app, { overflow: 'hidden', @@ -38,6 +38,8 @@ namespace $.$$ { Head_card: { pointerEvents: 'auto', margin: 'auto', + width: '35%', + textAlign: 'center', }, Head_title: { @@ -126,13 +128,15 @@ namespace $.$$ { Hint_no: { pointerEvents: 'auto', color: '#ff6666', + zIndex: 10, }, Hint_yes: { pointerEvents: 'auto', color: $mol_theme.current, + zIndex: 10, }, } ) - + } diff --git a/app/app.view.tree b/app/app.view.tree index 167784b..32b16ed 100644 --- a/app/app.view.tree +++ b/app/app.view.tree @@ -1,5 +1,5 @@ $optimade_tmdne_app $mol_view - title \This material does not exist + title \This Material Does Not Exist? number? 1 plugins / <= Theme $mol_theme_auto diff --git a/card/card.view.css.ts b/card/card.view.css.ts index 8207b38..222ebe4 100644 --- a/card/card.view.css.ts +++ b/card/card.view.css.ts @@ -1,7 +1,7 @@ namespace $.$$ { - + $mol_style_define( $optimade_tmdne_card, { - + pointerEvents: 'auto', width: 'max-content', position: 'fixed', @@ -101,13 +101,13 @@ namespace $.$$ { gap: '0.5rem', }, - Why_optinal: { + Why_optional: { color: $mol_theme.shade, font: { style: 'italic', }, }, - + } ) - + } diff --git a/card/card.view.tree b/card/card.view.tree index 0d9268a..57da28b 100644 --- a/card/card.view.tree +++ b/card/card.view.tree @@ -16,7 +16,7 @@ $optimade_tmdne_card $optimade_tmdne_swipe sub / <= Why_title $mol_paragraph title \Why? - <= Why_optinal $mol_paragraph - title \(optinal) + <= Why_optional $mol_paragraph + title \(optional) <= Why $mol_textarea value? <=> why? \ From 9ae2ca7ab9cca318dc67f9e4819783213a9b0279 Mon Sep 17 00:00:00 2001 From: Evgeny Blokhin Date: Sat, 29 Jun 2024 16:51:39 +0200 Subject: [PATCH 7/7] Fix prediction table on mobile screens --- app/app.view.css | 3 +++ app/app.view.tree | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 app/app.view.css diff --git a/app/app.view.css b/app/app.view.css new file mode 100644 index 0000000..29b85b2 --- /dev/null +++ b/app/app.view.css @@ -0,0 +1,3 @@ +@media all and (max-width: 900px) { + [optimade_tmdne_app_param_mae], [optimade_tmdne_app_param_name] { display: none; } +} diff --git a/app/app.view.tree b/app/app.view.tree index 0a4cfa8..95e5823 100644 --- a/app/app.view.tree +++ b/app/app.view.tree @@ -33,13 +33,13 @@ $optimade_tmdne_app $mol_view <= Param* $mol_view sub / <= Param_name* $mol_paragraph - minimal_height 16 + minimal_height 24 title <= param_name* \ <= Param_symbol_html* $optimade_tmdne_html_view html <= param_symbol* \ \= <= Param_value* $mol_view - minimal_height 16 + minimal_height 24 sub / <= param_value* \ <= Param_unit* $optimade_tmdne_html_view