Commit 5224e752 authored by Febi Chajadi (fec935)'s avatar Febi Chajadi (fec935)
Browse files

Updated Login page to resize better.

parent 462474fc
......@@ -18,7 +18,7 @@ function App (){
const [user, setUser] = useState();
const [au, setau] = useState();
const [prof, setprof] = useState();
const mode = "testingroute";
const mode = "app2";
//<Route path="/" exact component={() => <Login thispass={setPat}/>} />
return (
<isauth.Provider value={{au, setau}}>
......
......@@ -18,8 +18,10 @@ function Dashboard({username}) {
if(prof){
setartistname(prof[0].artistName);
setlocation(prof[0].locationbased);
var profilepicadd = "https://sharedspaces-dev.usask.ca/app2/serve/artistspic/" + prof[0].artistPic;
setprofilepicname(profilepicadd);
if (prof[0].artistPic.length > 0 && typeof prof[0].artistPic !== 'undefined'){
var profilepicadd = "https://sharedspaces-dev.usask.ca/app2/serve/artistspic/" + prof[0].artistPic;
setprofilepicname(profilepicadd);
}
setuploadtext("Click image to change.");
setbio(prof[0].bio);
}
......@@ -35,12 +37,13 @@ function Dashboard({username}) {
useEffect(() => {
async function checkIcon(){
if(profilepic && profilepic.length > 0){
let check_icon = await verifyProfileImage(profilepic, ['FFD8FFE0', '89504E47', 'FFD8FFE2'], 1100);
let check_icon = await verifyProfileImage(profilepic, ['FFD8FFE0', '89504E47', 'FFD8FFE2'], 11000);
if (check_icon === true) {
var updtmessage = "Selected " + profilepic[0].name;
setuploadtext(updtmessage);
} else {
toast.warn("Please ensure the profile icon file is in jpeg/png format and is under 10kb.");
setprofilepic(null);
}
} else {
setuploadtext("Click image to change (10 KB limit).");
......@@ -107,6 +110,7 @@ function Dashboard({username}) {
}
}
if (matchvalue < 1 || varFile[0].size > varLimit) {
console.log(varFile[0].size);
resolve(false);
} else {
resolve(true);
......@@ -127,6 +131,7 @@ function Dashboard({username}) {
toast.warn('Please ensure every input field is completed and an icon is selected.');
return
} else {
newprofile.append('dblookup', 'artists');
newprofile.append('artistName', artistname);
newprofile.append('location', location);
newprofile.append('bio', bio);
......@@ -164,6 +169,7 @@ function Dashboard({username}) {
tosave.append('artistfn', profilepic[0]);
tosave.append('artistPic', profilepic[0].name);
}
tosave.append('dblookup', 'artists');
tosave.append('updatetype', 'artist');
tosave.append('artistName', artistname);
tosave.append('location', location);
......@@ -187,7 +193,7 @@ function Dashboard({username}) {
setprofilepic(null);
})
.catch(err => {
toast.warn('Upload failed.');
toast.warn('Save failed.');
});
}
......
......@@ -224,30 +224,48 @@ function Editor() {
history.push('/profile');
}
/*Sends a command to the Unity app to change the size of the 3d model
* param float newsizenum: the new size value.
*/
const changeSize = (newsizenum) => {
unityContent.send("scriptManager", "adjustSize", newsizenum);
}
/* Sends a command to the Unity app to change the rotation of the 3d model
* param float newX: the new x value.
* param float newY: the new y value.
* param float newZ: the new z value.
*/
const changeRot = (newX, newY, newZ) => {
var newstring = newX + ' ' + newY + ' ' + newZ;
unityContent.send("scriptManager", "adjustRot", newstring);
}
/*Sends a command to the Unity app to change the positioning of the 3d model
* param float newX: the new x value.
* param float newY: the new y value.
* param float newZ: the new z value.
*/
const changePos = (newX, newY, newZ) => {
var newstring = newX + ' ' + newY + ' ' + newZ;
unityContent.send("scriptManager", "adjustPos", newstring);
}
/* Sends a command to the Unity app to delete the current 3d model. */
const destroyObj = () => {
unityContent.send("scriptManager", "deleteItems");
}
/* Sends an Axios request to either upload a new model or update an existing one. Appends the relevant fields such as positioning, rotational, and name to a form that is sent along with any files
* relevant to the model. On a successful reply from the server, the Unity app is reloaded with the uploaded files to display. Relevant React hooks that held files are set to null.
*/
const newupload = async() => {
setStatus(true);
const multiForm = new FormData();
let updatetype = "";
let tagStr = "";
let rightsTag = "";
multiForm.append('dblookup', 'items');
multiForm.append('size', props.current.size);
multiForm.append('xVal', props.current.xVal);
multiForm.append('yVal', props.current.yVal);
......@@ -363,6 +381,14 @@ function Editor() {
});
}
/* Removes baked textures or audio files that were previously uploaded. An Axios request is sent with the filename, id of the model, and the type of media to remove. The Unity app is called
* on successful server reply to reload the app. The associated hook is also reset to null
* param string filename
* param var filetype
* param method setfiletype
* param fileselected
* param string updatetype
*/
const removeItem = async(filename, filetype, setfiletype, fileselected, updatetype) => {
setStatus(true);
if(filetype !== null && filetype.length > 0){
......@@ -414,6 +440,9 @@ function Editor() {
}
}
/* Sends an Axios request to the server to set the review_status of the 3d model. Only accessible by admin accounts.
* param string verdict: verdict for the entry. Either "true" or "ignore".
*/
const decision = (verdict) => {
axios({
method: 'post',
......@@ -434,6 +463,9 @@ function Editor() {
});
}
/* Method that starts when the upload button is pressed. It checks to macke sure a license is selected, the relevant input fields are filled, and verifies each uploaded file to make sure
* they are in the right format and are within size limits.
*/
const onClickHandler = async() => {
try {
const infoForm = new FormData();
......@@ -441,7 +473,7 @@ function Editor() {
infoForm.append('artist', props.current.artistName);
let check_3d = await checkFiles(files, ['4B617964'], 3000000);
let check_tex = await checkFiles(texture, ['FFD8FFE0', '89504E47', 'FFD8FFE2'], 1100000);
let check_icon = await checkFiles(iconPic, ['FFD8FFE0', '89504E47', 'FFD8FFE2'], 1100);
let check_icon = await checkFiles(iconPic, ['FFD8FFE0', '89504E47', 'FFD8FFE2'], 11000);
let check_audio = await checkFiles(audio, ['4944333'], 1100000);
let check_previous = await axios.post("https://sharedspaces-dev.usask.ca/uploadconnect/checkitem.php", infoForm);
if (allrights_tag === false && universal_tag === false && attributionshare_tag === false && attributionnoncom_tag === false){
......@@ -492,6 +524,11 @@ function Editor() {
}
}
/* Verifies the provided files are in the correct format and are within the size limit.
* param var varFile: the file that is being checked.
* param string array varHex: hex value that the file has to match to be considered valid.
* param int varLimit: the max file size allowed for the file.
*/
const checkFiles = (varFile, varHex, varLimit) => {
return new Promise((resolve) => {
if (varFile === null || varFile.length < 1){
......
......@@ -112,6 +112,7 @@ function Exhibitions() {
tosave.append('exhibitionpic', exhibitionsicon[0].name);
tosave.append('exhibitionfn', exhibitionsicon[0]);
}
tosave.append('dblookup', 'exhibitions');
tosave.append('exhibitionName', props.current.exhibitionname);
tosave.append('galleries', props.current.galleries);
tosave.append('shortdesc', props.current.shortdesc);
......
.container{
min-width: 100vw;
min-height: 100vh;
display: inline-flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-evenly;
align-items: stretch;
align-content: stretch;
}
.leftPanel {
height: 100%;
width: 50%;
min-height: 100vh;
float: left;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
align-items: left;
background-color: #6fccdc;
}
.rightPanel {
height: 100%;
width: 50%;
min-height: 100vh;
display: flex;
flex-direction: column;
float: right;
background-color: #f04c51;
display: grid;
grid-template-columns: 1fr;
grid-template-areas:
'header'
'main'
'footer';
}
.login-wrapper{
padding:5vw;
display: flex;
flex-direction: column;
max-width: 75%;
}
#logo{
padding: 1vh 1vw 3vh 0;
align-self: flex-end;
padding-right: 2vh;
padding-top: 2vh;
float: right;
max-width: 3vw;
}
......@@ -49,6 +49,10 @@
padding: 0.3em 1.2em;
}
.homelogin-button:hover{
cursor: pointer;
}
.register-button{
font-size: 1em;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
......@@ -60,6 +64,11 @@
margin: 2vh 0.5vw 2vh 0;
padding: 0.5em 1.2em;
}
.register-button:hover{
cursor: pointer;
}
p {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-weight: 500;
......@@ -89,12 +98,9 @@ input{
text-align: center;
}
.flex-grid{
align-self: flex-start;
max-width: 50vw;
max-height: 50vh;
justify-self: center;
display: flex;
flex-wrap: wrap;
grid-area: main;
max-width: 100%;
margin-bottom: 0;
}
.grid-item{
......
......@@ -258,7 +258,9 @@ export default function Login() {
</div>
<div className="rightPanel">
<ToastContainer />
<img id="logo" src={logo} alt="Logo" />
<div style={{'gridArea': 'header'}}>
<img id="logo" src={logo} alt="Logo" />
</div>
<div className="flex-grid">
<img className="grid-item" src={process.env.PUBLIC_URL + '/pic1.jpg'} alt="In-Between Places" />
<img className="grid-item" src={process.env.PUBLIC_URL + '/pic2.jpg'} alt="Come Full Circle" />
......
......@@ -113,6 +113,7 @@ function Spaces() {
tosave.append('spacesPic', spacesicon[0].name);
tosave.append('spacefn', spacesicon[0]);
}
tosave.append('dblookup', 'spaces');
tosave.append('spacesname', props.current.spacesname);
tosave.append('location', props.current.location);
tosave.append('shortdesc', props.current.shortdesc);
......
......@@ -19,6 +19,7 @@ const Tag = ({tagitems, updateTags, status, displayStatus}) => {
updateTags(null);
}
/* Method used to bring the tags panel into focus.*/
const focusClick = (e) => {
if (parentContainer.current !== null && e.target === parentContainer.current) {
inputContainer.current.focus();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment