diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8f0de65 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 + +[docker-compose.yml] +indent_size = 4 diff --git a/Gemfile b/Gemfile index 976bbe4..74025e4 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,8 @@ gem "puma", ">= 5.0" # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem "tzinfo-data", platforms: %i[ windows jruby ] +gem "view_component" + group :development, :test do # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem gem "debug", platforms: %i[ mri windows ], require: "debug/prelude" diff --git a/Gemfile.lock b/Gemfile.lock index 5d9a74a..2b8c072 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -205,6 +205,9 @@ GEM concurrent-ruby (~> 1.0) uri (1.0.3) useragent (0.16.11) + view_component (4.0.2) + activesupport (>= 7.1.0, < 8.1) + concurrent-ruby (~> 1) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) @@ -230,6 +233,7 @@ DEPENDENCIES rails (~> 8.0.2, >= 8.0.2.1) sqlite3 (>= 2.1) tzinfo-data + view_component BUNDLED WITH 2.7.1 diff --git a/app/assets/fonts/PTSans-Bold.ttf b/app/assets/fonts/PTSans-Bold.ttf new file mode 100644 index 0000000..f82c3bd Binary files /dev/null and b/app/assets/fonts/PTSans-Bold.ttf differ diff --git a/app/assets/fonts/PTSans-BoldItalic.ttf b/app/assets/fonts/PTSans-BoldItalic.ttf new file mode 100644 index 0000000..3e6cf4e Binary files /dev/null and b/app/assets/fonts/PTSans-BoldItalic.ttf differ diff --git a/app/assets/fonts/PTSans-Italic.ttf b/app/assets/fonts/PTSans-Italic.ttf new file mode 100644 index 0000000..b06ce61 Binary files /dev/null and b/app/assets/fonts/PTSans-Italic.ttf differ diff --git a/app/assets/fonts/PTSans-Regular.ttf b/app/assets/fonts/PTSans-Regular.ttf new file mode 100644 index 0000000..adaf671 Binary files /dev/null and b/app/assets/fonts/PTSans-Regular.ttf differ diff --git a/app/assets/fonts/PTSerif-Bold.ttf b/app/assets/fonts/PTSerif-Bold.ttf new file mode 100644 index 0000000..36d47eb Binary files /dev/null and b/app/assets/fonts/PTSerif-Bold.ttf differ diff --git a/app/assets/fonts/PTSerif-BoldItalic.ttf b/app/assets/fonts/PTSerif-BoldItalic.ttf new file mode 100644 index 0000000..fa30e55 Binary files /dev/null and b/app/assets/fonts/PTSerif-BoldItalic.ttf differ diff --git a/app/assets/fonts/PTSerif-Italic.ttf b/app/assets/fonts/PTSerif-Italic.ttf new file mode 100644 index 0000000..9b110a4 Binary files /dev/null and b/app/assets/fonts/PTSerif-Italic.ttf differ diff --git a/app/assets/fonts/PTSerif-Regular.ttf b/app/assets/fonts/PTSerif-Regular.ttf new file mode 100644 index 0000000..f87c0f1 Binary files /dev/null and b/app/assets/fonts/PTSerif-Regular.ttf differ diff --git a/app/assets/images/background.jpg b/app/assets/images/background.jpg new file mode 100644 index 0000000..4e94b27 Binary files /dev/null and b/app/assets/images/background.jpg differ diff --git a/app/assets/images/buttons/aliasing.png b/app/assets/images/buttons/aliasing.png new file mode 100644 index 0000000..27b53e9 Binary files /dev/null and b/app/assets/images/buttons/aliasing.png differ diff --git a/app/assets/images/buttons/cnfunknown.gif b/app/assets/images/buttons/cnfunknown.gif new file mode 100644 index 0000000..b8e9239 Binary files /dev/null and b/app/assets/images/buttons/cnfunknown.gif differ diff --git a/app/assets/images/buttons/csshard.gif b/app/assets/images/buttons/csshard.gif new file mode 100644 index 0000000..24fb8d5 Binary files /dev/null and b/app/assets/images/buttons/csshard.gif differ diff --git a/app/assets/images/buttons/juli.gif b/app/assets/images/buttons/juli.gif new file mode 100644 index 0000000..4ff0364 Binary files /dev/null and b/app/assets/images/buttons/juli.gif differ diff --git a/app/assets/images/buttons/linuxnow.gif b/app/assets/images/buttons/linuxnow.gif new file mode 100644 index 0000000..61de1c3 Binary files /dev/null and b/app/assets/images/buttons/linuxnow.gif differ diff --git a/app/assets/images/buttons/paws-aliased.png b/app/assets/images/buttons/paws-aliased.png new file mode 100644 index 0000000..a7d1b22 Binary files /dev/null and b/app/assets/images/buttons/paws-aliased.png differ diff --git a/app/assets/images/buttons/servfail.png b/app/assets/images/buttons/servfail.png new file mode 100644 index 0000000..acfebd0 Binary files /dev/null and b/app/assets/images/buttons/servfail.png differ diff --git a/app/assets/images/buttons/thnlqd.png b/app/assets/images/buttons/thnlqd.png new file mode 100644 index 0000000..ec17caa Binary files /dev/null and b/app/assets/images/buttons/thnlqd.png differ diff --git a/app/assets/images/buttons/transrights.gif b/app/assets/images/buttons/transrights.gif new file mode 100644 index 0000000..7f705aa Binary files /dev/null and b/app/assets/images/buttons/transrights.gif differ diff --git a/app/assets/images/buttons/vim.gif b/app/assets/images/buttons/vim.gif new file mode 100644 index 0000000..3fd0e9e Binary files /dev/null and b/app/assets/images/buttons/vim.gif differ diff --git a/app/assets/images/buttons/wah.png b/app/assets/images/buttons/wah.png new file mode 100644 index 0000000..65e3f74 Binary files /dev/null and b/app/assets/images/buttons/wah.png differ diff --git a/app/assets/images/buttons/x86.gif b/app/assets/images/buttons/x86.gif new file mode 100644 index 0000000..f271daa Binary files /dev/null and b/app/assets/images/buttons/x86.gif differ diff --git a/app/assets/images/embeds/pandamonium.png b/app/assets/images/embeds/pandamonium.png new file mode 100644 index 0000000..ec4f22e Binary files /dev/null and b/app/assets/images/embeds/pandamonium.png differ diff --git a/app/assets/images/favicon.ico b/app/assets/images/favicon.ico new file mode 100644 index 0000000..48ce013 Binary files /dev/null and b/app/assets/images/favicon.ico differ diff --git a/app/assets/images/logo-v2.gif b/app/assets/images/logo-v2.gif new file mode 100755 index 0000000..afd32b8 Binary files /dev/null and b/app/assets/images/logo-v2.gif differ diff --git a/app/assets/images/logo-v2.png b/app/assets/images/logo-v2.png new file mode 100644 index 0000000..0edda8f Binary files /dev/null and b/app/assets/images/logo-v2.png differ diff --git a/app/assets/images/pandamonium-legacy/filters.jpg b/app/assets/images/pandamonium-legacy/filters.jpg new file mode 100644 index 0000000..3a7a3ab Binary files /dev/null and b/app/assets/images/pandamonium-legacy/filters.jpg differ diff --git a/app/assets/images/pandamonium-legacy/frontrowseat.jpg b/app/assets/images/pandamonium-legacy/frontrowseat.jpg new file mode 100644 index 0000000..e99addf Binary files /dev/null and b/app/assets/images/pandamonium-legacy/frontrowseat.jpg differ diff --git a/app/assets/images/pandamonium-legacy/gel-drawer.jpg b/app/assets/images/pandamonium-legacy/gel-drawer.jpg new file mode 100644 index 0000000..ffe17bc Binary files /dev/null and b/app/assets/images/pandamonium-legacy/gel-drawer.jpg differ diff --git a/app/assets/images/pandamonium-legacy/lxdesk.jpg b/app/assets/images/pandamonium-legacy/lxdesk.jpg new file mode 100644 index 0000000..7ac691e Binary files /dev/null and b/app/assets/images/pandamonium-legacy/lxdesk.jpg differ diff --git a/app/assets/images/pandamonium-legacy/pa_meister.jpg b/app/assets/images/pandamonium-legacy/pa_meister.jpg new file mode 100644 index 0000000..e9b7bc8 Binary files /dev/null and b/app/assets/images/pandamonium-legacy/pa_meister.jpg differ diff --git a/app/assets/images/pandamonium-legacy/projectionist.jpg b/app/assets/images/pandamonium-legacy/projectionist.jpg new file mode 100644 index 0000000..878ac82 Binary files /dev/null and b/app/assets/images/pandamonium-legacy/projectionist.jpg differ diff --git a/app/assets/images/pandamonium-legacy/technician.jpg b/app/assets/images/pandamonium-legacy/technician.jpg new file mode 100644 index 0000000..f5708f0 Binary files /dev/null and b/app/assets/images/pandamonium-legacy/technician.jpg differ diff --git a/app/assets/images/pandamonium-legacy/three-of-them.jpg b/app/assets/images/pandamonium-legacy/three-of-them.jpg new file mode 100644 index 0000000..7abffb9 Binary files /dev/null and b/app/assets/images/pandamonium-legacy/three-of-them.jpg differ diff --git a/app/assets/images/pandamonium-legacy/two-of-them.jpg b/app/assets/images/pandamonium-legacy/two-of-them.jpg new file mode 100644 index 0000000..cdc8b30 Binary files /dev/null and b/app/assets/images/pandamonium-legacy/two-of-them.jpg differ diff --git a/app/assets/images/pandamonium/filters.jpg b/app/assets/images/pandamonium/filters.jpg new file mode 100644 index 0000000..a19d958 Binary files /dev/null and b/app/assets/images/pandamonium/filters.jpg differ diff --git a/app/assets/images/pandamonium/frontrowseat.jpg b/app/assets/images/pandamonium/frontrowseat.jpg new file mode 100644 index 0000000..17228a0 Binary files /dev/null and b/app/assets/images/pandamonium/frontrowseat.jpg differ diff --git a/app/assets/images/pandamonium/gel-drawer.jpg b/app/assets/images/pandamonium/gel-drawer.jpg new file mode 100644 index 0000000..abdcc51 Binary files /dev/null and b/app/assets/images/pandamonium/gel-drawer.jpg differ diff --git a/app/assets/images/pandamonium/lxdesk.jpg b/app/assets/images/pandamonium/lxdesk.jpg new file mode 100644 index 0000000..c85da3d Binary files /dev/null and b/app/assets/images/pandamonium/lxdesk.jpg differ diff --git a/app/assets/images/pandamonium/pa_meister.jpg b/app/assets/images/pandamonium/pa_meister.jpg new file mode 100644 index 0000000..4a50065 Binary files /dev/null and b/app/assets/images/pandamonium/pa_meister.jpg differ diff --git a/app/assets/images/pandamonium/projectionist.jpg b/app/assets/images/pandamonium/projectionist.jpg new file mode 100644 index 0000000..dcb1186 Binary files /dev/null and b/app/assets/images/pandamonium/projectionist.jpg differ diff --git a/app/assets/images/pandamonium/technician.jpg b/app/assets/images/pandamonium/technician.jpg new file mode 100644 index 0000000..29b9e92 Binary files /dev/null and b/app/assets/images/pandamonium/technician.jpg differ diff --git a/app/assets/images/pandamonium/three-of-them.jpg b/app/assets/images/pandamonium/three-of-them.jpg new file mode 100644 index 0000000..1f7eee0 Binary files /dev/null and b/app/assets/images/pandamonium/three-of-them.jpg differ diff --git a/app/assets/images/pandamonium/two-of-them.jpg b/app/assets/images/pandamonium/two-of-them.jpg new file mode 100644 index 0000000..f149d73 Binary files /dev/null and b/app/assets/images/pandamonium/two-of-them.jpg differ diff --git a/app/assets/images/peek.png b/app/assets/images/peek.png new file mode 100644 index 0000000..2647658 Binary files /dev/null and b/app/assets/images/peek.png differ diff --git a/app/assets/images/progress.svg b/app/assets/images/progress.svg new file mode 100644 index 0000000..0e3bd33 --- /dev/null +++ b/app/assets/images/progress.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/roscoe_tile.jpg b/app/assets/images/roscoe_tile.jpg new file mode 100755 index 0000000..5bde1b1 Binary files /dev/null and b/app/assets/images/roscoe_tile.jpg differ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index fe93333..f7dccf5 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -8,3 +8,363 @@ * * Consider organizing styles into separate files for maintainability. */ + +:root { + --background: hsl(214, 67%, 85%); + --foreground: hsl(214, 20%, 14%); + --border-color: hsl(214, 96%, 48%); + --border: var(--border-color) 2px solid; + --shadow-color: hsla(214, 96%, 43%, 0.4); + --shadow: drop-shadow(8px 8px var(--shadow-color)); + --shadow-small: drop-shadow(3px 3px var(--shadow-color)); + --links: hsl(214, 27%, 22%); + --links-hover: hsl(214, 27%, 15%); + --table-header: hsla(214, 96%, 43%, 0.2); +} + +/* ───────────────────────────────────── Fonts ────────────────────────────────────── */ +@font-face { + font-family: "PT Sans"; + src: url("PTSans-Regular.ttf") format("truetype"); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: "PT Sans"; + src: url("PTSans-Italic.ttf") format("truetype"); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: "PT Sans"; + src: url("PTSans-Bold.ttf") format("truetype"); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: "PT Sans"; + src: url("PTSans-BoldItalic.ttf") format("truetype"); + font-weight: bold; + font-style: italic; +} + +@font-face { + font-family: "PT Serif"; + src: url("PTSerif-Regular.ttf") format("truetype"); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: "PT Serif"; + src: url("PTSerif-Italic.ttf") format("truetype"); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: "PT Serif"; + src: url("PTSerif-Bold.ttf") format("truetype"); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: "PT Serif"; + src: url("PTSerif-BoldItalic.ttf") format("truetype"); + font-weight: bold; + font-style: italic; +} + +/* ───────────────────────────────────── Pride ────────────────────────────────────── */ +#prideflag { + position: fixed; + top: 0; + right: 0; + width: 120px; + transform-origin: 100% 0; + transition: transform .5s cubic-bezier(.32,1.63,.41,1.01); + z-index: 8008135; +} +#prideflag:hover { + transform: scale(110%); +} +#prideflag:active { + transform: scale(110%); +} +#prideflag * { + pointer-events: all; +} + +/* ───────────────────────────────────── Global ───────────────────────────────────── */ +html { + height: 100%; + color-scheme: light; + scrollbar-color: var(--border-color) var(--background); +} + +body { + color: var(--foreground); + min-height: 100%; + background: url('roscoe_tile.jpg'); + padding: 5px; + font-family: "PT Serif", serif; +} + +img.logo_paw { + filter: grayscale(100%) sepia(100%) hue-rotate(180deg) saturate(300%); +} + +h1, +h2, +h3, +h4, +h5, +h6 { + margin: 20px 0 0 0; +} + +p, +ul, +ol, +dl, +menu, +dir { + margin: 0; +} + +hr { + border: none; + border-top: var(--border); +} + +a { + color: var(--links); + text-decoration: underline dotted; +} + +a:hover { + color: var(--links-hover); + text-decoration: underline solid; +} + +div.page-container { + width: 800px; + margin: 5px auto; +} + +div.page-container > div { + background-color: var(--background); + filter: var(--shadow); + padding: 10px; + border: var(--border); + margin-bottom: 20px; +} + +div.page-container > div:last-child { + margin-bottom: 0; +} + +header { + display: grid; + grid-template-columns: 64px 1fr; + grid-template-rows: 1fr; + grid-column-gap: 15px; + grid-row-gap: 0; + align-items: center; +} + +header img { + image-rendering: pixelated; +} + +header h1 { + margin: 0; + font-style: italic; +} + +header h1, +header p { + display: inline; +} + +main>div { + position: relative; +} + +main>div::after { + display: block; + content: ""; + clear: both; +} + +div#footer { + display: grid; + grid-template-columns: auto 1fr; + grid-template-rows: 1fr; + grid-column-gap: 0; + grid-row-gap: 0; + align-items: center; +} + +div#footer div:last-child { + text-align: right; +} + +div#footer div:last-child img { + image-rendering: pixelated; + margin: 0; + padding: 0; + width: 88px; + height: 31px; +} + +/** Wah! **/ +div.wah { + float: right; + border: var(--border); + padding: 5px; + filter: var(--shadow-small); + background-color: var(--background); +} + +div.wah img { + display: block; +} + +div.wah h3, +div.wah p { + text-align: center; + margin: 5px 0; + font-style: italic; +} + +div.wah p { + margin-bottom: 0; +} + +div.wah img { + width: 250px; +} + +/** Guestbook **/ +table.form input, +table.form textarea, +table.form button { + background-color: var(--background); + border: var(--border); + filter: var(--shadow-small); +} + +table.form input, +table.form textarea { + width: 250px; +} + +table.form textarea { + resize: none; +} + +table.form button:hover { + background-color: var(--border-color); + color: var(--background); + filter: none; +} + +table.form tr td, +table.gb-entry-form-container td:last-child { + vertical-align: top; +} + +div.gb-entry { + border: var(--border); + filter: var(--shadow-small); + background-color: var(--background); + width: 75%; + padding: 10px; +} + +/** Music **/ +table.music-top10 { + border: var(--border); + filter: var(--shadow-small); + background-color: var(--background); + border-collapse: collapse; +} + +table.music-top10 th, +table.music-top10 td { + padding: 2px 5px; +} + +table.music-top10 th:first-child { + text-align: left; +} + +table.music-top10 tr:first-child th { + border-right: var(--border); + border-bottom: var(--border); +} + +table.music-top10 tr:first-child th:last-child { + border-right: none; +} + +table.music-top10 tr td { + border-right: var(--border); +} + +table.music-top10 tr td:last-child { + border-right: none; +} +table.music-top10 tr:first-child th, +table.music-top10 tr td:first-child { + background-color: var(--table-header); +} + +div.current-track { + display: grid; + grid-template-columns: 180px auto; + grid-template-rows: 1fr; + grid-column-gap: 10px; + align-items: center; +} + +div.current-track img { + float: left; + filter: var(--shadow-small); + border: var(--border); + width: 174px; + height: 174px; +} + +/** Bookmarks **/ +div.bookmark-category:first-child h2 { + margin: 0; +} + + + +/* ────────────────────────────────── Rosco & Leko ────────────────────────────────── */ +div.rosco-leko-gallery { + display: flex; + flex-wrap: wrap; + align-items: flex-start; +} + +div.rosco-leko-gallery > div { + border: var(--border); + padding: 5px; + filter: var(--shadow-small); + background-color: var(--background); + margin: 10px; + height: auto; +} + +div.rosco-leko-gallery > div, +div.rosco-leko-gallery > div img { + max-width: 220px; +} diff --git a/app/components/wah_component.html.erb b/app/components/wah_component.html.erb new file mode 100644 index 0000000..4246ce1 --- /dev/null +++ b/app/components/wah_component.html.erb @@ -0,0 +1,5 @@ +
+

