-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from javiruiz27/new-structure
feat: init new structure
- Loading branch information
Showing
81 changed files
with
4,288 additions
and
816 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>LoginUi</title> | ||
<base href="/" /> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | ||
<link rel="stylesheet" href="/src/styles.css" /> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "login-ui", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/login-ui/src", | ||
"projectType": "application", | ||
"tags": [], | ||
"// targets": "to see all targets run: nx show project login-ui --web", | ||
"targets": {} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import { ThemeProvider } from '@mui/material'; | ||
import { theme } from '@onboarding/themes'; | ||
import App from './App'; | ||
import { I18nProvider } from '@onboarding/i18n/feature'; | ||
|
||
const translations = { | ||
//cant import of external file. eslint error | ||
es: { | ||
'test.test': 'prueba', | ||
}, | ||
en: { | ||
'test.test': 'test', | ||
}, | ||
}; | ||
|
||
type Props = object; | ||
|
||
const locale = navigator.language; | ||
|
||
export const AppStarter: React.FC<Props> = () => { | ||
const children = ( | ||
<ThemeProvider theme={theme}> | ||
<I18nProvider translations={translations} locale={locale}> | ||
<App /> | ||
</I18nProvider> | ||
</ThemeProvider> | ||
); | ||
|
||
return children; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Typography } from '@mui/material'; | ||
import React from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
const App = () => { | ||
return ( | ||
<div className="container"> | ||
<Typography variant="h1">HOLA QUE TAL</Typography> | ||
<Typography variant="subtitle1"> | ||
<FormattedMessage id="test.test" /> | ||
</Typography> | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { StrictMode } from 'react'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import * as ReactDOM from 'react-dom/client'; | ||
import { AppStarter } from './app/AppStarter'; | ||
|
||
const root = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
); | ||
|
||
root.render( | ||
<StrictMode> | ||
<BrowserRouter> | ||
<AppStarter /> | ||
</BrowserRouter> | ||
</StrictMode> | ||
); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"es": { | ||
"test.test": "prueba" | ||
}, | ||
"en": { | ||
"test.test": "test" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"types": [ | ||
"node", | ||
"@nx/react/typings/cssmodule.d.ts", | ||
"@nx/react/typings/image.d.ts", | ||
"vite/client" | ||
] | ||
}, | ||
"exclude": [ | ||
"src/**/*.spec.ts", | ||
"src/**/*.test.ts", | ||
"src/**/*.spec.tsx", | ||
"src/**/*.test.tsx", | ||
"src/**/*.spec.js", | ||
"src/**/*.test.js", | ||
"src/**/*.spec.jsx", | ||
"src/**/*.test.jsx", | ||
"vite.config.ts", | ||
"vite.config.mts", | ||
"vitest.config.ts", | ||
"vitest.config.mts" | ||
], | ||
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"allowJs": false, | ||
"esModuleInterop": false, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"types": ["vite/client", "vitest"] | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.app.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
], | ||
"extends": "../../tsconfig.base.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"types": [ | ||
"vitest/globals", | ||
"vitest/importMeta", | ||
"vite/client", | ||
"node", | ||
"vitest", | ||
"@nx/react/typings/cssmodule.d.ts", | ||
"@nx/react/typings/image.d.ts" | ||
] | ||
}, | ||
"include": [ | ||
"vite.config.ts", | ||
"vite.config.mts", | ||
"vitest.config.ts", | ||
"vitest.config.mts", | ||
"src/**/*.test.ts", | ||
"src/**/*.spec.ts", | ||
"src/**/*.test.tsx", | ||
"src/**/*.spec.tsx", | ||
"src/**/*.test.js", | ||
"src/**/*.spec.js", | ||
"src/**/*.test.jsx", | ||
"src/**/*.spec.jsx", | ||
"src/**/*.d.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/// <reference types='vitest' /> | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; | ||
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; | ||
|
||
export default defineConfig({ | ||
root: __dirname, | ||
cacheDir: '../../node_modules/.vite/apps/login-ui', | ||
server: { | ||
port: 4200, | ||
host: 'localhost', | ||
}, | ||
preview: { | ||
port: 4300, | ||
host: 'localhost', | ||
}, | ||
plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])], | ||
// Uncomment this if you are using workers. | ||
// worker: { | ||
// plugins: [ nxViteTsPaths() ], | ||
// }, | ||
build: { | ||
outDir: '../../dist/apps/login-ui', | ||
emptyOutDir: true, | ||
reportCompressedSize: true, | ||
commonjsOptions: { | ||
transformMixedEsModules: true, | ||
}, | ||
}, | ||
test: { | ||
watch: false, | ||
globals: true, | ||
environment: 'jsdom', | ||
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], | ||
reporters: ['default'], | ||
coverage: { | ||
reportsDirectory: '../../coverage/apps/login-ui', | ||
provider: 'v8', | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const nx = require('@nx/eslint-plugin'); | ||
const baseConfig = require('../../eslint.config.js'); | ||
|
||
module.exports = [ | ||
...baseConfig, | ||
...nx.configs['flat/react'], | ||
{ | ||
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], | ||
// Override or add rules here | ||
rules: {}, | ||
}, | ||
]; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"name": "ui", | ||
"name": "otp", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/ui/src", | ||
"sourceRoot": "apps/otp/src", | ||
"projectType": "application", | ||
"tags": [], | ||
"// targets": "to see all targets run: nx show project ui --web", | ||
"// targets": "to see all targets run: nx show project otp --web", | ||
"targets": {} | ||
} |
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
apps/otp/src/app/components/validate-token-form/validate-token-form.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Button, Typography } from '@mui/material'; | ||
import { useContext, useEffect, useState } from 'react'; | ||
import { OtpInputComp } from '../otp-input/otp-input'; | ||
import useValidateToken from '../../hooks/use-validate-token'; | ||
import { AuthenticationContext } from '../../context/authentication-context'; | ||
import { Snackbar } from '@mui/material'; | ||
|
||
const ValidateTokenForm = () => { | ||
const [userToken, setUserToken] = useState<string>(''); | ||
const [openErrorMessage, setOpenErrorMessage] = useState<boolean>(false); | ||
|
||
const { | ||
mutate: fetchValidation, | ||
isSuccess, | ||
data: jwtToken, | ||
error, | ||
} = useValidateToken(); | ||
const { email } = useContext(AuthenticationContext); | ||
|
||
const handleValidateToken = () => { | ||
fetchValidation({ email: email ?? '', otp: userToken }); | ||
}; | ||
|
||
useEffect(() => { | ||
if (error) { | ||
setOpenErrorMessage(true); | ||
} | ||
}, [error]); | ||
|
||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'center', | ||
gap: '8px', | ||
}} | ||
> | ||
<Typography variant="h5">Introduce your token</Typography> | ||
<OtpInputComp userToken={userToken} setUserToken={setUserToken} /> | ||
<Button type="submit" onClick={handleValidateToken}> | ||
Validate | ||
</Button> | ||
<Snackbar | ||
open={openErrorMessage} | ||
message={'Error validating your otp token'} | ||
onClose={() => setOpenErrorMessage(false)} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ValidateTokenForm; |
Oops, something went wrong.