diff --git a/visions/ui/.gitignore b/visions/ui/.gitignore deleted file mode 100644 index a547bf3..0000000 --- a/visions/ui/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? diff --git a/visions/ui/README.md b/visions/ui/README.md deleted file mode 100644 index 74872fd..0000000 --- a/visions/ui/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@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 -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -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 -export default tseslint.config({ - languageOptions: { - // other options... - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - }, -}) -``` - -- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` -- Optionally add `...tseslint.configs.stylisticTypeChecked` -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: - -```js -// eslint.config.js -import react from 'eslint-plugin-react' - -export default tseslint.config({ - // Set the react version - settings: { react: { version: '18.3' } }, - plugins: { - // Add the react plugin - react, - }, - rules: { - // other rules... - // Enable its recommended rules - ...react.configs.recommended.rules, - ...react.configs['jsx-runtime'].rules, - }, -}) -``` diff --git a/visions/ui/Taskfile.yml b/visions/ui/Taskfile.yml deleted file mode 100644 index dddd16f..0000000 --- a/visions/ui/Taskfile.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: "3" - -tasks: - fmt: - cmds: - - npm run fmt - - build: - cmds: - - npm install - - npx tsc --watch - - test: - cmds: - # - cd ../visions-types && task build - - npm install - - npm run test diff --git a/visions/ui/eslint.config.js b/visions/ui/eslint.config.js deleted file mode 100644 index af78dac..0000000 --- a/visions/ui/eslint.config.js +++ /dev/null @@ -1,29 +0,0 @@ -import js from "@eslint/js"; -import globals from "globals"; -import reactHooks from "eslint-plugin-react-hooks"; -import reactRefresh from "eslint-plugin-react-refresh"; -import tseslint from "typescript-eslint"; -import eslintConfigPrettier from "eslint-config-prettier"; - -export default tseslint.config( - { ignores: ["dist"] }, - { - extends: [js.configs.recommended, ...tseslint.configs.recommended, eslintConfigPrettier], - files: ["**/*.{ts,tsx}"], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - }, - plugins: { - "react-hooks": reactHooks, - "react-refresh": reactRefresh, - }, - rules: { - ...reactHooks.configs.recommended.rules, - "react-refresh/only-export-components": [ - "warn", - { allowConstantExport: true }, - ], - }, - }, -); diff --git a/visions/ui/index.html b/visions/ui/index.html deleted file mode 100644 index 9fdc22d..0000000 --- a/visions/ui/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - -
- -Hello, ${this.name}!
`; - } -} - diff --git a/visions/ui/src/state.ts b/visions/ui/src/state.ts deleted file mode 100644 index 93b5a60..0000000 --- a/visions/ui/src/state.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Client } from 'visions-client' - -export type AuthState = - | { type: 'unauthed' } - | { type: 'authed'; sessionId: string } - -export type State = { - auth: AuthState -} - -export const initialState = (): State => ({ - auth: { type: 'unauthed' }, -}) - -export const sessionId = (state: State): string | undefined => { - if (state.auth.type === 'authed') { - return state.auth.sessionId - } else { - return undefined - } -} - -export type Action = { type: 'set-auth'; content: AuthState } - -export const reducer = (state: State, action: Action) => { - switch (action.type) { - case 'set-auth': { - return { ...state, auth: action.content } - } - default: { - return state - } - } -} - -export class Controller { - client: Client - state: State - - constructor( - client: Client, - state: State, - ) { - this.client = client - this.state = state - } - - // On any request, there are four options. - // The request succeeds. No problem. - // The request succeeds, but the user needs to reset their password. - // The action fails. - // The HTTP request itself fails. - async auth(username: string, password: string) { - let response = await this.client.auth(username, password) - switch (response.status) { - case 'ok': { - /* - this.dispatch({ - type: 'set-auth', - content: { - type: 'authed', - sessionId: response.content.content, - }, - }) - */ - return - } - } - } -} diff --git a/visions/ui/tsconfig.json b/visions/ui/tsconfig.json deleted file mode 100644 index caec80a..0000000 --- a/visions/ui/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "module": "es6", - "moduleResolution": "node", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "sourceMap": true, - "outDir": "./dist", - "rootDir": "./src" - } -}