Skip to content

$mol_hack пул реквест#3

Open
reatailret wants to merge 14 commits intoblokhin:mainfrom
reatailret:main
Open

$mol_hack пул реквест#3
reatailret wants to merge 14 commits intoblokhin:mainfrom
reatailret:main

Conversation

@reatailret
Copy link

Описание в readme.

  • используется поиск из либы NLP
  • есть PWA
  • подробнее в видео readme

return new cl()
}

string_to_facets( search: string )
Copy link

Choose a reason for hiding this comment

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

Думаю тут и далее бы тоже не помешала мемоизация.

Comment on lines +48 to +52
for( const facet of val )
{
if( !result[ facet.facet ] ) result[ facet.facet ] = []
result[ facet.facet ].push( facet.label )
}
Copy link

Choose a reason for hiding this comment

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

Кажется тут можно применить $mol_array_groups.

Copy link
Author

Choose a reason for hiding this comment

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

не подходит

uri_to_facets()
{
const res = [] as $optimade_zero_api_Facet[]
const dict = $mol_mem_cached( () => $mol_state_arg.dict() )!
Copy link

Choose a reason for hiding this comment

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

А почему потребовалось брать значение из кеша напрямую? Никто не гарантирует, что в кеше в этот момент что-то будет.


if( search && Object.keys( search ).length )
{
const response = $mol_fetch.json( this.srch_endpoint() + '?' + new URLSearchParams( { q: JSON.stringify( search ) } ).toString() ) as unknown as $optimade_zero_api_SearchResponse
Copy link

Choose a reason for hiding this comment

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

Думаю сборку урла имеет смысл вынести в отдельную функцию, чтобы не копипастить её много раз.

Copy link

Choose a reason for hiding this comment

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

А зачем дублировать одни и те же картинки по нескольку раз?

export class $optimade_zero_htmlstring extends $.$optimade_zero_htmlstring {
@$mol_mem
auto(){
this.dom_node().innerHTML = this.html()
Copy link

Choose a reason for hiding this comment

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

Это очень не безопасно вставлять дикий html из апи в приложение. Лучше использовать $mol_html_view.

event_click? <=> event_logout? null
login_content $mol_row
sub /
<= ltitle @ \Please login (api dont work, CORS error, random SID generated)
Copy link

Choose a reason for hiding this comment

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

Префикс l не понятен.

} else {
this.login_status('Login failed')
// set random sid
this.api().user_sid(Math.random().toString(36).substring(2, 15))
Copy link

Choose a reason for hiding this comment

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

Кажется тут пригодился бы $mol_guid.

<= SearchButton $mol_button_major
title <= sblabel @ \Search
click? <=> search_click? null
<= Subrowsearch $mol_row
Copy link

Choose a reason for hiding this comment

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

Слипшиеся слова довольно сложно читать.

this.reload_search()
this.$.$mol_wait_timeout( 200 )

return this.api().selectize( this.word() ).map( el => ({...el, label:el.label.replaceAll('<sup>', '').replaceAll('</sup>', '').replaceAll('<sub>', '').replaceAll('</sub>', '')}) )
Copy link

Choose a reason for hiding this comment

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

Думаю тут можно было бы обойтись и одной регуляркой.

@reatailret
Copy link
Author

пулл реквест обновлён

@reatailret
Copy link
Author

Пулл реквест обновлен

  • авторизация работает
  • авторизация без потери поиска (если из карточки)
  • пример поиска, изменение ссылки по таймеру
  • дополнительные теги под спойлером
  • переход к странице поиска при открытии сайта
  • частично типизированы стили, некоторые не получилось указать корректно.
  • удалены отладочные логи

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants