Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ApplicationController < ActionController::Base
end

before_action do
@is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark")
unless signed_in?
@hide_seasonal_decorations = true
end
Expand Down
43 changes: 43 additions & 0 deletions app/views/layouts/_body_suffix.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<%# locals: (skip_fullstory: false) %>
<% if Rails.env.production? && !skip_fullstory %>
<%= render "application/fullstory" if current_user&.sessions_reported %>
<% end %>

<% if flash[:confetti] %>
<script src="/brand/js-confetti.browser.js"></script>
<script>
const triggerConfetti = () => {
const jsConfetti = new JSConfetti()
const emojis = <%= flash[:confetti_emojis].to_json.html_safe %>

setTimeout(() => {
if (!emojis) {
jsConfetti.addConfetti()
} else {
jsConfetti.addConfetti({
emojis: emojis.split(",")
})
}
}, 100);
};

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

(async () => {
while (typeof JSConfetti == "undefined") {
await sleep(500);
}

triggerConfetti()
})();
</script>
<% end %>
<% if Flipper.enabled?(:transactions_background_2024_06_05, current_user) %>
<style>
.success-dark {
color: #1f8164
}
</style>
<% end %>
75 changes: 75 additions & 0 deletions app/views/layouts/_head.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<%# locals: (title_suffix: "HCB", skip_dark_js: false, custom_stylesheet: false, custom_application_js: false, skip_plausible: false, skip_console_art: false, console_art_url: nil) %>

<!-- come hack with us on hcb! <%= Rails.configuration.constants.github_url %> -->
<title>
<%= yield(:title).concat(" –") if content_for?(:title) %>
<%= title_suffix %>
</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<meta name="theme-color" content="<%= @is_dark ? "#17171d" : "#f9fafc" %>">
<meta name="apple-itunes-app" content="app-id=6465424810">

<%= yield(:before_assets) if content_for?(:before_assets) %>

<%= javascript_include_tag "dark", 'data-turbo-track': "reload" %>
<%= stylesheet_link_tag "application", media: "all", 'data-turbo-track': "reload" unless custom_stylesheet %>
<%= yield(:custom_stylesheet) if content_for?(:custom_stylesheet) %>
<%= javascript_include_tag "application", 'data-turbo-track': "reload", defer: true unless custom_application_js %>
<%= yield(:custom_application_js) if content_for?(:custom_application_js) %>
<%= javascript_include_tag "bundle", 'data-turbo-track': "reload", defer: true %>

<%= yield(:additional_scripts) if content_for?(:additional_scripts) %>

<% if Rails.env.production? && !skip_plausible %>
<script defer data-domain="hcb.hackclub.com" src="https://plausible.io/js/script.pageview-props.tagged-events.js"></script>
<% end %>

<% unless Rails.env.production? %>
<meta name="turbo-prefetch" content="false">
<% end %>

<% if Rails.env.production? && !skip_console_art %>
<script>
console.log(`%c -*%@@%*-
.=#@@@@@@@@@@#=.
.=%@@@@@*-..-*@@@@@%=.
-#@@@@@+: :+@@@@@#-
:*@@@@@*: :*@@@@@*:
=%@@@@#- -#@@@@%=.
*@@@@@+. .+@@@@@*
*@@*- *@@* *@@* *@@* :*@@*
@@@@ @@@@ @@@@
@@@@ @@@@ @@@@
@@@@ @@@@ @@@@
@@@@ @@@@ @@@@
@@@@ @@@@ @@@@
@@@@ @@@@ @@@@
@@@@ @@@@ @@@@
*@@* *@@* *@@*

*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*
*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*

Come hack on HCB with us!
<%= console_art_url || Rails.configuration.constants.github_url %> <%# erb_lint:disable ErbSafety %>
`, 'color: #ec3750; font-weight: bold; font-size: 10px;')
</script>
<% end %>

<meta name="format-detection" content="telephone=no">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<% if content_for?(:favicon) %>
<%= yield :favicon %>
<% elsif user_birthday? %>
<link rel="icon" type="image/png" href="/favicon-party.gif">
<% else %>
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-<%= Rails.env %>-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-<%= Rails.env %>-16x16.png">
<% end %>
<link rel="manifest" href="/site.webmanifest">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#ec3750">
<meta name="msapplication-TileColor" content="#ec3750">
<%= yield(:additional_head_tags) if content_for?(:additional_head_tags) %>
<%= yield(:head) if content_for?(:head) %>
11 changes: 11 additions & 0 deletions app/views/layouts/_seasonal.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%# locals: (render_snow: true) %>
<%# LET THERE BE SNOW %>
<% if winter? && render_snow %>
<%= react_component "holiday/Snow", {}, { style: "height:100%" } %>
<% end %>

<%# ghosts and ghouls %>
<% if fall? %>
<img src="https://hc-cdn.hel1.your-objectstorage.com/s/v3/7e4929972e5eee4c_image.png" alt="oOoOoOoOo" class="flying-spook ghost">
<img src="https://hc-cdn.hel1.your-objectstorage.com/s/v3/1106e43a5e5219cf_image.png" alt="witch orpheus" class="flying-spook">
<% end %>
20 changes: 6 additions & 14 deletions app/views/layouts/admin.html.erb
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
<% @is_dark = !!@dark || cookies[:theme] == "dark" || (cookies[:theme] == "system" && cookies[:system_preference] == "dark") %>

<!DOCTYPE html>
<html lang="en" data-dark="<%= @is_dark %>">
<head>
<title>
<%= "#{yield(:title)} –" if content_for?(:title) %>
HCB Admin
</title>
<%= render "layouts/head",
title_suffix: "HCB Admin",
custom_stylesheet: true,
custom_application_js: true,
skip_console_art: true,
skip_plausible: true %>

<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= javascript_include_tag "dark", 'data-turbo-track': "reload" %>
<%= stylesheet_link_tag "admin", media: "all", "data-turbo-track": "reload" %>
<%= javascript_include_tag "admin", "data-turbo-track": "reload", defer: true %>
<%= javascript_include_tag "bundle", 'data-turbo-track': "reload", defer: true %>
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-<%= Rails.env %>-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-<%= Rails.env %>-16x16.png">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%= yield(:head) if content_for?(:head) %>
</head>
<body class="bg-snow">
<a class="skip-to-main" href="#main">Skip to main content</a>
Expand Down
Loading