Skip to content

Nested components #975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
spacing
  • Loading branch information
levkk committed Sep 2, 2023
commit f49c81a3f3abbf258073e4449bbfc9bc071856b7
9 changes: 5 additions & 4 deletions pgml-apps/cargo-pgml-components/src/frontend/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ pub fn add(path: &Path, overwrite: bool) {
exit(1);
}

let binding = Path::new(&COMPONENT_DIRECTORY).join(path);
let parent = binding
let parent = path
.parent()
.expect("paths should have parents, where are you putting the component?");

Expand Down Expand Up @@ -155,12 +154,13 @@ fn update_module(path: &Path, root: bool) {
update_module(&path, false);
}

let component = Component::from(Path::new(&path));
let component_path = path.components().skip(2).collect::<PathBuf>();
let component = Component::from(Path::new(&component_path));
modules.push(component);
}

let components_mod = path.join("mod.rs");
let modules = unwrap_or_exit!(templates::Mod { modules, root }.render_once());
let modules = unwrap_or_exit!(templates::Mod { modules, root }.render_once()).replace("\n\n", "\n");

let existing_modules = if components_mod.is_file() {
unwrap_or_exit!(read_to_string(&components_mod))
Expand All @@ -179,6 +179,7 @@ fn update_module(path: &Path, root: bool) {

/// Check that the path has more Rust modules.
fn has_more_modules(path: &Path) -> bool {
let path = Path::new(COMPONENT_DIRECTORY).join(path);
debug!("checking if {} has more modules", path.display());

if !path.exists() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
<% if root { %>
mod component;
pub(crate) use component::{component, Component};

<% } %>

<% for component in modules.iter() { %>
// <%= component.full_path() %>
pub mod <%= component.name() %>;

<% if !component.is_node() { %>
pub use <%= component.name() %>::<%= component.rust_name() %>;
<% } %>
Expand Down
74 changes: 14 additions & 60 deletions pgml-dashboard/src/components/mod.rs
Original file line number Diff line number Diff line change
@@ -1,107 +1,61 @@
// This file is automatically generated.
// You shouldn't modify it manually.


mod component;
pub(crate) use component::{component, Component};




// src/components/src/components/breadcrumbs
// src/components/breadcrumbs
pub mod breadcrumbs;


pub use breadcrumbs::Breadcrumbs;


// src/components/src/components/confirm_modal
// src/components/confirm_modal
pub mod confirm_modal;


pub use confirm_modal::ConfirmModal;


// src/components/src/components/github_icon
// src/components/github_icon
pub mod github_icon;


pub use github_icon::GithubIcon;


// src/components/src/components/left_nav_menu
// src/components/left_nav_menu
pub mod left_nav_menu;


pub use left_nav_menu::LeftNavMenu;


// src/components/src/components/left_nav_web_app
// src/components/left_nav_web_app
pub mod left_nav_web_app;


pub use left_nav_web_app::LeftNavWebApp;


// src/components/src/components/modal
// src/components/modal
pub mod modal;


pub use modal::Modal;


// src/components/src/components/nav
// src/components/nav
pub mod nav;


pub use nav::Nav;


// src/components/src/components/nav_link
// src/components/nav_link
pub mod nav_link;


pub use nav_link::NavLink;


// src/components/src/components/navbar
// src/components/navbar
pub mod navbar;


pub use navbar::Navbar;


// src/components/src/components/navbar_web_app
// src/components/navbar_web_app
pub mod navbar_web_app;


pub use navbar_web_app::NavbarWebApp;


// src/components/src/components/postgres_logo
// src/components/postgres_logo
pub mod postgres_logo;


pub use postgres_logo::PostgresLogo;


// src/components/src/components/static_nav
// src/components/static_nav
pub mod static_nav;


pub use static_nav::StaticNav;


// src/components/src/components/static_nav_link
// src/components/static_nav_link
pub mod static_nav_link;


pub use static_nav_link::StaticNavLink;


// src/components/src/components/test_component
// src/components/test_component
pub mod test_component;


pub use test_component::TestComponent;

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy