Skip to content

Commit

Permalink
GH-485: update dictionary app
Browse files Browse the repository at this point in the history
  • Loading branch information
anh.vu2 committed Sep 12, 2021
1 parent f0b15b5 commit 283b749
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 52 deletions.
21 changes: 0 additions & 21 deletions apps/col_add_entry.py

This file was deleted.

45 changes: 45 additions & 0 deletions apps/col_dictionary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import os
from os.path import join

import streamlit as st
import streamlit.components.v1 as components

st.set_page_config(
page_title="Dictionary App",
layout="wide",
)

json_viewer_build_dir = join(
os.path.dirname(os.path.abspath(__file__)),
"components", "json_viewer", "component", "frontend", "build"
)
json_viewer = components.declare_component(
"json_viewer",
path=json_viewer_build_dir
)

# SIDEBAR
add_selectbox = st.sidebar.text_input('Word', value="gà")

# MAIN
st.write('# Dictionary')
st.text_input('Word', key=1, value="gà")
data = [
{
"description": "(Động vật học) Loài chim nuôi (gia cầm) để lấy thịt và trứng, bay kém, mỏ cứng, con trống có cựa và biết gáy.",
"tag": "noun",
"examples": [
"Bán gà ngày gió, bán chó ngày mưa. (tục ngữ)",
"Gà người gáy, gà nhà ta sáng. (tục ngữ)"
]
},
{
"description": "Đánh cuộc riêng trong một ván bài tổ tôm hay tài bàn ngoài số tiền góp chính",
"tag": "verb",
"examples": [
"Gà lần nào cũng thua thì đánh làm gì."
]
}
]

output_data = json_viewer(json_object=data, label=0)
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"files": {
"main.js": "./static/js/main.d10f9d91.chunk.js",
"main.js.map": "./static/js/main.d10f9d91.chunk.js.map",
"main.js": "./static/js/main.ee7180e8.chunk.js",
"main.js.map": "./static/js/main.ee7180e8.chunk.js.map",
"runtime-main.js": "./static/js/runtime-main.723788a6.js",
"runtime-main.js.map": "./static/js/runtime-main.723788a6.js.map",
"static/js/2.5b8594be.chunk.js": "./static/js/2.5b8594be.chunk.js",
"static/js/2.5b8594be.chunk.js.map": "./static/js/2.5b8594be.chunk.js.map",
"index.html": "./index.html",
"precache-manifest.62c0bc516be77e6eb09560a8155d8a3b.js": "./precache-manifest.62c0bc516be77e6eb09560a8155d8a3b.js",
"precache-manifest.98ae7f8f21e9dfea38c2aa5dcc10e9eb.js": "./precache-manifest.98ae7f8f21e9dfea38c2aa5dcc10e9eb.js",
"service-worker.js": "./service-worker.js",
"static/js/2.5b8594be.chunk.js.LICENSE.txt": "./static/js/2.5b8594be.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.723788a6.js",
"static/js/2.5b8594be.chunk.js",
"static/js/main.d10f9d91.chunk.js"
"static/js/main.ee7180e8.chunk.js"
]
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><title>Streamlit Component</title><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Streamlit Component"/><link rel="stylesheet" href="bootstrap.min.css"/></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,i,l=t[0],a=t[1],f=t[2],c=0,s=[];c<l.length;c++)i=l[c],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(t);s.length;)s.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,l=1;l<r.length;l++){var a=r[l];0!==o[a]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="./";var l=this.webpackJsonpstreamlit_json_view=this.webpackJsonpstreamlit_json_view||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var f=0;f<l.length;f++)t(l[f]);var p=a;r()}([])</script><script src="./static/js/2.5b8594be.chunk.js"></script><script src="./static/js/main.d10f9d91.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><title>Streamlit Component</title><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Streamlit Component"/><link rel="stylesheet" href="bootstrap.min.css"/></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,i,l=t[0],a=t[1],f=t[2],c=0,s=[];c<l.length;c++)i=l[c],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(t);s.length;)s.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,l=1;l<r.length;l++){var a=r[l];0!==o[a]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="./";var l=this.webpackJsonpstreamlit_json_view=this.webpackJsonpstreamlit_json_view||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var f=0;f<l.length;f++)t(l[f]);var p=a;r()}([])</script><script src="./static/js/2.5b8594be.chunk.js"></script><script src="./static/js/main.ee7180e8.chunk.js"></script></body></html>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
"./precache-manifest.62c0bc516be77e6eb09560a8155d8a3b.js"
"./precache-manifest.98ae7f8f21e9dfea38c2aa5dcc10e9eb.js"
);

self.addEventListener('message', (event) => {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class JsonViewer extends StreamlitComponentBase<State> {
onEdit={this.onChanged}
onDelete={this.onChanged}
onAdd={this.onChanged}
name={null}
displayDataTypes={false}
/>
)
}
Expand Down

0 comments on commit 283b749

Please sign in to comment.