Added web app to view database

This commit is contained in:
jin 2022-05-08 09:49:14 +03:00
parent 734fad2614
commit 2ee9db4565
11 changed files with 251 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* -text

25
.github/workflows/toxic_app.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Deploy
on:
workflow_dispatch:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build app
uses: hyoo-ru/mam_build@master2
with:
token: ${{ secrets.GH_PAT }}
package: 'toxic/app'
- name: Deploy on GitHub Pages
if: github.ref == 'refs/heads/master'
uses: alex-page/blazing-fast-gh-pages-deploy@v1.1.0
with:
repo-token: ${{ secrets.GH_PAT }}
site-directory: 'toxic/app/-'

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
-*
.idea/
src/

1
app/CNAME Normal file
View File

@ -0,0 +1 @@
toxic-repos.ru

13
app/app.locale=ru.json Normal file
View File

@ -0,0 +1,13 @@
{
"$toxic_app_Add_hint": "Добавить новую проблему",
"$toxic_app_Chat_hint": "Обсуждения",
"$toxic_app_Mail_hint": "Почта",
"$toxic_app_New_hint": "Нвости",
"$toxic_app_type_name_all": "Все",
"$toxic_app_type_name_broken_assembly": "Ломает сборку",
"$toxic_app_type_name_ddos": "DDOS",
"$toxic_app_type_name_hostile_actions": "Хулиганство",
"$toxic_app_type_name_ip_block": "Блокировка по IP",
"$toxic_app_type_name_malware": "Саботаж",
"$toxic_app_type_name_political_slogans": "Политические слоганы"
}

4
app/app.meta.tree Normal file
View File

@ -0,0 +1,4 @@
include \/mol/offline/install
deploy \/toxic/logo/logo.svg
deploy \/toxic/data/json/toxic-repos.json

45
app/app.view.css Normal file
View File

@ -0,0 +1,45 @@
[toxic_app] {
--mol_theme_hue: 380deg;
}
[toxic_app_menu] {
flex: 0 0 18rem;
}
[toxic_app_issues_page] {
flex: 0 0 60rem;
}
[toxic_app_issues] {
/* padding: var(--mol_gap_block); */
}
[toxic_app_issue] {
padding: var(--mol_gap_block);
}
[toxic_app_issue_main] {
justify-content: space-between;
flex-wrap: wrap;
gap: .75rem;
}
[toxic_app_issue_name] {
text-shadow: 0 0;
flex: 1 1 auto;
}
[toxic_app_issue_type] {
color: var(--mol_theme_shade);
}
[toxic_app_issue_date] {
color: var(--mol_theme_shade);
}
[toxic_app_issue_descr] {
max-width: 100%
}
[toxic_app_issue_descr_row] {
}

68
app/app.view.tree Normal file
View File

@ -0,0 +1,68 @@
$toxic_app $mol_book2_catalog
menu_title \Toxis Repos
menu_tools /
<= Add $mol_link
uri \https://t.me/darksider_bot
hint @ \Add new issue
sub /
<= Add_icon $mol_icon_plus
<= Source $mol_link_source
uri \https://github.com/nin-jin/toxic-repos
<= Lights $mol_lights_toggle
menu_foot /
<= Chat $mol_link
uri \https://t.me/toxic_repos
hint @ \Discussions
sub /
<= Chat_icon $mol_icon_telegram
<= New $mol_link
uri \https://twitter.com/ZStravnik
hint @ \News
sub /
<= News_icon $mol_icon_twitter
<= Mail $mol_link
uri \mailto:info@toxic-repos.ru
hint @ \E-Mail
sub /
<= Mail_icon $mol_icon_email
plugins /
<= Theme $mol_theme_auto
spreads *
\
<= Issues_page*all
broken_assembly <= Issues_page*broken_assembly
ddos <= Issues_page*ddos
hostile_actions <= Issues_page*hostile_actions
ip_block <= Issues_page*ip_block
malware <= Issues_page*malware
political_slogans <= Issues_page*political_slogans
type_name *
all @ \All
broken_assembly @ \Broken Assemply
ddos @ \DDOS
hostile_actions @ \Hostile Actions
ip_block @ \IP Block
malware @ \Malware
political_slogans @ \Political Slogans
Issues_page* $mol_page
title <= issues_page_title* \
tools /
<= Search $mol_search
query?val <=> search?val \
body /
<= Issues $mol_list rows <= issues /
Issue* $mol_list
rows /
<= Issue_main* $mol_link
uri <= issue_uri* \
sub /
<= Issue_name* $mol_dimmer
haystack <= issue_name* \
needle <= search
<= Issue_type* $mol_view
sub / <= issue_type* \
<= Issue_date* $mol_view
sub / <= issue_date* \
<= Issue_descr* $mol_text
text <= issue_descr* \
highlight <= search

76
app/app.view.ts Normal file
View File

@ -0,0 +1,76 @@
namespace $.$$ {
const Data = $mol_data_array(
$mol_data_record({
id: $mol_data_integer,
datetime: $mol_data_string,
problem_type: $mol_data_string,
name: $mol_data_string,
commit_link: $mol_data_string,
description: $mol_data_string,
})
)
export class $toxic_app extends $.$toxic_app {
@ $mol_mem_key
issues_page_title( id: string ) {
return this.type_name()[ id ] ?? id
}
@ $mol_mem
data_all() {
const json = this.$.$mol_fetch.json( 'toxic/data/json/toxic-repos.json' )
return Data( json )
}
@ $mol_mem
search( next?: string ) {
return this.$.$mol_state_arg.value( 'search', next ) ?? ''
}
@ $mol_mem
data_filtered() {
let data = this.data_all()
const type = this.spread()
if( type ) data = data.filter( item => item.problem_type === type )
const search = this.search()
if( search ) data = data.filter(
$mol_match_text( search, item => [ item.name, item.description ] )
)
return data
}
@ $mol_mem
issues() {
return this.data_filtered().map( (_,i)=> this.Issue( i ) )
}
issue_name( index: number ) {
return this.data_filtered()[ index ].name
}
@ $mol_mem_key
issue_date( index: number ) {
return new $mol_time_moment( this.data_filtered()[ index ].datetime ).toString( 'YYYY-MM-DD' )
}
issue_type( index: number ) {
return this.type_name()[ this.data_filtered()[ index ].problem_type ]
}
issue_uri( index: number ) {
return this.data_filtered()[ index ].commit_link
}
issue_descr( index: number ) {
return this.data_filtered()[ index ].description
}
}
}

14
app/index.html Normal file
View File

@ -0,0 +1,14 @@
<!doctype html>
<html mol_view_root>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<link href="toxic/logo/logo.svg" rel="icon" />
</head>
<body mol_view_root>
<div mol_view_root="$toxic_app"></div>
<script src="web.js" charset="utf-8"></script>
</body>
</html>

3
logo/logo.svg Normal file
View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="140px" height="140px" viewBox="-0.5 -0.5 140 140"><defs/><g><rect x="10" y="90" width="120" height="40" rx="6" ry="6" fill="#f8cecc" stroke="#b85450" stroke-width="20" pointer-events="all"/><rect x="30" y="50" width="80" height="40" rx="6" ry="6" fill="#f8cecc" stroke="#b85450" stroke-width="20" pointer-events="all"/><rect x="50" y="10" width="40" height="40" rx="6" ry="6" fill="#f8cecc" stroke="#b85450" stroke-width="20" pointer-events="all"/></g></svg>

After

Width:  |  Height:  |  Size: 700 B