Merge branch 'main' into static

This commit is contained in:
Sam Becker 2024-04-12 08:49:04 -05:00
commit b18bab2460
4 changed files with 306 additions and 294 deletions

View File

@ -14,6 +14,7 @@ describe('EXIF', () => {
it('exposure compensation', () => {
expect(formatExposureCompensation(-1)).toBe('-1ev');
expect(formatExposureCompensation(0)).toBe(undefined);
expect(formatExposureCompensation(0.25)).toBe('+1/4ev');
expect(formatExposureCompensation(0.33)).toBe('+1/3ev');
expect(formatExposureCompensation(0.333)).toBe('+1/3ev');
expect(formatExposureCompensation(0.5)).toBe('+1/2ev');
@ -22,8 +23,22 @@ describe('EXIF', () => {
expect(formatExposureCompensation(0.015625)).toBe('+1/64ev');
expect(formatExposureCompensation(-0.015625)).toBe('-1/64ev');
expect(formatExposureCompensation(1)).toBe('+1ev');
expect(formatExposureCompensation(-1.33)).toBe('-1 1/3ev');
expect(formatExposureCompensation(1.33)).toBe('+1 1/3ev');
expect(formatExposureCompensation(1.333)).toBe('+1 1/3ev');
expect(formatExposureCompensation(1.3333)).toBe('+1 1/3ev');
expect(formatExposureCompensation(1.5)).toBe('+1 1/2ev');
expect(formatExposureCompensation(1.9960938)).toBe('+2ev');
// Ignore long fractions
expect(formatExposureCompensation(-0.119)).toBe('-0.12ev');
expect(formatExposureCompensation(-0.112340989)).toBe('-0.11ev');
expect(formatExposureCompensation(0.119)).toBe('+0.12ev');
expect(formatExposureCompensation(0.112340989)).toBe('+0.11ev');
expect(formatExposureCompensation(1.119)).toBe('+1.12ev');
expect(formatExposureCompensation(1.112340989)).toBe('+1.11ev');
expect(formatExposureCompensation(-1.119)).toBe('-1.12ev');
expect(formatExposureCompensation(-1.112340989)).toBe('-1.11ev');
expect(formatExposureCompensation(1.9595959)).toBe('+1.96ev');
});
});
});

View File

@ -9,18 +9,18 @@
"analyze": "ANALYZE=true next build"
},
"dependencies": {
"@aws-sdk/client-s3": "3.552.0",
"@aws-sdk/s3-request-presigner": "3.552.0",
"@next/bundle-analyzer": "14.1.4",
"@aws-sdk/client-s3": "3.554.0",
"@aws-sdk/s3-request-presigner": "3.554.0",
"@next/bundle-analyzer": "14.2.0",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/forms": "^0.5.7",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^15.0.0",
"@testing-library/react": "^15.0.1",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.7",
"@types/react": "18.2.75",
"@types/react-dom": "18.2.24",
"@types/react": "18.2.76",
"@types/react-dom": "18.2.25",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"@upstash/ratelimit": "^1.0.3",
@ -36,13 +36,13 @@
"cmdk": "^1.0.0",
"date-fns": "^3.6.0",
"eslint": "8.57.0",
"eslint-config-next": "14.1.4",
"eslint-config-next": "14.2.0",
"exifr": "^7.1.3",
"framer-motion": "^11.0.27",
"framer-motion": "^11.0.28",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"nanoid": "^5.0.7",
"next": "14.2.0-canary.67",
"next": "14.2.1-canary.0",
"next-auth": "5.0.0-beta.15",
"next-themes": "^0.3.0",
"openai": "^4.33.0",

551
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -42,9 +42,15 @@ export const formatNumberToFraction = (number: number) => {
const fraction = decimal !== 0
? formatDecimalToFraction(Math.abs(decimal))
: '';
const sign = number > 0 ? '+' : '-';
const whole = integer > 0
? fraction ? `${integer} ` : integer
: '';
return `${sign}${whole}${fraction}`;
const sign = number >= 0 ? '+' : '-';
// Ensure fractions are not too long
if (!fraction || fraction.length <= 4) {
const whole = integer > 0
? fraction ? `${integer} ` : integer
: fraction ? '' : '0';
return `${sign}${whole}${fraction}`;
} else {
const decimalFormatted = decimal.toPrecision(2).replace(/^-*0+/, '');
return `${sign}${integer}${decimalFormatted}`;
}
};