add analytics, v 1.2.1

main
Yuriy Evdokimov 2023-12-13 15:05:17 +05:00
parent 008eb07567
commit 6aac4f7727
5 changed files with 22 additions and 29 deletions

View File

@ -1,27 +1,10 @@
# React + TypeScript + Vite # Pinyin Dictation
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. this is a source code repository for pinyin.wst74.ru site
Currently, two official plugins are available: ## version history
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh v 1.2.1
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh added analytics script call
this README instead of default vitejs
## Expanding the ESLint configuration begin of multivoice
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level `parserOptions` property like this:
```js
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
```
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list

View File

@ -4,6 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script async src="https://anl.wst74.ru/script.js" data-website-id="88168e43-88d4-4c29-bcb0-4c0cc878e7bb"></script>
<title>Pinyin dictation</title> <title>Pinyin dictation</title>
</head> </head>
<body> <body>

View File

@ -2,7 +2,7 @@
"name": "pinyindictation", "name": "pinyindictation",
"author": {"email": "rurik19@yandex.ru", "name": "Юрий Евдокимов"}, "author": {"email": "rurik19@yandex.ru", "name": "Юрий Евдокимов"},
"private": true, "private": true,
"version": "1.2.0", "version": "1.2.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -1,6 +1,6 @@
import { Context, createContext, Dispatch, useContext } from "react"; import { Context, createContext, Dispatch, useContext } from "react";
import { Action, ToggleType } from "./reducer" import { Action, ToggleType } from "./reducer"
import { Syllable, SylPart, Tone } from "./types"; import { SoundPackName, Syllable, SylPart, Tone } from "./types";
import { isEnabled } from "./utils"; import { isEnabled } from "./utils";
export interface IState { export interface IState {
@ -17,7 +17,8 @@ export interface IState {
allEnabled: (type: ToggleType) => false, allEnabled: (type: ToggleType) => false,
isEnabled: (type: ToggleType, index: string) => false, isEnabled: (type: ToggleType, index: string) => false,
isFound: () => false, isFound: () => false,
isToneChecked: (toneNo: number) => false isToneChecked: (toneNo: number) => false,
soundPackName: SoundPackName
} }
export interface IStore { export interface IStore {
@ -48,7 +49,8 @@ export const defaultState:object = {
}, },
isFound: function():boolean { return (this as IState).foundSyllables!.length > 0 && (this as IState).toneChecks!.length > 0} isFound: function():boolean { return (this as IState).foundSyllables!.length > 0 && (this as IState).toneChecks!.length > 0}
, ,
isToneChecked: function(toneNo: number):boolean{ return (this as IState).toneChecks.includes(toneNo) } isToneChecked: function(toneNo: number):boolean{ return (this as IState).toneChecks.includes(toneNo) },
soundPackName: SoundPackName.archchinese
} }
export const AppContext:Context<IStore> = createContext<IStore>({ state: defaultState as IState, dispatch: () => null }) export const AppContext:Context<IStore> = createContext<IStore>({ state: defaultState as IState, dispatch: () => null })

View File

@ -34,4 +34,11 @@ export enum BtnColor {
green = "success" green = "success"
} }
export enum Status {params, prepare, playing, plaied, showlist} export enum Status {params, prepare, playing, plaied, showlist}
export enum SoundPackName { archchinese, dongchinesea, dongchineseb, dongchinesec }
export type SoundPack = {
name: SoundPackName,
audioPath: string
}