Skip to content

Commit

Permalink
feat: more look-alike katakana chars
Browse files Browse the repository at this point in the history
  • Loading branch information
arkhlima committed May 30, 2023
1 parent d5d3910 commit fa81560
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/CharGroupSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Char = (props: CharProps) => {
})

onCleanup(() => {
if (animation.data) animation.kill()
if (animation) animation.kill()
})

return (
Expand Down
5 changes: 4 additions & 1 deletion src/constants/kana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ export const DIAGRAPH_DIACRITICS: CharGroup = [
['ぴゃ', 'ぴゅ', 'ぴょ'], // PY
]

export const LOOK_ALIKE: CharGroup = [
export const KATAKANA_LOOK_ALIKE: CharGroup = [
['し', 'つ', 'そ', 'ん', 'の'],
['う', 'ふ', 'わ', 'ら', 'を'],
['こ', 'ゆ', 'ろ', null, null],
['く', 'け', 'た', null, null],
['ち', 'テ', null, null, null],
['す', 'ぬ', null, null, null],
]
4 changes: 2 additions & 2 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
MONOGRAPHS,
MONOGRAPH_DIACRITICS,
DIAGRAPH_DIACRITICS,
LOOK_ALIKE,
KATAKANA_LOOK_ALIKE,
} from '~/constants/kana'

const App = () => {
Expand Down Expand Up @@ -75,7 +75,7 @@ const App = () => {
/>
<Show when={state.selectedScript === 'Katakana'}>
<CharGroupSelect
chars={LOOK_ALIKE}
chars={KATAKANA_LOOK_ALIKE}
selectedChars={`selected${state.selectedScript}LookAlike`}
toggleChars={toggleChars}
toggleAllChars={toggleAllChars}
Expand Down
6 changes: 3 additions & 3 deletions src/routes/quiz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ const AnimatedChar = (props: AnimatedCharProps) => {
})

onCleanup(() => {
if (animation.data) animation.kill()
if (animation) animation.kill()
})

return <span ref={(el) => (char = el)}>{props.children}</span>
}

const Quiz = () => {
const state = useStore()
const { setAnswer } = state
const { setAnswer, reset } = state

const navigate = useNavigate()
let answerInput: HTMLInputElement
Expand Down Expand Up @@ -122,7 +122,7 @@ const Quiz = () => {
})

onCleanup(() => {
if (animation.data) animation.kill()
if (animation) animation.kill()
})

const calculateTranslateValue = (question: number): number => {
Expand Down
12 changes: 7 additions & 5 deletions src/store/kanaStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
MONOGRAPH_DIACRITICS,
DIAGRAPHS,
DIAGRAPH_DIACRITICS,
LOOK_ALIKE,
KATAKANA_LOOK_ALIKE,
} from '~/constants/kana'
import type { CharGroup, Script } from '~/constants/kana'

Expand Down Expand Up @@ -61,7 +61,9 @@ const initialState: State = {
selectedKatakanaDiagraphDiacritics: DIAGRAPH_DIACRITICS.map((group) =>
group.map(() => '')
),
selectedKatakanaLookAlike: LOOK_ALIKE.map((group) => group.map(() => '')),
selectedKatakanaLookAlike: KATAKANA_LOOK_ALIKE.map((group) =>
group.map(() => '')
),

questions: [],
currentQuestion: 0,
Expand Down Expand Up @@ -177,8 +179,6 @@ const useStore = create<State & Actions>((set, get) => ({

reset: () => {
set({
scripts: ['Hiragana', 'Katakana'],

selectedScript: 'Hiragana',

totalHiragana: 0,
Expand All @@ -204,7 +204,9 @@ const useStore = create<State & Actions>((set, get) => ({
selectedKatakanaDiagraphDiacritics: DIAGRAPH_DIACRITICS.map((group) =>
group.map(() => '')
),
selectedKatakanaLookAlike: LOOK_ALIKE.map((group) => group.map(() => '')),
selectedKatakanaLookAlike: KATAKANA_LOOK_ALIKE.map((group) =>
group.map(() => '')
),

questions: [],
currentQuestion: 0,
Expand Down

1 comment on commit fa81560

@vercel
Copy link

@vercel vercel bot commented on fa81560 May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kanakata – ./

kanakata-git-main-arkhlima.vercel.app
kanakata.vercel.app
kanakata-arkhlima.vercel.app

Please sign in to comment.