Merge branch 'master' of https://github.com/sigonasr2/ngsplanner
This commit is contained in:
commit
c47a25371d
19
src/App.js
19
src/App.js
@ -608,7 +608,7 @@ function LoginForm(p) {
|
|||||||
function SubmitLogin() {
|
function SubmitLogin() {
|
||||||
setError("")
|
setError("")
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
axios.post(GetBackendURL(p)+"/login",{
|
axios.post(GetBackendURL(p)+"/validUser",{
|
||||||
username:username,
|
username:username,
|
||||||
password:md5(password)
|
password:md5(password)
|
||||||
})
|
})
|
||||||
@ -619,6 +619,7 @@ function LoginForm(p) {
|
|||||||
setUsername("")
|
setUsername("")
|
||||||
setPassword("")
|
setPassword("")
|
||||||
setRememberMe(false)
|
setRememberMe(false)
|
||||||
|
history.push("/")
|
||||||
} else {
|
} else {
|
||||||
setError("Could not authenticate!")
|
setError("Could not authenticate!")
|
||||||
}
|
}
|
||||||
@ -635,11 +636,11 @@ function LoginForm(p) {
|
|||||||
<Box title="Login Form">
|
<Box title="Login Form">
|
||||||
{loading?
|
{loading?
|
||||||
<img src={process.env.PUBLIC_URL+"/spinner.gif"} alt="" style={{background:"linear-gradient(white,#bca9f5)",marginTop:"10px"}} />
|
<img src={process.env.PUBLIC_URL+"/spinner.gif"} alt="" style={{background:"linear-gradient(white,#bca9f5)",marginTop:"10px"}} />
|
||||||
:<><h3 className="formError">{error}</h3>
|
:<><div onKeyDown={(f)=>{if (f.key==="Enter") {SubmitLogin()}}}><h3 className="formError">{error}</h3>
|
||||||
<FormField field="username" label="Username: " value={username} maxlength={20} onChange={(p)=>{setUsername(p.currentTarget.value)}} placeholder="Username"/><br/>
|
<FormField field="username" label="Username: " value={username} maxlength={20} onChange={(p)=>{setUsername(p.currentTarget.value)}} placeholder="Username"/><br/>
|
||||||
<FormField field="password" label="Password: " type="password" value={password} onChange={(p)=>{setPassword(p.currentTarget.value)}} placeholder="Password"/><br/>
|
<FormField field="password" label="Password: " type="password" value={password} onChange={(p)=>{setPassword(p.currentTarget.value)}} placeholder="Password"/><br/>
|
||||||
<FormField field="rememberMe" label="Remember Me " type="toggle" checked={rememberMe} onChange={(p)=>{setRememberMe(p.currentTarget.checked)}}/><br/>
|
<FormField field="rememberMe" label="Remember Me " type="toggle" checked={rememberMe} onChange={(p)=>{setRememberMe(p.currentTarget.checked)}}/><br/>
|
||||||
<button type="submit" onClick={SubmitLogin}>Login</button></>
|
<button type="submit" onClick={SubmitLogin}>Login</button></div></>
|
||||||
}
|
}
|
||||||
</Box></>
|
</Box></>
|
||||||
}
|
}
|
||||||
@ -648,6 +649,7 @@ function RegisterForm(p) {
|
|||||||
const [username,setUsername] = useState("")
|
const [username,setUsername] = useState("")
|
||||||
const [password,setPassword] = useState("")
|
const [password,setPassword] = useState("")
|
||||||
const [password2,setPassword2] = useState("")
|
const [password2,setPassword2] = useState("")
|
||||||
|
const [email,setEmail] = useState("")
|
||||||
const [rememberMe,setRememberMe] = useState(false)
|
const [rememberMe,setRememberMe] = useState(false)
|
||||||
const [error,setError] = useState("")
|
const [error,setError] = useState("")
|
||||||
const [loading,setLoading] = useState(false)
|
const [loading,setLoading] = useState(false)
|
||||||
@ -666,6 +668,7 @@ function RegisterForm(p) {
|
|||||||
if (username.length>20) {throw "Username must be less than 21 characters in length."}
|
if (username.length>20) {throw "Username must be less than 21 characters in length."}
|
||||||
if (password.length<6) {throw "Password must contain at least 6 characters."}
|
if (password.length<6) {throw "Password must contain at least 6 characters."}
|
||||||
if (password!==password2) {throw "Password fields must match."}
|
if (password!==password2) {throw "Password fields must match."}
|
||||||
|
if (!email.includes("@")) {throw "Invalid E-mail."}
|
||||||
}catch(err){
|
}catch(err){
|
||||||
setError(err)
|
setError(err)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
@ -673,7 +676,8 @@ function RegisterForm(p) {
|
|||||||
}
|
}
|
||||||
axios.post(GetBackendURL(p)+"/register",{
|
axios.post(GetBackendURL(p)+"/register",{
|
||||||
username:username,
|
username:username,
|
||||||
password:md5(password)
|
password:md5(password),
|
||||||
|
email:email
|
||||||
})
|
})
|
||||||
.then((data)=>{
|
.then((data)=>{
|
||||||
if (data.data.verified) {
|
if (data.data.verified) {
|
||||||
@ -699,9 +703,10 @@ function RegisterForm(p) {
|
|||||||
{loading?
|
{loading?
|
||||||
<img src={process.env.PUBLIC_URL+"/spinner.gif"} alt="" style={{background:"linear-gradient(white,#bca9f5)",marginTop:"10px"}} />
|
<img src={process.env.PUBLIC_URL+"/spinner.gif"} alt="" style={{background:"linear-gradient(white,#bca9f5)",marginTop:"10px"}} />
|
||||||
:<><h3 className="formError">{error}</h3>
|
:<><h3 className="formError">{error}</h3>
|
||||||
<FormField field="username" label="Username: " value={username} maxlength={20} onChange={(p)=>{setUsername(p.currentTarget.value)}} placeholder="Username" tooltip="Enter a username (4-20 characters, alphanumeric only)"/><br/>
|
<FormField field="username" label="Username: " value={username} maxlength={20} onChange={(p)=>{setUsername(p.currentTarget.value)}} placeholder="Username" tooltip="Enter a username (4-20 characters, a-z and _ only)"/><br/>
|
||||||
<FormField field="password" label="Password: " type="password" value={password} onChange={(p)=>{setPassword(p.currentTarget.value)}} placeholder="Password" tooltip="Enter a password (6 or more characters)"/><br/>
|
<FormField field="password" label="Password: " type="password" value={password} onChange={(p)=>{setPassword(p.currentTarget.value)}} placeholder="Password" tooltip="Enter a password (6 or more characters)"/><br/>
|
||||||
<FormField field="password2" label="Verify Password: " type="password" value={password2} onChange={(p)=>{setPassword2(p.currentTarget.value)}} placeholder="Verify Password" tooltip="Enter password again."/><br/>
|
<FormField field="password2" label="Verify Password: " type="password" value={password2} onChange={(p)=>{setPassword2(p.currentTarget.value)}} placeholder="Verify Password" tooltip="Enter password again."/><br/>
|
||||||
|
<FormField field="email" label="E-mail: " type="email" value={email} onChange={(p)=>{setEmail(p.currentTarget.value)}} placeholder="email@example.com" tooltip="This is used to send you password reset emails."/><br/>
|
||||||
<FormField field="rememberMe" label="Remember Me " type="toggle" checked={rememberMe} onChange={(p)=>{setRememberMe(p.currentTarget.checked)}}/><br/>
|
<FormField field="rememberMe" label="Remember Me " type="toggle" checked={rememberMe} onChange={(p)=>{setRememberMe(p.currentTarget.checked)}}/><br/>
|
||||||
<button type="submit" onClick={SubmitRegister}>Login</button></>
|
<button type="submit" onClick={SubmitRegister}>Login</button></>
|
||||||
}
|
}
|
||||||
@ -747,8 +752,8 @@ function App() {
|
|||||||
const [DATA,setDATA] = useState({GetData:()=>{}})
|
const [DATA,setDATA] = useState({GetData:()=>{}})
|
||||||
const [DATAID,setDATAID] = useState({GetData:()=>{}})
|
const [DATAID,setDATAID] = useState({GetData:()=>{}})
|
||||||
|
|
||||||
const [LOGGEDINUSER,setLOGGEDINUSER] = useState("sigonasr2")
|
const [LOGGEDINUSER,setLOGGEDINUSER] = useState("")
|
||||||
const [LOGGEDINHASH,setLOGGEDINHASH] = useState("7355ddfc5b81291cdd2c3025976c108c")
|
const [LOGGEDINHASH,setLOGGEDINHASH] = useState("")
|
||||||
|
|
||||||
|
|
||||||
function GetData(table,row,col,id){
|
function GetData(table,row,col,id){
|
||||||
|
@ -3,6 +3,9 @@ import Modal from 'react-modal'
|
|||||||
import { DisplayIcon } from './DEFAULTS';
|
import { DisplayIcon } from './DEFAULTS';
|
||||||
import { ExpandTooltip } from './components/ExpandTooltip';
|
import { ExpandTooltip } from './components/ExpandTooltip';
|
||||||
|
|
||||||
|
//Helper variables for Weapon selector with structure: [weapon_type,weapon,potential,potential_tooltip,weapon_existence_data]
|
||||||
|
const WEAPON_WEAPONTYPE=0;const WEAPON_WEAPON=1;const WEAPON_POTENTIAL=2;const WEAPON_POTENTIAL_TOOLTIP=3;const WEAPON_EXISTENCE_DATA=4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook that alerts clicks outside of the passed ref
|
* Hook that alerts clicks outside of the passed ref
|
||||||
*/
|
*/
|
||||||
@ -162,6 +165,10 @@ function SelectorWindow(p) {
|
|||||||
</PopupWindow>
|
</PopupWindow>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GetSpecialWeaponName(item) {
|
||||||
|
return item[WEAPON_EXISTENCE_DATA]!==undefined?(item[WEAPON_EXISTENCE_DATA].special_name?.length>0)?item[WEAPON_EXISTENCE_DATA].special_name:(item[WEAPON_WEAPON].name+" "+item[WEAPON_WEAPONTYPE].name):""
|
||||||
|
}
|
||||||
|
|
||||||
function TestPanel(p) {
|
function TestPanel(p) {
|
||||||
const [bpGraphMax,setbpGraphMax] = useState(1000)
|
const [bpGraphMax,setbpGraphMax] = useState(1000)
|
||||||
const [hpGraphMax,sethpGraphMax] = useState(1000)
|
const [hpGraphMax,sethpGraphMax] = useState(1000)
|
||||||
@ -185,9 +192,6 @@ const [classSkillTreeWindowOpen,setClassSkillTreeWindowOpen] = useState(false)
|
|||||||
const [weaponSelectWindowOpen,setWeaponSelectWindowOpen] = useState(false)
|
const [weaponSelectWindowOpen,setWeaponSelectWindowOpen] = useState(false)
|
||||||
const [armorSelectWindowOpen,setArmorSelectWindowOpen] = useState(false)
|
const [armorSelectWindowOpen,setArmorSelectWindowOpen] = useState(false)
|
||||||
|
|
||||||
//Helper variables for Weapon selector with structure: [weapon_type,weapon,potential,potential_tooltip,weapon_existence_data]
|
|
||||||
const WEAPON_WEAPONTYPE=0;const WEAPON_WEAPON=1;const WEAPON_POTENTIAL=2;const WEAPON_POTENTIAL_TOOLTIP=3;const WEAPON_EXISTENCE_DATA=4;
|
|
||||||
|
|
||||||
const [selectedWeapon,setSelectedWeapon] = useState([])
|
const [selectedWeapon,setSelectedWeapon] = useState([])
|
||||||
const [selectedArmor1,setSelectedArmor1] = useState([])
|
const [selectedArmor1,setSelectedArmor1] = useState([])
|
||||||
const [selectedArmor2,setSelectedArmor2] = useState([])
|
const [selectedArmor2,setSelectedArmor2] = useState([])
|
||||||
@ -297,7 +301,7 @@ useEffect(()=>{
|
|||||||
<div className="box">
|
<div className="box">
|
||||||
<div className="boxTitleBar">
|
<div className="boxTitleBar">
|
||||||
<h1>Equipped Weapon</h1></div>
|
<h1>Equipped Weapon</h1></div>
|
||||||
<h2 className="rifle">{selectedWeapon[WEAPON_WEAPON]?.name + " " + selectedWeapon[WEAPON_WEAPONTYPE]?.name}+40</h2>
|
<h2 className="rifle">{GetSpecialWeaponName(selectedWeapon)}+40</h2>
|
||||||
<div><PageControl pages={3} currentPage={weaponPage} setCurrentPage={setWeaponPage} /><div></div></div>
|
<div><PageControl pages={3} currentPage={weaponPage} setCurrentPage={setWeaponPage} /><div></div></div>
|
||||||
{weaponPage === 1 ?
|
{weaponPage === 1 ?
|
||||||
|
|
||||||
@ -586,7 +590,7 @@ AUGMENT
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
displayFunction={(item)=>{
|
displayFunction={(item)=>{
|
||||||
return <li className={"itemwep r"+item[WEAPON_WEAPON].rarity} onClick={()=>{setSelectedWeapon(item);setWeaponSelectWindowOpen(false)}}><div className="itemWeaponWrapper"><img className="itemimg" alt="" src={DisplayIcon(item[WEAPON_EXISTENCE_DATA]?.icon)} /><em className="rifle">{item[WEAPON_EXISTENCE_DATA].special_name ?? item[WEAPON_WEAPON].name+" "+item[WEAPON_WEAPONTYPE].name}</em></div><br /><span className="atk">{item[WEAPON_WEAPON].atk}</span> <ExpandTooltip id={"mouseover-tooltip"+item[WEAPON_WEAPONTYPE].id+"_"+item[WEAPON_WEAPON].id+"_"+item[WEAPON_POTENTIAL].id+"_"+item[WEAPON_POTENTIAL_TOOLTIP].id} tooltip={<>{item[WEAPON_POTENTIAL_TOOLTIP].map((pot,i)=><>{(i!==0)&&<br/>}{pot.name}: {pot.description?pot.description.split("\\n").map((it)=><>{it}<br/> </>):<></>}</>)}</>}>
|
return <li className={"itemwep r"+item[WEAPON_WEAPON].rarity} onClick={()=>{setSelectedWeapon(item);setWeaponSelectWindowOpen(false)}}><div className="itemWeaponWrapper"><img className="itemimg" alt="" src={DisplayIcon(item[WEAPON_EXISTENCE_DATA]?.icon)} /><em className="rifle">{GetSpecialWeaponName(item)}</em></div><br /><span className="atk">{item[WEAPON_WEAPON].atk}</span> <ExpandTooltip id={"mouseover-tooltip"+item[WEAPON_WEAPONTYPE].id+"_"+item[WEAPON_WEAPON].id+"_"+item[WEAPON_POTENTIAL].id+"_"+item[WEAPON_POTENTIAL_TOOLTIP].id} tooltip={<>{item[WEAPON_POTENTIAL_TOOLTIP].map((pot,i)=><>{(i!==0)&&<br/>}{pot.name}: {pot.description?pot.description.split("\\n").map((it)=><>{it}<br/> </>):<></>}</>)}</>}>
|
||||||
<span className="pot">{item[WEAPON_POTENTIAL].name}</span>
|
<span className="pot">{item[WEAPON_POTENTIAL].name}</span>
|
||||||
</ExpandTooltip></li>}}
|
</ExpandTooltip></li>}}
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user