GithubHelp home page GithubHelp logo

lemmynet / lemmy-ui-leptos Goto Github PK

View Code? Open in Web Editor NEW
108.0 108.0 10.0 1006 KB

License: GNU Affero General Public License v3.0

TypeScript 9.00% Shell 1.11% CSS 0.07% Rust 88.08% JavaScript 0.57% Dockerfile 1.17%

lemmy-ui-leptos's People

Contributors

baptistemontan avatar dessalines avatar jim-taylor-business avatar nothing4you avatar renovate[bot] avatar sleeplessone1917 avatar sunaurus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lemmy-ui-leptos's Issues

Easier to reason about src file hierarchy

Opening an issue from this discussion as promised.

Proposed file hierarchy

  • src
    • lib.rs
    • main.rs
    • constants.rs
    • host.rs
    • cookie_middleware.rs
    • routes.rs
    • routes
      • home.rs
      • home
        • home_page.rs
      • login.rs
      • login
        • login_page.rs
        • login_form.rs
      • post.rs
      • post
        • post_page.rs
        • get_post.rs
    • layouts.rs
    • layouts
      • base_layout.rs
      • filter_bar_layout
    • contexts.rs
    • contexts
      • site_context.rs
      • theme_context.rs
    • common.rs
    • common
      • components.rs
      • components
        • icon.rs
        • text_input.rs
        • unpack.rs
      • serverfns.rs
      • serverfns
        • list_comments.rs
        • list_posts.rs
    • utils.rs
    • utils
      • derive_query_signal.rs
      • types.rs

Digest

For simplicity, I didn't list every file that exists in the project. Some things to call out:

  • Uses newer, more idiomatic style of declaring modules. Refer to this blurb from the Rust book. This should make it easier to find module styles since there won't be a bunch of files all names mod.rs strewn throughout the codebase.
  • Routes keep modules that are only related to what a given route/page as siblings (e.g. login_form.rs and get_post.rs, a component and serverfn respectively, listed above)
  • Went with "Page" as a suffix instead of "Activity". Not a diehard on this change, but I'm unfamiliar with the convention of calling these "activities" instead of "pages", which threw me off at first.

Things to hash out

There are some things I'm still not sure of in this suggestion. For example, in this hierarchy, several serverfns (e.g. vote, save, etc.) are only relevant to one or a few components (vote buttons, content actions). It arguably makes more sense to colocate these with the relevant components instead of throwing them in the common serverfns directory. A similar case can be made for colocating the navbars and the logout serverfn with the BaseLayout since they're only ever used there. If we did do this approach, I could see a hierarchy like:

  • layouts
    • base_layout.rs
    • base_layout
      • base_layout.rs
      • logout.rs
      • top_nav.rs
      • bottom_nav.rs

Or perhaps:

  • layouts
    • base_layout.rs
    • base_layout
      • base_layout.rs
      • serverfns.rs
      • serverfns
        • logout.rs
      • components.rs
      • components
        • top_nav.rs
        • bottom_nav.rs

Thoughts?

Add dependency on lemmy-client

Now that there is a rust library specifically for making requests for lemmy, it makes sense to shift to using that instead of the hand-spun one currently used in this repo.

Homepage as close as possible to lemmy-ui homepage in functionality

Hello! I've been learning Rust for the last couple of years and just so happen to have used Leptos in my last personal project.

My background is in decades of web development of all types so I would very much like to contribute to Lemmy, specifically the new Leptos UI to start.

I have already been working on my own branch for a week or so to get familiar with the code base and dev environment. Things are going fine!

I was wondering how work pieces are managed in the project and it seemed sensible to start with an Issue to indicate that I would like to work on a part of the new app so that other people also working on the app can organize themselves with that in mind.

I've been working on bringing the Leptos homepage up to the function and graphic design of the current UI but using the SSR and hydration of Leptos and the widgets and tools of Daisy and Tailwind.

I'm happy to carry on with this and it would be great to have the blessing of the team. I'm also totally happy to move on to another part of the app or just collaborate and help with work other people have already started.

Is leptos the right choice for the UI rewrite?

@phiresky mentioned in the maintainer chat that he has concerns about using leptos for the UI repo. While I think leptos is definitely a step up from inferno, I have my own concerns about it. To spur discussion, I'll make some pros/cons lists for leptos, solidjs with solid start (my first choice of leptos alternative), and nextjs (popular fullstack framework with many compatible libraries).

Leptos

