hook up updates + more styles

This commit is contained in:
Nate 2021-09-16 17:12:24 -04:00
parent eb32675652
commit 18fd689177
5 changed files with 98 additions and 61 deletions

View file

@ -1,15 +1,55 @@
use crate::{AppState, Request, RequestExt};
use crate::{
auth::RequestExt as _, github::Release, AppState, LayoutData, Request, RequestExt as _,
};
use comrak::ComrakOptions;
use serde::{Serialize};
use std::sync::Arc;
use tide::http::mime;
use tide::{http::mime};
pub fn add_routes(updates: &mut tide::Server<Arc<AppState>>) {
updates.at("/updates").get(get_updates);
}
async fn get_updates(mut request: Request) -> tide::Result {
let data = request.layout_data().await?;
#[derive(Serialize)]
struct UpdatesData {
#[serde(flatten)]
layout: Arc<LayoutData>,
releases: Option<Vec<Release>>,
}
let mut data = UpdatesData {
layout: request.layout_data().await?,
releases: None,
};
if let Some(user) = request.current_user().await? {
if user.is_insider {
data.releases = Some(
request
.state()
.repo_client
.releases()
.await?
.into_iter()
.filter_map(|mut release| {
if release.draft {
None
} else {
let mut options = ComrakOptions::default();
options.render.unsafe_ = true; // Allow raw HTML in the markup. We control these release notes anyway.
release.body = comrak::markdown_to_html(&release.body, &options);
Some(release)
}
})
.collect(),
);
}
}
Ok(tide::Response::builder(200)
.body(request.state().render_template("updates.hbs", &data)?)
.content_type(mime::HTML)
.build())
}
}

View file

