Skip to content

Commit 6ee0380

Browse files
committed
v2.4.1
1 parent da13c1a commit 6ee0380

12 files changed

Lines changed: 89 additions & 62 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ Changelogs for development versions are located in their corresponding branch.
44

55
## 2.4.1
66

7-
#### Currently WIP
7+
#### Released 2020-05-09
88

99
### Features
1010

11+
- New sidebar design in Edit Pages and Settings
1112
- Improved UI consistency
1213
- Better usage via keyboard
14+
- Improved Error Handling
1315

1416
## 2.4.0
1517

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "minecraft-manager",
3-
"version": "2.4.0",
3+
"version": "2.4.1",
44
"license": "GPL-3.0",
55
"main": "main.js",
66
"author": "theemeraldtree",
@@ -115,4 +115,4 @@
115115
"ci": "yarn run compile && yarn pub",
116116
"license-disclaimer": "yarn licenses generate-disclaimer > src/assets/licenseDisclaimer.txt"
117117
}
118-
}
118+
}

src/component/button/button.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import styled from 'styled-components';
1+
import styled, { css } from 'styled-components';
22

33
function getColor(name) {
44
switch (name) {
@@ -33,8 +33,8 @@ const Button = styled.button.attrs(props => ({
3333
border: 2px solid transparent;
3434
${props =>
3535
props.disabled &&
36-
`
37-
filter: brightness(0.65);
36+
css`
37+
filter: brightness(0.65);
3838
`}
3939
img {
4040
width: 90%;
@@ -52,14 +52,14 @@ const Button = styled.button.attrs(props => ({
5252
&:hover {
5353
${props =>
5454
!props.disabled &&
55-
`
56-
filter: brightness(0.75);
57-
`}
55+
css`
56+
filter: brightness(0.75);
57+
`}
5858
${props =>
5959
props.disabled &&
60-
`
61-
cursor: not-allowed;
62-
`}
60+
css`
61+
cursor: not-allowed;
62+
`}
6363
}
6464
&:focus-visible {
6565
border-color: yellow;

src/manager/launcherManager.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ const LauncherManager = {
142142
},
143143
getMCAccounts() {
144144
logger.info('Getting Minecraft accounts...');
145-
return FSU.readJSONSync(this.getLauncherProfiles()).authenticationDatabase;
145+
if (fs.existsSync(Global.PROFILES_PATH)) {
146+
return FSU.readJSONSync(this.getLauncherProfiles()).authenticationDatabase;
147+
}
148+
return undefined;
146149
}
147150
};
148151

src/page/editprofile/components/subAssetEditor.jsx

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import MoveToOverlay from './moveToOverlay';
2222
import CustomDropdown from '../../../component/customdropdown/customdropdown';
2323
import ErrorManager from '../../../manager/errorManager';
2424
import useKeyPress from '../../../util/useKeyPress';
25+
import AlertManager from '../../../manager/alertManager';
2526

2627
const { dialog } = require('electron').remote;
2728

@@ -303,15 +304,25 @@ export default function SubAssetEditor({ id, assetType, dpWorld }) {
303304

304305
const deleteClick = assetid => {
305306
if (assetType !== 'datapack') {
306-
const asset = profile.getSubAssetFromID(assetType, assetid);
307-
profile
308-
.deleteSubAsset(assetType, asset)
309-
.then(() => {
310-
updateProgressStates();
311-
})
312-
.catch(e => {
313-
ToastManager.createToast('Unable to delete', ErrorManager.makeReadable(e, 'subasset'));
314-
});
307+
const del = () => {
308+
const asset = profile.getSubAssetFromID(assetType, assetid);
309+
profile
310+
.deleteSubAsset(assetType, asset)
311+
.then(() => {
312+
// hacky fix
313+
setTimeout(() => {
314+
updateProgressStates();
315+
}, 100);
316+
})
317+
.catch(e => {
318+
ToastManager.createToast('Unable to delete', ErrorManager.makeReadable(e, 'subasset'));
319+
});
320+
};
321+
if (assetType === 'world') {
322+
AlertManager.alert('are you sure?', '', del, 'delete', 'cancel');
323+
} else {
324+
del();
325+
}
315326
} else {
316327
const asset = dpWorld.datapacks.find(dp => dp.id === assetid);
317328
dpWorld.deleteDatapack(profile, asset);
@@ -458,6 +469,22 @@ export default function SubAssetEditor({ id, assetType, dpWorld }) {
458469
})
459470
.map(asset => {
460471
if (displayState === 'assetsList') {
472+
if (!asset.name) {
473+
return (
474+
<AssetCard
475+
progressState={progressState}
476+
key="undefinedasset"
477+
compact
478+
asset={{
479+
id: asset.id,
480+
name: 'Undefined Asset',
481+
version: { displayName: 'Something has gone wrong - please delete' }
482+
}}
483+
showDelete
484+
deleteClick={deleteClick}
485+
/>
486+
);
487+
}
461488
if (asset.name.toLowerCase().includes(liveSearchTerm.toLowerCase())) {
462489
return (
463490
<AssetCard

src/page/settings/components/section.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import styled from 'styled-components';
22

33
const Section = styled.div`
44
max-width: 680px;
5-
background-color: #404040;
5+
background-color: #2b2b2b;
66
margin: 10px;
77
padding: 10px;
88
h2 {
@@ -13,6 +13,10 @@ const Section = styled.div`
1313
margin-top: 5px;
1414
margin-bottom: 5px;
1515
}
16+
17+
& > div {
18+
margin-top: 5px;
19+
}
1620
`;
1721

1822
export default Section;

src/page/settings/pages/about.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const AboutTop = styled.div`
2828
font-weight: thin;
2929
font-size: 13pt;
3030
}
31-
background-color: #505050;
31+
background-color: #353535;
3232
`;
3333

3434
const AboutBottom = styled.div`
@@ -235,7 +235,7 @@ export default function About() {
235235
}
236236
color="green"
237237
>
238-
view full license information
238+
view full license info
239239
</Button>
240240
</div>
241241
<div>

src/page/settings/pages/defaults.jsx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
import React, { useReducer } from 'react';
2-
import styled from 'styled-components';
32
import InputContainer from '../../editprofile/components/inputcontainer';
43
import Checkbox from '../../../component/checkbox/checkbox';
54
import Detail from '../../../component/detail/detail';
65
import SettingsManager from '../../../manager/settingsManager';
7-
8-
const Panel = styled.div`
9-
background-color: #2b2b2b;
10-
padding: 10px;
11-
width: 380px;
12-
margin-bottom: 5px;
13-
14-
h3 {
15-
margin: 0;
16-
}
17-
18-
& > div {
19-
margin-top: 5px;
20-
}
21-
`;
6+
import Section from '../components/section';
227

238
export default function Defaults() {
249
const [, forceUpdate] = useReducer(x => x + 1, 0);
@@ -34,7 +19,7 @@ export default function Defaults() {
3419
<p>
3520
The following are default settings that are used for <b>new</b> profiles only
3621
</p>
37-
<Panel>
22+
<Section>
3823
<h3>Sync Options</h3>
3924
<InputContainer>
4025
<Checkbox
@@ -60,7 +45,7 @@ export default function Defaults() {
6045
/>
6146
<Detail>Sync in-game server list</Detail>
6247
</InputContainer>
63-
</Panel>
48+
</Section>
6449
</>
6550
);
6651
}

src/page/settings/settingsPage.jsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,34 @@ const Sidebar = styled.div`
1515
`;
1616

1717
const Item = styled.p`
18-
margin-top: 10px;
19-
width: 100%;
18+
width: calc(100% - 5px);
2019
display: block;
2120
height: 25px;
22-
text-align: center;
2321
color: white;
2422
text-decoration: none;
25-
font-size: 15pt;
26-
font-weight: 100;
23+
font-size: 12pt;
24+
font-weight: 400;
2725
cursor: pointer;
2826
&:hover {
2927
filter: brightness(0.75);
3028
}
29+
3130
${props =>
3231
props.active &&
3332
`
34-
font-weight: bolder;
35-
&:hover {
36-
filter: brightness(1.0);
37-
}
38-
`}
33+
filter: brightness(1);
34+
background: #424242;
35+
&:hover {
36+
filter: brightness(1);
37+
}
38+
`}
3939
40-
margin-bottom: 15px;
41-
transition: font-weight 150ms;
40+
margin-bottom: 0;
41+
margin-top: 0;
42+
padding-top: 10px;
43+
padding-bottom: 4px;
44+
padding-left: 5px;
45+
transition: background 150ms;
4246
`;
4347

4448
const Container = styled.div`

src/type/profile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ export default class Profile extends OAMFAsset {
532532
this.mods.splice(this.mods.indexOf(asset), 1);
533533
this.progressState[asset.id] = undefined;
534534
fs.unlink(path.join(this.gameDir, `/${asset.getMainFile().path}`), e => {
535-
if (e.code !== 'ENOENT') {
535+
if (e && e.code !== 'ENOENT') {
536536
if (e) {
537537
this.logger.error(`Unable to delete subasset ${asset.id}: ${e.toString()}`);
538538
this.mods.push(asset);

0 commit comments

Comments
 (0)