Dress to Impress, a big fancy Neopets customization tool!
  • Ruby 53.7%
  • JavaScript 30.6%
  • Haml 6.5%
  • Sass 5.2%
  • HTML 3.6%
  • Other 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Armin (AI) 3e85e4eeae
All checks were successful
CI / rspec (push) Successful in 1m35s
CI / deploy (push) Successful in 2m20s
Add an NC Pet Styles mode to wardrobe search (#38)
Adds an **NC Pet Styles** mode to wardrobe search. The pose picker's Styles tab opens right over the pet, so the style you hover to preview is hidden behind the popover you're hovering in. In search, the preview pane stays uncovered.

## Screenshots

| Hovering a style previews it, with a pill over the pet | Typing filters the grid by name, color or species |
|---|---|
| ![The search panel showing style tiles grouped by color; the pet on the left shows the hovered style, with a "Previewing · Fluttering Faerie" pill above it](https://code.openneo.net/attachments/d52dd5ea-64da-401c-a1cd-70b560733445) | ![The grid filtered to "nostalgic", with Nostalgic Faerie Ice worn and named in the caption bar](https://code.openneo.net/attachments/36774dc6-c595-4060-81ac-18b0af28b531) |

<details><summary>Phone width</summary>

<img src="https://code.openneo.net/attachments/9e0ecfdb-f7cd-4830-bf7a-29fc00f22c8e" width="390" alt="At phone width, the grid is the lower pane with the pet above it, and a tapped style is worn">

</details>

## What changes for users

- **Getting there.** Typing the start of "styles", "pet" or "tokens" in the search field offers an **NC Pet Styles** filter, after any NC/NP/PB suggestions. The advanced search suggestions offer it too. It shows in the field's left addon, like the zone and NC/NP filters.
- **The grid.** Tiles are about 72px (64px on phones), grouped by color with the pet's color first. Two short lines under each name it: the series ("Nostalgic") and the Prismatic variant ("Pink"). Typed text filters by name, color and species.
- **Wearing.** Clicking a tile wears it. Clicking the worn tile, or pressing Space on it, takes it off. There's no Default tile.
- **Previewing.** With a mouse, resting on a tile for 200ms previews it on the pet. A "Previewing" pill over the pet names the style. Leaving the grid, typing or picking ends the preview. Touch has no preview: a tap wears.
- **Caption bar.** Pinned to the bottom, it names the hovered style, or else the worn one. For a worn, named style it links to the token's item page. The hovered style gets "Click to wear" instead of a link: moving down to a link would leave the grid and end the hover.
- **Keyboard.** Down from the field moves to the worn style, or the first one. Arrow keys move between styles (and wear them, as in the popover), without wrapping at the ends: Up or Left from the first style goes back to the field, like item search. Escape goes back to the field too. Scrolling by keyboard keeps the focused tile clear of the caption bar.

The pose picker's Styles tab is unchanged for now. Step 3 of the plan slims it to a row that opens this mode.

## Under the hood

- `filterToItemKind: "STYLE"` is the new query value. In that mode, zone and own/want suggestions are hidden, and the style suggestion is hidden while those filters are set. Own/want for styles is a later follow-up.
- `SearchPanel` renders the new `StyleSearchResults` for `STYLE`, which filters the species' styles in the browser from the same `/species/:id/alt-styles.json` the wardrobe already loads. No server change.
- `previewAltStyleId` moved from `WardrobePreviewAndControls` up to `WardrobePage`, so search and the pose picker share it.
- A few named styles have no series yet, so the server's series is the `<New?>` placeholder. Their tiles show the style's name instead.

## Testing

`yarn lint` and Prettier are clean. There's no JS test runner, so I checked these in Chromium against a local server with public data, using a Faerie Aisha (143 styles):

- [x] The suggestion appears for "styl", and picking it shows 143 tiles with the "NC Pet Styles" addon.
- [x] Hovering previews on the pet and shows the pill. Clicking wears it (`style=` lands in the URL), the pill goes away, and the picker button reads "Fluttering".
- [x] Clicking the worn tile again takes it off. Space on the worn tile takes it off, and Space again puts it back on.
- [x] "nostalgic pink" shows 2 tiles. "zzz" shows "No styles match “zzz”."
- [x] Down from the field focuses the first tile. ArrowRight moves and wears. Escape returns to the field, and a second Escape returns to the outfit list.
- [x] Phone emulation (iPhone 13): tapping wears, and no preview or pill sticks.
- [x] Switching species to Acara mid-preview clears the pill, and the grid reloads with Acara's 98 styles, Faerie first.
- [x] Up from the first tile returns to the field without wearing anything. Right on the last tile stays put. Walking 40 tiles with the arrow keys keeps each focused tile above the caption bar.
- [x] With only 2 matches, the caption bar still sits at the bottom of the panel.
- [x] "nc" suggests only "Neocash items"; "st", "pe", "token" and "styl" offer NC Pet Styles. Ordinary item search ("hat") looks unchanged.

A fresh-eyes review pass found the keyboard and layout issues above, now fixed. Not yet checked: a screen reader, and Firefox. (Space-to-remove has a guard for browsers that click on keyup, but I could only test Chromium.)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014PWWczDoFB58ZYFZ68WxeS
Reviewed-on: #38
2026-11-17 13:12:49 -08:00
.devcontainer Set up Codespaces 2026-05-25 23:30:05 +00:00
.forgejo/workflows Let deploy-bot's SSH key work from the new runner box (#33) 2026-11-16 20:49:42 -08:00
.husky Add RSpec to the commit hook 2024-10-24 15:22:39 -07:00
app Add an NC Pet Styles mode to wardrobe search (#38) 2026-11-17 13:12:49 -08:00
bin Deploy automatically when changes land in main (#18) 2026-11-09 08:10:30 -08:00
config Patch sanitize, omniauth, and msgpack security advisories (#23) 2026-11-15 18:00:25 -08:00
db Harden the deletion fix: more indexes, safer migration, deadlock retry 2026-11-08 04:29:04 +00:00
deploy Run the itemdb style import daily (#39) 2026-11-17 12:43:29 -08:00
docs Run the itemdb style import daily (#39) 2026-11-17 12:43:29 -08:00
lib Import unlabeled style tokens from itemdb (#30) 2026-11-16 21:40:48 -08:00
public Remove temporary files used in previous glitch-fixing commit 2026-01-19 11:15:33 -08:00
spec Freeze time in rate limit specs, to fix a flaky test (#40) 2026-11-17 12:58:52 -08:00
test Add assets to modeling tests, and also uhh some other fixes 2024-10-21 16:46:10 -07:00
vendor Run bundle update (#24) 2026-11-15 19:06:04 -08:00
.bundler-audit.yml Run bundle update (#24) 2026-11-15 19:06:04 -08:00
.eslintrc.json Set up eslint for wardrobe-2020 2023-11-02 18:11:07 -07:00
.gitignore Improve Solargraph LSP in our spec files 2024-11-19 11:28:36 -08:00
.rspec Move modeling tests to RSpec 2024-10-21 16:03:58 -07:00
.ruby-version Upgrade to Ruby 3.4.5, Rails 8.0.2 2025-07-23 20:39:27 -07:00
.security-scan-ignore.yml Refresh JS dependencies within their current ranges (#25) 2026-11-15 19:08:34 -08:00
.yarnrc.yml Upgrade to Yarn 4.0.2 2024-01-14 23:05:53 -08:00
CLAUDE.md Add basic CLAUDE.md 2026-11-07 19:31:06 -08:00
config.ru Upgrade to Rails 6.1.7.4 2023-10-23 19:05:07 -07:00
falcon.rb Raise the production memory cap, and use jemalloc (#19) 2026-11-09 07:48:14 -08:00
Gemfile Patch reachable security advisories, add bin/security-scan 2026-11-08 04:30:24 +00:00
Gemfile.lock Run bundle update (#24) 2026-11-15 19:06:04 -08:00
LICENSE.md Update GitHub links to point to our self-hosted OpenNeo Code 2024-02-29 11:24:21 -08:00
package.json Patch reachable security advisories, add bin/security-scan 2026-11-08 04:30:24 +00:00
Procfile.dev Update devcontainer 2025-10-30 02:16:54 +00:00
Rakefile Uninstall resque 2023-10-23 19:05:04 -07:00
README.md Deploy automatically when changes land in main (#18) 2026-11-09 08:10:30 -08:00
yarn.lock Refresh JS dependencies within their current ranges (#25) 2026-11-15 19:08:34 -08:00

Dress to Impress beach logo

Dress to Impress

Dress to Impress (DTI) is a tool for designing Neopets outfits. Load your pet, browse items, and see how they look together—all with a mobile-friendly interface!

Architecture Overview

DTI is a Rails application with a React-based outfit editor, backed by MySQL databases and a crowdsourced data collection system.

Core Components

  • Rails backend (Ruby 3.4, Rails 8.0): Serves web pages, API endpoints, and manages data
  • MySQL databases: Primary database (openneo_impress) + legacy auth database (openneo_id)
  • React outfit editor: Embedded in app/javascript/wardrobe-2020/, provides the main customization UI
  • Modeling system: Crowdsources pet/item appearance data by fetching from Neopets APIs when users load their pets

The Impress 2020 Complication

In 2020, we started a NextJS rewrite ("Impress 2020") to modernize the frontend. We've since consolidated back into Rails, but Impress 2020 still provides essential services:

  • GraphQL API: Some outfit appearance data still loads via GraphQL (being migrated to Rails REST APIs)
  • Image generation: Runs a headless browser to render outfit thumbnails and convert HTML5 assets to PNGs

See docs/impress-2020-dependencies.md for migration status.

Key Concepts

Customization Data Model

The core data model powers outfit rendering and item compatibility. See docs/customization-architecture.md for details.

Quick summary:

  • body_id is the key compatibility constraint (not species or color directly)
  • Items have different swf_assets (visual layers) for different bodies
  • Restrictions are subtractive: start with all layers, hide some based on zone restrictions
  • Data is crowdsourced through "modeling" (users loading pets to contribute appearance data)

Modeling (Crowdsourced Data)

DTI doesn't pre-populate item/pet data. Instead:

  1. User loads a pet (via pet name lookup)
  2. DTI fetches appearance data from Neopets APIs (legacy Flash/AMF protocol)
  3. New SwfAsset records and relationships are created
  4. Over time, the database learns which items fit which pet bodies

This "self-sustaining" approach means the site stays up-to-date as Neopets releases new content, without manual data entry.

Directory Map

Key Application Files

app/
├── controllers/
│   ├── outfits_controller.rb       # Outfit editor + CRUD
│   ├── items_controller.rb         # Item search, pages, and JSON APIs
│   ├── pets_controller.rb          # Pet loading (triggers modeling)
│   └── closet_hangers_controller.rb # User item lists ("closets")
│
├── models/
│   ├── item.rb                     # Items + compatibility prediction logic
│   ├── pet_type.rb                 # Species+Color combinations (has body_id)
│   ├── pet_state.rb                # Visual variants (pose/gender/mood)
│   ├── swf_asset.rb                # Visual layers (biology/object)
│   ├── outfit.rb                   # Saved outfits + rendering logic (visible_layers)
│   ├── alt_style.rb                # Alternative pet appearances (Nostalgic, etc.)
│   ├── pet/
│   │   └── modeling_snapshot.rb    # Processes Neopets API data into models
│   └── auth_user/
│       └── deletion.rb             # Account deletion (domain logic lives here, by model)
│
├── services/                       # Clients for EXTERNAL services only (see its README)
│   ├── neopets/
│   │   ├── custom_pets.rb          # Neopets AMF/Flash API client (pet data)
│   │   ├── nc_mall.rb              # NC Mall item scraping
│   │   └── neopass.rb              # NeoPass OAuth integration
│   ├── neopets_media_archive.rb    # Local mirror of images.neopets.com
│   └── lebron_nc_values.rb         # NC item trading values (external API)
│
├── javascript/
│   ├── wardrobe-2020/              # React outfit editor (extracted from Impress 2020)
│   │   ├── loaders/                # REST API calls (migrated from GraphQL)
│   │   ├── WardrobePage/           # Main editor UI
│   │   └── components/             # Shared React components
│   └── application.js              # Rails asset pipeline entrypoint
│
└── views/
    ├── outfits/
    │   └── edit.html.haml          # Outfit editor page (loads React app)
    ├── items/
    │   └── show.html.haml          # Item detail page
    └── closet_hangers/
        └── index.html.haml         # User closet/item lists

Configuration & Docs

config/
├── routes.rb                       # All Rails routes
├── database.yml                    # Multi-database setup (main + openneo_id)
└── environments/
    └── *.rb                        # Env-specific config (incl. impress_2020_origin)

Documentation:

Tests:

  • test/ - Test::Unit tests (privacy features)
  • spec/ - RSpec tests (models, services, integrations)
    • Coverage is focused on key areas: modeling, prediction logic, external APIs
    • Not comprehensive, but thorough for critical behaviors

Tech Stack

  • Backend: Ruby on Rails (Ruby 3.4, Rails 8.0)
  • Frontend: Mix of Rails views (Turbo/HAML) and React (for outfit editor)
  • Database: MySQL (two databases: openneo_impress, openneo_id)
  • Styling: CSS, Sass (moving toward modern Rails conventions)
  • External Integrations:
    • Neopets.com: Legacy Flash/AMF protocol for pet appearance data (modeling)
    • Neopets NC Mall: Web scraping for NC item availability/pricing
    • NeoPass: OAuth integration for Neopets account linking
    • Neopets Media Archive: Local filesystem mirror of images.neopets.com (never discards old files)
    • Lebron's NC Values: Third-party API for NC item trading values (lebron-values.netlify.app)
    • Impress 2020: GraphQL for some outfit data, image generation service (being phased out)

Development Notes

OpenNeo ID Database

The openneo_id database is a legacy from when authentication was a separate service ("OpenNeo ID") meant to unify auth across multiple OpenNeo projects. DTI was the only project that succeeded, so the apps were merged—but the database split remains for now.

Implications:

  • Rails is configured for multi-database mode
  • User auth models live in auth_user.rb and connect to openneo_id
  • ⚠️ CRITICAL: Impress 2020 also directly accesses both openneo_impress and openneo_id databases via SQL
  • Database migrations affecting these schemas must consider Impress 2020's direct access
  • See docs/impress-2020-dependencies.md for full details on this dependency

Rails/React Hybrid

Most pages are traditional Rails views using Turbo for interactivity. The outfit editor (/outfits/new) is a full React app that:

  • Loads into a #wardrobe-2020-root div
  • Uses React Query for data fetching
  • Calls both Rails REST APIs (in loaders/) and Impress 2020 GraphQL (being migrated)

The goal is to simplify this over time—either consolidate into Rails+Turbo, or commit fully to React. For now, we're in a hybrid state.

Deployment

  • Main app: VPS running Rails (Puma, MySQL)
  • Impress 2020: Separate VPS in same datacenter (NextJS, GraphQL, headless browser for images)
  • Shared databases: Both services directly access the same MySQL databases over the network
    • openneo_impress - Main application data
    • openneo_id - Authentication data
    • ⚠️ Any database schema changes must be compatible with both services
  • Automatic deploys: Changes deploy when they land in main and the specs pass, including database migrations. See docs/deployment-setup.md and docs/database-migrations.md.

Project maintained by @matchu • OpenNeo.net