Random Wah!

+ <%= image_tag @wah_url, alt: "Random image featuring a red panda" %> +

Image "stolen" from tinyfox.dev

+
diff --git a/app/components/wah_component.rb b/app/components/wah_component.rb new file mode 100644 index 0000000..0ee61d3 --- /dev/null +++ b/app/components/wah_component.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true +require "net/http" +require "json" + +class WahComponent < ViewComponent::Base + def initialize(legacy:) + if legacy then + else + uri = URI.parse('https://api.tinyfox.dev/img.json?animal=wah') + req = Net::HTTP::Get.new(uri.to_s) + res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) {|http| + http.request(req) + } + data = JSON.parse(res.body) + url = "https://tinyfox.dev" + data["loc"] + + @wah_url = url + + end + end +end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000..64e8657 --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,9 @@ +class HomeController < ApplicationController + def years_between_dates(date_from, date_to) + return (date_to - date_from).to_i / 365 + end + + def index + @age = years_between_dates(DateTime.civil_from_format(:local, 2005, 6, 7), DateTime.now) + end +end diff --git a/app/controllers/music_controller.rb b/app/controllers/music_controller.rb new file mode 100644 index 0000000..eec3eb8 --- /dev/null +++ b/app/controllers/music_controller.rb @@ -0,0 +1,78 @@ +require 'uri' +require 'net/http' + +class MusicController < ApplicationController + def get_current_track + if Rails.cache.exist?("current_track") + return Rails.cache.read("current_track") + end + + uri = URI.parse('https://ws.audioscrobbler.com/2.0/') + params = { + :method => 'user.getrecenttracks', + :user => Rails.application.credentials.lastfm.username, + :format => 'json', + :nowplaying => 'true', + :api_key => Rails.application.credentials.lastfm.api_key + } + uri.query = URI.encode_www_form(params) + req = Net::HTTP::Get.new(uri.to_s) + res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) {|http| + http.request(req) + } + data = JSON.parse(res.body) + track_data = data["recenttracks"]["track"][0] + image = defined?(track_data["image"][-1]) ? track_data["image"][-1] : false + now_playing = false + if track_data["@attr"] != nil + now_playing = track_data["@attr"]["nowplaying"] == "true" + end + + current_track = { + :title => track_data["name"], + :artist => track_data["artist"]["#text"], + :url => track_data["url"], + :image => image["#text"], + :header => if now_playing then "Now Playing" else "Last Track" end + } + return current_track + end + + def get_top_tracks + if Rails.cache.exist?("top_tracks") + return Rails.cache.read("top_tracks") + end + + uri = URI.parse('https://ws.audioscrobbler.com/2.0/') + params = { + :method => 'user.gettoptracks', + :user => Rails.application.credentials.lastfm.username, + :format => 'json', + :period => '1month', + :limit => 10, + :api_key => Rails.application.credentials.lastfm.api_key + } + uri.query = URI.encode_www_form(params) + req = Net::HTTP::Get.new(uri.to_s) + res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) {|http| + http.request(req) + } + data = JSON.parse(res.body) + top_tracks = [] + data["toptracks"]["track"].each do |track| + top_tracks.push({ + :title => track["name"], + :artist => track["artist"]["name"], + :url => track["url"], + :plays => track["playcount"] + }) + end + + return top_tracks + end + + def index + @current_track = get_current_track + @top_tracks = get_top_tracks + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..269e8ce 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,9 @@ module ApplicationHelper + def is_legacy + return ( + request.host === "legacy.wah.moe" or + request.host.start_with? ("192.168") or + request.headers["Host"] === nil + ) + end end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb new file mode 100644 index 0000000..23de56a --- /dev/null +++ b/app/helpers/home_helper.rb @@ -0,0 +1,2 @@ +module HomeHelper +end diff --git a/app/helpers/music_helper.rb b/app/helpers/music_helper.rb new file mode 100644 index 0000000..7843f98 --- /dev/null +++ b/app/helpers/music_helper.rb @@ -0,0 +1,2 @@ +module MusicHelper +end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 0000000..7e18b60 --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,30 @@ +<%= unless is_legacy then render(WahComponent.new(legacy: is_legacy)) end %> + +

