Skip to content

Commit

Permalink
[C] update library
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgoff committed May 15, 2024
1 parent 1f1d9a8 commit 92f155f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
15 changes: 15 additions & 0 deletions helpers/assets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type ValidCantoSize = 100 | 240 | 320 | 500 | 640 | 800 | 2050;

const ValidCantoSizes: Array<ValidCantoSize> = [
100, 240, 320, 500, 640, 800, 2050,
];

export const resizeCantoImage = (previewUrl: string, size: ValidCantoSize) => {
if (ValidCantoSizes.includes(size)) {
const urlWithoutConstraint = previewUrl.slice(0, -3);

return urlWithoutConstraint.concat(size.toString());
}

return previewUrl;
};
5 changes: 3 additions & 2 deletions helpers/widgets.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Alert } from "@/lib/api/hooks/useAlerts";
import { resizeCantoImage } from "./assets";

export const combineAlertsAndImages = (
alerts: Array<Alert | any>,
images: Array<any>
) => {
const size = 200;
const size = 240;

return {
alerts: alerts.map((alert, i) => {
Expand All @@ -18,7 +19,7 @@ export const combineAlertsAndImages = (
image: {
width: size,
height: size,
url: directUrlPreview,
url: resizeCantoImage(directUrlPreview, size),
},
};
}),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@greatsumini/react-facebook-login": "^3.3.3",
"@react-oauth/google": "^0.11.0",
"@rubin-epo/epo-react-lib": "^2.0.24",
"@rubin-epo/epo-widget-lib": "^0.9.11-beta.1",
"@rubin-epo/epo-widget-lib": "^0.9.12",
"@unly/universal-language-detector": "^2.0.3",
"@urql/core": "^4.1.0",
"@urql/next": "^1.1.0",
Expand Down
18 changes: 3 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3057,22 +3057,10 @@
react-uid "^2.3.2"
styled-components "^6.1.1"

"@rubin-epo/epo-widget-lib@file:../epo-react-lib/packages/epo-widget-lib/tempPublish":
version "0.9.12"
dependencies:
"@rubin-epo/epo-react-lib" "2.0.24"
context-filter-polyfill "^0.3.6"
d3-array "^3.2.4"
d3-geo "^3.1.0"
d3-geo-projection "^4.0.0"
lodash "^4.17.21"
react-slider "^2.0.6"
skia-canvas "^1.0.1"
styled-components "^6.1.1"
use-resize-observer "^9.1.0"

"@rubin-epo/epo-widget-lib@file:/Users/agoff/Documents/workspace/epo-react-lib/packages/epo-widget-lib/tempPublish":
"@rubin-epo/epo-widget-lib@^0.9.12":
version "0.9.12"
resolved "https://registry.yarnpkg.com/@rubin-epo/epo-widget-lib/-/epo-widget-lib-0.9.12.tgz#91facebe49705c9932c100169b87a506d73d8490"
integrity sha512-6MRYFdQ0QATuGVqOYVpfXLASwujBrqXfTZLn62WbAMgUNCq1LWiX5rT9OHb4bmT5PUgOfxbcVDbskcBBwnl7uQ==
dependencies:
"@rubin-epo/epo-react-lib" "2.0.24"
context-filter-polyfill "^0.3.6"
Expand Down

0 comments on commit 92f155f

Please sign in to comment.