From 8753851001ce6e2d9257ce086ab9854c69bd97ac Mon Sep 17 00:00:00 2001 From: Christopher Biscardi Date: Mon, 26 Feb 2024 23:28:56 -0800 Subject: [PATCH] leptosfmt files --- src/app.rs | 4 +- src/app/routes/admin/image.rs | 69 ++++-- src/app/routes/admin/issue.rs | 113 +++++---- src/app/routes/admin/issues.rs | 4 +- src/app/routes/admin/showcase.rs | 116 ++++++--- src/app/routes/admin/showcase/id.rs | 368 +++++++++++++++++----------- src/app/routes/custom.rs | 4 +- src/app/routes/issue.rs | 154 ++++++------ 8 files changed, 499 insertions(+), 333 deletions(-) diff --git a/src/app.rs b/src/app.rs index 226456e..d2ac9c2 100644 --- a/src/app.rs +++ b/src/app.rs @@ -234,8 +234,8 @@ fn Wrapper(children: Children) -> impl IntoView { -
// -
+ // +
} } diff --git a/src/app/routes/admin/image.rs b/src/app/routes/admin/image.rs index 0f24f3c..b9c45bf 100644 --- a/src/app/routes/admin/image.rs +++ b/src/app/routes/admin/image.rs @@ -15,7 +15,10 @@ pub fn Image() -> impl IntoView {
-
} } @@ -295,20 +295,30 @@ fn Showcases() -> impl IntoView { ); view! { -
    - "Loading (Suspense Fallback)..."

    } - }> - {move || { - showcases.read().map(|data| match data { - Err(e) => view! {
    {e.to_string()}
    }.into_view(), - Ok(showcases) => showcases - .iter() - .map(|showcase| view! { }) - .collect_view() - }) - }} -
    +
      + "Loading (Suspense Fallback)..."

      } + }> + {move || { + showcases + .read() + .map(|data| match data { + Err(e) => view! {
      {e.to_string()}
      }.into_view(), + Ok(showcases) => { + showcases + .iter() + .map(|showcase| { + view! { } + }) + .collect_view() + } + }) + }} + +
    } } @@ -317,35 +327,48 @@ fn Showcases() -> impl IntoView { fn ShowcaseLi(showcase: ShowcaseData) -> impl IntoView { view! {
  • -
    -
    -

    - - - {showcase.title} - -

    - {showcase.posted_date.map(|posted_date| view! { -

    - "posted at" - -

    - })} -
    -
    -
    - - -
    -
  • +
    +
    +

    + + + {showcase.title} + +

    + {showcase + .posted_date + .map(|posted_date| { + view! { +

    + "posted at" + +

    + } + })} + +
    +
    +
    + + +
    + } } diff --git a/src/app/routes/admin/issues.rs b/src/app/routes/admin/issues.rs index 3acc462..c9c30c8 100644 --- a/src/app/routes/admin/issues.rs +++ b/src/app/routes/admin/issues.rs @@ -65,8 +65,8 @@ pub fn Issues() -> impl IntoView { > {&issue.display_name} -

    // -

    + // +

"trimmed description without markdown render" diff --git a/src/app/routes/admin/showcase.rs b/src/app/routes/admin/showcase.rs index 3d2e187..d12ad69 100644 --- a/src/app/routes/admin/showcase.rs +++ b/src/app/routes/admin/showcase.rs @@ -119,27 +119,47 @@ pub fn Showcase() -> impl IntoView { - "Loading (Suspense Fallback)..."

}> - {showcases.get().map(|data| match data { - (Err(e), Err(e2)) => view!{
{e.to_string()}
{e2.to_string()}
}, - (_, Err(e)) | (Err(e), _) => view!{
{e.to_string()}
}, - (Ok(showcases), Ok(issues)) => { - view! { -
-
    - - - -
+ "Loading (Suspense Fallback)..."

} + }> + {showcases + .get() + .map(|data| match data { + (Err(e), Err(e2)) => { + view! { +
+
{e.to_string()}
+
{e2.to_string()}
} } - } - )} + (_, Err(e)) | (Err(e), _) => { + view! { +
+
{e.to_string()}
+
+ } + } + (Ok(showcases), Ok(issues)) => { + view! { +
+
    + + + +
+
+ } + } + })} +
} @@ -151,28 +171,44 @@ fn AddShowcaseToIssueForm(showcase: ShowcaseData, issue_id: Option) -> i view! {
  • -
    -
    -

    {showcase.title}

    -
    -
    -

    posted on

    - - - - //

    Submitted by {showcase.submitted_by}

    -
    -
    - {issue_id.map(|issue_id| view!{ -
    - - - - - -
    - })} -
  • +
    +
    +

    {showcase.title}

    +
    +
    +

    + posted on + +

    + + + + //

    Submitted by {showcase.submitted_by}

    +
    +
    + {issue_id + .map(|issue_id| { + view! { +
    + + + + + +
    + } + })} + + } } diff --git a/src/app/routes/admin/showcase/id.rs b/src/app/routes/admin/showcase/id.rs index 874a7d6..2370ddf 100644 --- a/src/app/routes/admin/showcase/id.rs +++ b/src/app/routes/admin/showcase/id.rs @@ -66,110 +66,152 @@ pub fn Showcase() -> impl IntoView { view! {
    - "Loading Showcase"

    }> - {showcase.get().map(|data| match data { - Err(e) => view!{
    {e.to_string()}
    }, - Ok(None) => view!{
    {"Unable to find Showcase".to_string()}
    }, - Ok(Some(showcase)) => { - let showcase_id = showcase.id.clone(); - view! { -
    - -
    - - - -
    -
    - - -
    -
    - - -
    - -
    - -
    - -
    - -
    - -
    - -
      - - - -
    -
    - }} - }) - } + "Loading Showcase"

    } + }> + {showcase + .get() + .map(|data| match data { + Err(e) => { + view! { +
    +
    {e.to_string()}
    +
    + } + } + Ok(None) => { + view! { +
    +
    {"Unable to find Showcase".to_string()}
    +
    + } + } + Ok(Some(showcase)) => { + let showcase_id = showcase.id.clone(); + view! { +
    + +
    + + + +
    +
    + + +
    +
    + + +
    + +
    + +
    + +
    + +
    + +
    + +
      + + + +
    +
    + } + } + })} +
    - +
    } } @@ -378,27 +420,41 @@ fn Images(showcase_id: String) -> impl IntoView { let images = create_resource(move || {}, |_| fetch_images()); view! { - "Loading (Suspense Fallback)..."

    }> - { - let showcase_id = showcase_id.clone(); - - images.get().map(move |data| match (showcase_id, data) { - (_, Err(e)) => view!{
    {e.to_string()}
    }.into_view(), - (showcase_id, Ok(images)) => { - view! { -
      - - - -
    - }.into_view() - } - }) + "Loading (Suspense Fallback)..."

    } + }> + + { + let showcase_id = showcase_id.clone(); + images + .get() + .map(move |data| match (showcase_id, data) { + (_, Err(e)) => view! {
    {e.to_string()}
    }.into_view(), + (showcase_id, Ok(images)) => { + view! { +
      + + + +
    + } + .into_view() + } + }) } +
    } } @@ -410,21 +466,29 @@ fn ShowcaseImageLi(showcase_id: String, id: String, url: String) -> impl IntoVie view! {
  • - - + +
    -

    {&id}

    +

    + {&id} +

    //

    {description}

    - - - - - + + + + +
  • } } @@ -436,21 +500,29 @@ fn ImageLi(showcase_id: String, id: String, url: String, description: String) -> view! {
  • - - + +
    -

    {&id}

    +

    + {&id} +

    {description}

    - - - - - + + + + +
  • } } diff --git a/src/app/routes/custom.rs b/src/app/routes/custom.rs index bbe1693..69c3e0a 100644 --- a/src/app/routes/custom.rs +++ b/src/app/routes/custom.rs @@ -223,8 +223,8 @@ pub fn Issue() -> impl IntoView {

    {issue.as_ref().unwrap().title.clone()}

    -

    // /> "2024-02-11" diff --git a/src/app/routes/issue.rs b/src/app/routes/issue.rs index 4f00e70..2ccb571 100644 --- a/src/app/routes/issue.rs +++ b/src/app/routes/issue.rs @@ -317,9 +317,8 @@ pub fn Issue() -> impl IntoView {

    {issue.title.clone()}

    -

    - {issue.issue_date.to_string()} +

    + {issue.issue_date.to_string()}

    @@ -339,11 +338,7 @@ pub fn Issue() -> impl IntoView { .showcases .into_iter() .map(|showcase| { - view! { - - } + view! { } }) .collect::>()} //

    Crates

    @@ -370,25 +365,25 @@ pub fn Issue() -> impl IntoView { //

    Education

    // //

    - // Pull Requests Merged this week + // Pull Requests Merged this week //

    //
      - // {merged_pull_requests - // .expect("") - // .iter() - // .map(|pull_request| { - // view! { - // - // } - // }) - // .collect::>()} + // {merged_pull_requests + // .expect("") + // .iter() + // .map(|pull_request| { + // view! { + // + // } + // }) + // .collect::>()} //
    @@ -408,42 +403,40 @@ pub fn Issue() -> impl IntoView { Pull Requests Opened this week
      - - // {opened_pull_requests - // .expect("") - // .iter() - // .map(|pull_request| { - // view! { - // - // } - // }) - // .collect::>()} + // {opened_pull_requests + // .expect("") + // .iter() + // .map(|pull_request| { + // view! { + // + // } + // }) + // .collect::>()}

    Issues Opened this week

      - - // {opened_issues - // .expect("") - // .iter() - // .map(|issue| { - // view! { - // - // } - // }) - // .collect::>()} + // {opened_issues + // .expect("") + // .iter() + // .map(|issue| { + // view! { + // + // } + // }) + // .collect::>()}
    @@ -608,13 +601,15 @@ fn ShowcaseView(showcase: Showcase) -> impl IntoView { let mut it = showcase.images.iter(); let first_image = it.next(); view! { - {first_image.map(|image| { - view!{ - - &image.description/ - - } - })} + {first_image + .map(|image| { + view! { + + &image.description/ + + } + })} +
      impl IntoView {
    -

    {showcase.title}

    - {showcase.discord_url.is_empty().not().then_some(view!{ - - discord - - - - -} -)} +

    {showcase.title}

    + {showcase + .discord_url + .is_empty() + .not() + .then_some( + view! { + + discord + + + + + }, + )}