From e60eb0b089c82689030a25261066dea13b576727 Mon Sep 17 00:00:00 2001 From: Mojito-Fivem Date: Tue, 30 Aug 2022 22:00:01 +0100 Subject: [PATCH] fix(ui): npwd components to fix input focus --- globals.d.ts | 4 + src/components/Dialogue.tsx | 13 ++-- webpack.config.js | 148 ++++++++++++++++++------------------ 3 files changed, 88 insertions(+), 77 deletions(-) diff --git a/globals.d.ts b/globals.d.ts index a0993ed..9716e25 100644 --- a/globals.d.ts +++ b/globals.d.ts @@ -2,3 +2,7 @@ declare module '*.png' { const value: any; export = value; } + +declare module 'layout/ui' { + export const TextField: any; +} \ No newline at end of file diff --git a/src/components/Dialogue.tsx b/src/components/Dialogue.tsx index 98e5d98..17b0323 100644 --- a/src/components/Dialogue.tsx +++ b/src/components/Dialogue.tsx @@ -12,6 +12,7 @@ import {state} from '../atoms/app-atoms' import fetchNui from "../utils/fetchNui"; import {ServerPromiseResp} from "../types/common"; import {useSnackbar} from "./snackbar/useSnackbar"; +import {TextField} from 'layout/ui' interface Dialogue { close: () => void; @@ -63,13 +64,15 @@ export const BuyDialogue: React.FC = ({close}) => { You will receive {(parseFloat(amount) / currentRate).toFixed(2)} bits } - $} + InputProps={{ + startAdornment: $ + }} /> @@ -130,7 +133,7 @@ export const SellDialogue: React.FC = ({close}) => { You will receive ${parseFloat(amount) * currentRate} } - = ({close}) => { } - - ({ - before: [isDevelopment && ReactRefreshTypeScript()].filter(Boolean), - }), - transpileOnly: isDevelopment, + entry: './src/bootstrap.ts', + mode: isDevelopment ? 'development' : 'production', + devtool: 'inline-source-map', + module: { + rules: [ + { + test: /\.[jt]sx?$/, + exclude: /node_modules/, + use: [ + { + loader: require.resolve('ts-loader'), + options: { + getCustomTransformers: () => ({ + before: [isDevelopment && ReactRefreshTypeScript()].filter(Boolean), + }), + transpileOnly: isDevelopment, + }, + }, + ], + }, + { + test: /\.(png|jpe?g|gif)$/i, + exclude: /node_modules/, + use: [ + { + loader: 'file-loader', + }, + ], }, - }, - ], - }, - { - test: /\.(png|jpe?g|gif)$/i, - exclude: /node_modules/, - use: [ - { - loader: 'file-loader', - }, ], - }, - ], - }, - resolve: { - extensions: ['.tsx', '.ts', '.js'], - }, - output: { - path: path.resolve(__dirname, 'web/dist'), - publicPath: 'auto', - clean: true, - }, - plugins: [ - new ModuleFederationPlugin({ - name: 'npwd_crypto', - filename: 'remoteEntry.js', - exposes: { - './config': './npwd.config', - }, - shared: { - ...deps, - react: { - singleton: true, - requiredVersion: deps.react, - }, - 'react-dom': { - singleton: true, - requiredVersion: deps['react-dom'], - } - }, - }), - new HtmlWebpackPlugin({ - cache: false, - template: './src/index.html', - }), - new webpack.DefinePlugin({ - process: { env: { REACT_APP_IN_GAME: process.env.REACT_APP_IN_GAME } }, - }), - isDevelopment && new ReactRefreshWebpackPlugin(), - ].filter(Boolean), + }, + resolve: { + extensions: ['.tsx', '.ts', '.js'], + }, + output: { + path: path.resolve(__dirname, 'web/dist'), + publicPath: 'auto', + clean: true, + }, + plugins: [ + new ModuleFederationPlugin({ + name: 'npwd_crypto', + filename: 'remoteEntry.js', + exposes: { + './config': './npwd.config', + }, + remotes: { + layout: "layout@http://localhost:3000/remoteEntry.js" + }, + shared: { + ...deps, + react: { + singleton: true, + requiredVersion: deps.react, + }, + 'react-dom': { + singleton: true, + requiredVersion: deps['react-dom'], + } + }, + }), + new HtmlWebpackPlugin({ + cache: false, + template: './src/index.html', + }), + new webpack.DefinePlugin({ + process: {env: {REACT_APP_IN_GAME: process.env.REACT_APP_IN_GAME}}, + }), + isDevelopment && new ReactRefreshWebpackPlugin(), + ].filter(Boolean), - devServer: { - port: 3002, - headers: { - 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS', - 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization', + devServer: { + port: 3002, + headers: { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS', + 'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization', + }, }, - }, };