Files
TheGame/packages/web/utils/imageHelpers.ts
δυς 81883f940e Miscellaneous changes pulled from #1078 (#1115)
​#1078 is at about 4,000 lines changed and includes both code implementing features and unrelated functional and stylistic changes. This set of changes is about ⅓ of the total and should be largely independent.

These changes include:

* have Dependabot ignore `patch` version changes
* switch the cache invalidation Hasura action to asynchronous
* add a uniqueness constraint on the combination of player and skill ids
* print a comprehensible error message in the db seeding script on network errors
* add a mutex on the account creation process & allow it to happen only once *(subsequent runs were failing b/c of the uniqueness constraint on the ETH address & returning `null` (closes #1098))
* adds some more profile editing related types
* renames `HighLow7dType` to `HighLowType`
* refactors the `ColorBar` component to include links to a color explanation
* replaces `fake-tag`'s `gql` string identifier with the dependency-free `/* GraphQL */`
* rename `lib/hooks/useUserXp.ts` to `useUserXP.ts`
* fixed some typings to remove `any`s
* bumped some library versions & fixed the version numbers of some others
2022-02-08 06:01:06 -05:00

17 lines
475 B
TypeScript

import { imageLink, Maybe } from '@metafam/utils';
export const optimizedImage = (key: string, url?: Maybe<string>, opts = {}) => {
switch (key) {
case 'profileImageURL': {
return imageLink(url, { ar: '1:1', height: 200, ...opts }) ?? undefined;
}
case 'backgroundImageURL':
case 'bannerImageURL': {
return imageLink(url, { height: 300, ...opts }) ?? undefined;
}
default: {
return imageLink(url, opts) ?? undefined;
}
}
};