From 89dda36194e61fdcaea5d56f60e4b73d5c1e7da6 Mon Sep 17 00:00:00 2001 From: Alex Ren <41168529+qcoral@users.noreply.github.com> Date: Mon, 12 May 2025 19:06:09 -0400 Subject: [PATCH] added advanced page routing, updated some visuals on topbar, updated some content --- Gemfile.lock | 2 +- app/assets/stylesheets/markdown.css | 9 ++- app/controllers/advanced_controller.rb | 32 ++++++++++ app/controllers/docs_controller.rb | 0 app/helpers/docs_helper.rb | 0 app/views/advanced/_sidebar.html.erb | 15 +++++ .../project_guidelines.md | 0 app/views/advanced/show.html.erb | 4 ++ app/views/{overview => advanced}/submit.md | 6 +- app/views/docs/api/overview.md | 0 app/views/docs/guides/index.md | 0 app/views/docs/guides/setup/index.md | 0 app/views/docs/show.html.erb | 0 app/views/layouts/advanced.html.erb | 42 ++++++++++++++ app/views/layouts/docs.html.erb | 0 app/views/overview/getting_started.md | 42 -------------- app/views/overview/overview.md | 58 +++++++++++++++++++ app/views/overview/undercity.md | 11 ++++ app/views/shared/_topbar.html.erb | 6 +- config/routes.rb | 2 + 20 files changed, 176 insertions(+), 53 deletions(-) create mode 100644 app/controllers/advanced_controller.rb create mode 100644 app/controllers/docs_controller.rb create mode 100644 app/helpers/docs_helper.rb create mode 100644 app/views/advanced/_sidebar.html.erb rename app/views/{overview => advanced}/project_guidelines.md (100%) create mode 100644 app/views/advanced/show.html.erb rename app/views/{overview => advanced}/submit.md (93%) create mode 100644 app/views/docs/api/overview.md create mode 100644 app/views/docs/guides/index.md create mode 100644 app/views/docs/guides/setup/index.md create mode 100644 app/views/docs/show.html.erb create mode 100644 app/views/layouts/advanced.html.erb create mode 100644 app/views/layouts/docs.html.erb delete mode 100644 app/views/overview/getting_started.md create mode 100644 app/views/overview/overview.md create mode 100644 app/views/overview/undercity.md diff --git a/Gemfile.lock b/Gemfile.lock index d01d20f..b136327 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -473,4 +473,4 @@ DEPENDENCIES web-console BUNDLED WITH - 2.6.7 \ No newline at end of file + 2.6.7 diff --git a/app/assets/stylesheets/markdown.css b/app/assets/stylesheets/markdown.css index fccf464..5fb504a 100644 --- a/app/assets/stylesheets/markdown.css +++ b/app/assets/stylesheets/markdown.css @@ -1,6 +1,6 @@ .markdown-content { line-height: 1.5; - color: #C7C2CF; + color: #dedae3; } .markdown-content h1 { @@ -99,4 +99,9 @@ div.markdown p:last-child { color: #52c0ff; text-decoration: none; text-decoration: underline wavy; -} \ No newline at end of file +} + +.markdown-content strong { + font-weight: bold; + color: #f583e4; +} diff --git a/app/controllers/advanced_controller.rb b/app/controllers/advanced_controller.rb new file mode 100644 index 0000000..0cf13ed --- /dev/null +++ b/app/controllers/advanced_controller.rb @@ -0,0 +1,32 @@ +class AdvancedController < ApplicationController + def show + # Get the requested page from the URL + page = params[:page] + + # Sanitize the page parameter to prevent directory traversal + sanitized_page = sanitize_page(page) + + # Build the file path for the Markdown file in the advanced folder + file_path = Rails.root.join("app", "views", "advanced", "#{sanitized_page}.md") + + # Check if the file exists + if File.exist?(file_path) + # Read and render the Markdown file + markdown = File.read(file_path) + renderer = Redcarpet::Markdown.new(Redcarpet::Render::HTML, extensions = {}) + @content = renderer.render(markdown) + render layout: "advanced" + else + # Render a 404 page if the file doesn't exist + render plain: "Page not found", status: :not_found + end + end + + private + + # Sanitize the page parameter to prevent directory traversal + def sanitize_page(page) + # Allow only alphanumeric characters, dashes, and underscores + page.gsub(/[^a-zA-Z0-9_-]/, "") + end +end diff --git a/app/controllers/docs_controller.rb b/app/controllers/docs_controller.rb new file mode 100644 index 0000000..e69de29 diff --git a/app/helpers/docs_helper.rb b/app/helpers/docs_helper.rb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/advanced/_sidebar.html.erb b/app/views/advanced/_sidebar.html.erb new file mode 100644 index 0000000..446b6f7 --- /dev/null +++ b/app/views/advanced/_sidebar.html.erb @@ -0,0 +1,15 @@ +
+
+
+ <%# link_to "Projects", projects_path, class: "#{current_page?(projects_path) ? 'bg-[#564CAD]' : 'hover:bg-[#564CAD]'} bg-[#2E2A54] p-2 rounded transition duration-100 block" %> + <%= link_to "asdf", advanced_page_path("getting_started"), class: "#{current_page?(advanced_page_path("getting_started")) ? 'bg-[#564CAD]' : 'hover:bg-[#564CAD]'} bg-[#2E2A54] p-2 rounded transition duration-100 block" %> + <%= link_to "Invite to Undercity", advanced_page_path("points"), class: "#{current_page?(advanced_page_path("points")) ? 'bg-[#564CAD]' : 'hover:bg-[#564CAD]'} bg-[#2E2A54] p-2 rounded transition duration-100 block" %> + <%= link_to "Project guidelines", advanced_page_path("project_guidelines"), class: "#{current_page?(advanced_page_path("project_guidelines")) ? 'bg-[#564CAD]' : 'hover:bg-[#564CAD]'} bg-[#2E2A54] p-2 rounded transition duration-100 block" %> + <%= link_to "How to submit", advanced_page_path("submit"), class: "#{current_page?(advanced_page_path("submit")) ? 'bg-[#564CAD]' : 'hover:bg-[#564CAD]'} bg-[#2E2A54] p-2 rounded transition duration-100 block" %> +
+ +
+
+ + + diff --git a/app/views/overview/project_guidelines.md b/app/views/advanced/project_guidelines.md similarity index 100% rename from app/views/overview/project_guidelines.md rename to app/views/advanced/project_guidelines.md diff --git a/app/views/advanced/show.html.erb b/app/views/advanced/show.html.erb new file mode 100644 index 0000000..d6fab2c --- /dev/null +++ b/app/views/advanced/show.html.erb @@ -0,0 +1,4 @@ +
+ <%= raw @content %> +
+ diff --git a/app/views/overview/submit.md b/app/views/advanced/submit.md similarity index 93% rename from app/views/overview/submit.md rename to app/views/advanced/submit.md index 9f312ba..1fb08e9 100644 --- a/app/views/overview/submit.md +++ b/app/views/advanced/submit.md @@ -12,10 +12,6 @@ Before submitting, please make sure of the following: - [ ] ANY other files that are part of your project - [ ] A link to a source for every item in your BOM -- [ ] hjkhkj -- hjkhkjh -- hjkhjhj - ## Fill out the form [https://forms.hackclub.com/highway](https://forms.hackclub.com/highway) @@ -28,4 +24,4 @@ If you get approved, you'll get an email to let you know! **If it gets rejected, you'll have to wait 1 week before getting another review.** -Durinng this time, \ No newline at end of file +During this time, asdf \ No newline at end of file diff --git a/app/views/docs/api/overview.md b/app/views/docs/api/overview.md new file mode 100644 index 0000000..e69de29 diff --git a/app/views/docs/guides/index.md b/app/views/docs/guides/index.md new file mode 100644 index 0000000..e69de29 diff --git a/app/views/docs/guides/setup/index.md b/app/views/docs/guides/setup/index.md new file mode 100644 index 0000000..e69de29 diff --git a/app/views/docs/show.html.erb b/app/views/docs/show.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/layouts/advanced.html.erb b/app/views/layouts/advanced.html.erb new file mode 100644 index 0000000..14b617c --- /dev/null +++ b/app/views/layouts/advanced.html.erb @@ -0,0 +1,42 @@ + + + + <%= content_for(:title) || "Site" %> + + + + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + <%= yield :head %> + + <%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %> + <%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %> + + + + + + <%# Includes all stylesheet files in app/assets/stylesheets %> + <%= stylesheet_link_tag :app, "data-turbo-track": "reload" %> + <%= javascript_importmap_tags %> + + + +
+
+
+ <%= render partial: "advanced/sidebar" %> +
+
+
+
<%= render "shared/topbar", class: "sticky top-0" %>
+
+ <%= yield %> +
+
+
+
+
+ + diff --git a/app/views/layouts/docs.html.erb b/app/views/layouts/docs.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/overview/getting_started.md b/app/views/overview/getting_started.md deleted file mode 100644 index 3b5ca31..0000000 --- a/app/views/overview/getting_started.md +++ /dev/null @@ -1,42 +0,0 @@ -# Getting started - -Have a project idea in mind already? Not to worry! Here's how to - -## Here's how it works: - -### Overview - -1. Start your project -2. Journal & Log your progress along the way -3. Get up to $150 USD to build it. (Get up to 350 USD if it qualifies as an advanced project.) - -Each project you design gets you 6 points - -### Extra dvanced projects - -If you're - -### Allowed Vendors -By default, you're - -### - -## Some tips - -## Starting your project - -### 1. Make a new GitHub repository! - -A *git repository* is essentially a new project. GitHub is a website that will host these for you, *for free*! - -### 2. Start your journal! - -### 3. Make a pull request to add it to the repository! -(insert instructions on how to make a PR to the yaml file) - -### 4. Get designing! - - -### 5. Submit! - -Once you're done, you can **submit** your project \ No newline at end of file diff --git a/app/views/overview/overview.md b/app/views/overview/overview.md new file mode 100644 index 0000000..982c5cb --- /dev/null +++ b/app/views/overview/overview.md @@ -0,0 +1,58 @@ +# Guide + +### Welcome to the **Highway** to **Undercity**, an unforgettable summer of hardware running from now through July 31st. + +#### If you've *never* done hardware before, this is *your* opportunity to get started. That one project you saw on YouTube but had no idea how to build? *That ends now.* +
+#### If you're already a seasoned pro, this is your chance to really level up. That 5-axis 3D printer you've been thinking of? Now's your chance +
+Earn **points** with each project you build. Collect prizes along the way. Join your friends at Undercity, a 4 day hackathon in San Francisco at GitHub HQ + +## Here's how it works: + +### 1. Build hardware projects + +#### Guided starter projects: 4 points each + +No idea what to build? Perfect! Hack Club has a ton of resources for specific projects like macropads already available. + +Hit the **"Starters"** button in the top right to find them! + +(insert image of button being pressed) + +You'll learn how to design your first hardware project & get the parts & tools delivered to you to build it! + +(insert image of some projects) + +#### Fully custom projects: 6 points each + +If you're already a seasoned hardware hacker, hit the "advanced" toggle on the top right! + +(insert image) + +It'll unlock a new tab that gives you everything you need to design your own projects. + +Head on over to + + +### 2. Join weekly events + +Every week, we'll host events like Speedruns, Game Nights, AMAs, and Showcases! + +Hit the button labeled "Events" to see them: + +First one up is the Kickoff call on **insertdate**. Get your 1st point for free! + +(P.S: you can some points from these!) + +### 3. Get invited to Undercity + +Once you collect 12 points, AND you've physically built 1 project, you'll get invited to Undercity[insertlink], a 4 day hardware hackathon at GitHub HQ from July 11-14. + +It'll be filled to the *brim* with hardware - hundreds of microcontrollers, kilometers of cabling, and more 3D printing than you could ever need. (Did someone mention a PCB mill?) + +# Ready. Set. Build! + +*Any questions? Check out the [FAQ](/faq)* + +(cool image) diff --git a/app/views/overview/undercity.md b/app/views/overview/undercity.md new file mode 100644 index 0000000..a37630b --- /dev/null +++ b/app/views/overview/undercity.md @@ -0,0 +1,11 @@ +# Undercity + +**Undercity** is a 4 day hardware hackathon hosted at GitHub HQ in San Francisco, California from July 11-14th. + +To qualify for Undercity, you need at least 12 points and 1 *physically built*, working hardware project. + +## Travel Stipends + +You'll automatically qualify for a reimbursment once you have **finished building the projects you submitted for Undercity**. + +The amount will be revealed at the kickoff call! \ No newline at end of file diff --git a/app/views/shared/_topbar.html.erb b/app/views/shared/_topbar.html.erb index 665fabc..50ced44 100644 --- a/app/views/shared/_topbar.html.erb +++ b/app/views/shared/_topbar.html.erb @@ -23,8 +23,8 @@ -