Thursday, June 04, 2026 3:29:53 AM
> project show esm_website_v1
The unexpected heart of the ESM ecosystem. What started as a simple Rails dashboard has evolved into the command center for thousands of gaming communities, proving that sometimes the best infrastructure projects are the ones you never planned to build.
Details
> card_selector.js
import $ from "../helpers/cash_dom";
import * as R from "ramda";

export default class CardSelector {
  constructor(cards) {
    this.cards = cards;

    // Cache the original button text on init
    this.originalButtonText = R.map(
      (card) => $(card).find("button").text(),
      cards
    );
  }

  select(key, selectedText = "SELECTED") {
    this.reset();

    const selectedCard = this.cards[key];
    if (!selectedCard) return;

    $(selectedCard).addClass("selected");

    const button = $(selectedCard).find("button");
    button.addClass("selected");
    button.html(selectedText);
  }

  reset() {
    R.forEachObjIndexed((card, key) => {
      const cardElem = $(card);
      cardElem.removeClass("selected");

      const button = cardElem.find("button");
      button.removeClass("selected");

      // Restore the original text we cached
      button.html(this.originalButtonText[key]);
    }, this.cards);
  }
}
All opinions represented herein are my own
- © 2024 - 2026 itsthedevman
- build 4294fb2