diff --git a/CHANGELOG.md b/CHANGELOG.md index 444383b..6b7bfc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## [0.8.0] 2024-10-09 ### Added - Add Kaktovik numeral package +- inputMode="decimal" for input, iPhone keyboard will show numeric pad ## [0.7.0] 2024-05-16 ### Added diff --git a/packages/kaktovik/badges/coverage.svg b/packages/kaktovik/badges/coverage.svg index 281ac22..7291acb 100644 --- a/packages/kaktovik/badges/coverage.svg +++ b/packages/kaktovik/badges/coverage.svg @@ -1 +1 @@ -Coverage: 96.73%Coverage96.73% \ No newline at end of file +Coverage: 94.56%Coverage94.56% \ No newline at end of file diff --git a/packages/numerals-client/package.json b/packages/numerals-client/package.json index 228e4ce..9012a6a 100644 --- a/packages/numerals-client/package.json +++ b/packages/numerals-client/package.json @@ -16,7 +16,7 @@ "@numerals/eastern-arabic": "0.0.2", "@numerals/hanifi-rohingya": "0.0.1", "@numerals/hieroglyphic": "0.0.2", - "@numerals/kaktovik": "0.0.1-next.0", + "@numerals/kaktovik": "0.0.1", "@numerals/mayan": "0.0.1", "@numerals/roman": "0.0.2", "@numerals/thai": "0.0.2" diff --git a/packages/numerals-web/CHANGELOG.md b/packages/numerals-web/CHANGELOG.md index 50110b1..1f1afce 100644 --- a/packages/numerals-web/CHANGELOG.md +++ b/packages/numerals-web/CHANGELOG.md @@ -2,7 +2,7 @@ -## [0.8.0] 2024-01-16 +## [0.8.0] 2024-10-16 ### Added - Add Kaktovik numeral conversion diff --git a/packages/numerals-web/next.config.js b/packages/numerals-web/next.config.js index 658404a..d656242 100644 --- a/packages/numerals-web/next.config.js +++ b/packages/numerals-web/next.config.js @@ -1,4 +1,6 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; - -module.exports = nextConfig; +module.exports = { + experimental: { + missingSuspenseWithCSRBailout: false, + }, +} diff --git a/packages/numerals-web/package.json b/packages/numerals-web/package.json index 03704ed..ed0deb0 100644 --- a/packages/numerals-web/package.json +++ b/packages/numerals-web/package.json @@ -1,7 +1,7 @@ { "name": "numerals-web", "private": true, - "version": "0.8.0-next.0", + "version": "0.8.0", "scripts": { "dev": "next dev", "build": "next build", @@ -18,13 +18,13 @@ "@numerals/eastern-arabic": "0.0.2", "@numerals/hanifi-rohingya": "0.0.1", "@numerals/hieroglyphic": "0.0.2", - "@numerals/kaktovik": "0.0.1-next.0", + "@numerals/kaktovik": "0.0.1", "@numerals/mayan": "0.0.1", "@numerals/roman": "0.0.2", "@numerals/thai": "0.0.2", "@vercel/analytics": "^1.1.2", "@vercel/speed-insights": "^1.0.9", - "next": "^14.1.0", + "next": "14.2.15", "react": "^18.2.0", "react-dom": "^18.2.0", "react-select": "^5.8.0" diff --git a/packages/numerals-web/src/app/page.tsx b/packages/numerals-web/src/app/page.tsx index b660060..7d2e430 100644 --- a/packages/numerals-web/src/app/page.tsx +++ b/packages/numerals-web/src/app/page.tsx @@ -11,22 +11,23 @@ import { convert as convertTh } from '@numerals/thai' import { convert as convertHr } from '@numerals/hanifi-rohingya' import { convert as convertKa } from '@numerals/kaktovik' import Image from 'next/image' +import { Numerals, getNumerals } from './types' +import { useSearchParams } from 'next/navigation' -enum Numerals { - EasternArabic = 'easternArabic', - Mayan = 'mayan', - Hieroglyphic = 'hieroglyphic', - Roman = 'roman', - Aegean = 'aegean', - Thai = 'thai', - HanifiRohingya = 'hanifi-rohingya', - Kaktovik = 'kaktovik', -} +const DEFAULT_TO = Numerals.EasternArabic +const DEFAULT_INPUT = '' export default function Home() { - const [textBoxValue, setTextBoxValue] = useState('') - const [resultText, setResultText] = useState('') - const [toValue, setToValue] = useState(Numerals.EasternArabic) + const query = useSearchParams() + const to = query?.get('to') + const input = query?.get('input') + const landingTo = getNumerals(to, DEFAULT_TO) + const landingInput = input ?? DEFAULT_INPUT + const [toValue, setToValue] = useState(landingTo) + const [textBoxValue, setTextBoxValue] = useState(landingInput) + const landingResult = landingInput ? convert(parseFloat(landingInput), landingTo) : '' + const [resultText, setResultText] = useState(landingResult) + const options = [ { value: Numerals.EasternArabic, label: 'Eastern Arabic ูค ูฃ ูข ูก' }, @@ -36,48 +37,52 @@ export default function Home() { { value: Numerals.Aegean, label: 'Aegean ๐„‡ ๐„ˆ ๐„ ๐„™' }, { value: Numerals.Thai, label: 'Thai เน‘ เน’ เน“ เน”' }, { value: Numerals.HanifiRohingya, label: 'Hanifi Rohingya ๐ด ๐ด‘ ๐ด’ ๐ด“' }, - { value: Numerals.Kaktovik, label: 'Kaktovic ๐‹€ ๐‹ ๐‹‚ ๐‹ƒ' }, + { value: Numerals.Kaktovik, label: 'Kaktovik ๐‹€ ๐‹ ๐‹‚ ๐‹ƒ' }, ] - const ToSelect = () =>
- - option.value === toValue)} + onChange={(selectedOption) => { + if (!selectedOption) { + setToValue(DEFAULT_TO) + return + } + setToValue(selectedOption.value) + try { + const result = convert(parseFloat(textBoxValue), selectedOption.value) + setResultText(result) + } catch (e: any) { + setResultText(e.message) + } + }} + /> +
+ } return (

Numerals Converter

-