From 82cf9a4f0819bec96d1cf5050cc4e8dc17568be0 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 30 Oct 2023 12:40:08 -0400 Subject: main page! and other layout stuff --- app/assets/images/wittle/wittle_expert.png | Bin 0 -> 155050 bytes app/assets/images/wittle/wittle_hard.png | Bin 0 -> 92194 bytes app/assets/images/wittle/wittle_normal.png | Bin 0 -> 81341 bytes app/assets/stylesheets/wittle/general.css.scss | 86 ++++++++++++++++++++++++- app/controllers/wittle/puzzles_controller.rb | 8 +++ app/views/wittle/puzzles/about.html.haml | 27 ++++++-- app/views/wittle/puzzles/index.html.haml | 1 + app/views/wittle/puzzles/show.html.haml | 1 + 8 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 app/assets/images/wittle/wittle_expert.png create mode 100644 app/assets/images/wittle/wittle_hard.png create mode 100644 app/assets/images/wittle/wittle_normal.png diff --git a/app/assets/images/wittle/wittle_expert.png b/app/assets/images/wittle/wittle_expert.png new file mode 100644 index 0000000..b806b57 Binary files /dev/null and b/app/assets/images/wittle/wittle_expert.png differ diff --git a/app/assets/images/wittle/wittle_hard.png b/app/assets/images/wittle/wittle_hard.png new file mode 100644 index 0000000..e993e9b Binary files /dev/null and b/app/assets/images/wittle/wittle_hard.png differ diff --git a/app/assets/images/wittle/wittle_normal.png b/app/assets/images/wittle/wittle_normal.png new file mode 100644 index 0000000..adc0943 Binary files /dev/null and b/app/assets/images/wittle/wittle_normal.png differ diff --git a/app/assets/stylesheets/wittle/general.css.scss b/app/assets/stylesheets/wittle/general.css.scss index a0eb980..f7bb56f 100644 --- a/app/assets/stylesheets/wittle/general.css.scss +++ b/app/assets/stylesheets/wittle/general.css.scss @@ -10,8 +10,8 @@ a { display: block; - width: 1110px; - height: 454px; + width: 600px; + height: 245px; text-indent: -5000px; text-decoration: none; margin: 0; @@ -169,3 +169,85 @@ input[type="range"]::-ms-thumb { padding: 0; } } + +#current-date { + margin-top: 1em; + text-align: center; +} + +#choose-difficulty { + margin: 1em auto 2em; + width: max-content; + display: flex; +} + +#normal-link { + width: 215px; + margin-right: 1em; + + a { + background-image: image-url("wittle/wittle_normal.png"); + background-size: cover; + display: block; + width: 215px; + height: 215px; + text-indent: -5000px; + text-decoration: none; + margin: 0; + } +} + +#hard-link { + width: 215px; + margin-right: 1em; + + a { + background-image: image-url("wittle/wittle_hard.png"); + background-size: cover; + display: block; + width: 215px; + height: 215px; + text-indent: -5000px; + text-decoration: none; + margin: 0; + } +} + +#expert-link { + width: 215px; + + a { + background-image: image-url("wittle/wittle_expert.png"); + background-size: cover; + display: block; + width: 215px; + height: 215px; + text-indent: -5000px; + text-decoration: none; + margin: 0; + } +} + +.summary { + width: 50%; + min-width: 600px; + margin: 0 auto 1em; +} + +.puzzle-status { + text-align: center; + margin-bottom: 0; +} + +.breadcrumb { + text-align: center; + + a, a:visited { + color: #555d66; + text-decoration: none; + } + + a:hover { + text-decoration: underline; + } +} diff --git a/app/controllers/wittle/puzzles_controller.rb b/app/controllers/wittle/puzzles_controller.rb index 3c3c8a6..b481460 100644 --- a/app/controllers/wittle/puzzles_controller.rb +++ b/app/controllers/wittle/puzzles_controller.rb @@ -2,8 +2,16 @@ module Wittle class PuzzlesController < ApplicationController def about @normal_puzzle = Puzzle.normal.order(created_at: :desc).first + @normal_started = ((session[:started_puzzles] || []).include? @normal_puzzle.id) + @normal_solved = ((session[:played_puzzles] || []).include? @normal_puzzle.id) + @hard_puzzle = Puzzle.hard.order(created_at: :desc).first + @hard_started = ((session[:started_puzzles] || []).include? @hard_puzzle.id) + @hard_solved = ((session[:played_puzzles] || []).include? @hard_puzzle.id) + @expert_puzzle = Puzzle.expert.order(created_at: :desc).first + @expert_started = ((session[:started_puzzles] || []).include? @expert_puzzle.id) + @expert_solved = ((session[:played_puzzles] || []).include? @expert_puzzle.id) end def index diff --git a/app/views/wittle/puzzles/about.html.haml b/app/views/wittle/puzzles/about.html.haml index 6a47972..a96fcf9 100644 --- a/app/views/wittle/puzzles/about.html.haml +++ b/app/views/wittle/puzzles/about.html.haml @@ -1,4 +1,23 @@ -%p by Hatkirby, with help from Sigma144 and jbzdarkid -%p= link_to "Normal", @normal_puzzle -%p= link_to "Hard", @hard_puzzle -%p= link_to "Expert", @expert_puzzle +%p.summary Wittle gives you daily randomly-generated puzzles in the style of those from the 2016 indie game, The Witness. There are three difficulties of puzzles to choose from: +%h2#current-date= @normal_puzzle.created_at.strftime("%B %-d, %Y") +%nav#choose-difficulty + #normal-link + = link_to "Normal", @normal_puzzle + - if @normal_solved + %p.puzzle-status Solved! + - elsif @normal_started + %p.puzzle-status Started + #hard-link + = link_to "Hard", @hard_puzzle + - if @hard_solved + %p.puzzle-status Solved! + - elsif @hard_started + %p.puzzle-status Started + #expert-link + = link_to "Expert", @expert_puzzle + - if @expert_solved + %p.puzzle-status Solved! + - elsif @expert_started + %p.puzzle-status Started +%p.summary Wittle was created by Hatkirby, with major help from Sigma144 (who wrote the puzzle generation code) and jbzdarkid (who wrote the puzzle solving web interface). If you encounter any bugs, or have feedback regarding puzzle difficulty level, feel free to contact me! I am hatkirby on Discord, and you can also find me in the Witness Speedrunning server. +%p.summary There is an archive of past puzzles for those interested. diff --git a/app/views/wittle/puzzles/index.html.haml b/app/views/wittle/puzzles/index.html.haml index 097eb87..fe497e4 100644 --- a/app/views/wittle/puzzles/index.html.haml +++ b/app/views/wittle/puzzles/index.html.haml @@ -1,3 +1,4 @@ +.breadcrumb= link_to "← Back to home page", root_path %h1 Archive %table#archive %tr diff --git a/app/views/wittle/puzzles/show.html.haml b/app/views/wittle/puzzles/show.html.haml index 8628298..7307152 100644 --- a/app/views/wittle/puzzles/show.html.haml +++ b/app/views/wittle/puzzles/show.html.haml @@ -1,3 +1,4 @@ +.breadcrumb= link_to "← Back to home page", root_path %h1 Wittle ##{@puzzle.id} .puzzle-description #{@puzzle.category.capitalize} - #{@puzzle.created_at.strftime("%B %-d, %Y")} #puzzle-container{ style: "display: flex; justify-content: center; align-items: center" } -- cgit 1.4.1