mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
chore(web): add prettier and format
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { HStack, Text, Select, Spacer } from "@chakra-ui/react";
|
||||
import { useLocales } from "../../../providers/LocaleProvider";
|
||||
import { fetchNui } from "../../../utils/fetchNui";
|
||||
import { HStack, Text, Select, Spacer } from '@chakra-ui/react';
|
||||
import { useLocales } from '../../../providers/LocaleProvider';
|
||||
import { fetchNui } from '../../../utils/fetchNui';
|
||||
|
||||
const LocaleSetting: React.FC<{
|
||||
languages: string[];
|
||||
@@ -11,18 +11,14 @@ const LocaleSetting: React.FC<{
|
||||
|
||||
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
props.setSelectValue(e.target.value);
|
||||
fetchNui("getLocale", e.target.value);
|
||||
fetchNui('getLocale', e.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<HStack spacing={5}>
|
||||
<Text>{locale.ui.settings.language}</Text>
|
||||
<Spacer />
|
||||
<Select
|
||||
onChange={(e) => handleChange(e)}
|
||||
value={props.selectValue}
|
||||
w={150}
|
||||
>
|
||||
<Select onChange={(e) => handleChange(e)} value={props.selectValue} w={150}>
|
||||
{props.languages.map((language) => (
|
||||
<option key={language} value={language}>
|
||||
{language}
|
||||
|
||||
@@ -7,26 +7,26 @@ import {
|
||||
ModalHeader,
|
||||
ModalOverlay,
|
||||
useDisclosure,
|
||||
} from "@chakra-ui/react";
|
||||
import LocaleSetting from "./components/locale";
|
||||
import { useState } from "react";
|
||||
import { useNuiEvent } from "../../hooks/useNuiEvent";
|
||||
import { fetchNui } from "../../utils/fetchNui";
|
||||
import { useLocales } from "../../providers/LocaleProvider";
|
||||
} from '@chakra-ui/react';
|
||||
import LocaleSetting from './components/locale';
|
||||
import { useState } from 'react';
|
||||
import { useNuiEvent } from '../../hooks/useNuiEvent';
|
||||
import { fetchNui } from '../../utils/fetchNui';
|
||||
import { useLocales } from '../../providers/LocaleProvider';
|
||||
|
||||
const Settings: React.FC = () => {
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const { locale } = useLocales();
|
||||
const [languages, setLanguages] = useState([""]);
|
||||
const [selectValue, setSelectValue] = useState("");
|
||||
const [languages, setLanguages] = useState(['']);
|
||||
const [selectValue, setSelectValue] = useState('');
|
||||
|
||||
const closeSettings = () => {
|
||||
onClose();
|
||||
fetchNui("closeSettings");
|
||||
fetchNui('closeSettings');
|
||||
};
|
||||
|
||||
useNuiEvent("loadLocales", (data) => setLanguages(data));
|
||||
useNuiEvent("openSettings", (data: string) => {
|
||||
useNuiEvent('loadLocales', (data) => setLanguages(data));
|
||||
useNuiEvent('openSettings', (data: string) => {
|
||||
onOpen();
|
||||
setSelectValue(data);
|
||||
});
|
||||
@@ -46,11 +46,7 @@ const Settings: React.FC = () => {
|
||||
<ModalContent>
|
||||
<ModalHeader>{locale.ui.settings.title}</ModalHeader>
|
||||
<ModalBody>
|
||||
<LocaleSetting
|
||||
languages={languages}
|
||||
selectValue={selectValue}
|
||||
setSelectValue={setSelectValue}
|
||||
/>
|
||||
<LocaleSetting languages={languages} selectValue={selectValue} setSelectValue={setSelectValue} />
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button colorScheme="blue" onClick={closeSettings}>
|
||||
|
||||
Reference in New Issue
Block a user