diff --git a/docs-site/config.toml b/docs-site/config.toml index 14439ebeb..b89e754b6 100644 --- a/docs-site/config.toml +++ b/docs-site/config.toml @@ -68,64 +68,94 @@ weight = 20 [[extra.homepage.features]] name = "Models" -description = 'Empower the 1-person team. Service, data, emails, background jobs, tasks, CLI to drive it,everything is included.' +description = 'Model your business with rich entities and avoid writing SQL, backed by SeaORM. Build relations, validation and custom logic on your entities for the best maintainability.' example = '''```rust impl Model { pub async fn find_by_email( db: &DatabaseConnection, email: &str) -> ModelResult { - users::Entity::find().filter( - query::condition().eq(users::Column::Email, email).build() - ) - .one(db).await? - .ok_or_else(|| ModelError::EntityNotFound) + users::Entity::find().filter( + query::condition().eq(users::Column::Email, email).build() + ) + .one(db).await? + .ok_or_else(|| ModelError::EntityNotFound) + } + + pub async create_report(&self, ctx: &AppContext) -> Result<()>{ + ReportWorker::perform_later( + &ctx, + ReportArgs{ user_id: self.id } + ).await?; } } + ``` ''' [[extra.homepage.features]] name = "Controllers" -description = ' Empower the 1-person team. Service, data, emails, background jobs, tasks, CLI to drive it,everything is included.' +description = 'Handle Web requests parameters, body, validation, and render a response that is content-aware. We use Axum for the best performance, simplicity and extensibility.' example = '''```rust -pub async fn list(State(ctx): State) -> Result { - format::json(Entity::find().all(&ctx.db).await?) +pub async fn get_one( + Format(respond_to): Format, + Path(id): Path, + State(ctx): State, +) -> Result { + let res = notes::Entity::find_by_id(id).one(&ctx.db).await?; + match res { + Ok(item) => match respond_to { + RespondTo::Html => format::html(item_view(&item)), + _ => format::json(item), + }, + Err(err) => Err(err), + } } pub fn routes() -> Routes { - Routes::new() - .prefix("users") - .add("/", get(list)) + Routes::new() + .prefix("notes") + .add("/:id", get(get_one)) } - - - ``` ''' [[extra.homepage.features]] name = "Views" -description = ' Empower the 1-person team. Service, data, emails, background jobs, tasks, CLI to drive it,everything is included.' +description = 'Use server-rendered templates with Tera or JSON. Loco can render views on the server or work with a frontend app seamlessly. Configure your fullstack set up any way you like.' example = '''```rust -pub fn home(v: &impl ViewRenderer) -> Result { - format::render().view(v, "home/hello.html", json!({})) -} +// Literals +format::text("Loco") + +// Tera view engine +format::render().view(v, "home/hello.html", json!({})) +// strongly typed JSON responsed, backed by `serde` +format::json(Health { ok: true }) + +// Etags, cookies, and more +format::render().etag("loco-etag")?.empty() ``` ''' [[extra.homepage.features]] name = "Background Jobs" -description = ' Empower the 1-person team. Service, data, emails, background jobs, tasks, CLI to drive it,everything is included.' +description = 'Perform compute or I/O intensive jobs in the background with a Redis backed queue, or with threads. Implementing a worker is as simple as implementing a perform function for the Worker trait.' example = '''```rust -pub fn routes() -> Routes { - Routes::new() - .prefix("guide") - .add("/", get(hello)) - .add("/echo", post(echo)) +impl worker::Worker for DownloadWorker { + async fn perform(&self, args: DownloadArgs) -> worker::Result<()> { + println!("Creating users report. Requested by {}", args.user_guid); + let all = users::Entity::find() + .all(&self.ctx.db) + .await + .map_err(Box::from)?; + for user in &all { + println!("user: {}", user.id); + } + Ok(()) + } } ``` ''' diff --git a/docs-site/static/header.svg b/docs-site/static/header.svg index 1aa812ce1..0a7864c55 100644 --- a/docs-site/static/header.svg +++ b/docs-site/static/header.svg @@ -1,17 +1,18 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/docs-site/static/styles/styles.css b/docs-site/static/styles/styles.css index 1891ad87c..ffa48e0b2 100644 --- a/docs-site/static/styles/styles.css +++ b/docs-site/static/styles/styles.css @@ -449,7 +449,7 @@ video { :root { --background: #ffffff; --background-secondary: #5F456B; - --foreground: #333; + --foreground: #1d1d1f; --primary: #D45546; --border: #3A3A54; --card: #1D1D2A; @@ -975,7 +975,7 @@ a.active { .prose { --tw-prose-body: #374151; - --tw-prose-headings: #111827; + --tw-prose-headings: var(--foreground); --tw-prose-lead: #4b5563; --tw-prose-links: #111827; --tw-prose-bold: #111827; @@ -1229,6 +1229,11 @@ a.active { margin-bottom: 0.75rem; } +.my-5 { + margin-top: 1.25rem; + margin-bottom: 1.25rem; +} + .-ml-2 { margin-left: -0.5rem; } @@ -1249,6 +1254,14 @@ a.active { margin-bottom: 2.5rem; } +.mb-20 { + margin-bottom: 5rem; +} + +.mb-3 { + margin-bottom: 0.75rem; +} + .mb-4 { margin-bottom: 1rem; } @@ -1285,10 +1298,6 @@ a.active { margin-top: -60px; } -.mb-8 { - margin-bottom: 2rem; -} - .block { display: block; } @@ -1501,6 +1510,10 @@ a.active { background-color: var(--card); } +.bg-inherit { + background-color: inherit; +} + .bg-transparent { background-color: transparent; } @@ -1561,11 +1574,6 @@ a.active { padding-bottom: 0.5rem; } -.py-5 { - padding-top: 1.25rem; - padding-bottom: 1.25rem; -} - .py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; @@ -1608,6 +1616,10 @@ a.active { padding-top: 2rem; } +.pb-12 { + padding-bottom: 3rem; +} + .text-left { text-align: left; } @@ -1616,6 +1628,11 @@ a.active { text-align: center; } +.text-2xl { + font-size: 1.5rem; + line-height: 2rem; +} + .text-3xl { font-size: 1.875rem; line-height: 2.25rem; @@ -1636,6 +1653,11 @@ a.active { line-height: 1.25rem; } +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} + .font-bold { font-weight: 700; } @@ -1656,6 +1678,10 @@ a.active { letter-spacing: -0.025em; } +.text-background { + color: var(--background); +} + .text-black { --tw-text-opacity: 1; color: rgb(0 0 0 / var(--tw-text-opacity)); @@ -1669,9 +1695,33 @@ a.active { color: var(--foreground); } -.text-red-500 { +.text-green-400 { --tw-text-opacity: 1; - color: rgb(239 68 68 / var(--tw-text-opacity)); + color: rgb(74 222 128 / var(--tw-text-opacity)); +} + +.text-inherit { + color: inherit; +} + +.text-red-100 { + --tw-text-opacity: 1; + color: rgb(254 226 226 / var(--tw-text-opacity)); +} + +.text-red-400 { + --tw-text-opacity: 1; + color: rgb(248 113 113 / var(--tw-text-opacity)); +} + +.text-yellow-400 { + --tw-text-opacity: 1; + color: rgb(250 204 21 / var(--tw-text-opacity)); +} + +.text-yellow-500 { + --tw-text-opacity: 1; + color: rgb(234 179 8 / var(--tw-text-opacity)); } .placeholder-white::-moz-placeholder { @@ -1714,12 +1764,6 @@ a.active { box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); } -.shadow-2xl { - --tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); - --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - .backdrop-blur { --tw-backdrop-blur: blur(8px); -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia); @@ -1769,6 +1813,23 @@ a.active { h2 { margin-top: 0px; } + pre { + margin-top: 0px; + margin-bottom: 0px; + } +} + +.footer-links { + a { + margin-left: 0.5rem; + margin-right: 0.5rem; + } + a { + color: var(--background); + } + a { + text-decoration-line: none; + } } .fatbtn { diff --git a/docs-site/static/syntax-theme-light.css b/docs-site/static/syntax-theme-light.css index 25973b848..e0a5f30a8 100644 --- a/docs-site/static/syntax-theme-light.css +++ b/docs-site/static/syntax-theme-light.css @@ -6,7 +6,7 @@ color: #383a42; background-color: #fafafa; border: 1px solid #e0e0e0; - overflow: scroll; + overflow: auto; } .z-comment { diff --git a/docs-site/styles/styles.css b/docs-site/styles/styles.css index 971c249dc..1c8205d1d 100644 --- a/docs-site/styles/styles.css +++ b/docs-site/styles/styles.css @@ -8,7 +8,7 @@ --background: #ffffff; --background-secondary: #5F456B; - --foreground: #333; + --foreground: #1d1d1f; --primary: #D45546; --border: #3A3A54; @@ -49,14 +49,20 @@ @apply text-6xl; @apply mb-8; letter-spacing: -0.05em; - } h2 { @apply text-3xl font-light; @apply mt-0; } + pre { + @apply my-0; + } +} +.footer-links { + a { + @apply no-underline text-background mx-2; + } } - .fatbtn { @apply no-underline text-lg font-semibold text-foreground bg-background rounded-sm px-8 py-3; } diff --git a/docs-site/tailwind.config.js b/docs-site/tailwind.config.js index 214ec2dee..6102f82d7 100644 --- a/docs-site/tailwind.config.js +++ b/docs-site/tailwind.config.js @@ -6,6 +6,14 @@ module.exports = { content: ["./themes/**/*.html", "./templates/**/*.html", "./content/**/*.md"], theme: { extend: { + typography: ({ theme }) => ({ + DEFAULT: { + // this is for prose class + css: { + "--tw-prose-headings": theme("colors.foreground"), + }, + }, + }), spacing: {}, colors: { background: "var(--background)", diff --git a/docs-site/templates/index.html b/docs-site/templates/index.html index e08fced16..37bf02eb1 100644 --- a/docs-site/templates/index.html +++ b/docs-site/templates/index.html @@ -30,7 +30,7 @@ -
+

It’s Like Ruby on Rails, but for Rust. @@ -50,7 +50,7 @@

-
+

It’s time to make Rust your super-power. @@ -65,10 +65,10 @@

-
$ cargo loco generate scaffold post title:string content:text
added: "src/controllers/post.rs" +
$ cargo loco generate scaffold post title:string content:text
added: "src/controllers/post.rs" injected: "src/controllers/mod.rs" injected: "src/app.rs" -...
$ cargo loco start
+...
$ cargo loco start
▄ ▀ ▀ ▄ @@ -86,14 +86,13 @@

▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ https://loco.rs

-environment: development - database: automigrate - logger: disabled -compilation: debug - modes: server - -listening on localhost:5150 -
+environment: development + database: automigrate + logger: disabled +compilation: debug + modes: server + +
listening on localhost:5150
@@ -112,7 +111,7 @@

-
+

Enjoy that sweet & effortless Rust performance @@ -156,12 +155,11 @@

{{ val.example | markdown(inline=true) | safe }}

-

+

{{ val.name }}

-

- Empower the 1-person team. Service, data, emails, background jobs, tasks, CLI to drive it, - everything is included. +

+ {{val.description | safe}}

{% endfor %} @@ -171,7 +169,27 @@

- +
{% endblock content %}