diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0a6827a00..821341f77 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -68,7 +68,7 @@ jobs: run: $DOCKER_RUN tests - name: Upload Test Results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: test-results diff --git a/app/javascript/src/javascripts/navigation.js b/app/javascript/src/javascripts/navigation.js index d2f2fe5d3..3d5fd84ad 100644 --- a/app/javascript/src/javascripts/navigation.js +++ b/app/javascript/src/javascripts/navigation.js @@ -1,8 +1,8 @@ const Navigation = {}; Navigation.init = function () { - const wrapper = $("body"); - $("#nav-toggle").on("click", (event) => { + const wrapper = $("html"); + $("#nav-toggle, .nav-offset-left, .nav-offset-bottom").on("click", (event) => { event.preventDefault(); wrapper.toggleClass("nav-toggled"); diff --git a/app/javascript/src/javascripts/post_search.js b/app/javascript/src/javascripts/post_search.js index 5b2505d20..78cb1a5ea 100644 --- a/app/javascript/src/javascripts/post_search.js +++ b/app/javascript/src/javascripts/post_search.js @@ -19,25 +19,28 @@ PostSearch.initialize_input = function ($form) { // Adjust the number of rows based on input length $textarea - .on("input", () => { - $textarea.css("height", 0); - $textarea.css("height", element.scrollHeight + "px"); - }) + .on("input", recalculateInputHeight) .on("keypress", function (event) { if (event.which !== 13 || event.shiftKey) return; event.preventDefault(); $textarea.closest("form").submit(); }); + $(window).on("resize", recalculateInputHeight); + // Reset default height - $textarea.trigger("input"); + recalculateInputHeight(); + + function recalculateInputHeight () { + $textarea.css("height", 0); + $textarea.css("height", element.scrollHeight + "px"); + } }; PostSearch.initialize_wiki_preview = function ($preview) { let visible = LStorage.Posts.WikiExcerpt; if (visible) $preview.removeClass("hidden"); - console.log("init", visible); $($preview.find("a.wiki-excerpt-toggle")).on("click", (event) => { event.preventDefault(); @@ -45,7 +48,6 @@ PostSearch.initialize_wiki_preview = function ($preview) { visible = !visible; $preview.toggleClass("hidden", !visible); LStorage.Posts.WikiExcerpt = visible; - console.log("state", visible); return false; }); diff --git a/app/javascript/src/styles/common/navigation.scss b/app/javascript/src/styles/common/navigation.scss index 4c9acdfde..3a732f95d 100644 --- a/app/javascript/src/styles/common/navigation.scss +++ b/app/javascript/src/styles/common/navigation.scss @@ -2,14 +2,11 @@ nav.navigation { display: grid; grid-template-areas: "logo logo controls"; grid-template-columns: min-content auto; - grid-template-rows: min-content auto min-content min-content; + grid-template-rows: min-content min-content min-content min-content auto; width: 100%; // otherwise narrow when fixed z-index: 20; // otherwise post labels layered above - pointer-events: none; // allow clicking through offset - & > menu { pointer-events: auto; } - /* Top bar, always visible */ .nav-logo { @@ -20,6 +17,9 @@ nav.navigation { a.nav-logo-link { display: flex; + // Height: 3.75rem + // - padding 0.25 * 2 = 0.5 + // - image 3.25 height: 3.25rem; width: 3.25rem; margin: 0.25rem; @@ -43,6 +43,12 @@ nav.navigation { padding-right: 0.5em; background-color: themed("color-background"); + // Height: 3.75rem + // - wrapper padding 0.875 * 2 = 1.75 + // - link padding 0.25 * 2 = 0.5 + // - font size 1.5 + padding: 0.875rem; + & > a { display: flex; gap: 0.25em; @@ -59,10 +65,16 @@ nav.navigation { } /* Prevent toggled menus from being too wide */ - .nav-offset { - grid-area: offset; - pointer-events: none; + .nav-offset-left { + grid-area: offleft; display: none; // flex + background: #00000050; + } + + .nav-offset-bottom { + grid-area: offbott; + display: none; // flex + background: #00000050; } /* Toggled menus, hidden by default */ @@ -81,6 +93,9 @@ nav.navigation { border-bottom: 1px solid themed("color-foreground"); padding: 0.5em; + // "Comments" is usually the longest and might wrap + white-space: nowrap; + i { width: 1.5rem; color: themed("color-link-active"); @@ -89,6 +104,22 @@ nav.navigation { } &.current a { background-color: themed("color-foreground"); } + &.forum-updated { + position: relative; + + &::after { + content: ""; + width: 6px; + height: 6px; + border-radius: 3px; + + background: var(--palette-text-red); + + position: absolute; + right: 0.2em; + top: 1em; + } + } } } @@ -99,6 +130,11 @@ nav.navigation { background-color: themed("color-foreground"); font-size: 1.35em; + height: 440px; + + // Prevent the tools / help buttons from being pushed + // way too low on pages with a lot of secondary links + overflow: scroll; li { padding: 0; @@ -116,6 +152,11 @@ nav.navigation { form input[type="text"] { width: 100%; box-sizing: border-box; + + // Reduced font size to make the search + // box less claustrophobic + font-size: 1em; + padding: 0.25em 0.5em; } } } @@ -195,6 +236,13 @@ nav.navigation { margin: -0.5em 0; } } + + // Hack to put the wiki/help links before discord/sstar on mobile + // but still have "more" at the end on desktop + nav-more { + grid-row: 1; + grid-column: 3; + } } } } @@ -208,26 +256,30 @@ body[data-th-sheader="true"] nav.navigation { // Mobile toggle -body.nav-toggled { - padding-top: 4rem; +html.nav-toggled { + + height: 100%; + overflow: hidden; + + body { padding-top: 3.75rem; } nav.navigation { grid-template-areas: "logo logo controls" - "offset primary secondary " - "offset tools tools " - "offset help help "; + "offleft primary secondary " + "offleft tools tools " + "offleft help help " + "offbott offbott offbott "; grid-template-columns: auto minmax(auto, 180px) minmax(auto, 180px); position: fixed; top: 0; height: 100vh; - max-height: 800px; max-width: 100vw; // prevent bug when page overflows viewport // Allow scrolling when the menu is too long overflow-y: scroll; - .nav-primary, .nav-secondary, .nav-offset { + .nav-primary, .nav-secondary, .nav-offset-left, .nav-offset-bottom { display: flex; } .nav-tools, .nav-help { @@ -241,7 +293,7 @@ body.nav-toggled { // Desktop -nav.navigation, body.nav-toggled nav.navigation { +nav.navigation, html.nav-toggled nav.navigation { @include window-larger-than(800px) { grid-template-areas: "logo primary help tools " @@ -261,7 +313,7 @@ nav.navigation, body.nav-toggled nav.navigation { a.nav-logo-link { margin: 0.25rem 0.5rem 0 0; } } - .nav-offset, .nav-controls { display: none; } + .nav-offset-left, .nav-offset-bottom, .nav-controls { display: none; } .nav-primary { display: flex; @@ -281,12 +333,17 @@ nav.navigation, body.nav-toggled nav.navigation { padding: 0 0.75em; i { display: none; } } + + &.forum-updated::after { + top: 0.2em; + } } } .nav-secondary { display: flex; flex-flow: row; + height: unset; padding: 0 0.25em; font-size: 1.05em; @@ -348,6 +405,12 @@ nav.navigation, body.nav-toggled nav.navigation { } .nav-tools { + + // Otherwise help gets layered above it + // When the viewport is narrow (but not mobile) + z-index: 1; + background: var(--color-background); + li { a { i { color: themed("color-link"); } @@ -377,5 +440,8 @@ body.c-static.a-home { nav.navigation, menu.nav-logo, menu.nav-secondary { background: unset; } + menu.nav-tools { + background: var(--bg-color); + } } } diff --git a/app/javascript/src/styles/common/post_search.scss b/app/javascript/src/styles/common/post_search.scss index 48555aa85..68ce953d4 100644 --- a/app/javascript/src/styles/common/post_search.scss +++ b/app/javascript/src/styles/common/post_search.scss @@ -14,7 +14,9 @@ // Override default texarea styles font-family: Verdana, sans-serif; - font-size: 1.05em; + font-size: 1rem; + line-height: 1rem; + padding: 0.5rem 0 0.5rem 0.5rem; // Remove old styles from z_responsive vertical-align: unset; @@ -28,11 +30,9 @@ // Disable manual resizing resize: none; - flex: 1; - padding: 0.5em; - border-radius: 3px 0 0 3px; box-sizing: border-box; + flex: 1; &:focus, &:focus + button[type="submit"] { background: #FFC; } } @@ -43,13 +43,20 @@ font-size: unset; max-width: unset; - font-size: 1em; - padding: 0.5em; + font-size: 1rem; + line-height: 1rem; + padding: 0.5rem; border-radius: 0 3px 3px 0; background: white; span { display: none; } } + + @include window-larger-than(800px) { + textarea, button[type="submit"] { + font-size: 0.85rem; + } + } } } diff --git a/app/javascript/src/styles/common/z_responsive.scss b/app/javascript/src/styles/common/z_responsive.scss index e960794be..df89c65fe 100644 --- a/app/javascript/src/styles/common/z_responsive.scss +++ b/app/javascript/src/styles/common/z_responsive.scss @@ -67,22 +67,6 @@ } } - div#page aside#sidebar { - padding: 5px; - - input#tags { - width: 80%; - } - - button[type=submit] { - font-size: 1.2em; - background-color: #EEE; - height: 42px; - padding: 2px 10px; - border: 1px solid rgb(197, 197, 197); - } - } - div#page { > div /* div#c-$controller */ diff --git a/app/logical/post_sets/favorites.rb b/app/logical/post_sets/favorites.rb index 877ee1a22..617aae9d3 100644 --- a/app/logical/post_sets/favorites.rb +++ b/app/logical/post_sets/favorites.rb @@ -28,10 +28,22 @@ module PostSets end end + def has_explicit? + !CurrentUser.safe_mode? + end + def hidden_posts @hidden_posts ||= posts.reject(&:visible?) end + def login_blocked_posts + @login_blocked_posts ||= posts.select(&:loginblocked?) + end + + def safe_posts + @safe_posts ||= posts.select { |p| p.safeblocked? && !p.deleteblocked? } + end + def api_posts result = posts fill_children(result) diff --git a/app/views/layouts/_nav.html.erb b/app/views/layouts/_nav.html.erb index 4c3bb1867..ec9e03fd1 100644 --- a/app/views/layouts/_nav.html.erb +++ b/app/views/layouts/_nav.html.erb @@ -7,7 +7,8 @@ <%= render "layouts/main_links" %> -
+ +