Hi! This is my personal homepage on the World Wide + Web. +

+<% unless is_legacy then%> +
+<% end %> +

Some quick facts about me:

+ +<% unless is_legacy then%> +
+<% end %> +

Interests:

+ diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f213a44..7632b43 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,10 +1,13 @@ - - - <%= content_for(:title) || "Wah Moe" %> - - - + + + + + + + + + wah! (dot moe) <%= csrf_meta_tags %> <%= csp_meta_tag %> @@ -13,15 +16,75 @@ <%# 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) %> - - - + <%= favicon_link_tag %> <%# Includes all stylesheet files in app/assets/stylesheets %> <%= stylesheet_link_tag :app %> - + - - <%= yield %> - + + <%= link_to (image_tag "progress.svg", width: 120, height: 120, alt: "progressive pride flag"), "https://git.arimelody.me/ari/prideflag", id: "prideflag", target: "_blank" %> +
+ +
+
+ <%= yield %> +
+
+
+
+ +
+
+ diff --git a/app/views/music/index.html.erb b/app/views/music/index.html.erb new file mode 100644 index 0000000..ae28bdd --- /dev/null +++ b/app/views/music/index.html.erb @@ -0,0 +1,32 @@ +
+ <% if @current_track["image"] != "" %> +
+ <%= image_tag @current_track[:image], alt: "Album cover for " + @current_track[:title] + " by " + @current_track[:artist] %> +
+ <% end %> +
+

