From fae9bad09689fe14f71db7e464f5baa62406f33b Mon Sep 17 00:00:00 2001 From: AML - A Laycock Date: Mon, 28 Oct 2024 13:11:27 +0000 Subject: [PATCH] fix: fix build issues --- app/lib/utils/contrast-color.ts | 12 ++++++------ app/routes/app.documents.$document.attach.tsx | 9 +++++---- app/routes/app.system.tsx | 2 +- app/routes/app_.login.tsx | 2 -- tests/unit/utils.spec.ts | 17 ++++++++++++++++- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app/lib/utils/contrast-color.ts b/app/lib/utils/contrast-color.ts index c60f207..a8432d2 100644 --- a/app/lib/utils/contrast-color.ts +++ b/app/lib/utils/contrast-color.ts @@ -1,12 +1,12 @@ -export function contrastColor(color: string) { +export const contrastColor = (color: string) => { return luma(color) >= 165 ? '#444' : '#fff' } -function luma(color: string | Array) { +const luma = (color: string | Array) => { // color can be a hx string or an array of RGB values 0-255 - var rgb = typeof color === 'string' ? hexToRGBArray(color) : color + const rgb = typeof color === 'string' ? hexToRGBArray(color) : color return 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2] // SMPTE C, Rec. 709 weightings } -function hexToRGBArray(color: string) { +const hexToRGBArray = (color: string) => { if (color.length === 3) color = color.charAt(0) + @@ -16,7 +16,7 @@ function hexToRGBArray(color: string) { color.charAt(2) + color.charAt(2) else if (color.length !== 6) throw 'Invalid hex color: ' + color - var rgb = [] - for (var i = 0; i <= 2; i++) rgb[i] = parseInt(color.substr(i * 2, 2), 16) + const rgb = [] + for (let i = 0; i <= 2; i++) rgb[i] = parseInt(color.substr(i * 2, 2), 16) return rgb } diff --git a/app/routes/app.documents.$document.attach.tsx b/app/routes/app.documents.$document.attach.tsx index 4692fbb..4db69a3 100644 --- a/app/routes/app.documents.$document.attach.tsx +++ b/app/routes/app.documents.$document.attach.tsx @@ -14,10 +14,11 @@ import {ensureUser} from '~/lib/utils/ensure-user' import {getPrisma} from '~/lib/prisma.server' import {pageTitle} from '~/lib/utils/page-title' import {Input} from '~/lib/components/input' -import {Button} from '~/lib/components/button' -import {getUploadMetaData} from '~/lib/utils/upload-handler.server' -import {getUploadHandler} from '~/lib/utils/upload-handler.server' -import {AButton} from '~/lib/components/button' +import {Button, AButton} from '~/lib/components/button' +import { + getUploadMetaData, + getUploadHandler +} from '~/lib/utils/upload-handler.server' export type Attachment = { uri: string diff --git a/app/routes/app.system.tsx b/app/routes/app.system.tsx index 7e603bd..c912172 100644 --- a/app/routes/app.system.tsx +++ b/app/routes/app.system.tsx @@ -82,7 +82,7 @@ const System = () => {