1
0
Fork 1

Use shorter style name in outfit editor's pose picker label

Now that some of these series names are very long (like "Prismatic
Cocoa: Festive"), they can throw off the layout. Let's just use the
shorter one, it's clear enough!
This commit is contained in:
Emi Matchu 2025-01-12 12:02:52 -08:00
parent a385a5b962
commit b6e3079599
4 changed files with 12 additions and 5 deletions
app
controllers
javascript/wardrobe-2020
WardrobePage
loaders
models

View file

@ -29,8 +29,7 @@ class AltStylesController < ApplicationController
format.json { format.json {
@alt_styles = @alt_styles.includes(swf_assets: [:zone]).by_name_grouped @alt_styles = @alt_styles.includes(swf_assets: [:zone]).by_name_grouped
render json: @alt_styles.as_json( render json: @alt_styles.as_json(
only: [:id, :species_id, :color_id, :body_id, :series_name, only: [:id, :species_id, :color_id, :body_id, :thumbnail_url],
:adjective_name, :thumbnail_url],
include: { include: {
swf_assets: { swf_assets: {
only: [:id, :body_id], only: [:id, :body_id],
@ -38,7 +37,7 @@ class AltStylesController < ApplicationController
methods: [:urls, :known_glitches], methods: [:urls, :known_glitches],
} }
}, },
methods: [:series_name, :adjective_name, :thumbnail_url], methods: [:series_main_name, :adjective_name],
) )
} }
end end

View file

@ -283,7 +283,7 @@ const PosePickerButton = React.forwardRef(
const theme = useTheme(); const theme = useTheme();
const icon = altStyle != null ? twemojiSunglasses : getIcon(pose); const icon = altStyle != null ? twemojiSunglasses : getIcon(pose);
const label = altStyle != null ? altStyle.seriesName : getLabel(pose); const label = altStyle != null ? altStyle.seriesMainName : getLabel(pose);
return ( return (
<ClassNames> <ClassNames>

View file

@ -49,7 +49,7 @@ function normalizeAltStyle(altStyleData) {
speciesId: String(altStyleData.species_id), speciesId: String(altStyleData.species_id),
colorId: String(altStyleData.color_id), colorId: String(altStyleData.color_id),
bodyId: String(altStyleData.body_id), bodyId: String(altStyleData.body_id),
seriesName: altStyleData.series_name, seriesMainName: altStyleData.series_main_name,
adjectiveName: altStyleData.adjective_name, adjectiveName: altStyleData.adjective_name,
thumbnailUrl: altStyleData.thumbnail_url, thumbnailUrl: altStyleData.thumbnail_url,

View file

@ -76,6 +76,14 @@ class AltStyle < ApplicationRecord
real_series_name.present? real_series_name.present?
end end
def series_main_name
series_name.split(': ').last
end
def series_variant_name
series_name.split(': ').first
end
def adjective_name def adjective_name
"#{series_name} #{color.human_name}" "#{series_name} #{color.human_name}"
end end