<%= @current_track[:header]%>:

+ <%== link_to @current_track[:title] %>
+ by <%= @current_track[:artist] %>
+
+
+ + + + + + + + + + <% @top_tracks.each.with_index do |track, index| %> + + + + + + + <% end %> +
+

Top 10 Tracks (Last 30 days):

+
#TrackArtistPlays
<%= index %><%= link_to track[:title], track[:url] %><%= track[:artist] %><%= track[:plays] %>
diff --git a/config/application.rb b/config/application.rb index ecbec11..cd4fd84 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,6 +14,8 @@ require "action_view/railtie" # require "action_cable/engine" require "rails/test_unit/railtie" +require 'view_component' + # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) diff --git a/config/routes.rb b/config/routes.rb index 48254e8..18c4ca4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,5 +10,7 @@ Rails.application.routes.draw do # get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker # Defines the root path route ("/") - # root "posts#index" + root "home#index" + + get "music" => "music#index" end diff --git a/test/components/wah_component_test.rb b/test/components/wah_component_test.rb new file mode 100644 index 0000000..3745d2c --- /dev/null +++ b/test/components/wah_component_test.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "test_helper" + +class WahComponentTest < ViewComponent::TestCase + def test_component_renders_something_useful + # assert_equal( + # %(Hello, components!), + # render_inline(WahComponent.new(message: "Hello, components!")).css("span").to_html + # ) + end +end diff --git a/test/controllers/home_controller_test.rb b/test/controllers/home_controller_test.rb new file mode 100644 index 0000000..eac0e33 --- /dev/null +++ b/test/controllers/home_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class HomeControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/music_controller_test.rb b/test/controllers/music_controller_test.rb new file mode 100644 index 0000000..6ad6457 --- /dev/null +++ b/test/controllers/music_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class MusicControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end