diff --git a/.gitignore b/.gitignore index 9a42bd6b..baeecf14 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ jirs-client/build tmp jirs-server/target jirs-cli/target +jirs-bat/bat diff --git a/Cargo.lock b/Cargo.lock index 864f94d0..e1e92c24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,14 +121,16 @@ dependencies = [ [[package]] name = "actix-cors" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e5c769e4d332bfad27f11b8139b5818c4bbddb02c385b8f16344d93ff1a8eb" +checksum = "aaf0c4345c9663a2822d42602391418fd5766f269109ec6bf1784b056a9356a7" dependencies = [ - "actix-service", "actix-web", "derive_more", "futures-util", + "log", + "once_cell", + "tinyvec 1.0.1", ] [[package]] @@ -752,22 +754,6 @@ dependencies = [ "libc", ] -[[package]] -name = "bson" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c11f16001d679cb13d14b2c93c7d0fa13bb484a87c34a6c4c39707ad936499b5" -dependencies = [ - "base64 0.12.3", - "chrono", - "hex", - "lazy_static", - "linked-hash-map", - "rand 0.7.3", - "serde", - "serde_json", -] - [[package]] name = "buf-min" version = "0.1.1" @@ -981,11 +967,11 @@ checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" [[package]] name = "crc32fast" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] [[package]] @@ -1593,6 +1579,26 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gumdrop" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46571f5d540478cf70d2a42dd0d6d8e9f4b9cc7531544b93311e657b86568a0b" +dependencies = [ + "gumdrop_derive", +] + +[[package]] +name = "gumdrop_derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915ef07c710d84733522461de2a734d4d62a3fd39a4d4f404c2f385ef8618d05" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "h2" version = "0.2.6" @@ -1868,8 +1874,8 @@ dependencies = [ name = "jirs-css" version = "0.1.0" dependencies = [ - "clap", "glob", + "gumdrop", "notify", ] @@ -1930,20 +1936,28 @@ dependencies = [ "uuid 0.8.1", ] +[[package]] +name = "jirs_bat" +version = "0.1.0" +dependencies = [ + "bincode", + "flate2", + "serde", + "syntect", +] + [[package]] name = "jirs_client" version = "0.1.0" dependencies = [ "bincode", - "bson", "chrono", "comrak", + "flate2", "futures 0.1.30", "jirs-data", "js-sys", "lazy_static", - "num-traits", - "ron", "seed", "serde", "serde_cbor", @@ -2517,9 +2531,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e555d9e657502182ac97b539fb3dae8b79cda19e3e4f8ffb5e8de4f18df93c95" +checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" [[package]] name = "pin-utils" @@ -2873,17 +2887,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "ron" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8a58080b7bb83b2ea28c3b7a9a994fd5e310330b7c8ca5258d99b98128ecfe4" -dependencies = [ - "base64 0.12.3", - "bitflags", - "serde", -] - [[package]] name = "rusoto_core" version = "0.43.0" @@ -2985,9 +2988,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2610b7f643d18c87dff3b489950269617e6601a51f1f05aa5daefee36f64f0b" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" [[package]] name = "rustc_version" @@ -3150,7 +3153,6 @@ version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" dependencies = [ - "indexmap", "itoa", "ryu", "serde", @@ -3329,9 +3331,9 @@ checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" [[package]] name = "syn" -version = "1.0.45" +version = "1.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9c5432ff16d6152371f808fb5a871cd67368171b09bb21b43df8e4a47a3556" +checksum = "5ad5de3220ea04da322618ded2c42233d02baca219d6f160a3e9c87cda16c942" dependencies = [ "proc-macro2", "quote", @@ -3352,9 +3354,9 @@ dependencies = [ [[package]] name = "syntect" -version = "4.4.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3978df05b5850c839a6b352d3c35ce0478944a4be689be826b53cf75363e88" +checksum = "83b43a6ca1829ccb0c933b615c9ea83ffc8793ae240cecbd15119b13d741161d" dependencies = [ "bincode", "bitflags", @@ -3369,6 +3371,7 @@ dependencies = [ "serde_derive", "serde_json", "walkdir", + "yaml-rust", ] [[package]] @@ -4149,6 +4152,15 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a" +[[package]] +name = "yaml-rust" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "zeroize" version = "1.1.1" diff --git a/Cargo.toml b/Cargo.toml index 466deff1..362ff095 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,5 +24,6 @@ members = [ "./jirs-client", "./jirs-data", "./jirs-css", + "./jirs-bat", ] diff --git a/jirs-bat/Cargo.toml b/jirs-bat/Cargo.toml new file mode 100644 index 00000000..bdf59120 --- /dev/null +++ b/jirs-bat/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "jirs_bat" +version = "0.1.0" +authors = ["Adrian Wozniak "] +edition = "2018" +description = "BAT scrapping" +repository = "https://gitlab.com/adrian.wozniak/jirs" +license = "MPL-2.0" + +[dependencies] +serde = "*" + +[dependencies.flate2] +version = "1.0" +default-features = false + +[dependencies.bincode] +version = "1.0" + +[dependencies.syntect] +version = "=4.2.0" +default-features = false +features = [ + "regex-fancy", + "parsing", + "yaml-load", + "dump-load", + "dump-create", + "dump-load-rs", + "dump-create-rs", + "assets", + "html", + "default-fancy" +] diff --git a/jirs-bat/build.rs b/jirs-bat/build.rs new file mode 100644 index 00000000..ba36c1ca --- /dev/null +++ b/jirs-bat/build.rs @@ -0,0 +1,16 @@ +use std::error::Error; + +fn main() -> Result<(), Box> { + std::fs::create_dir_all("./tmp")?; + + std::process::Command::new("git") + .arg("clone") + .arg("https://github.com/sharkdp/bat.git") + .arg("./tmp/bat") + .spawn()?; + std::process::Command::new("git") + .args(&["submodule", "update", "--init", "--recursive"]) + .current_dir("./tmp/bat") + .spawn()?; + Ok(()) +} diff --git a/jirs-bat/src/main.rs b/jirs-bat/src/main.rs new file mode 100644 index 00000000..a5877db2 --- /dev/null +++ b/jirs-bat/src/main.rs @@ -0,0 +1,26 @@ +use bincode::serialize_into; +use bincode::Result; +use flate2::write::ZlibEncoder; +use flate2::Compression; +use serde::Serialize; +use std::fs::File; +use std::io::{BufWriter, Write}; +use std::path::Path; +use syntect::dumps::from_binary; +use syntect::parsing::SyntaxSet; + +pub fn dump_to_writer(to_dump: &T, output: W) -> Result<()> { + let mut encoder = ZlibEncoder::new(output, Compression::none()); + serialize_into(&mut encoder, to_dump) +} + +pub fn dump_to_file>(to_dump: &T, path: P) -> Result<()> { + let output = BufWriter::new(File::create(path)?); + dump_to_writer(to_dump, output) +} + +fn main() -> Result<()> { + let set: SyntaxSet = from_binary(include_bytes!("../../jirs-client/src/hi/syntaxes.bin")); + dump_to_file(&set, "./tmp/syntaxes.fast.bin")?; + Ok(()) +} diff --git a/jirs-client/Cargo.toml b/jirs-client/Cargo.toml index 70a7adaa..b4740e2e 100644 --- a/jirs-client/Cargo.toml +++ b/jirs-client/Cargo.toml @@ -38,18 +38,15 @@ seed = { version = "0.7.0" } serde = { version = "*" } serde_json = { version = "*" } bincode = { version = "*" } -ron = { version = "*" } -bson = "1.1.0" serde_cbor = "0.11.1" chrono = { version = "0.4", default-features = false, features = ["serde", "wasmbind"] } uuid = { version = "0.8.1", features = ["serde"] } futures = "^0.1.26" comrak = "*" -num-traits = { version = "*" } +flate2 = "*" lazy_static = "*" -syntect = { version = "*", default-features = false, features = ["html", "regex-fancy", "dump-load-rs"] } [dependencies.wasm-bindgen] version = "*" @@ -93,5 +90,17 @@ features = [ "DragEvent", ] +[dependencies.syntect] +version = "=4.2.0" +default-features = false +features = [ + "parsing", + "dump-load", + "dump-load-rs", + "dump-create-rs", + "html", + "default-fancy" +] + [dev-dependencies] wasm-bindgen-test = { version = "*" } diff --git a/jirs-client/js/css/global.css b/jirs-client/js/css/global.css index daebe84e..b39ff5b6 100644 --- a/jirs-client/js/css/global.css +++ b/jirs-client/js/css/global.css @@ -1,7 +1,12 @@ html, body, #root { height: 100%; min-height: 100%; - min-width: 768px; +} + +@media (min-width: 1240px) { + html, body, #root { + min-width: 768px; + } } body { diff --git a/jirs-client/js/css/login.css b/jirs-client/js/css/login.css index 82dab320..9ba0037b 100644 --- a/jirs-client/js/css/login.css +++ b/jirs-client/js/css/login.css @@ -1,8 +1,7 @@ #login > .styledForm { + margin-top: 5rem; display: flex; flex-direction: column; - margin: 0 auto 24px; - width: 400px; background: rgb(255, 255, 255) none repeat scroll 0 0; border-radius: 3px; box-shadow: rgba(0, 0, 0, 0.1) 0 0 10px; @@ -11,7 +10,6 @@ } #login > .styledForm:first-of-type { - margin-top: 124.5px; margin-bottom: 0; } @@ -53,7 +51,19 @@ line-height: 32px; } -#login .twoRow { +#login > .styledForm .twoRow { display: flex; justify-content: space-between; } + +@media (min-width: 1240px) { + #login > .styledForm { + margin: 0 auto 24px; + width: 400px; + max-width: 400px; + } + + #login > .styledForm:first-of-type { + margin-top: 124.5px; + } +} diff --git a/jirs-client/js/css/project.css b/jirs-client/js/css/project.css index e9f103e9..8fce9513 100644 --- a/jirs-client/js/css/project.css +++ b/jirs-client/js/css/project.css @@ -27,6 +27,7 @@ #projectPage > #projectBoardFilters { display: flex; + flex-direction: column; align-items: center; margin-top: 24px; } @@ -87,6 +88,7 @@ display: flex; margin: 26px -5px 0; position: relative; + flex-direction: column; } #projectPage > .rows > .row > .rowName { @@ -101,7 +103,6 @@ flex-direction: column; margin: 0 5px; min-height: 400px; - width: 25%; border-radius: 3px; background: var(--backgroundLightest); } @@ -147,7 +148,6 @@ #projectPage > .rows > .row > .projectBoardLists > .list > .issues > .issueLink > .issue.isBeingDragged { transform: rotate(3deg); - /*box-shadow: 5px 10px 30px 0 rgba(9, 30, 66, 0.15);*/ position: absolute; top: 0; left: 0; @@ -164,16 +164,6 @@ font-size: 15px; } -@media (max-width: 1100px) { - #projectPage > .rows > .row > .projectBoardLists > .list > .issues > .issueLink > .issue { - padding: 10px 8px; - } - - #projectPage > .projectBoardLists > .list > .issues > .issueLink > .issue > .title { - font-size: 14.5px - } -} - #projectPage > .rows > .row > .projectBoardLists > .list > .issues > .issueLink > .issue > .bottom { display: flex; justify-content: space-between; @@ -201,14 +191,39 @@ box-shadow: 0 0 0 2px #fff; } -@media (max-width: 1100px) { - #projectPage { - padding: 25px 20px 50px calc(var(--appNavBarLeftWidth) + var(--secondarySideBarWidth) + 20px); - } +#projectPage > .rows > .row > .projectBoardLists > .list > .issues > .issueLink > .issue { + display: flex; + justify-content: space-between; + cursor: pointer; } -@media (max-width: 999px) { - #projectPage { - padding-left: calc(var(--appNavBarLeftWidth) + var(--secondarySideBarWidth) + 20px - var(--secondarySideBarWidth)); +#projectPage > #projectBoardFilters > .filterChild { + width: 90%; + margin-bottom: 1rem; +} + +@media (min-width: 1240px) { + #projectPage {} + + #projectPage > #projectBoardFilters { + flex-direction: row; + } + + #projectPage > #projectBoardFilters > .filterChild { + width: auto; + margin-bottom: auto; + } + + #projectPage > .rows > .row > .projectBoardLists { + flex-direction: row; + } + + #projectPage > .rows > .row > .projectBoardLists > .list { + width: 25%; + } + + #projectPage > .rows > .row > .projectBoardLists > .list > .issues > .issueLink > .issue { + display: block; + padding: 10px 8px; } } diff --git a/jirs-client/js/css/styledPage.css b/jirs-client/js/css/styledPage.css index 181f1d75..a744bae8 100644 --- a/jirs-client/js/css/styledPage.css +++ b/jirs-client/js/css/styledPage.css @@ -1,3 +1,10 @@ .innerPage { - padding: 25px 32px 50px calc(var(--appNavBarLeftWidth) + var(--secondarySideBarWidth) + 40px); + padding-left: calc(var(--appNavBarLeftWidth) + 20px); + padding-right: 20px; +} + +@media (min-width: 1240px) { + .innerPage { + padding: 25px 32px 50px calc(var(--appNavBarLeftWidth) + var(--secondarySideBarWidth) + 40px); + } } diff --git a/jirs-client/js/css/variables.css b/jirs-client/js/css/variables.css index 08151c07..0071903a 100644 --- a/jirs-client/js/css/variables.css +++ b/jirs-client/js/css/variables.css @@ -86,3 +86,8 @@ --avatar-color-7: rgb(87, 218, 202); --avatar-color-8: rgb(87, 165, 218); } + +:root /* screen size */ +{ + --desktop: 1240px; +} diff --git a/jirs-client/js/template.html b/jirs-client/js/template.html index cc76a1ef..c06eb8c0 100644 --- a/jirs-client/js/template.html +++ b/jirs-client/js/template.html @@ -14,6 +14,7 @@ width: 100%; height: 100%; display: block; + text-align: center; } .spinner { @@ -21,14 +22,15 @@ width: 180px; height: 80px; margin: 0 auto; + text-align: center; } .lds-hourglass { display: inline-block; position: relative; - width: 80px; + width: 180px; height: 80px; - margin: 4rem auto; + margin: 4rem auto 1rem; } .lds-hourglass:after { @@ -37,7 +39,7 @@ border-radius: 50%; width: 0; height: 0; - margin: 8px; + margin: 8px auto; box-sizing: border-box; border: 32px solid #fff; border-color: #fff transparent #fff transparent; diff --git a/jirs-client/scripts/prod.sh b/jirs-client/scripts/prod.sh index 97106a19..9f66584c 100755 --- a/jirs-client/scripts/prod.sh +++ b/jirs-client/scripts/prod.sh @@ -6,7 +6,7 @@ rm -Rf build mkdir build wasm-pack build --mode normal --release --out-name jirs --out-dir ./build --target web -../target/debug/jirs-css -i ./js/styles.css -O ./build/styles.css +../target/debug/jirs-css -i ./js/styles.css -o ./build/styles.css cp -r ./static/* ./build cat ./static/index.js \ diff --git a/jirs-client/scripts/run-wasm-pack.sh b/jirs-client/scripts/run-wasm-pack.sh index df9dd304..7d03cb15 100755 --- a/jirs-client/scripts/run-wasm-pack.sh +++ b/jirs-client/scripts/run-wasm-pack.sh @@ -10,7 +10,7 @@ mkdir -p target wasm-pack build --mode force --dev --out-name jirs --out-dir ./tmp --target web -- --verbose -../target/debug/jirs-css -i ./js/styles.css -O ./tmp/styles.css +../target/debug/jirs-css -i ./js/styles.css -o ./tmp/styles.css cp -r ./static/* ./tmp cat ./static/index.js | diff --git a/jirs-client/src/hi/all.themedump b/jirs-client/src/hi/all.themedump deleted file mode 100644 index a79c10bd..00000000 Binary files a/jirs-client/src/hi/all.themedump and /dev/null differ diff --git a/jirs-client/src/hi/mod.rs b/jirs-client/src/hi/mod.rs index b88dd314..a0e183d5 100644 --- a/jirs-client/src/hi/mod.rs +++ b/jirs-client/src/hi/mod.rs @@ -1,13 +1,208 @@ +use bincode::deserialize_from; +use bincode::Result; +use flate2::bufread::ZlibDecoder; use lazy_static::lazy_static; -use syntect::{dumps::*, highlighting::ThemeSet}; - -pub mod syntax_set; -// -// pub use syntax::get_syntax; -// pub use syntax::SYNTAX_LIST; -// pub use syntax::SYNTAX_NAMES; +use serde::de::DeserializeOwned; +use std::io::BufRead; +use syntect::highlighting::ThemeSet; +use syntect::parsing::SyntaxSet; lazy_static! { - pub static ref THEME_SET: ThemeSet = from_binary(include_bytes!("./all.themedump")); - // pub static ref SYNTAX_SET: SyntaxSet = syntax_set::load(); + pub static ref THEME_SET: ThemeSet = integrated_themeset(); + pub static ref SYNTAX_SET: SyntaxSet = integrated_syntaxset(); +} + +pub static SYNTAX_NAMES: &[&str; 175] = &[ + "Plain Text", + "ASP", + "HTML (ASP)", + "ActionScript", + "AppleScript", + "Batch File", + "NAnt Build File", + "C#", + "C++", + "C", + "CSS", + "Clojure", + "D", + "DMD Output", + "Diff", + "Erlang", + "HTML (Erlang)", + "Git Attributes", + "Git Commit", + "Git Common", + "Git Config", + "Git Ignore", + "Git Link", + "Git Log", + "Git Mailmap", + "Git Rebase Todo", + "Go", + "Graphviz (DOT)", + "Groovy", + "HTML", + "Haskell", + "Literate Haskell", + "JSON", + "Java Server Page (JSP)", + "Java", + "Javadoc", + "Java Properties", + "JavaScript", + "Regular Expressions (Javascript)", + "BibTeX", + "LaTeX Log", + "LaTeX", + "TeX", + "Lisp", + "Lua", + "Make Output", + "Makefile", + "Markdown", + "MultiMarkdown", + "MATLAB", + "OCaml", + "OCamllex", + "OCamlyacc", + "camlp4", + "Objective-C++", + "Objective-C", + "PHP Source", + "PHP", + "Regular Expressions (PHP)", + "Pascal", + "Perl", + "Python", + "Regular Expressions (Python)", + "R Console", + "R", + "Rd (R Documentation)", + "HTML (Rails)", + "JavaScript (Rails)", + "Ruby Haml", + "Ruby on Rails", + "SQL (Rails)", + "Regular Expression", + "reStructuredText", + "Ruby", + "Cargo Build Results", + "Rust", + "SQL", + "Scala", + "Bourne Again Shell (bash)", + "Shell-Unix-Generic", + "commands-builtin-shell-bash", + "HTML (Tcl)", + "Tcl", + "Textile", + "XML", + "YAML", + "AWK", + "Apache Conf", + "AsciiDoc (Asciidoctor)", + "ARM Assembly", + "Assembly (x86_64)", + "CMake C Header", + "CMake C++ Header", + "CMake", + "CMakeCache", + "CMakeCommands", + "Advanced CSV", + "Cabal", + "CoffeeScript", + "CpuInfo", + "Crystal", + "Dart Analysis Output", + "Dart", + "Dockerfile", + "DotENV", + "Elixir", + "HTML (EEx)", + "Regular Expressions (Elixir)", + "Elm Compile Messages", + "Elm Documentation", + "Elm", + "Email", + "F#", + "Friendly Interactive Shell (fish)", + "Fortran (Fixed Form)", + "Fortran (Modern)", + "Fortran Namelist", + "GFortran Build Results", + "OpenMP (Fortran)", + "fstab", + "GLSL", + "GraphQL", + "group", + "HTML (Twig)", + "hosts", + "INI", + "JavaScript (Babel)", + "HTML (Jinja2)", + "Jinja2", + "jsonnet", + "Julia", + "Kotlin", + "Less", + "Manpage", + "MemInfo", + "nginx", + "Nim", + "Nix", + "orgmode", + "passwd", + "PowerShell", + "Protocol Buffer", + "Protocol Buffer (TEXT)", + "Puppet", + "PureScript", + "QML", + "Rego", + "resolv", + "Robot Framework syntax highlighting.", + "SCSS", + "Sass", + "Salt State (SLS)", + "SML", + "Strace", + "Stylus", + "Swift", + "syslog", + "TOML", + "JSON (Terraform)", + "Terraform", + "TypeScript", + "TypeScriptReact", + "Verilog", + "VimL", + "Vue Component", + "requirements.txt", + "Highlight non-printables", + "Authorized Keys", + "Known Hosts", + "Private Key", + "SSH Common", + "SSH Config", + "SSH Crypto", + "SSHD Config", + "varlink", +]; + +fn from_reader(input: R) -> Result { + let mut decoder = ZlibDecoder::new(input); + deserialize_from(&mut decoder) +} + +fn from_binary(v: &[u8]) -> T { + from_reader(v).unwrap() +} + +fn integrated_syntaxset() -> SyntaxSet { + from_binary(include_bytes!("./syntaxes.fast.bin")) +} + +fn integrated_themeset() -> ThemeSet { + from_binary(include_bytes!("./themes.bin")) } diff --git a/jirs-client/src/hi/newlines.packdump b/jirs-client/src/hi/newlines.packdump deleted file mode 100644 index a0bf32f6..00000000 Binary files a/jirs-client/src/hi/newlines.packdump and /dev/null differ diff --git a/jirs-client/src/hi/syntax_set.cbor b/jirs-client/src/hi/syntax_set.cbor deleted file mode 100644 index a5f3856e..00000000 Binary files a/jirs-client/src/hi/syntax_set.cbor and /dev/null differ diff --git a/jirs-client/src/hi/syntaxes.bin b/jirs-client/src/hi/syntaxes.bin new file mode 100644 index 00000000..a69ec6fe Binary files /dev/null and b/jirs-client/src/hi/syntaxes.bin differ diff --git a/jirs-client/src/hi/themes.bin b/jirs-client/src/hi/themes.bin new file mode 100644 index 00000000..b8683424 Binary files /dev/null and b/jirs-client/src/hi/themes.bin differ diff --git a/jirs-client/src/lib.rs b/jirs-client/src/lib.rs index 6f25ec9c..c159cdfa 100644 --- a/jirs-client/src/lib.rs +++ b/jirs-client/src/lib.rs @@ -279,8 +279,18 @@ pub fn render(host_url: String, ws_url: String) { HOST_URL = host_url; WS_URL = ws_url; } - // if !cfg!(debug_assertions) { - // crate::hi::syntax_set::load(); + // { + // let now = chrono::Utc::now(); + // log!("Loading syntax"); + // let _ = crate::hi::SYNTAX_SET.find_syntax_by_name("varlink"); + // let end = chrono::Utc::now(); + // log!("Syntax loaded"); + // log!(end - now); + // log!(crate::hi::SYNTAX_SET + // .syntaxes() + // .iter() + // .map(|s| s.name.as_str()) + // .collect::>()); // } elements::define(); diff --git a/jirs-client/src/print.rs b/jirs-client/src/print.rs index 8b4b56c3..1854b36e 100644 --- a/jirs-client/src/print.rs +++ b/jirs-client/src/print.rs @@ -1,11 +1,11 @@ fn main() { - std::fs::create_dir_all("./jirs-client/src/hi/syntax").unwrap(); - - use syntect::{dumps::*, parsing::*}; - let syntax_set: SyntaxSet = from_binary(include_bytes!("./hi/newlines.packdump")); - std::fs::write( - "./jirs-client/src/hi/syntax_set.cbor", - serde_cbor::ser::to_vec(&syntax_set).unwrap(), - ) - .unwrap(); + // std::fs::create_dir_all("./jirs-client/src/hi/syntax").unwrap(); + // + // use syntect::{dumps::*, parsing::*}; + // let syntax_set: SyntaxSet = from_binary(include_bytes!("./hi/newlines.packdump")); + // std::fs::write( + // "./jirs-client/src/hi/syntax_set.cbor", + // serde_cbor::ser::to_vec(&syntax_set).unwrap(), + // ) + // .unwrap(); } diff --git a/jirs-client/src/project/view.rs b/jirs-client/src/project/view.rs index 109671df..90deab27 100644 --- a/jirs-client/src/project/view.rs +++ b/jirs-client/src/project/view.rs @@ -47,7 +47,7 @@ fn header() -> Node { .into_node(); div![ id!["projectBoardHeader"], - div![id!["boardName"], "Kanban board"], + div![id!["boardName"], class!["headerChild"], "Kanban board"], a![ attrs![At::Href => "https://gitlab.com/adrian.wozniak/jirs", At::Target => "__blank", At::Rel => "noreferrer noopener"], button @@ -72,6 +72,7 @@ fn project_board_filters(model: &Model) -> Node { .empty() .active(project_page.only_my_filter) .text("Only My Issues") + .add_class("filterChild") .on_click(mouse_ev(Ev::Click, |_| Msg::ProjectToggleOnlyMy)) .build() .into_node(); @@ -79,6 +80,7 @@ fn project_board_filters(model: &Model) -> Node { let recently_updated = StyledButton::build() .empty() .text("Recently Updated") + .add_class("filterChild") .on_click(mouse_ev(Ev::Click, |_| Msg::ProjectToggleRecentlyUpdated)) .build() .into_node(); @@ -89,6 +91,7 @@ fn project_board_filters(model: &Model) -> Node { { seed::button![ id!["clearAllFilters"], + class!["filterChild"], "Clear all", mouse_ev(Ev::Click, |_| Msg::ProjectClearFilters), ] @@ -136,7 +139,7 @@ fn avatars_filters(model: &Model) -> Node { }) .collect(); - div![id!["avatars"], avatars] + div![id!["avatars"], class!["filterChild"], avatars] } fn project_board_lists(model: &Model) -> Node { diff --git a/jirs-css/Cargo.toml b/jirs-css/Cargo.toml index 32eb4eb2..488ec374 100644 --- a/jirs-css/Cargo.toml +++ b/jirs-css/Cargo.toml @@ -7,6 +7,6 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -clap = { version = "*", features = [] } glob = { version = "*" } notify = { version = "*" } +gumdrop = { version = "*", default-features = false } diff --git a/jirs-css/src/main.rs b/jirs-css/src/main.rs index 246351b0..1fb4677c 100644 --- a/jirs-css/src/main.rs +++ b/jirs-css/src/main.rs @@ -94,9 +94,9 @@ impl std::fmt::Display for CssFile { } #[derive(Debug, Default)] -struct Application { - input: String, - output: Option, +struct Application<'l> { + input: &'l str, + output: Option<&'l str>, watch: bool, prelude_selector: bool, files_map: HashMap>, @@ -105,7 +105,7 @@ struct Application { sender: Option>, } -impl Application { +impl<'l> Application<'l> { fn read_timestamp(input: &Path) -> Result { std::fs::File::open(input) .and_then(|file| file.metadata()) @@ -259,28 +259,30 @@ impl Application { } } +#[derive(gumdrop::Options, Debug)] +struct Opts { + #[options(help = "Root input file")] + input: Option, + #[options(help = "Optional output file. If not given result will be printed to stdout")] + output: Option, + #[options(help = "Watch file changes")] + watch: bool, + #[options(help = "Add reset css prelude")] + prelude: bool, + #[options(help = "Print help message")] + help: bool, +} + fn main() -> Result<(), String> { - let matches = clap::App::new("jirs-css") - .arg( - clap::Arg::with_name("input") - .short("i") - .default_value(INPUT) - .takes_value(true), - ) - .arg(clap::Arg::with_name("output").short("O").takes_value(true)) - .arg(clap::Arg::with_name("watch").short("W").takes_value(false)) - .arg( - clap::Arg::with_name("prelude") - .short("p") - .help("Prepend file name as class to each selector"), - ) - .get_matches(); + use gumdrop::Options; + + let opts: Opts = Opts::parse_args_default_or_exit(); let mut app = Application { - input: matches.value_of("input").unwrap().to_string(), - output: matches.value_of("output").map(|s| s.to_string()), - watch: matches.is_present("watch"), - prelude_selector: matches.is_present("prelude"), + input: opts.input.as_deref().unwrap_or_else(|| INPUT), + output: opts.output.as_deref(), + watch: opts.watch, + prelude_selector: opts.prelude, files_map: Default::default(), fm: Default::default(), root_file: None, @@ -289,15 +291,16 @@ fn main() -> Result<(), String> { let root_path = app.input.to_string(); let root = std::path::Path::new(&root_path); - let output_timestamp = matches - .value_of("output") + let output_timestamp = opts + .output + .as_deref() .ok_or_else(|| std::io::Error::from_raw_os_error(0)) .and_then(File::open) .and_then(|file| file.metadata()) .and_then(|meta| meta.modified()) .unwrap_or_else(|_| SystemTime::UNIX_EPOCH); - if app.check_timestamps(root, output_timestamp)? && !matches.is_present("watch") { + if app.check_timestamps(root, output_timestamp)? && !opts.watch { return Ok(()); } @@ -308,7 +311,7 @@ fn main() -> Result<(), String> { app.parse()?; app.print(); - if !matches.is_present("watch") { + if !opts.watch { return Ok(()); } diff --git a/jirs-data/Cargo.toml b/jirs-data/Cargo.toml index 34b9dfe2..8e56692c 100644 --- a/jirs-data/Cargo.toml +++ b/jirs-data/Cargo.toml @@ -24,5 +24,5 @@ uuid = { version = ">=0.7.0, <0.9.0", features = ["serde"] } [dependencies.diesel] optional = true -version = "1.4.4" +version = "1.4.5" features = [ "unstable", "postgres", "numeric", "extras", "uuidv07" ] diff --git a/jirs-server/Cargo.toml b/jirs-server/Cargo.toml index 8b0d5b95..99d09269 100644 --- a/jirs-server/Cargo.toml +++ b/jirs-server/Cargo.toml @@ -71,7 +71,7 @@ lettre = { version = "*" } lettre_email = { version = "*" } [dependencies.diesel] -version = "1.4.4" +version = "1.4.5" features = [ "unstable", "postgres", "numeric", "extras", "uuidv07" ] [dependencies.jirs-data]