Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add link in card header #4

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/app.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ $optimade_tmdne_app $mol_view
click? <=> click_yes? null
^ cards / <= Card* $optimade_tmdne_card
name <= card_name* \
json_link <=> card_link* \
loaded <= card_loaded* false
why? <=> why*? \
pointer_holding? <=> card_holding? false
Expand Down
8 changes: 8 additions & 0 deletions app/app.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,18 @@ namespace $.$$ {
return formula_html( str )
}

@ $mol_mem_key
card_link( n: number ) {
let link = this.fetch_by_number( n )?.data[ 0 ]?.attributes?._gnome_material_id
return `https://optimade-gnome.odbx.science/v1/structures/data/gnome_data/by_id.zip/data/gnome_data/by_id/${link}.CIF`
}


@ $mol_mem_key
card_loaded( n: number ) {
try {
this.card_name( n )
this.card_link( n )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not necessary, card_name is put into this method just to wait for the fetch to done (it's worth replacing card_name with fetch_by_number to make this more obvious)

return this.number() === n
} catch (error) {
if( $mol_promise_like( error ) ) return false
Expand Down
10 changes: 10 additions & 0 deletions card/card.view.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ namespace $.$$ {
weight: 700,
size: '1.5rem',
},
pointerEvents: 'auto',
},

Name_content:{
flex:{
direction: 'row'
},
justify: {
content: 'center',
},
},

Question: {
Expand Down
9 changes: 6 additions & 3 deletions card/card.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ $optimade_tmdne_card $optimade_tmdne_swipe
attr *
card_position <= card_position \
sub /
<= Name $mol_html_view
minimal_height 22
html <= name \
<= Name $mol_link
uri <= json_link \
sub /
<= Name_content $mol_html_view
minimal_height 22
html <= name \
<= Question $mol_paragraph
title \Do you think it's synthesizable?
<= Why_label $mol_view
Expand Down