From e4fb067e4566b9f4ab6d6eeaab43754cdf90e54a Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Sun, 21 Jan 2024 04:49:06 -0800 Subject: [PATCH] Remove old trade hangers UI from item page --- app/assets/stylesheets/items/_show.sass | 56 ------------------------- app/controllers/items_controller.rb | 3 +- app/helpers/items_helper.rb | 6 --- app/javascript/item-page.js | 26 ------------ app/views/items/show.html.haml | 21 ---------- config/locales/en-MEEP.yml | 12 ------ config/locales/en.yml | 12 ------ config/locales/es.yml | 12 ------ config/locales/pt.yml | 12 ------ 9 files changed, 1 insertion(+), 159 deletions(-) diff --git a/app/assets/stylesheets/items/_show.sass b/app/assets/stylesheets/items/_show.sass index b29cd378..905a5223 100644 --- a/app/assets/stylesheets/items/_show.sass +++ b/app/assets/stylesheets/items/_show.sass @@ -24,10 +24,6 @@ body.items-show margin-left: 1em padding: 1em width: 30em - - // compete with #trade-hangers - position: relative - z-index: 2 h3 font-size: 150% @@ -60,49 +56,7 @@ body.items-show input[type=number] margin-right: .5em width: 3em - - #trade-hangers - font-size: 85% - margin-bottom: 3em - text-align: left - p - position: relative - - &:first-child - margin-bottom: .5em - - &[data-overflows] - overflow: hidden - .toggle - display: block - - &[data-showing-more] - .toggle - .less - display: block - - .more - display: none - - .toggle - background: white - bottom: 0 - cursor: pointer - display: none - font-family: $main-font - padding: 0 1em - position: absolute - right: 0 - - button - +reset-awesome-button - &:hover - text-decoration: underline - - .less - display: none - #item-contributors +subtle-banner clear: both @@ -128,13 +82,3 @@ body.items-show .nc-icon height: 16px width: 16px - - &.js - #trade-hangers - p - max-height: 3em - overflow: hidden - - &.showing-more - max-height: none - diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index 73992ff1..c4d5207b 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -58,8 +58,7 @@ class ItemsController < ApplicationController respond_to do |format| format.html do - @trades = @item.closet_hangers.trading.includes(:user).user_is_active. - order('users.last_trade_activity_at DESC').to_trades + @trades = @item.closet_hangers.trading.user_is_active.to_trades @contributors_with_counts = @item.contributors_with_counts diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index 63bc3210..8640e94e 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -78,12 +78,6 @@ module ItemsHelper def auction_genie_url_for(item) "https://www.neopets.com/genie.phtml?type=process_genie&criteria=exact&auctiongenie=#{CGI::escape item.name}" end - - def render_trades(trades) - trades.map do |trade| - link_to trade.user.name, user_closet_hangers_path(trade.user) - end.to_sentence.html_safe - end def format_contribution_count(count) " (×#{count})".html_safe if count > 1 diff --git a/app/javascript/item-page.js b/app/javascript/item-page.js index c66f53fb..5d8d56b0 100644 --- a/app/javascript/item-page.js +++ b/app/javascript/item-page.js @@ -13,29 +13,3 @@ ReactDOM.render( , rootNode, ); - -try { - const tradeHangers = document.querySelector("#trade-hangers"); - const tradeSections = document.querySelectorAll("#trade-hangers p"); - for (const section of tradeSections) { - const oneLine = parseFloat(getComputedStyle(section)['line-height']); - const maxHeight = Math.ceil(oneLine * 2); - - if (section.clientHeight > maxHeight) { - section.style.maxHeight = `${maxHeight}px`; - section.setAttribute("data-overflows", ""); - } - - section.querySelector(".more")?.addEventListener("click", (event) => { - section.setAttribute("data-showing-more", ""); - section.style.maxHeight = "none"; - }); - - section.querySelector(".less")?.addEventListener("click", (event) => { - section.removeAttribute("data-showing-more"); - section.style.maxHeight = `${maxHeight}px`; - }); - } -} catch (error) { - console.error("Error applying trade list more/less toggle", error); -} diff --git a/app/views/items/show.html.haml b/app/views/items/show.html.haml index ad93b011..e90436fb 100644 --- a/app/views/items/show.html.haml +++ b/app/views/items/show.html.haml @@ -8,27 +8,6 @@ #item-info %p= @item.description - #trade-hangers - - if Time.now < Date.new(2024, 1, 26) - %p - ✨⏳️ - %i We now only show recently-updated lists here! - ⏳️✨ - %p - %strong - = t '.trading_users.header.owned', count: @trades[:offering].size - = render_trades(@trades[:offering]) - %span.toggle - %button.more= t '.trading_users.show_more' - %button.less= t '.trading_users.show_less' - %p - %strong - = t '.trading_users.header.wanted', count: @trades[:seeking].size - = render_trades(@trades[:seeking]) - %span.toggle - %button.more= t '.trading_users.show_more' - %button.less= t '.trading_users.show_less' - - if user_signed_in? #your-items-form %h3 diff --git a/config/locales/en-MEEP.yml b/config/locales/en-MEEP.yml index a40f5abd..ff32a82c 100644 --- a/config/locales/en-MEEP.yml +++ b/config/locales/en-MEEP.yml @@ -285,18 +285,6 @@ en-MEEP: occupied_header: Occupeeps restricted_header: Restreeps none: Meepless - trading_users: - header: - owned: - zero: We don't know anymeep who has this item meep for trade. - one: "1 user has this item meep for trade:" - other: "%{count} users have this item meep for trade:" - wanted: - zero: "We don't know anymeep who meeps this item." - one: "1 user meeps this item:" - other: "%{count} users meep this item:" - show_more: meep more - show_less: meep less preview: header: Meepview customize_more: Customize meep diff --git a/config/locales/en.yml b/config/locales/en.yml index 0b6f0e54..da472e93 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -314,18 +314,6 @@ en: occupied_header: Occupies restricted_header: Restricts none: None - trading_users: - header: - owned: - zero: We don't know anyone who has this item up for trade. - one: "1 user has this item up for trade:" - other: "%{count} users have this item up for trade:" - wanted: - zero: "We don't know anyone who wants this item." - one: "1 user wants this item:" - other: "%{count} users want this item:" - show_more: more - show_less: less subpages_nav: preview: Preview trades: diff --git a/config/locales/es.yml b/config/locales/es.yml index 0c0c643c..093b99b5 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -224,18 +224,6 @@ es: occupied_header: Ocupa restricted_header: Restringe none: Nada - trading_users: - header: - owned: - zero: No conocemos a nadie que tenga este objeto para intercambiar. - one: "1 usuario tiene este objeto para intercambiar:" - other: "%{count} usuarios tienen este objeto para intercambiar:" - wanted: - zero: "No conocemos a nadie que busque este objeto." - one: "1 usuario busca este objeto:" - other: "%{count} usuarios buscan este objeto:" - show_more: más - show_less: menos preview: header: Previsualizar customize_more: Personalizar más diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 8f5dc994..d7093dca 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -224,18 +224,6 @@ pt: occupied_header: Ocupações restricted_header: Restrições none: Nada - trading_users: - header: - owned: - zero: Ninguém quer trocar esse item - one: "1 usuário quer trocar esse item:" - other: "%{count} usuários possuem, e querem trocar esse item:" - wanted: - zero: "Nós não conhecemos ninguém que procure esse item." - one: "1 usuário procura esse item:" - other: "%{count} usuários procuram esse item:" - show_more: mais - show_less: menos preview: header: Pré-Visualizar customize_more: Personalize mais