Skip to content

Commit

Permalink
Cleanup and add deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jordus100 committed Mar 17, 2024
1 parent a0bb25c commit 0b93033
Show file tree
Hide file tree
Showing 14 changed files with 779 additions and 51 deletions.
759 changes: 750 additions & 9 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
"@mui/material": "^5.7.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
Expand All @@ -9,6 +12,7 @@
"react-redux": "^8.1.3",
"react-router-dom": "^6.18.0",
"react-scripts": "^5.0.1",
"reactjs-popup": "^2.0.6",
"recharts": "^2.12.1",
"redux": "^4.2.1",
"redux-persist": "^6.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/User/ProfileView/ProfileInfoTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ function changeState(newState) {
}

function ProfileInfoTable(props) {
const { state, user } = props;
const { state } = props;
const [content, setContent] = useState(null);
useEffect(() => {
var con = changeState(state);
const con = changeState(state);
setContent(con);
}, [state]);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@


function ProfileInfoTableAchivments(props) {
function ProfileInfoTableAchievements(props) {
const {playerId} = props;

return (
<table>
<tr>
<th>Achivments</th>
<th>achievements</th>
</tr>
<tr>
<td>{playerId}</td>
Expand All @@ -15,4 +15,4 @@ function ProfileInfoTableAchivments(props) {
);
}

export default ProfileInfoTableAchivments;
export default ProfileInfoTableAchievements;
2 changes: 1 addition & 1 deletion src/User/ProfileView/ProfileView.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
height: 100%;
}

.user-achivments {
.user-achievements {
bottom: 0;
padding: 10px;
border: 3px solid black;
Expand Down
8 changes: 4 additions & 4 deletions src/User/ProfileView/ProfileView.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useParams } from 'react-router-dom';
import React, { useState, useEffect } from 'react';
import { getUser } from '../../services/Api';
import ProfileInfoTable from './ProfileInfoTable';
import ProfileInfoTableAchivments from './ProfileInfoTableAchivments';
import ProfileInfoTableAchievements from './ProfileInfoTableAchievements';

import './ProfileView.css';
import ProfileInfoTableButtons from './ProfileInfoTableButtons';
Expand Down Expand Up @@ -34,12 +34,12 @@ function ProfileView() {
<p>{user.rating}</p>
</div>
</div>
<div className='widget user-achivments'>
<ProfileInfoTableAchivments userId={user.playerid}/>
<div className='widget user-achievements'>
<ProfileInfoTableAchievements userId={user.playerid}/>
</div>
</div>
<div className='cell row2col1'>
{id == myID ?
{id === myID ?
<a className='change-photo' href='/'>Change photo</a>
:
<></>
Expand Down
3 changes: 0 additions & 3 deletions src/User/Settings/ChangePhoto.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { act } from "react-dom/test-utils";


export default function ChangePhotoPopup(props) {
var {setReturn} = props;
var updatePhoto = function(e){
Expand Down
2 changes: 1 addition & 1 deletion src/User/Settings/DeleteAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function DeleteAccountPopup(setReturn) {
var writen = e.target[0].value;
if (writen !== 'delete') {
console.log("Wrong input");
return;

} else {
setReturn();
}
Expand Down
23 changes: 6 additions & 17 deletions src/User/Settings/UserSettings.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import {useEffect, useState} from 'react';
import Popup from 'reactjs-popup';
import ChangeUsernamePopup from './ChangeUsername';
import {useState} from 'react';


import Switch from '@mui/material/Switch';
import Select from '@mui/material/Select';
import InputLabel from '@mui/material/InputLabel';
import MenuItem from '@mui/material/MenuItem';
import FormGroup from '@mui/material/FormGroup';
import Switch from '@mui/material/Switch';
import Select from '@mui/material/Select';
import InputLabel from '@mui/material/InputLabel';
import MenuItem from '@mui/material/MenuItem';
import FormGroup from '@mui/material/FormGroup';
import FormControlLabel from '@mui/material/FormControlLabel';
import SettingPopup from './SettingPopup';

Expand All @@ -28,14 +25,6 @@ function deleteAccount(){
console.log("yo account was removed");
}

function saveSettings(settings){
console.log("yo settings ware updated");
}

function resetSettings(){
console.log("yo settings ware reversed");
}

function setDarkMode() {
console.log("yo dark mode was changed");
}
Expand Down
1 change: 0 additions & 1 deletion src/User/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function User({ isAuthenticated, user, login, logout }) {
<Link to="/register">
<button className="login-btn">Register</button>
</Link>

</>
)}
</>
Expand Down
3 changes: 1 addition & 2 deletions src/User/store.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// store.js
import { createStore, applyMiddleware } from 'redux';
import { createStore } from 'redux';
import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage/session'; // Use sessionStorage

Expand Down Expand Up @@ -34,7 +34,6 @@ const persistConfig = {

const persistedReducer = persistReducer(persistConfig, authReducer);
const store = createStore(persistedReducer);

export const persistor = persistStore(store);

export default store;
1 change: 0 additions & 1 deletion src/forms/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import './AddGameForm.scss'
import './Form.scss'
import React, { useState } from "react";
import {UserService} from "../services/UserService";

import { connect } from 'react-redux';
import { login, logout } from '../User/actions';

Expand Down
4 changes: 2 additions & 2 deletions src/services/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ function Request(data, endpoint, apifunc) {
})
}

const achivments = c["urls"]["achivments"]
const achievements = c["urls"]["achievements"]
//const gametype = c["urls"]["gametype"]
//const player = c["urls"]["player"]
//const points = c["urls"]["points"]
const tournament = c["urls"]["tournament"]
//const userSettings = c["urls"]["userSettings"]

function getAcivmentsForPlayer(request) {
return Request(request, "achivments", achivments["functions"]["GetAchivmentsForPlayer"])
return Request(request, "achievements", achievements["functions"]["GetachievementsForPlayer"])
}

function getTournaments(request) {
Expand Down
10 changes: 5 additions & 5 deletions src/services/client.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"path": "api/",
"version": "v1",
"urls": {
"achivments": {
"achievements": {
"path": "/Achievements",
"functions":{
"GetAchivmentsForPlayer": {
"path": "/getAchivmentsForPlayer",
"GetachievementsForPlayer": {
"path": "/getachievementsForPlayer",
"method": "GET",
"params": ["playerId"]
},
"GetAchivmentTypes": {
"path": "/getAchivmentTypes",
"GetachievementTypes": {
"path": "/getachievementTypes",
"method": "GET"
}
}
Expand Down

0 comments on commit 0b93033

Please sign in to comment.