diff --git a/src/web.rs b/src/web.rs index 9eaaf626..922483e2 100644 --- a/src/web.rs +++ b/src/web.rs @@ -50,6 +50,7 @@ impl CliWebConfig { } const CSS: &str = include_str!("./web/style.css"); +const FILES: &str = include_str!("./web/files.html"); pub fn generate_web(all_packages: &Vec, config: &CliWebConfig) { let repo_path = &config.out_dir.join(redoxer::target()); @@ -132,10 +133,12 @@ pub fn generate_web(all_packages: &Vec, config: &CliWebConfig) { for (package, files) in &files_map { index_files.parse(package, files); } - let files_path = repo_path.join("files.json"); + let files_json = repo_path.join("files.json"); index_files - .write(&files_path) + .write(&files_json) .expect("Failed to write files.json"); + let files_path = repo_path.join("files.html"); + fs::write(files_path, FILES).expect("Failed to write files.html"); } pub(crate) fn get_category(dir: &Path) -> String { diff --git a/src/web/files.html b/src/web/files.html new file mode 100644 index 00000000..f4dccde1 --- /dev/null +++ b/src/web/files.html @@ -0,0 +1,401 @@ + + + + + + + Package File Browser + + + + +
+

Package File Browser

+ +
+ + +
+
+
/
+
+
Loading files...
+
+
+
+
Files
+
+
+
+
File Content
+
+
+ Select a file to reveal details. +
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/src/web/style.css b/src/web/style.css index 560735ea..87773f55 100644 --- a/src/web/style.css +++ b/src/web/style.css @@ -43,11 +43,9 @@ body { border-radius: 6px; padding: 15px; margin: 10px; - display: inline-block; width: 30%; vertical-align: top; - display: flex; flex: 0 1 280px; flex-direction: column; @@ -162,7 +160,7 @@ code { } .install-action { - display: inline-block; + display: inline-block; background-color: #fff; border: 1px solid #ddd; border-radius: 6px; @@ -191,7 +189,7 @@ code { } .pkg-main, .pkg-meta { - width: 100%; + width: 100%; } @media (min-width: 768px) { @@ -245,13 +243,90 @@ th { width: 50%; } +.search-box { + width: 100%; + padding: 12px 15px; + font-size: 1.1rem; + border: 1px solid #ddd; + border-radius: 6px; + margin-bottom: 20px; + box-sizing: border-box; + font-family: inherit; +} + +.browser-panels { + display: flex; + gap: 20px; + height: 80vh; + min-height: 400px; +} + +.panel { + flex: 1; + border: 1px solid #eee; + border-radius: 6px; + display: flex; + flex-direction: column; + background-color: #fff; + overflow: hidden; +} + +.panel-header { + font-weight: 600; + padding: 10px 15px; + border-bottom: 1px solid #eee; + background-color: #f9f9f9; + font-family: ui-monospace, SFMono-Regular, monospace; + font-size: 0.9rem; +} + +.panel-body { + flex: 1; + overflow-y: auto; + padding: 10px 0; +} + +.list-item { + padding: 8px 15px; + cursor: pointer; + display: flex; + align-items: center; + user-select: none; +} + +.list-item:hover { + background-color: #f1f8ff; +} + +.list-item.selected { + background-color: #0366d6; + color: #fff; +} + +.list-item.selected .pkg-badge { + color: #fff; + background-color: rgba(255, 255, 255, 0.2); +} + +.pkg-badge { + font-size: 0.75rem; + color: #6a737d; + background-color: #eee; + padding: 2px 6px; + border-radius: 12px; +} +.up-icon::before { + content: "↵ "; + margin-right: 0.2em; +} + @media (prefers-color-scheme: dark) { body { background-color: #000; color: #ccc; } - .package-card, .card, .pkg-header, .index-header { + .package-card, .card, .panel, .pkg-header, .index-header { background-color: #111; border-color: #333; } @@ -289,4 +364,30 @@ th { th, td, .pkg-deps li, .pkg-dependents li { border-bottom-color: #333; } -} + + .search-box { + background-color: #000; + color: #ccc; + border-color: #333; + } + + .panel-header { + background-color: #1a1a1a; + border-bottom-color: #333; + color: #8b949e; + } + + .list-item:hover { + background-color: #222; + } + + .list-item.selected { + background-color: #1f6feb; + color: #fff; + } + + .pkg-badge { + background-color: #333; + color: #8b949e; + } +} \ No newline at end of file