@ -1,6 +1,6 @@
{{#> layout }}
<div class="container mx-auto max-w-screen-md text-main p-10 pt-20">
<div class="max-w-screen-md text-main font-extralight p-20">
<h1 class="text-white text-4xl font-display font-extralight mb-10">Meet Zed&mdash;A lightning fast code editor written natively in Rust.</h1>
<p class="leading-7">
Level up your development process with:
@ -11,8 +11,14 @@
<li>the ability to rewind time to any point</li>
</ul>
</p>
<p class="mt-5 leading-7">Early access to Zed will open up mid-2022 for small teams and individuals. Be the <a href="/community" class="underline">first to know</a>.</p>
<p class="mt-5 leading-7">Read <a href="/story>" class="underline">our story</a>.</p>
<p class="mt-5 leading-7">Early access to Zed will open up mid-2022 for small teams and individuals.</p>
<a href="/community" class="underline inline-block border border-white mt-10 mb-10 p-5">Be the first to know.</a>
<h2 class="text-white font-display font-extralight mt-20">We started Zed for ourselves&mdash;To bring joy back to writing code every day.</h1>
<p class="mt-5 leading-7">Modern text editors have forgotten the core tentants of software speed and reliability first, features second.</p>
<p class="mt-5 leading-7">While we are building Zed from the ground up built for collaboration, we are putting in the time to ensure every feature we build is performant and rock solid.</p>
<p class="mt-5 leading-7">New software tends to overpromise and underdeliver&mdash;Our goal with Zed is to start small and impress with a singular focus on developer experience.</p>
<a href="/story" class="underline inline-block border border-white mt-10 mb-10 p-5">Read our story.</a>
</div>
{{/layout}}

View file

@ -22,9 +22,9 @@
</script>
</head>
<body class="box-border font-body text-main font-light bg-black flex w-full h-full overflow-hidden">
<main class="container mx-auto max-w-screen-2xl flex text-gray-50">
<nav class="flex-initial flex flex-col w-1/5 p-10 pt-20 font-extralight border-r border-white">
<body class="box-border font-body text-main font-light bg-black">
<main class="container mx-auto max-w-screen-2xl min-h-full grid grid-cols-4 gap-x-px bg-white text-gray-50">
<nav class="flex flex-col p-10 pt-20 bg-black font-extralight">
<a href="/" class="font-display">
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="path-2-inside-1" fill="white">
@ -64,21 +64,19 @@
<!-- AND If user is an admin -->
{{#if current_user.is_admin }}
<div class="font-mono flex flex-col mt-10">
<a href="/admin" class="text-base lowercase no-underline hover:underline mt-2">
Admin
</a>
</div>
<div class="font-mono flex flex-col mt-10">
<p class="text-xs tracking-widest uppercase">Admin Zone</p>
<a href="/admin" class="inline-block text-base lowercase no-underline hover:underline mt-2">
Admin
</a>
</div>
{{/if}}
<div class="flex-1"></div>
<div class="relative">
<div class="mt-10">
<!-- TODO: Dropdown is linked to #avatar, just using it for now. Come back and clean up later -->
<p id="avatar" class="text-base lowercase no-underline hover:underline mt-2">@{{current_user.github_login}}</p>
<form id="sign_out" action="/sign_out" method="post"
class="hidden absolute mt-1 -top-10 left-0 bg-black border border-white text-center text-sm p-2 px-4 whitespace-nowrap">
<button class="hover:underline">Sign out</button>
<p id="avatar" class="text-base lowercase no-underline hover:underline">@{{current_user.github_login}}</p>
<form id="sign_out" action="/sign_out" method="post">
<button class="text-base text-gray-400 lowercase no-underline hover:underline mt-2">Sign out</button>
</form>
</div>
@ -91,7 +89,7 @@
{{/if}}
</nav>
<div class="flex-1 max-w-screen-xl overflow-y-auto">
<div class="bg-black col-span-3">
{{> @partial-block}}
</div>
</main>

View file

@ -1,19 +1,19 @@
{{#> layout }}
<div class="container mx-auto max-w-screen-md text-main p-10 pt-20">
<h1 class="hidden text-4xl font-display font-extralight mb-10">The Team</h1>
<article>
<h2 class="font-display font-extralight">Nathan Sobo</h2>
<p class="mt-4 leading-7">Nathan joined GitHub in late 2011 to build the <a href="https://atom.io" class="underline">Atom text editor</a>, and he led the Atom team until 2018.</p>
<p class="mt-4 leading-7">He also co-led development of <a href="https://teletype.atom.io" class="underline">Teletype for Atom</a>, pioneering one of the first production uses of conflict-free replicated data types for collaborative text editing.</p>
<p class="mt-4 leading-7">He's been dreaming about building the worlds best text editor since he graduated from college, and is excited to finally have the knowledge, tools, and resources to achieve this vision.</p>
<div class="text-sm font-extralight grid grid-cols-2 gap-px bg-white border-r border-white">
<article class="bg-black p-10 pt-20">
<div class="content">
<h3 class="font-display font-extralight">Nathan Sobo</h3>
<p class="mt-4 leading-7">Nathan joined GitHub in late 2011 to build the <a href="https://atom.io" class="underline">Atom text editor</a>, and he led the Atom team until 2018.</p>
<p class="mt-4 leading-7">He also co-led development of <a href="https://teletype.atom.io" class="underline">Teletype for Atom</a>, pioneering one of the first production uses of conflict-free replicated data types for collaborative text editing.</p>
<p class="mt-4 leading-7">He's been dreaming about building the worlds best text editor since he graduated from college, and is excited to finally have the knowledge, tools, and resources to achieve this vision.</p>
</div>
</article>
<article>
<h2 class="font-display font-extralight mt-10">Antonio Scandurra</h2>
<article class="bg-black p-10 pt-20">
<h3 class="font-display font-extralight">Antonio Scandurra</h3>
<p class="mt-4 leading-7">Antonio joined the Atom team in 2014 while still in university after his outstanding open source contributions caught the attention of the team.</p>
<p class="mt-4 leading-7">He later joined Nathan in architecting <a href="https://teletype.atom.io" class="underline">Teletype for Atom</a> and researching the foundations of what has turned into Zed.</p>
@ -21,15 +21,17 @@
<p class="mt-4 leading-7">For the last two years, hes become an expert in distributed systems and conflict-free replicated data types through the development of a real-time, distributed, conflict-free database implemented in Rust for <a href="https://ditto.live" class="underline">Ditto</a>.</p>
</article>
<article>
<h2 class="font-display font-extralight mt-10">Max Brunsfeld</h2>
<p class="mt-4 leading-7">Max joined the Atom team in 2013 after working at Pivotal Labs. While driving Atom towards its 1.0 launch during the day, Max spent nights and weekends building <a href="https://tree-sitter.github.io" class="underline">Tree-sitter</a>, a blazing-fast and expressive incremental parsing framework that currently powers all code analysis at GitHub.</p>
<article class="bg-black p-10">
<h3 class="font-display font-extralight">Max Brunsfeld</h3>
<p class="mt-4 leading-7">Max joined the Atom team in 2013 after working at Pivotal Labs.</p>
<p class="mt-4 leading-7">While driving Atom towards its 1.0 launch during the day, Max spent nights and weekends building <a href="https://tree-sitter.github.io" class="underline">Tree-sitter</a>, a blazing-fast and expressive incremental parsing framework that currently powers all code analysis at GitHub.</p>
<p class="mt-4 leading-7">Before leaving to start Zed, Max helped GitHub's semantic analysis team integrate Tree-sitter to support syntax highlighting and code navigation on <a href="https://github.com" class="underline">github.com</a>.</p>
</article>
<article>
<h2 class="font-display font-extralight mt-10">Nate Butler</h2>
<article class="bg-black p-10">
<h3 class="font-display font-extralight">Nate Butler</h3>
<p class="mt-4 leading-7">wip</p>
</article>
</div>

View file

@ -1,30 +1,21 @@
{{#> layout }}
<div class="container mx-auto max-w-screen-md p-10 pt-20">
<h1 class="text-white text-4xl font-extralight mb-10">Updates</h1>
<div class="max-w-screen-lg mx-auto text-main font-extralight p-20">
{{#if releases}}
<div class="container mx-auto py-12 px-8 md:px-12">
{{#each releases}}
<div class="md:flex md:flex-row mb-32 md:mb-12">
<div class="font-display mb-8 md:mb-0 md:text-right w-48">
<div class="text-2xl font-bold whitespace-nowrap">
VERSION {{name}}
</div>
<a class="text-md underline text-yellow-600 hover:text-yellow-700"
href="/releases/{{tag_name}}/{{assets.0.name}}">
DOWNLOAD
</a>
</div>
<div
class="prose prose-lg xl:prose-xl border-t md:border-t-0 pt-8 md:border-l border-gray-400 md:ml-8 md:pl-8 md:pt-0 xl:ml-16 xl:pl-16 max-w-5xl font-body">
{{{body}}}
</div>
<h1 class="text-white text-4xl font-display font-extralight mb-10">Updates</h1>
{{#each releases}}
<article id="{{name}}" class="mb-20">
<h2 class="text-white font-display font-extralight">Zed {{name}}</h2>
<a class="underline mt-5 leading-7" href="/releases/{{tag_name}}/{{assets.0.name}}">Download</a>
<div class="mt-5">
{{{body}}}
</div>
{{/each}}
</div>
</article>
{{/each}}
{{else}}
<h1>Hey!</h1>
<p>You can't access this without <a href=" /sign_in">logging in</a>.</p>
{{/if}}