Remove old trade hangers UI from item page

This commit is contained in:
Emi Matchu 2024-01-21 04:49:06 -08:00
parent b9bb697ca1
commit e4fb067e45
9 changed files with 1 additions and 159 deletions

View file

@ -25,10 +25,6 @@ body.items-show
padding: 1em
width: 30em
// compete with #trade-hangers
position: relative
z-index: 2
h3
font-size: 150%
font-weight: bold
@ -61,48 +57,6 @@ body.items-show
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

View file

@ -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

View file

@ -79,12 +79,6 @@ module ItemsHelper
"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)
" (&times;#{count})".html_safe if count > 1
end

View file

@ -13,29 +13,3 @@ ReactDOM.render(
</AppProvider>,
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);
}

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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