Page MenuHomePhabricator

[Cashtab] Do not render parenthesis around non-existent NFT tickers
ClosedPublic

Authored by bytesofman on Sep 23 2024, 23:48.

Details

Summary

A number of NFT collections do not have a ticker, so they are displayed with a mysterious '()'

Only show the parenthesis-wrapping around the ticker for tokens that have a ticker.

Test Plan

npm test and check screenshots here

before:

image.png (249×142 px, 31 KB)

after:

image.png (249×156 px, 31 KB)

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: <Nfts /> We can cancel a listing and buy a listing ======
TestingLibraryElementError: Unable to find an element with the text: Classics (CLS). This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="sc-dEfkYy gCfMiu"
    >
      <div
        class="Toastify"
      />
      <div
        class="sc-cqPOvA clVrIX"
      >
        <div
          class="sc-gNJABI jWsBXr"
        >
          <div
            class="sc-kEmuub hIthwo"
          >
            <img
              alt="cashtab"
              class="sc-bbkauy jKzBhk"
              src="test-file-stub"
            />
            <div
              class="sc-ghsgMZ ceeeOL"
            >
              Listed NFTs
              <svg
                title="NFT"
              />
            </div>
          </div>
          <div
            class="sc-eNNmBn edTXfc"
          >
            <select
              class="sc-eEieub iBVdYg"
              data-testid="wallet-select"
              id="wallets"
              name="wallets"
            >
              <option
                class="sc-RbTVP hMcPpG"
                value="NFT Trading [BURNED]"
              >
                NFT Trading [BURNED]
              </option>
            </select>
            <div
              class="sc-eopZyb iDutwN"
            >
              <button
                aria-label="Copy ecash:qplvc8a5eyfehtwjyu539xwsck9dw0clpqah3r8al9"
                class="sc-iQNlJl dQNUoI"
              >
                <svg
                  title="copy-paste"
                />
              </button>
              <div
                class="sc-cpmLhU dyeBXy"
              >
                <div
                  class="sc-dymIpo gyYfmt"
                >
                  <input
                    checked=""
                    class="sc-jzgbtB jgfSAg"
                    id="show-hide-balance"
                    name="show-hide-balance"
                    title="show-hide-balance"
                    type="checkbox"
                  />
                  <label
                    class="sc-bnXvFD hBMwJl"
                    for="show-hide-balance"
                  >
                    <span
                      class="sc-gFaPwZ jegjwl"
                      data-off=""
                      data-on=""
                    />
                    <span
                      class="sc-fhYwyz jdgzKk"
                    />
                  </label>
                </div>
              </div>
            </div>
          </div>
          <div
            class="sc-dznXNo epBKIx"
            title="Wallet Info"
          >
            <div
              class="sc-drlKqa gzObdq"
              title="Balance in XEC"
            >
              9,878.65
               
              XEC
               
            </div>
            <div
              class="sc-bIqbHp eQIbJZ"
              title="Balance in Local Currency"
            >
              $
              0.30
               
              USD
            </div>
            <p
              class="sc-jxGEyO dzLOSG"
              title="Price in Local Currency"
            >
              1 
              XEC
               = 
              0.00003000
               
              USD
            </p>
          </div>
          <div
            class="sc-iuDHTM bRkhcV"
          >
            <div
              class="sc-eLdqWK lcKXEg"
              title="Listed NFTs"
            >
              <div
                class="sc-iSDuPN iLaLMx"
              >
                <div
                  class="sc-cpmLhU dyeBXy"
                >
                  <div
                    class="sc-dymIpo bckJer"
                  >
                    <input
                      class="sc-jzgbtB jgfSAg"
                      id="Toggle NFTs"
                      name="Toggle NFTs"
                      title="Toggle NFTs"
                      type="checkbox"
                    />
                    <label
                      class="sc-bnXvFD hBMwJl"
                      for="Toggle NFTs"
                    >
                      <span
                        class="sc-gFaPwZ hktLQl"
                        data-off=""
                        data-on=""
                      />
                      <span
                        class="sc-fhYwyz dqlgzj"
                      />
                    </label>
                  </div>
                </div>
                <div
                  class="sc-gqPbQI czjmLG"
                >
                  Toggle Buy / Manage Listings
                </div>
              </div>
              <div
                class="sc-iiUIRa dgWsgt"
              >
                Manage your listings
              </div>
              <div
                class="sc-hgRTRy Etfv"
              >
                <div
                  class="sc-feryYK jgljYH"
                >
                  <button
                    aria-label="See your listed NFTs from the Classics collection"
                    class="sc-LKuAh dQHtoR"
                  >
                    <div
                      class="sc-iIHSe jBvFws"
                      size="128"
                      title="631fd95d1c3016526f098f46fe8613b216cd1bdb4f8b8859b3ff8e9d7cadd2cc"
                    />
                  </button>
                  <div
                    class="sc-gldTML bwOSAw"
                  >
                    <div
                      class="sc-hgHYgh cfMKy"
                    >
                      <a
                        href="https://explorer.e.cash/tx/631fd95d1c3016526f098f46fe8613b216cd1bdb4f8b8859b3ff8e9d7cadd2cc"
                        rel="noopener noreferrer"
                        target="_blank"
                      >
                        631
                        ...
                        2cc
                      </a>
                      <button
                        class="sc-iQNlJl dQNUoI"
                      >
                        <svg
                          title="copy-paste"
                        />
                      </button>
                    </div>
                  </div>
                  <div
                    class="sc-gldTML bwOSAw"
                  >
                    Classics
                    (CLS)
                  </div>
                  <div
                    class="sc-gldTML bwOSAw"
                  />
                  <div
                    class="sc-gldTML bwOSAw"
                  >
                    12
                     NFTs
                  </div>
                  <div
                    class="sc-gldTML bwOSAw"
                  >
                    1
                     
                    listed
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div
          class="sc-yZwTr cWMKbM"
        >
          <button
            class="sc-FQuPU doSOrh"
          >
            <svg />
          </button>
          <button
            aria-label="Send Screen"
            class="sc-FQuPU doSOrh"
            style="padding-bottom: 10px;"
          >
            <div
              class="sc-iwsKbI cuDgAv"
            >
              <svg
                title="tx-sent"
              />
            </div>
          </button>
          <button
            aria-label="Tokens"
            class="sc-FQuPU doSOrh"
          >
            <svg
              title="Tokens"
            />
          </button>
          <button
            aria-label="Receive"
            class="sc-FQuPU doSOrh"
          >
            <svg
              title="tx-received"
            />
          </button>
          <div
            class="sc-fjhmcy jOtBOs"
            title="Show Other Screens"
          >
            <span
              class="sc-hwcHae jiKkID"
            />
            <div
              class="sc-lnmtFM dXSWsQ"
              title="Other Screens"
            >
              <button
                class="sc-erNlkL jUqjSc"
              >
                 
                <p>
                  Wallet Backup
                </p>
                <svg
                  title="wallet"
                />
              </button>
              <button
                class="sc-erNlkL jUqjSc"
              >
                 
                <p>
                  Wallets
                </p>
                <svg
                  title="wallets"
                />
              </button>
              <button
                class="sc-erNlkL glzCLH"
              >
                 
                <p>
                  Listed NFTs
                </p>
                <svg
                  title="NFT"
                />
              </button>
              <button
                class="sc-erNlkL jUqjSc"
              >
                 
                <p>
                  Contacts
                </p>
                <svg
                  title="Contact List"
                />
              </button>
              <button
                class="sc-erNlkL jUqjSc"
              >
                 
                <p>
                  Airdrop
                </p>
                <svg
                  title="tx-airdrop"
                />
              </button>
              <button
                class="sc-erNlkL jUqjSc"
              >
                 
                <p>
                  Rewards
                </p>
                <svg
                  title="Cashtab Rewards"
                />
              </button>
              <button
                class="sc-erNlkL jUqjSc"
              >
                 
                <p>
                  Swap
                </p>
                <svg
                  title="swap"
                />
              </button>
              <button
                class="sc-erNlkL jUqjSc"
              >
                <p>
                  Sign & Verify
                </p>
                <svg
                  class="sc-htpNat bPFBeM"
                />
              </button>
              <button
                class="sc-erNlkL jUqjSc"
              >
                <p>
                  Settings
                </p>
                <svg
                  title="settings"
                />
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
    at Object.getElementError (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:37:19)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:76:38
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:52:17
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:95:19
    at Object.getByText (/work/cashtab/src/components/Nfts/__tests__/index.test.js:237:23)

Each failure log is accessible here:
CashTab Unit Tests: <Nfts /> We can cancel a listing and buy a listing

emack added a subscriber: emack.

Not for this diff but tickers sound like something we should be mandating during token creation. It's an easy alternative to token id to separate identical tokens. But if we do mandate it then it's worth tracking whether a ticker already exist.
I also checked etoken creation and it's not mandated there either.

This revision is now accepted and ready to land.Sep 24 2024, 03:16