Pros

  • Lets devs make UIs in rust, an incredible and ergonomic language.
  • Lightning fast
  • WASM bundle for whole app sent to browser on first load, making client-side page changes very fast
  • Great support for progressive enhancement and graceful degradation

Cons

  • Rust's high learning curve will make it harder for many devs to contribute, especially frontend devs who are less likely to have used the language
  • Very limited ecosystem; many useful libraries are maintained by only one person with few commits and seem likely to be no longer actively developed
  • Documentation and other supplementary information is fairly limited
  • All of the WASM being sent on first load could make first load time slower

SolidJS/Solid Start

Pros

  • Performance on par with (and sometimes even better than) leptos
  • Small bundle size
  • Excellent tutorial
  • Support for progressive enhancement/graceful degradation on par with leptos
  • Semi-decent ecosystem compared to leptos
  • React-like without many of react's footguns

Cons

  • Relatively unused compared to other frameworks
  • Solid Start is still in beta and will probably have bugs not present in other frameworks
  • Ecosystem smaller than other fontend/fullstack frameworks like react, angular, and vue
  • Supplementary learning materials outside of the official tutorial and docs sparse

NextJS

Pros

  • Uses react, which is known by many frontend developers
  • Batteries included(ish, at least compared to the other frameworks listed here).
  • Very large ecosystem of compatible libraries that can be used.
  • Easy to find supplementary learning materials compared to the other frameworks listed

Cons

  • Uses react, with all the bloat and footguns it entails
  • Support for progressive enhancement/graceful degradation lacking compared to leptos and solid start

This list was made off the top of my head from my experience working with these frameworks. I'm likely forgetting to include other useful information about them. Then, of course, there are many other frameworks to choose from (I'd say too many). I've heard svelte/sveltekit is both nice to develop with and fairly performant, although I have no first hand experience with it.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update dependency @types/node to v20.14.5
  • Update dessalines/lemmy Docker tag to v0.19.4
  • Update pnpm to v9.4.0

Detected dependencies

cargo
Cargo.toml
  • leptos 0.6
  • leptos_meta 0.6
  • leptos_router 0.6
  • leptos_i18n 0
  • cfg-if 1
  • lemmy-client 1.0.0
  • serde 1
  • serde_json 1
  • wasm-bindgen 0.2
  • console_error_panic_hook 0
  • leptos_actix 0.6
  • actix-files 0
  • actix-web 4
  • actix-session 0.9
  • tokio 1.37
  • strum 0.26.2
  • trait-set 0.3.0
  • leptos-use 0.10.10
  • si_format 0.1.1
docker-compose
docker/docker-compose.yml
  • nginx 1-alpine
  • dessalines/lemmy 0.19.0-beta.7
  • asonix/pictrs 0.5.0-rc.2
  • postgres 16-alpine
end2end/docker-compose.yml
  • dessalines/lemmy 0.19.4-rc.5
  • asonix/pictrs 0.5.16
  • postgres 16-alpine
dockerfile
Dockerfile
npm
end2end/package.json
  • @playwright/test ^1.44.1
  • @types/node ^20.13.0
  • typescript ^5.4.5
package.json
  • daisyui ^4.12.2
  • prettier ^3.3.2
  • tailwindcss ^3.4.4
  • pnpm 9.3.0+sha512.ee7b93e0c2bd11409c6424f92b866f31d3ea1bef5fbe47d3c7500cdc3c9668833d2e55681ad66df5b640c61fa9dc25d546efa54d76d7f8bf54b13614ac293631
woodpecker
.woodpecker.yml
  • tmknom/prettier 3.2.5
  • tamasfe/taplo 0.8.1
  • postgres 16-alpine
  • dessalines/lemmy 0.19.4-beta.7
  • alpine 3
  • alpine 3

  • Check this box to trigger a request for Renovate to run again on this repository

Issue with new lemmy_client

@SleeplessOne1917 @dessalines

i was unable to get the new lemmy client to make any successful request apart from the home page content (list_posts) on the server side only.

i noticed the home page content has been commented out completely so i assume this was a known issue.

i have left all the code there and only added some prototype code to add the authentication header.

Discussion: Is there a point to keeping the gloo-net client?

Currently, the LemmyClient trait is implemented for both the awc client and a placeholder Fetch struct which uses gloo-net. I take it that the point of the browser client is to be able to make requests from the browser when needed. However, with Leptos's server function feature, I question if this is necessary: browser-side calls of server functions use a stub that uses the browser's native fetch API. With this in mind, is there a reason to keep this logic? Stripping it would make the client implementation much simpler.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.