nextui/apps/docs/utils/get-sponsors.ts
աӄա 3f0d81b560
refactor: optimisations (#3523)
* refactor: replace lodash with native approaches

* refactor(deps): update framer-motion versions

* feat(utilities): add @nextui-org/dom-animation

* refactor(components): load domAnimation dynamically

* refactor(deps): add @nextui-org/dom-animation

* fix(utilities): relocate index.ts

* feat(changeset): framer motion optimization

* chore(deps): bump framer-motion version

* fix(docs): conflict issue

* refactor(hooks): remove the unnecessary this aliasing

* refactor(utilities): remove the unnecessary this aliasing

* chore(docs): remove {} so that it won't be true all the time

* chore(dom-animation): end with new line

* refactor(hooks): use debounce from `@nextui-org/shared-utils`

* chore(deps): add `@nextui-org/shared-utils`

* refactor: move mapKeys logic to `@nextui-org/shared-utils`

* refactor: use `get` from `@nextui-org/shared-utils`

* refactor(docs): use `get` from `@nextui-org/shared-utils`

* refactor(shared-utils): mapKeys

* chore(deps): bump framer-motion version

* chore(deps): remove lodash

* refactor(docs): use intersectionBy from shared-utils

* feat(shared-utils): add intersectionBy

* chore(dom-animation): remove extra blank line

* refactor(shared-utils): revise intersectionBy

* fix(modal): add willChange

* refactor(shared-utils): add comments

* fix: build & tests

---------

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2024-11-04 17:47:43 -03:00

27 lines
731 B
TypeScript

import {uniqBy} from "@nextui-org/shared-utils";
import fetch from "node-fetch";
import {__PROD__} from "./env";
import {mockData, Sponsor} from "@/libs/docs/sponsors";
export const getSponsors = async () => {
try {
// if (!__PROD__) {
// return mockData;
// }
const res = await fetch("https://opencollective.com/nextui/members/all.json");
const data = (await res.json()) as Sponsor[];
// filter out repeated sponsors
const sponsors = uniqBy<Sponsor>(data, "profile").filter(
(sponsor) =>
sponsor.role !== "ADMIN" && sponsor.role !== "HOST" && sponsor.name !== "EthicalAds",
);
return sponsors as Sponsor[];
} catch (error) {
return __PROD__ ? [] : mockData;
}
};