All files / src/apps/gbs-music-web/components MusicWebCredits.tsx

0% Statements 0/29
0% Branches 0/12
0% Functions 0/12
0% Lines 0/26

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107                                                                                                                                                                                                                     
import React, { useMemo } from "react";
import FocusLock from "react-focus-lock";
import l10n from "shared/lib/lang/l10n";
import {
  Credits,
  CreditsTitle,
  CreditsSubHeading,
  CreditsPerson,
  CreditsGrid,
} from "ui/splash/credits/Credits";
import contributors from "contributors.json";
import contributorsExternal from "contributors-external.json";
import patrons from "patrons.json";
 
interface MusicWebCreditsProps {
  onClose: () => void;
}
 
const MusicWebCredits = ({ onClose }: MusicWebCreditsProps) => {
  const goldContributors = useMemo(
    () => contributors.filter((user) => user.group === "gold"),
    [],
  );
 
  const silverContributors = useMemo(
    () =>
      [...contributorsExternal]
        .map((contributor) => ({
          ...contributor,
          // eslint-disable-next-line camelcase
          html_url: contributor.html_url ?? "",
        }))
        .concat(contributors.filter((user) => user.group === "silver"))
        .sort((a, b) => {
          const loginA = a.login.toLowerCase();
          const loginB = b.login.toLowerCase();
          Iif (loginA < loginB) return -1;
          Iif (loginA > loginB) return 1;
          return 0;
        }),
    [],
  );
 
  return (
    <FocusLock>
      <Credits onClose={onClose}>
        <CreditsTitle>GBS Music</CreditsTitle>
        <CreditsSubHeading>Based On hUGETracker By</CreditsSubHeading>
        <CreditsPerson
          href="https://nickfa.ro/wiki/Main_Page"
          target="_blank"
          rel="noreferrer"
        >
          Nick "SuperDisk" Faro
        </CreditsPerson>
        <CreditsSubHeading>{l10n("SPLASH_CONTRIBUTORS")}</CreditsSubHeading>
        {goldContributors.map((contributor) => (
          <CreditsPerson
            key={contributor.login}
            href={contributor.html_url}
            target="_blank"
            rel="noreferrer"
          >
            {contributor.login}
          </CreditsPerson>
        ))}
        <CreditsGrid>
          {silverContributors.map((contributor) => (
            <CreditsPerson
              key={contributor.login}
              href={contributor.html_url}
              target="_blank"
              rel="noreferrer"
            >
              {contributor.login}
            </CreditsPerson>
          ))}
        </CreditsGrid>
        <CreditsSubHeading>Patrons</CreditsSubHeading>
        <CreditsGrid>
          {(patrons.goldTier || []).map((patron) => (
            <CreditsPerson key={patron.id} gold>
              {patron.attributes.full_name}
            </CreditsPerson>
          ))}
        </CreditsGrid>
        <CreditsGrid>
          {(patrons.silverTier || []).map((patron) => (
            <CreditsPerson key={patron.id}>
              {patron.attributes.full_name}
            </CreditsPerson>
          ))}
        </CreditsGrid>
        <CreditsGrid>
          {(patrons.pastPatrons || []).map((patron) => (
            <CreditsPerson key={patron.id}>
              {patron.attributes.full_name}
            </CreditsPerson>
          ))}
        </CreditsGrid>
      </Credits>
    </FocusLock>
  );
};
 
export default MusicWebCredits;